Crate dbn

source ·
Expand description

The official crate for working with Databento Binary Encoding (DBN), an extremely fast message encoding and storage format for normalized market data. The DBN specification includes a simple, self-describing metadata header and a fixed set of struct definitions, which enforce a standardized way to normalize market data.

All official Databento client libraries use DBN under the hood, both as a data interchange format and for in-memory representation of data. DBN is also the default encoding for all Databento APIs, including live data streaming, historical data streaming, and batch flat files. For more information about the encoding, read our introduction to DBN.

The crate supports reading and writing DBN files and streams, as well as converting them to other Encodings. It can also be used to update legacy DBZ files to DBN.

This crate provides:

  • Decoders for DBN and DBZ (the precursor to DBN), both sync and async, with the async feature flag
  • Encoders for CSV, DBN, and JSON, both sync and async, with the async feature flag
  • Normalized market data struct definitions corresponding to the different market data schemas offered by Databento
  • A wrapper type for holding a reference to a record struct of a dynamic type
  • Helper functions and macros for common tasks

§Feature flags

  • async: enables async decoding and encoding
  • python: enables pyo3 bindings
  • serde: enables deriving serde traits for types
  • trivial_copy: enables deriving the Copy trait for records

Re-exports§

Modules§

  • Compatibility shims for different DBN versions.
  • Contains dataset code constants.
  • Decoding DBN and Zstd-compressed DBN files and streams. Decoders implement the DecodeDbn trait.
  • Encoding DBN and Zstd-compressed DBN files and streams. Encoders implement the EncodeDbn trait.
  • Enums used in Databento APIs.
  • Types for errors that can occur while working with DBN.
  • Helper macros for working with multiple RTypes, Schemas, and types of records.
  • Contains Metadata struct which comes at the beginning of any DBN file or stream and MetadataBuilder for creating a Metadata with defaults.
  • Contains new types for pretty-printing values found in DBN records.
  • Enumerations for different data sources, venues, and publishers.
  • pythonpython
    Python wrappers around dbn functions. These are implemented here instead of in python/ to be able to implement pyo3 traits for DBN types.
  • Market data types for encoding different Databento Schemas and conversion functions.
  • The RecordRef struct for non-owning references to DBN records.
  • Maps for mapping instrument IDs to human-readable symbols.

Macros§

Enums§

  • An owned DBN record type of flexible type.
  • An immutable reference to a DBN record of flexible type. Unlike RecordRef, this type allows matching.

Constants§