Skip to content

Commit 1f8f61f

Browse files
authored
VER: Release 0.55.0
See release notes.
2 parents b8566e1 + f3e2a05 commit 1f8f61f

File tree

88 files changed

+109
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+109
-33
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ jobs:
3030
shell: bash
3131

3232
- name: Test (release)
33-
timeout-minutes: 3
33+
timeout-minutes: 5
3434
if: ${{ github.ref == 'refs/heads/main' }}
3535
run: scripts/test.sh -vvv --release
3636
shell: bash
3737

3838
- name: Test
39-
timeout-minutes: 3
39+
timeout-minutes: 5
4040
if: ${{ github.ref != 'refs/heads/main' }}
4141
run: scripts/test.sh -vvv
4242
shell: bash

CHANGELOG.md

Lines changed: 13 additions & 0 deletions

README.md

Lines changed: 1 addition & 1 deletion

databento/common/dbnstore.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def __init__(self, data_source: DataSource) -> None:
380380
def __iter__(self) -> Generator[DBNRecord, None, None]:
381381
reader = self.reader
382382
decoder = DBNDecoder(
383-
upgrade_policy=VersionUpgradePolicy.UPGRADE_TO_V2,
383+
upgrade_policy=VersionUpgradePolicy.UPGRADE_TO_V3,
384384
)
385385
while True:
386386
raw = reader.read(DBNStore.DBN_READ_SIZE)
@@ -394,6 +394,9 @@ def __iter__(self) -> Generator[DBNRecord, None, None]:
394394
self._instrument_map.insert_symbol_mapping_msg(record)
395395
yield record
396396
else:
397+
# This call to decode is required to seek past the decoded records
398+
# This behavior will be fixed in the next version of databento_dbn
399+
_ = decoder.decode()
397400
if len(decoder.buffer()) > 0:
398401
warnings.warn(
399402
BentoWarning("DBN file is truncated or contains an incomplete record"),

databento/common/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from collections.abc import Iterable
66
from collections.abc import Mapping
77
from io import BytesIO
8-
from json.decoder import JSONDecodeError
98
from os import PathLike
109
from typing import IO
1110
from typing import Any
@@ -15,6 +14,7 @@
1514
import requests
1615
from aiohttp import ClientResponse
1716
from aiohttp import ContentTypeError
17+
from requests import JSONDecodeError
1818
from requests import Response
1919
from requests.auth import HTTPBasicAuth
2020

databento/common/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
databento_dbn.ImbalanceMsg,
2222
databento_dbn.InstrumentDefMsg,
2323
databento_dbn.InstrumentDefMsgV1,
24-
databento_dbn.InstrumentDefMsgV3,
24+
databento_dbn.InstrumentDefMsgV2,
2525
databento_dbn.StatMsg,
26+
databento_dbn.StatMsgV1,
2627
databento_dbn.StatusMsg,
2728
databento_dbn.SymbolMappingMsg,
2829
databento_dbn.SymbolMappingMsgV1,

databento/historical/api/metadata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ def get_cost(
407407
) -> float:
408408
"""
409409
Request the cost in US dollars for historical streaming or batched
410-
files from Databento.
410+
files from Databento. This cost respects any discounts provided by flat
411+
rate plans.
411412
412413
Makes a `GET /metadata.get_cost` HTTP request.
413414

databento/live/gateway.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class SubscriptionRequest(GatewayControl):
133133
start: int | None = None
134134
snapshot: int = 0
135135
id: int | None = None
136+
is_last: int = 1
136137

137138

138139
@dataclasses.dataclass

databento/live/protocol.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __init__(
8282
self._heartbeat_interval_s = heartbeat_interval_s
8383

8484
self._dbn_decoder = databento_dbn.DBNDecoder(
85-
upgrade_policy=VersionUpgradePolicy.UPGRADE_TO_V2,
85+
upgrade_policy=VersionUpgradePolicy.UPGRADE_TO_V3,
8686
)
8787
self._gateway_decoder = GatewayDecoder()
8888

@@ -175,7 +175,7 @@ def connection_made(self, transport: asyncio.BaseTransport) -> None:
175175
176176
See Also
177177
--------
178-
asycnio.BufferedProtocol.connection_made
178+
asyncio.BufferedProtocol.connection_made
179179
180180
"""
181181
logger.debug("established connection to gateway")
@@ -190,7 +190,7 @@ def connection_lost(self, exc: Exception | None) -> None:
190190
191191
See Also
192192
--------
193-
asycnio.BufferedProtocol.connection_lost
193+
asyncio.BufferedProtocol.connection_lost
194194
195195
"""
196196
super().connection_lost(exc)
@@ -216,7 +216,7 @@ def eof_received(self) -> bool | None:
216216
217217
See Also
218218
--------
219-
asycnio.BufferedProtocol.eof_received
219+
asyncio.BufferedProtocol.eof_received
220220
221221
"""
222222
logger.info("received EOF from remote")
@@ -228,7 +228,7 @@ def get_buffer(self, sizehint: int) -> bytearray:
228228
229229
See Also
230230
--------
231-
asycnio.BufferedProtocol.get_buffer
231+
asyncio.BufferedProtocol.get_buffer
232232
233233
"""
234234
if len(self.__buffer) < sizehint:
@@ -241,7 +241,7 @@ def buffer_updated(self, nbytes: int) -> None:
241241
242242
See Also
243243
--------
244-
asycnio.BufferedProtocol.buffer_updated
244+
asyncio.BufferedProtocol.buffer_updated
245245
246246
"""
247247
logger.debug("read %d bytes from remote gateway", nbytes)
@@ -325,7 +325,8 @@ def subscribe(
325325

326326
subscriptions: list[SubscriptionRequest] = []
327327
chunked_symbols = list(chunk(symbols_list, SYMBOL_LIST_BATCH_SIZE))
328-
for batch in chunked_symbols:
328+
last_chunk_idx = len(chunked_symbols) - 1
329+
for i, batch in enumerate(chunked_symbols):
329330
batch_str = ",".join(batch)
330331
message = SubscriptionRequest(
331332
schema=validate_enum(schema, Schema, "schema"),
@@ -334,6 +335,7 @@ def subscribe(
334335
start=optional_datetime_to_unix_nanoseconds(start),
335336
snapshot=int(snapshot),
336337
id=subscription_id,
338+
is_last=int(i == last_chunk_idx),
337339
)
338340
subscriptions.append(message)
339341

databento/reference/api/corporate.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def get_range(
3939
stype_in: SType | str = "raw_symbol",
4040
events: Iterable[str] | str | None = None,
4141
countries: Iterable[str] | str | None = None,
42+
exchanges: Iterable[str] | str | None = None,
4243
security_types: Iterable[str] | str | None = None,
4344
flatten: bool = True,
4445
pit: bool = False,
@@ -84,6 +85,11 @@ def get_range(
8485
Takes any number of two letter ISO 3166-1 alpha-2 country codes per request.
8586
If not specified then will select **all** listing countries by default.
8687
See [CNTRY](https://databento.com/docs/standards-and-conventions/reference-data-enums#cntry) enum.
88+
exchanges : Iterable[str] or str, optional
89+
The (listing) exchanges to filter for.
90+
Takes any number of exchanges per request.
91+
If not specified then will select **all** exchanges by default.
92+
See [EXCHANGE](https://databento.com/docs/standards-and-conventions/reference-data-enums#exchange) enum.
8793
security_types : Iterable[str] or str, optional
8894
The security types to filter for.
8995
Takes any number of security types per request.
@@ -108,6 +114,7 @@ def get_range(
108114
symbols_list = optional_symbols_list_to_list(symbols, SType.RAW_SYMBOL)
109115
events = optional_string_to_list(events)
110116
countries = optional_string_to_list(countries)
117+
exchanges = optional_string_to_list(exchanges)
111118
security_types = optional_string_to_list(security_types)
112119

113120
data: dict[str, object | None] = {
@@ -122,6 +129,10 @@ def get_range(
122129
"compression": str(Compression.ZSTD), # Always request zstd
123130
}
124131

132+
# Only add the `exchanges` param if it is supplied, for compatibility
133+
if exchanges:
134+
data["exchanges"] = ",".join(exchanges)
135+
125136
response = self._post(
126137
url=self._base_url + ".get_range",
127138
data=data,

0 commit comments

Comments
 (0)