Skip to content

Commit ab1772b

Browse files
authored
VER: Release 0.62.0
2 parents 8e81195 + 6807649 commit ab1772b

File tree

8 files changed

+61
-41
lines changed

8 files changed

+61
-41
lines changed

CHANGELOG.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Changelog
22

3+
## 0.62.0 - 2025-08-19
4+
5+
This release delivers a number of breaking changes to the Python interface for DBN records to provide a cleaner and more consistent API.
6+
7+
#### Breaking changes
8+
- Removed `bill_id` from the response of `batch.list_jobs()` and `batch.submit_job()`
9+
- Upgraded `databento-dbn` to 0.40.0
10+
- Removed `hd` property from records in Python. Header fields are accessible
11+
directly from the record
12+
- Removed ability to directly instantiate most enums from an `int` in Python and coercion
13+
from `int` in `__eq__`. They can still be instantitated with the `from_int` class method.
14+
Write `Side.from_int(66)` instead of `Side(66)` and `Side.BID == Side.from_int(66)`
15+
instead of `Side.BID == 66`. Affected enums:
16+
- `Side`
17+
- `Action`
18+
- `InstrumentClass`
19+
- `MatchAlgorithm`
20+
- `UserDefinedInstrument`
21+
- `SecurityUpdateAction`
22+
- `SType`
23+
- `Schema`
24+
- `Encoding`
25+
- `Compression`
26+
- `TriState`
27+
- Removed string coercion in `__init__` and `__eq__` for `RType`, `SystemCode`, and
28+
`ErrorCode` enums in Python. It can still be instantiated from a `str` with the
29+
`from_str` class method. Write `RType.from_str("mbo")` instead of `RType("mbo")`
30+
and `RType.TRADES == RType.from_str("trades")` instead of `RType.TRADES == "trades"`
31+
32+
#### Enhancements
33+
- Added `END_OF_INTERVAL` variant to `SystemCode` enum
34+
335
## 0.61.0 - 2025-08-12
436

537
#### Breaking changes
@@ -19,7 +51,7 @@
1951
- Added `parquet_schema` option to `DBNStore.to_parquet()` for overriding the pyarrow schema.
2052
- Upgraded `databento-dbn` to 0.39.0
2153
- Added `side()` and `unpaired_side()` methods to `ImbalanceMsg` that convert the fields
22-
of the same name to the `Side` enum
54+
of the same name to the `Side` enum
2355
- Added `pretty_auction_time` property in Python for `ImbalanceMsg`
2456
- Added `action` and `ts_in_delta` getters to `BboMsg`
2557
- Added `ts_recv` getter to `StatusMsg`

databento/common/dbnstore.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,7 @@ def stype_in(self) -> SType | None:
584584
SType or None
585585
586586
"""
587-
stype = self._metadata.stype_in
588-
if stype:
589-
return SType(self._metadata.stype_in)
590-
return None
587+
return self._metadata.stype_in
591588

592589
@property
593590
def stype_out(self) -> SType:
@@ -599,7 +596,7 @@ def stype_out(self) -> SType:
599596
SType
600597
601598
"""
602-
return SType(self._metadata.stype_out)
599+
return self._metadata.stype_out
603600

604601
@property
605602
def symbology(self) -> dict[str, Any]:

databento/common/symbology.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ def insert_metadata(self, metadata: Metadata) -> None:
245245
# Nothing to do
246246
return
247247

248-
stype_in = SType(metadata.stype_in) if metadata.stype_in is not None else None
249-
stype_out = SType(metadata.stype_out) if metadata.stype_out is not None else None
250-
251248
for symbol_in, entries in metadata.mappings.items():
252249
for entry in entries:
253250
if not entry["symbol"]:
@@ -263,9 +260,9 @@ def insert_metadata(self, metadata: Metadata) -> None:
263260

264261
symbol, instrument_id = _resolve_mapping_tuple(
265262
symbol_in=symbol_in,
266-
stype_in=stype_in,
263+
stype_in=metadata.stype_in,
267264
symbol_out=entry["symbol"],
268-
stype_out=stype_out,
265+
stype_out=metadata.stype_out,
269266
)
270267

271268
self._insert_interval(
@@ -313,7 +310,7 @@ def insert_symbol_mapping_msg(
313310
symbol = msg.stype_out_symbol
314311

315312
self._insert_interval(
316-
msg.hd.instrument_id,
313+
msg.instrument_id,
317314
MappingInterval(
318315
start_date=start_ts.date(),
319316
end_date=end_ts.date(),

databento/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.61.0"
1+
__version__ = "0.62.0"

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "databento"
3-
version = "0.61.0"
3+
version = "0.62.0"
44
description = "Official Python client library for Databento"
55
authors = [
66
"Databento <[email protected]>",
@@ -32,7 +32,7 @@ aiohttp = [
3232
{version = "^3.8.3", python = "<3.12"},
3333
{version = "^3.9.0", python = "^3.12"}
3434
]
35-
databento-dbn = "~=0.39.0"
35+
databento-dbn = "~=0.40.0"
3636
numpy = [
3737
{version = ">=1.23.5", python = "<3.12"},
3838
{version = ">=1.26.0", python = "^3.12"}

tests/mockliveserver/server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ def _replay_done_callback(self, task: asyncio.Task[Any]) -> None:
297297

298298
async def _file_replay_task(self) -> None:
299299
for subscription in self._subscriptions:
300-
schema = Schema(subscription.schema)
300+
schema = (
301+
Schema.from_str(subscription.schema)
302+
if isinstance(subscription.schema, str)
303+
else subscription.schema
304+
)
301305
replay = self._file_replay_table[(self.dataset, schema)]
302306
logger.info("starting replay %s for %s", replay.name, self.peer)
303307
for chunk in replay:

tests/test_historical_bento.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,11 @@ def test_replay_with_stub_data_record_passes_to_callback(
444444

445445
# Assert
446446
assert isinstance(record, MBOMsg)
447-
assert record.hd.length == 14
448-
assert record.hd.rtype == 160
449-
assert record.hd.rtype == 160
450-
assert record.hd.publisher_id == 1
451-
assert record.hd.instrument_id == 5482
452-
assert record.hd.ts_event == 1609099225061045683
447+
assert record.rtype == 160
448+
assert record.rtype == 160
449+
assert record.publisher_id == 1
450+
assert record.instrument_id == 5482
451+
assert record.ts_event == 1609099225061045683
453452
assert record.order_id == 647784248135
454453
assert record.price == 3675750000000
455454
assert record.size == 2
@@ -1036,12 +1035,11 @@ def test_dbnstore_iterable(
10361035
second: MBOMsg = record_list[1] # type: ignore [assignment]
10371036

10381037
# Assert
1039-
assert first.hd.length == 14
1040-
assert first.hd.rtype == 160
1041-
assert first.hd.rtype == 160
1042-
assert first.hd.publisher_id == 1
1043-
assert first.hd.instrument_id == 5482
1044-
assert first.hd.ts_event == 1609099225061045683
1038+
assert first.rtype == 160
1039+
assert first.rtype == 160
1040+
assert first.publisher_id == 1
1041+
assert first.instrument_id == 5482
1042+
assert first.ts_event == 1609099225061045683
10451043
assert first.order_id == 647784248135
10461044
assert first.price == 3675750000000
10471045
assert first.size == 2
@@ -1053,12 +1051,11 @@ def test_dbnstore_iterable(
10531051
assert first.ts_in_delta == 0
10541052
assert first.sequence == 1180
10551053

1056-
assert second.hd.length == 14
1057-
assert second.hd.rtype == 160
1058-
assert second.hd.rtype == 160
1059-
assert second.hd.publisher_id == 1
1060-
assert second.hd.instrument_id == 5482
1061-
assert second.hd.ts_event == 1609099225061045683
1054+
assert second.rtype == 160
1055+
assert second.rtype == 160
1056+
assert second.publisher_id == 1
1057+
assert second.instrument_id == 5482
1058+
assert second.ts_event == 1609099225061045683
10621059
assert second.order_id == 647782686353
10631060
assert second.price == 3675500000000
10641061
assert second.size == 1

tests/test_historical_data.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def test_mbo_fields() -> None:
1111
struct = SCHEMA_STRUCT_MAP[databento.Schema.MBO]
1212

1313
fields = set(f for f in dir(struct) if not f.startswith(("_", "pretty_")))
14-
fields.remove("hd")
1514
fields.remove("record_size")
1615
fields.remove("size_hint")
1716

@@ -41,7 +40,6 @@ def test_mbp_fields(
4140
struct = SCHEMA_STRUCT_MAP[schema]
4241

4342
fields = set(f for f in dir(struct) if not f.startswith(("_", "pretty_")))
44-
fields.remove("hd")
4543
fields.remove("record_size")
4644
fields.remove("size_hint")
4745

@@ -74,7 +72,6 @@ def test_ohlcv_fields(
7472
struct = SCHEMA_STRUCT_MAP[schema]
7573

7674
fields = set(f for f in dir(struct) if not f.startswith(("_", "pretty_")))
77-
fields.remove("hd")
7875
fields.remove("record_size")
7976
fields.remove("size_hint")
8077

@@ -93,7 +90,6 @@ def test_trades_struct() -> None:
9390
struct = SCHEMA_STRUCT_MAP[databento.Schema.TRADES]
9491

9592
fields = set(f for f in dir(struct) if not f.startswith(("_", "pretty_")))
96-
fields.remove("hd")
9793
fields.remove("record_size")
9894
fields.remove("size_hint")
9995

@@ -112,7 +108,6 @@ def test_definition_struct() -> None:
112108
struct = SCHEMA_STRUCT_MAP[databento.Schema.DEFINITION]
113109

114110
fields = set(f for f in dir(struct) if not f.startswith(("_", "pretty_")))
115-
fields.remove("hd")
116111
fields.remove("record_size")
117112
fields.remove("size_hint")
118113

@@ -131,7 +126,6 @@ def test_imbalance_struct() -> None:
131126
struct = SCHEMA_STRUCT_MAP[databento.Schema.IMBALANCE]
132127

133128
fields = set(f for f in dir(struct) if not f.startswith(("_", "pretty_")))
134-
fields.remove("hd")
135129
fields.remove("record_size")
136130
fields.remove("size_hint")
137131

@@ -150,7 +144,6 @@ def test_statistics_struct() -> None:
150144
struct = SCHEMA_STRUCT_MAP[databento.Schema.STATISTICS]
151145

152146
fields = set(f for f in dir(struct) if not f.startswith(("_", "pretty_")))
153-
fields.remove("hd")
154147
fields.remove("record_size")
155148
fields.remove("size_hint")
156149

0 commit comments

Comments
 (0)