Skip to content

Commit

Permalink
VER: Release DBN 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Jul 19, 2023
1 parent 255e5c1 commit bbd7c0b
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 46 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion c/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dbn-c"
authors = ["Databento <[email protected]>"]
version = "0.7.1"
version = "0.8.0"
edition = "2021"
description = "C bindings for working with Databento Binary Encoding (DBN)"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "databento-dbn"
authors = ["Databento <[email protected]>"]
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"
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions rust/dbn-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dbn-cli"
authors = ["Databento <[email protected]>"]
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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion rust/dbn-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dbn-macros"
authors = ["Databento <[email protected]>"]
version = "0.7.1"
version = "0.8.0"
edition = "2021"
description = "Proc macros for dbn crate"
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions rust/dbn/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dbn"
authors = ["Databento <[email protected]>"]
version = "0.7.1"
version = "0.8.0"
edition = "2021"
description = "Library for working with Databento Binary Encoding (DBN)"
license = "Apache-2.0"
Expand All @@ -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 }
Expand Down
68 changes: 36 additions & 32 deletions rust/dbn/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit bbd7c0b

Please sign in to comment.