Skip to content

Commit 1d39f44

Browse files
authored
VER: Release 0.32.0
2 parents 920c7d1 + 3a8b44e commit 1d39f44

File tree

20 files changed

+414
-160
lines changed

20 files changed

+414
-160
lines changed

CHANGELOG.md

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

3+
## 0.32.0 - 2025-04-14
4+
5+
### Enhancements
6+
- Refactored the `rtype_dispatch` macro to be more flexible: it supports `ts_out`
7+
dispatching, async functions and methods, and now always verifies the record length
8+
- Refactored the `schema_dispatch` macro to be more flexible: it supports `ts_out`
9+
dispatching and async functions and methods
10+
11+
### Breaking changes
12+
- Updated the `rtype_dispatch` and `schema_dispatch` macro invocations to look more like
13+
function invocation
14+
15+
### Deprecations
16+
- Deprecated macros `rtype_async_dispatch`, `rtype_ts_out_dispatch`,
17+
`rtype_dispatch_with_ts_out`, `rtype_ts_out_async_dispatch`,
18+
`rtype_ts_out_method_dispatch`, and `rtype_ts_out_async_method_dispatch` in favor of
19+
an updated, more flexible `rtype_dispatch` macro
20+
21+
### Bug fixes
22+
- Fixed `RType` variant names in Python to match `Schema`
23+
- Added missing Python type declarations for `RType` variants
24+
- Fixed issue with Python `_hidden_fields` definition that caused `KeyError: _reserved1_00`
25+
with `CMBP1Msg` and other records with `ConsolidatedBidAskPair`
26+
327
## 0.31.0 - 2025-04-01
428

529
### Enhancements

Cargo.lock

Lines changed: 32 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resolver = "2"
1111
[workspace.package]
1212
authors = ["Databento <[email protected]>"]
1313
edition = "2021"
14-
version = "0.31.0"
14+
version = "0.32.0"
1515
documentation = "https://databento.com/docs"
1616
repository = "https://github.com/databento/dbn"
1717
license = "Apache-2.0"

c/src/text_serialization.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66

77
use dbn::{
88
encode::{csv, json, DbnEncodable, EncodeRecordRef},
9-
rtype, rtype_ts_out_dispatch, RecordHeader, RecordRef, Schema,
9+
rtype, rtype_dispatch, RecordHeader, RecordRef, Schema,
1010
};
1111

1212
use crate::cfile::CFileRef;
@@ -80,7 +80,7 @@ pub unsafe extern "C" fn s_serialize_record_header(
8080
.use_pretty_ts(options.pretty_ts)
8181
.build()
8282
.and_then(|mut encoder| {
83-
rtype_ts_out_dispatch!(record, options.ts_out, serialize_csv_header, &mut encoder)
83+
rtype_dispatch!(record, ts_out: options.ts_out, serialize_csv_header(&mut encoder))
8484
}),
8585
}
8686
// flatten
@@ -126,7 +126,7 @@ pub unsafe extern "C" fn f_serialize_record_header(
126126
.use_pretty_ts(options.pretty_ts)
127127
.build()
128128
.and_then(|mut encoder| {
129-
rtype_ts_out_dispatch!(record, options.ts_out, serialize_csv_header, &mut encoder)
129+
rtype_dispatch!(record, ts_out: options.ts_out, serialize_csv_header(&mut encoder))
130130
}),
131131
};
132132
res.map(|_| cfile.bytes_written() as i32)

python/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-dbn"
3-
version = "0.31.0"
3+
version = "0.32.0"
44
description = "Python bindings for encoding and decoding Databento Binary Encoding (DBN)"
55
authors = ["Databento <[email protected]>"]
66
license = "Apache-2.0"
@@ -17,7 +17,7 @@ build-backend = "maturin"
1717

1818
[project]
1919
name = "databento-dbn"
20-
version = "0.31.0"
20+
version = "0.32.0"
2121
authors = [
2222
{ name = "Databento", email = "[email protected]" }
2323
]

python/python/databento_dbn/_lib.pyi

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: UP007 PYI021 PYI053 PYI011
1+
# ruff: noqa: UP007 PYI021 PYI011
22
from __future__ import annotations
33

44
import datetime as dt
@@ -269,12 +269,12 @@ class RType(Enum):
269269
"""
270270
A DBN record type.
271271
272-
MBP0
272+
MBP_0
273273
Denotes a market-by-price record with a book depth of 0 (used for the `Trades` schema).
274-
MBP1
274+
MBP_1
275275
Denotes a market-by-price record with a book depth of 1 (also used for the
276276
`Tbbo` schema).
277-
MBP10
277+
MBP_10
278278
Denotes a market-by-price record with a book depth of 10.
279279
OHLCV_DEPRECATED
280280
Denotes an open, high, low, close, and volume record at an unspecified cadence.
@@ -306,7 +306,7 @@ class RType(Enum):
306306
Denotes a statistics record from the publisher (not calculated by Databento).
307307
MBO
308308
Denotes a market by order record.
309-
CBBO
309+
CMBP_1
310310
Denotes a consolidated best bid and offer record.
311311
CBBO_1S
312312
Denotes a consolidated best bid and offer record.
@@ -323,6 +323,30 @@ class RType(Enum):
323323
324324
""" # noqa: D405, D411
325325

326+
MBP_0: int
327+
MBP_1: int
328+
MBP_10: int
329+
OHLCV_DEPRECATED: int
330+
OHLCV_1S: int
331+
OHLCV_1M: int
332+
OHLCV_1H: int
333+
OHLCV_1D: int
334+
OHLCV_EOD: int
335+
STATUS: int
336+
INSTRUMENT_DEF: int
337+
IMBALANCE: int
338+
ERROR: int
339+
SYMBOL_MAPPING: int
340+
SYSTEM: int
341+
STATISTICS: int
342+
MBO: int
343+
CMBP_1: int
344+
CBBO_1S: int
345+
CBBO_1M: int
346+
TCBBO: int
347+
BBO_1S: int
348+
BBO_1M: int
349+
326350
@classmethod
327351
def from_int(cls, value: int) -> RType: ...
328352
@classmethod

python/src/dbn_decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pyo3::{prelude::*, IntoPyObjectExt};
55
use dbn::{
66
decode::dbn::{MetadataDecoder, RecordDecoder},
77
python::to_py_err,
8-
rtype_ts_out_dispatch, HasRType, VersionUpgradePolicy,
8+
rtype_dispatch, HasRType, VersionUpgradePolicy,
99
};
1010

1111
#[pyclass(module = "databento_dbn", name = "DBNDecoder")]
@@ -96,7 +96,7 @@ impl DbnDecoder {
9696

9797
// Safety: It's safe to cast to `WithTsOut` because we're passing in the `ts_out`
9898
// from the metadata header.
99-
unsafe { rtype_ts_out_dispatch!(rec, self.ts_out, push_rec, py, &mut recs) }?;
99+
rtype_dispatch!(rec, ts_out: self.ts_out, push_rec(py, &mut recs))?;
100100
// keep track of position after last _successful_ decoding to
101101
// ensure buffer is left in correct state in the case where one
102102
// or more successful decodings is followed by a partial one, i.e.

rust/dbn-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ name = "dbn"
1616
path = "src/main.rs"
1717

1818
[dependencies]
19-
dbn = { path = "../dbn", version = "=0.31.0", default-features = false }
19+
dbn = { path = "../dbn", version = "=0.32.0", default-features = false }
2020

2121
anyhow = { workspace = true }
2222
clap = { version = "4.5", features = ["derive", "wrap_help"] }

rust/dbn-cli/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ By default, `dbn` will not overwrite an existing file.
5252
To replace the contents of an existing file and allow overwriting files, pass
5353
the `-f` or `--force` flag.
5454

55+
### Merging DBN files
56+
You can use `dbn` to merge several DBN files into one, including files of different schemas.
57+
```sh
58+
# Merge files split by symbols
59+
dbn aapl.trades.dbn tsla.trades.dbn nvda.trades.dbn -o equities.trades.dbn
60+
# Or by date
61+
dbn equs-mini-20250331.dbn equs-mini-20250401.dbn equs-mini-20250402.dbn -o equs-mini-2025W14.dbn
62+
```
63+
The only limitation is they must be from the same dataset.
64+
5565
### Compressing the output
5666
In addition to reading Zstandard-compressed files, `dbn` can also write compressed JSON and CSV.
5767

0 commit comments

Comments
 (0)