dbn-cli 0.73.0

Command-line utility for converting Databento Binary Encoding (DBN) files to text-based formats
Documentation

dbn-cli

build license Current Crates.io Version

This crate provides a CLI tool dbn for converting Databento Binary Encoding (DBN) files to text formats, as well as updating legacy DBZ files to DBN.

For more information about DBN, read our introduction to DBN.

Installation

Pre-built dbn binaries are attached to every release of this repository. Builds are available for the following targets:

  • Linux: x86_64 and aarch64, both gnu and musl
  • macOS: x86_64 and aarch64
  • Windows: x86_64 and aarch64

Each release ships a dbn-<version>-<target>.tar.gz archive (or .zip on Windows) together with a .sha256 checksum file. Download the archive for your platform, verify the checksum, extract the archive, and move the dbn binary somewhere on your PATH.

Alternatively, if you have a Rust toolchain installed, you can build and install from source with Cargo:

cargo install dbn-cli

Usage

dbn supports CSV, TSV, JSON lines, DBN, Apache Parquet, and Apache Arrow IPC as output formats. By default, dbn outputs the result to standard output for ease of use with text-based command-line utilities. Running

dbn some.dbn --csv --limit 5

will print the header row and the first 5 data rows in some.dbn in CSV format to the console. Similarly, running

dbn ohlcv-1d.dbn.zst --json | jq '.high'

Will extract only the high prices from ohlcv-1d.dbn.zst. dbn works with both uncompressed and Zstandard-compressed DBN files.

You can also save the results directly to another file by running

dbn some.dbn.zst --json --output some.json

dbn will create a new file some.json with the data from some.dbn.zst formatted as JSON.

When the file name passed --output or -o ends in .json, .csv, .tsv, .dbn, .parquet, .arrow, or .feather, you can omit the output format flag.

dbn another.dbn.zst -o data.csv

This writes the contents of another.dbn.zst to data.csv in CSV format.

By default, dbn will not overwrite an existing file. To replace the contents of an existing file and allow overwriting files, pass the -f or --force flag.

Merging DBN files

You can use dbn to merge several DBN files into one, including files of different schemas.

# Merge files split by symbols
dbn aapl.trades.dbn tsla.trades.dbn nvda.trades.dbn -o equities.trades.dbn
# Or by date
dbn equs-mini-20250331.dbn equs-mini-20250401.dbn equs-mini-20250402.dbn -o equs-mini-2025W14.dbn

The only limitation is they must be from the same dataset.

Splitting DBN files

You can also split one DBN file into several by passing --split-by/-S with a split method and --output-pattern/-O with a pattern for the output file names.

# By schema, such as from a live data capture
dbn opra-pillar-20260114.dbn.zst --split-by schema --output-pattern 'opra-pillar-2026114.{schema}.dbn.zst'
# By time
dbn opra-pillar-202512.ohlcv-1s.dbn.zst --split-by day --output-pattern 'opra-pillar-{date}.ohlcv-1s.dbn.zst'
# By symbol, with the short argument forms
dbn equs-mini-20260114.dbn.zst -S symbol -O 'equs-mini-2026014-{symbol}.dbn.zst'

Compressing the output

In addition to reading Zstandard-compressed files, dbn can also write compressed JSON and CSV.

dbn ohlcv-1d.dbn -o ohclv-1d.json.zst

or explicitly

dbn ohlcv-1d.dbn --json --zstd -o ohlcv-1d.json.zst

Writing Parquet and Arrow

dbn can write Apache Parquet and Apache Arrow IPC (Feather v2) files. Pass --parquet/-P or --arrow/-A, or use an output path ending in .parquet, .arrow, or .feather.

dbn ohlcv-1d.dbn.zst -o ohlcv-1d.parquet

With these formats, --zstd compresses the data inside the file instead of the whole file, and --pretty writes prices as floating-point columns. Timestamps always use the native Arrow timestamp type.

Each file holds records of a single schema, so pass --schema or --split-by schema when the input mixes schemas. These formats require DBN metadata, so they don't support fragment input.

Reading and writing fragments

dbn can also read and write DBN files without the metadata header, these are called "DBN fragments". Pass the --input-fragment or --input-zstd-fragment flag to read a DBN file without a metadata header.

dbn 120000_121000.mbo.dbn.frag --input-fragment --json

You can also write DBN files without the metadata header with the --fragment or -F flag.

dbn ohlcv-1d.dbn -F -o ohlcv-1d.dbn.frag

Converting DBZ files to DBN

DBZ is a legacy precursor to DBN that required Zstandard. To convert a DBZ file to Zstandard-compressed DBN, run

dbn 20221212.mbo.dbz -o 20221212.dbn.zst

or pass --dbn to set the output encoding explicitly.

License

Distributed under the Apache 2.0 License.