Skip to content

Commit 4e68293

Browse files
authored
VER: Release 0.41.0
2 parents 632fa66 + f99db41 commit 4e68293

File tree

12 files changed

+177
-146
lines changed

12 files changed

+177
-146
lines changed

CHANGELOG.md

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

3+
## 0.41.0 - 2025-08-26
4+
5+
### Enhancements
6+
- Added `interval` method `RType` and `Schema` to get the duration for subsample schemas
7+
like `Ohlcv1H` and `Cbbo1S`
8+
9+
### Breaking changes
10+
- Changed the default value for `channel_id` to be `u8::MAX` in `MboMsg` and `u16::MAX`
11+
elsewhere since 0 is a valid channel ID
12+
13+
### Bug fixes
14+
- Changed default `inst_attrib_value` value from 0 to `i32::MAX` to match Rust
15+
316
## 0.40.0 - 2025-08-19
417

518
### Enhancements

Cargo.lock

Lines changed: 5 additions & 5 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.40.0"
14+
version = "0.41.0"
1515
documentation = "https://databento.com/docs"
1616
repository = "https://github.com/databento/dbn"
1717
license = "Apache-2.0"

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.40.0"
3+
version = "0.41.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.40.0"
20+
version = "0.41.0"
2121
authors = [
2222
{ name = "Databento", email = "[email protected]" }
2323
]

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.40.0", default-features = false }
19+
dbn = { path = "../dbn", version = "=0.41.0", default-features = false }
2020

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

rust/dbn/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ serde = ["dep:serde", "time/parsing", "time/serde"]
2525
trivial_copy = []
2626

2727
[dependencies]
28-
dbn-macros = { version = "=0.40.0", path = "../dbn-macros" }
28+
dbn-macros = { version = "=0.41.0", path = "../dbn-macros" }
2929

3030
async-compression = { version = "0.4.27", features = ["tokio", "zstd"], optional = true }
3131
csv = { workspace = true }

rust/dbn/src/enums/methods.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,26 @@ impl RType {
8282
_ => None,
8383
}
8484
}
85+
86+
/// Returns the interval associated with the `RType` if it's a subsampled
87+
/// record type, otherwise `None`.
88+
pub const fn interval(self) -> Option<time::Duration> {
89+
match self {
90+
RType::Ohlcv1S | RType::Cbbo1S | RType::Bbo1S => Some(time::Duration::SECOND),
91+
RType::Ohlcv1M | RType::Cbbo1M | RType::Bbo1M => Some(time::Duration::MINUTE),
92+
RType::Ohlcv1H => Some(time::Duration::HOUR),
93+
RType::Ohlcv1D | RType::OhlcvEod => Some(time::Duration::DAY),
94+
_ => None,
95+
}
96+
}
97+
}
98+
99+
impl Schema {
100+
/// Returns the interval associated with the `Schema` if it's a subsampled
101+
/// schema, otherwise `None`.
102+
pub fn interval(self) -> Option<time::Duration> {
103+
RType::from(self).interval()
104+
}
85105
}
86106

87107
impl From<TriState> for Option<bool> {

rust/dbn/src/python/record.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl MboMsg {
3030
side,
3131
ts_recv,
3232
flags = None,
33-
channel_id = 0,
33+
channel_id = None,
3434
ts_in_delta = 0,
3535
sequence = 0,
3636
))]
@@ -45,7 +45,7 @@ impl MboMsg {
4545
side: Side,
4646
ts_recv: u64,
4747
flags: Option<FlagSet>,
48-
channel_id: u8,
48+
channel_id: Option<u8>,
4949
ts_in_delta: i32,
5050
sequence: u32,
5151
) -> PyResult<Self> {
@@ -55,7 +55,7 @@ impl MboMsg {
5555
price,
5656
size,
5757
flags: flags.unwrap_or_default(),
58-
channel_id,
58+
channel_id: channel_id.unwrap_or(u8::MAX),
5959
action: action as u8 as c_char,
6060
side: side as u8 as c_char,
6161
ts_recv,
@@ -1538,7 +1538,7 @@ impl InstrumentDefMsg {
15381538
raw_instrument_id = 0,
15391539
leg_price = UNDEF_PRICE,
15401540
leg_delta = UNDEF_PRICE,
1541-
inst_attrib_value = 0,
1541+
inst_attrib_value = None,
15421542
underlying_id = 0,
15431543
market_depth_implied = None,
15441544
market_depth = None,
@@ -1560,7 +1560,7 @@ impl InstrumentDefMsg {
15601560
appl_id = None,
15611561
maturity_year = None,
15621562
decay_start_date = None,
1563-
channel_id = 0,
1563+
channel_id = None,
15641564
leg_count = 0,
15651565
leg_index = 0,
15661566
currency = "",
@@ -1612,7 +1612,7 @@ impl InstrumentDefMsg {
16121612
raw_instrument_id: u64,
16131613
leg_price: i64,
16141614
leg_delta: i64,
1615-
inst_attrib_value: i32,
1615+
inst_attrib_value: Option<i32>,
16161616
underlying_id: u32,
16171617
market_depth_implied: Option<i32>,
16181618
market_depth: Option<i32>,
@@ -1634,7 +1634,7 @@ impl InstrumentDefMsg {
16341634
appl_id: Option<i16>,
16351635
maturity_year: Option<u16>,
16361636
decay_start_date: Option<u16>,
1637-
channel_id: u16,
1637+
channel_id: Option<u16>,
16381638
leg_count: u16,
16391639
leg_index: u16,
16401640
currency: &str,
@@ -1684,7 +1684,7 @@ impl InstrumentDefMsg {
16841684
raw_instrument_id,
16851685
leg_price,
16861686
leg_delta,
1687-
inst_attrib_value,
1687+
inst_attrib_value: inst_attrib_value.unwrap_or(i32::MAX),
16881688
underlying_id,
16891689
market_depth_implied: market_depth_implied.unwrap_or(i32::MAX),
16901690
market_depth: market_depth.unwrap_or(i32::MAX),
@@ -1706,7 +1706,7 @@ impl InstrumentDefMsg {
17061706
appl_id: appl_id.unwrap_or(i16::MAX),
17071707
maturity_year: maturity_year.unwrap_or(u16::MAX),
17081708
decay_start_date: decay_start_date.unwrap_or(u16::MAX),
1709-
channel_id,
1709+
channel_id: channel_id.unwrap_or(u16::MAX),
17101710
leg_count,
17111711
leg_index,
17121712
currency: str_to_c_chars(currency)?,
@@ -2280,7 +2280,7 @@ impl StatMsg {
22802280
stat_type,
22812281
sequence = 0,
22822282
ts_in_delta = 0,
2283-
channel_id = 0,
2283+
channel_id = None,
22842284
update_action = None,
22852285
stat_flags = 0,
22862286
))]
@@ -2295,7 +2295,7 @@ impl StatMsg {
22952295
stat_type: StatType,
22962296
sequence: u32,
22972297
ts_in_delta: i32,
2298-
channel_id: u16,
2298+
channel_id: Option<u16>,
22992299
update_action: Option<StatUpdateAction>,
23002300
stat_flags: u8,
23012301
) -> PyResult<Self> {
@@ -2308,7 +2308,7 @@ impl StatMsg {
23082308
sequence,
23092309
ts_in_delta,
23102310
stat_type: stat_type as u16,
2311-
channel_id,
2311+
channel_id: channel_id.unwrap_or(u16::MAX),
23122312
update_action: update_action.unwrap_or_default() as u8,
23132313
stat_flags,
23142314
_reserved: Default::default(),
@@ -3363,7 +3363,7 @@ impl v1::StatMsg {
33633363
stat_type,
33643364
sequence = 0,
33653365
ts_in_delta = 0,
3366-
channel_id = 0,
3366+
channel_id = None,
33673367
update_action = None,
33683368
stat_flags = 0,
33693369
))]
@@ -3378,7 +3378,7 @@ impl v1::StatMsg {
33783378
stat_type: StatType,
33793379
sequence: u32,
33803380
ts_in_delta: i32,
3381-
channel_id: u16,
3381+
channel_id: Option<u16>,
33823382
update_action: Option<StatUpdateAction>,
33833383
stat_flags: u8,
33843384
) -> PyResult<Self> {
@@ -3391,7 +3391,7 @@ impl v1::StatMsg {
33913391
sequence,
33923392
ts_in_delta,
33933393
stat_type: stat_type as u16,
3394-
channel_id,
3394+
channel_id: channel_id.unwrap_or(u16::MAX),
33953395
update_action: update_action.unwrap_or_default() as u8,
33963396
stat_flags,
33973397
_reserved: Default::default(),

0 commit comments

Comments
 (0)