From bbd7c0b058b68f30c3aacd7151408563ed67cdba Mon Sep 17 00:00:00 2001 From: Carter Green Date: Wed, 19 Jul 2023 10:46:50 -0500 Subject: [PATCH] VER: Release DBN 0.8.0 --- CHANGELOG.md | 8 ++++- Cargo.lock | 10 +++--- c/Cargo.toml | 2 +- python/Cargo.toml | 2 +- python/pyproject.toml | 2 +- rust/dbn-cli/Cargo.toml | 4 +-- rust/dbn-macros/Cargo.toml | 2 +- rust/dbn/Cargo.toml | 4 +-- rust/dbn/src/enums.rs | 68 ++++++++++++++++++++------------------ 9 files changed, 56 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e2476..58ff1f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,26 @@ # Changelog -## 0.8.0 - TBD +## 0.8.0 - 2023-07-19 ### Enhancements - Switched from `anyhow::Error` to custom `dbn::Error` for all public fallible functions and methods. This should make it easier to disambiguate between error types. - `EncodeDbn::encode_record` and `EncodeDbn::record_record_ref` no longer treat a `BrokenPipe` error differently +- Added `AsyncDbnDecoder` - Added `pretty::Px` and `pretty::Ts` newtypes to expose price and timestamp formatting logic outside of CSV and JSON encoding - Added interning for Python strings +- Added `rtype` to encoded JSON and CSV to aid differeniating between different record types. + This is particularly important when working with live data. - Added `pretty_` Python attributes for DBN price fields - Added `pretty_` Python attributes for DBN UTC timestamp fields ### Breaking changes - All fallible operations now return a `dbn::Error` instead of an `anyhow::Error` - Updated serialization order to serialize `ts_recv` and `ts_event` first +- Moved header fields (`rtype`, `publisher_id`, `instrument_id`, and `ts_event`) to + nested object under the key `hd` in JSON encoding to match structure definitions +- Changed JSON encoding of all 64-bit integers to strings to avoid loss of precision - Updated `MboMsg` serialization order to serialize `action`, `side`, and `channel_id` earlier given their importance - Updated `Mbp1Msg`, `Mbp10Msg`, and `TradeMsg` serialization order to serialize diff --git a/Cargo.lock b/Cargo.lock index 1d317ef..174694b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,7 +238,7 @@ dependencies = [ [[package]] name = "databento-dbn" -version = "0.7.1" +version = "0.8.0" dependencies = [ "dbn", "pyo3", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "dbn" -version = "0.7.1" +version = "0.8.0" dependencies = [ "async-compression", "csv", @@ -266,7 +266,7 @@ dependencies = [ [[package]] name = "dbn-c" -version = "0.7.1" +version = "0.8.0" dependencies = [ "anyhow", "cbindgen", @@ -276,7 +276,7 @@ dependencies = [ [[package]] name = "dbn-cli" -version = "0.7.1" +version = "0.8.0" dependencies = [ "anyhow", "assert_cmd", @@ -290,7 +290,7 @@ dependencies = [ [[package]] name = "dbn-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/c/Cargo.toml b/c/Cargo.toml index 2c54af9..f148d4f 100644 --- a/c/Cargo.toml +++ b/c/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn-c" authors = ["Databento "] -version = "0.7.1" +version = "0.8.0" edition = "2021" description = "C bindings for working with Databento Binary Encoding (DBN)" license = "Apache-2.0" diff --git a/python/Cargo.toml b/python/Cargo.toml index b230b75..4627286 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "databento-dbn" authors = ["Databento "] -version = "0.7.1" +version = "0.8.0" edition = "2021" description = "Python library written in Rust for working with Databento Binary Encoding (DBN)" license = "Apache-2.0" diff --git a/python/pyproject.toml b/python/pyproject.toml index e504e4c..366cd4d 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "databento-dbn" -version = "0.7.1" +version = "0.8.0" description = "Python bindings for encoding and decoding Databento Binary Encoding (DBN)" authors = ["Databento "] license = "Apache-2.0" diff --git a/rust/dbn-cli/Cargo.toml b/rust/dbn-cli/Cargo.toml index 77c6036..3572e1f 100644 --- a/rust/dbn-cli/Cargo.toml +++ b/rust/dbn-cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn-cli" authors = ["Databento "] -version = "0.7.1" +version = "0.8.0" edition = "2021" description = "Command-line utility for converting Databento Binary Encoding (DBN) files to text-based formats" default-run = "dbn" @@ -17,7 +17,7 @@ path = "src/main.rs" [dependencies] # Databento common DBN library -dbn = { path = "../dbn", version = "=0.7.1", default_features = false } +dbn = { path = "../dbn", version = "=0.8.0", default_features = false } # Error handling anyhow = "1.0.70" diff --git a/rust/dbn-macros/Cargo.toml b/rust/dbn-macros/Cargo.toml index e30057a..5ccd90c 100644 --- a/rust/dbn-macros/Cargo.toml +++ b/rust/dbn-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn-macros" authors = ["Databento "] -version = "0.7.1" +version = "0.8.0" edition = "2021" description = "Proc macros for dbn crate" license = "Apache-2.0" diff --git a/rust/dbn/Cargo.toml b/rust/dbn/Cargo.toml index d527d70..4fa6c1a 100644 --- a/rust/dbn/Cargo.toml +++ b/rust/dbn/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dbn" authors = ["Databento "] -version = "0.7.1" +version = "0.8.0" edition = "2021" description = "Library for working with Databento Binary Encoding (DBN)" license = "Apache-2.0" @@ -19,7 +19,7 @@ serde = ["dep:serde", "time/parsing", "time/serde"] trivial_copy = [] [dependencies] -dbn-macros = { version = "=0.7.1", path = "../dbn-macros" } +dbn-macros = { version = "=0.8.0", path = "../dbn-macros" } # async (de)compression async-compression = { version = "0.3.15", features = ["tokio", "zstd"], optional = true } diff --git a/rust/dbn/src/enums.rs b/rust/dbn/src/enums.rs index 9e952e7..13e647e 100644 --- a/rust/dbn/src/enums.rs +++ b/rust/dbn/src/enums.rs @@ -214,79 +214,83 @@ pub mod rtype { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TryFromPrimitive)] #[repr(u8)] pub enum RType { - /// Market by price with a book depth of 0 (used for trades). + /// Denotes a market-by-price record with a book depth of 0 (used for the + /// [`Trades`](super::Schema::Trades) schema). Mbp0 = 0, - /// Market by price with a book depth of 1 (also used for TBBO). + /// Denotes a market-by-price record with a book depth of 1 (also used for the + /// [`Tbbo`](super::Schema::Tbbo) schema). Mbp1 = 0x01, - /// Market by price with a book depth of 10. + /// Denotes a market-by-price record with a book depth of 10. Mbp10 = 0x0A, - /// Open, high, low, close, and volume at an unspecified cadence. + /// Denotes an open, high, low, close, and volume record at an unspecified cadence. #[deprecated( since = "0.3.3", note = "Separated into separate rtypes for each OHLCV schema." )] OhlcvDeprecated = 0x11, - /// Open, high, low, close, and volume at a 1-second cadence. + /// Denotes an open, high, low, close, and volume record at a 1-second cadence. Ohlcv1S = 0x20, - /// Open, high, low, close, and volume at a 1-minute cadence. + /// Denotes an open, high, low, close, and volume record at a 1-minute cadence. Ohlcv1M = 0x21, - /// Open, high, low, close, and volume at a daily cadence. + /// Denotes an open, high, low, close, and volume record at an hourly cadence. Ohlcv1H = 0x22, - /// Open, high, low, close, and volume at a daily cadence. + /// Denotes an open, high, low, close, and volume record at a daily cadence. Ohlcv1D = 0x23, - /// Exchange status. + /// Denotes an exchange status record. Status = 0x12, - /// Instrument definition. + /// Denotes an instrument definition record. InstrumentDef = 0x13, - /// Order imbalance. + /// Denotes an order imbalance record. Imbalance = 0x14, - /// Error from gateway. + /// Denotes an error from gateway. Error = 0x15, - /// Symbol mapping. + /// Denotes a symbol mapping record. SymbolMapping = 0x16, - /// A non-error message. Also used for heartbeats. + /// Denotes a non-error message from the gateway. Also used for heartbeats. System = 0x17, - /// Statistics from the publisher (not calculated by Databento). + /// Denotes a statistics record from the publisher (not calculated by Databento). Statistics = 0x18, - /// Market by order. + /// Denotes a market by order record. Mbo = 0xA0, } - /// Market by price with a book depth of 0 (used for trades). + /// Denotes a market-by-price record with a book depth of 0 (used for the + /// [`Trades`](super::Schema::Trades) schema). pub const MBP_0: u8 = RType::Mbp0 as u8; - /// Market by price with a book depth of 1 (also used for TBBO). + /// Denotes a market-by-price record with a book depth of 1 (also used for the + /// [`Tbbo`](super::Schema::Tbbo) schema). pub const MBP_1: u8 = RType::Mbp1 as u8; - /// Market by price with a book depth of 10. + /// Denotes a market-by-price record with a book depth of 10. pub const MBP_10: u8 = RType::Mbp10 as u8; - /// Open, high, low, close, and volume at an unspecified cadence. + /// Denotes an open, high, low, close, and volume record at an unspecified cadence. #[deprecated( since = "0.3.3", note = "Separated into separate rtypes for each OHLCV schema." )] pub const OHLCV_DEPRECATED: u8 = RType::OhlcvDeprecated as u8; - /// Open, high, low, close, and volume at a 1-second cadence. + /// Denotes an open, high, low, close, and volume record at a 1-second cadence. pub const OHLCV_1S: u8 = RType::Ohlcv1S as u8; - /// Open, high, low, close, and volume at a 1-minute cadence. + /// Denotes an open, high, low, close, and volume record at a 1-minute cadence. pub const OHLCV_1M: u8 = RType::Ohlcv1M as u8; - /// Open, high, low, close, and volume at an hourly cadence. + /// Denotes an open, high, low, close, and volume record at an hourly cadence. pub const OHLCV_1H: u8 = RType::Ohlcv1H as u8; - /// Open, high, low, close, and volume at a daily cadence. + /// Denotes an open, high, low, close, and volume record at a daily cadence. pub const OHLCV_1D: u8 = RType::Ohlcv1D as u8; - /// Exchange status. + /// Denotes an exchange status record. pub const STATUS: u8 = RType::Status as u8; - /// Instrument definition. + /// Denotes an instrument definition record. pub const INSTRUMENT_DEF: u8 = RType::InstrumentDef as u8; - /// Order imbalance. + /// Denotes an order imbalance record. pub const IMBALANCE: u8 = RType::Imbalance as u8; - /// Error from gateway. + /// Denotes an error from gateway. pub const ERROR: u8 = RType::Error as u8; - /// Symbol mapping. + /// Denotes a symbol mapping record. pub const SYMBOL_MAPPING: u8 = RType::SymbolMapping as u8; - /// A non-error message. Also used for heartbeats. + /// Denotes a non-error message from the gateway. Also used for heartbeats. pub const SYSTEM: u8 = RType::System as u8; - /// Statistics from the publisher (not calculated by Databento). + /// Denotes a statistics record from the publisher (not calculated by Databento). pub const STATISTICS: u8 = RType::Statistics as u8; - /// Market by order. + /// Denotes a market-by-order record. pub const MBO: u8 = RType::Mbo as u8; /// Get the corresponding `rtype` for the given `schema`.