Skip to content

Commit a5ade46

Browse files
committed
MOD: Upgrade databento-dbn to 0.53.0
1 parent 201d91b commit a5ade46

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 0.75.0 - TBD
4+
5+
#### Enhancements
6+
- Upgraded `databento-dbn` to 0.53.0:
7+
- Made `ts_out` a permanent field on all Python record types, replacing the
8+
dynamic `__dict__` attribute. `ts_out` returns an `int` (`UNDEF_TIMESTAMP` when
9+
not set)
10+
- Removed `__dict__` from all Python record classes, eliminating a separate
11+
per-instance allocation
12+
313
## 0.74.1 - 2026-03-31
414

515
#### Enhancements

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The library is fully compatible with distributions of Anaconda 2023.x and above.
3232
The minimum dependencies as found in the `pyproject.toml` are also listed below:
3333
- python = "^3.10"
3434
- aiohttp = "^3.8.3"
35-
- databento-dbn = "~0.52.1"
35+
- databento-dbn = "~0.53.0"
3636
- numpy = ">=1.23.5"
3737
- pandas = ">=1.5.3"
3838
- pip-system-certs = ">=4.0" (Windows only)

databento/common/dbnstore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,9 @@ def to_ndarray(
12441244
schema_rtype = RType.from_schema(schema)
12451245
schema_filter = filter(lambda r: r.rtype == schema_rtype, self)
12461246

1247+
if self._metadata.ts_out:
1248+
schema_dtype.append(("ts_out", "u8"))
1249+
12471250
reader = self.reader
12481251
reader.seek(self._metadata_length)
12491252
ndarray_iter = NDArrayBytesIterator(
@@ -1256,9 +1259,6 @@ def to_ndarray(
12561259
schema_struct = self._schema_struct_map[self.schema]
12571260
schema_dtype = schema_struct._dtypes
12581261

1259-
if self._metadata.ts_out:
1260-
schema_dtype.append(("ts_out", "u8"))
1261-
12621262
if schema is not None and schema != self.schema:
12631263
# This is to maintain identical behavior with NDArrayBytesIterator
12641264
ndarray_iter = iter([np.empty([0, 1], dtype=schema_dtype)])

databento/live/session.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import logging
77
import math
88
import queue
9-
import struct
109
import threading
1110
from collections.abc import Iterable
1211
from functools import partial
@@ -267,16 +266,14 @@ def _dispatch_callbacks(self, record: DBNRecord) -> None:
267266

268267
def _dispatch_writes(self, record: DBNRecord) -> None:
269268
record_bytes = bytes(record)
270-
ts_out_bytes = struct.pack("Q", record.ts_out) if self._metadata.has_ts_out else b""
271269
for stream in self._user_streams:
272270
try:
273271
stream.write(record_bytes)
274-
stream.write(ts_out_bytes)
275272
except Exception as exc:
276273
logger.error(
277274
"error writing %s record (%d bytes) to `%s` stream",
278275
type(record).__name__,
279-
len(record_bytes) + len(ts_out_bytes),
276+
len(record_bytes),
280277
stream.stream_name,
281278
exc_info=exc,
282279
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dynamic = [ "classifiers" ]
1010
dependencies = [
1111
"aiohttp>=3.8.3,<4.0.0; python_version < '3.12'",
1212
"aiohttp>=3.9.0,<4.0.0; python_version >= '3.12'",
13-
"databento-dbn~=0.52.1",
13+
"databento-dbn~=0.53.0",
1414
"numpy>=1.23.5; python_version < '3.12'",
1515
"numpy>=1.26.0; python_version >= '3.12'",
1616
"pandas>=1.5.3,<4.0.0",

tests/test_historical_data.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def test_mbo_fields() -> None:
1515
fields.remove("record_size")
1616
fields.remove("size_hint")
1717
fields.remove("ts_index")
18+
fields.remove("ts_out")
1819

1920
# Act
2021
difference = fields.symmetric_difference(struct._ordered_fields)
@@ -45,6 +46,7 @@ def test_mbp_fields(
4546
fields.remove("record_size")
4647
fields.remove("size_hint")
4748
fields.remove("ts_index")
49+
fields.remove("ts_out")
4850

4951
# Act
5052
difference = fields.symmetric_difference(struct._ordered_fields)
@@ -78,6 +80,7 @@ def test_ohlcv_fields(
7880
fields.remove("record_size")
7981
fields.remove("size_hint")
8082
fields.remove("ts_index")
83+
fields.remove("ts_out")
8184

8285
# Act
8386
difference = fields.symmetric_difference(struct._ordered_fields)
@@ -97,6 +100,7 @@ def test_trades_struct() -> None:
97100
fields.remove("record_size")
98101
fields.remove("size_hint")
99102
fields.remove("ts_index")
103+
fields.remove("ts_out")
100104

101105
# Act
102106
difference = fields.symmetric_difference(struct._ordered_fields)
@@ -116,6 +120,7 @@ def test_definition_struct() -> None:
116120
fields.remove("record_size")
117121
fields.remove("size_hint")
118122
fields.remove("ts_index")
123+
fields.remove("ts_out")
119124

120125
# Act
121126
difference = fields.symmetric_difference(struct._ordered_fields)
@@ -135,6 +140,7 @@ def test_imbalance_struct() -> None:
135140
fields.remove("record_size")
136141
fields.remove("size_hint")
137142
fields.remove("ts_index")
143+
fields.remove("ts_out")
138144

139145
# Act
140146
difference = fields.symmetric_difference(struct._ordered_fields)
@@ -154,6 +160,7 @@ def test_statistics_struct() -> None:
154160
fields.remove("record_size")
155161
fields.remove("size_hint")
156162
fields.remove("ts_index")
163+
fields.remove("ts_out")
157164

158165
# Act
159166
difference = fields.symmetric_difference(struct._ordered_fields)

0 commit comments

Comments
 (0)