Skip to content

Commit dc42ff9

Browse files
committed
MOD: Increase symbol chunk size
1 parent b904496 commit dc42ff9

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#### Enhancements
66
- Added new off-market publishers for Eurex, and European Energy Exchange (EEX)
7+
- Increased live subscription symbol chunking size
78

89
## 0.53.0 - 2025-04-29
910

databento/live/gateway.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def parse(cls: type[T], line: str | bytes) -> T:
5959
return cls(**data_dict)
6060
except TypeError:
6161
raise ValueError(
62-
f"'{line!r}'is not a parsible {cls.__name__}",
62+
f"'{line!r}'is not a parseable {cls.__name__}",
6363
) from None
6464

6565
def __str__(self) -> str:
@@ -156,15 +156,15 @@ def parse_gateway_message(line: str) -> GatewayControl:
156156
Raises
157157
------
158158
ValueError
159-
If `line` is not a parsible GatewayControl message.
159+
If `line` is not a parseable GatewayControl message.
160160
161161
"""
162162
for message_cls in GatewayControl.__subclasses__():
163163
try:
164164
return message_cls.parse(line)
165165
except ValueError:
166166
continue
167-
raise ValueError(f"'{line.strip()}' is not a parsible gateway message")
167+
raise ValueError(f"'{line.strip()}' is not a parseable gateway message")
168168

169169

170170
class GatewayDecoder:

databento/live/protocol.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
RECV_BUFFER_SIZE: Final = 64 * 2**10 # 64kb
36-
SYMBOL_LIST_BATCH_SIZE: Final = 32
36+
SYMBOL_LIST_BATCH_SIZE: Final = 500
3737

3838
logger = logging.getLogger(__name__)
3939

@@ -324,7 +324,8 @@ def subscribe(
324324
symbols_list = symbols_list_to_list(symbols, stype_in_valid)
325325

326326
subscriptions: list[SubscriptionRequest] = []
327-
for batch in chunk(symbols_list, SYMBOL_LIST_BATCH_SIZE):
327+
chunked_symbols = list(chunk(symbols_list, SYMBOL_LIST_BATCH_SIZE))
328+
for batch in chunked_symbols:
328329
batch_str = ",".join(batch)
329330
message = SubscriptionRequest(
330331
schema=validate_enum(schema, Schema, "schema"),

tests/mockliveserver/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
SERVER_VERSION: Final = "0.4.2"
32-
READ_BUFFER_SIZE: Final = 2**10
32+
READ_BUFFER_SIZE: Final = 32 * 2**10
3333

3434
logger = logging.getLogger(__name__)
3535

tests/test_live_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ async def test_live_subscribe_large_symbol_list(
569569
"""
570570
# Arrange
571571
large_symbol_list = list(
572-
random.choices(string.ascii_uppercase, k=256), # noqa: S311
572+
random.choices(string.ascii_uppercase, k=3950), # noqa: S311
573573
)
574574

575575
# Act

0 commit comments

Comments
 (0)