Table of Contents

Namespace DatabentoDotNet.Dbn

Classes

AlignedBuffer

A read/write byte buffer backed by ulong[], guaranteeing that its byte view starts 8-byte aligned so records can later be reinterpreted in place over it.

DbnConstants

Wire-format constants for Databento Binary Encoding (DBN).

DbnDecodeException

Thrown when a byte sequence is not valid DBN: bad magic, an unsupported version, a truncated or self-inconsistent header, or a field whose raw value is not one the format defines.

DbnDecoder

Decodes a DBN stream — a file, a memory buffer, a socket — into metadata and records, handling Zstandard framing transparently.

DbnEncodeException

Thrown when a value cannot be represented in DBN: a symbol that is not ASCII or does not fit the stream's fixed symbol width, or metadata carrying a version this library will not emit.

DbnException

Base class for every DBN-specific failure this library raises.

DbnFsm

The incremental DBN decoder: a sans-I/O state machine that turns a byte stream arriving in arbitrary-sized pieces into metadata and records, without ever touching a Stream or a socket itself.

DbnTime

Converts between DBN's on-the-wire ulong nanosecond timestamps and NodaTime's Instant and LocalDate.

EnumValues

Validates a raw wire byte/word against the discriminants a DBN enum actually defines.

Metadata

The header that opens every DBN file and every live DBN stream: what the data is, what range it covers, and how its symbols resolve.

MetadataDecoder

Decodes the Metadata block that opens a DBN stream.

MetadataEncoder

Encodes a Metadata back into the DBN header bytes that open a stream.

OwnedRecord

A record copied out of the decoder's buffer and onto the heap, free of the buffer's lifetime. The counterpart of RecordRef: same bytes, same accessors, opposite ownership.

PitSymbolMap

A point-in-time symbol map: resolves an instrument ID to its symbol with no date involved at all. Useful for live symbology, or a historical request over a single day where the mapping is known not to change.

RTypeSchemaMapping

Conversions between RType and Schema.

RecordRefExtensions

The date half of a record's index timestamp: the calendar day a symbol map is keyed by.

SymbolMapping

One requested raw symbol and the intervals over which it resolved to an output symbol.

TsSymbolMap

A timeseries symbol map: resolves an instrument ID to its symbol on a specific date. Useful for a historical request spanning multiple days, where the same instrument ID can mean a different symbol on different dates (a continuous contract rolling to a new front-month instrument, for example).

WireStrings

Allocation-free, reflection-free text conversions for the DBN enums that have a wire text form.

Structs

BboMsg

A subsampled best bid and offer. The record of the Bbo1S and Bbo1M schemas.

BidAskPair

One price level: the bid and ask sides of a single book level.

BidAskPairArray1

A one-element inline array of BidAskPair: the levels field of Mbp1Msg and BboMsg.

BidAskPairArray10

A ten-element inline array of BidAskPair: the levels field of Mbp10Msg.

CStr11

A fixed 11-byte NUL-padded C-string field: asset in the DBN v3 instrument definition (7 bytes in v1 and v2).

CStr21

A fixed 21-byte NUL-padded C-string field: group and underlying in an instrument definition.

CStr22

A fixed 22-byte NUL-padded C-string field: every symbol field in DBN v1 — raw_symbol and the two SymbolMappingMsg symbols (71 bytes from v2 on).

CStr302

A fixed 302-byte NUL-padded C-string field: err in the DBN v2 and v3 error message (64 bytes in v1).

CStr303

A fixed 303-byte NUL-padded C-string field: msg in the DBN v2 and v3 system message (64 bytes in v1).

CStr31

A fixed 31-byte NUL-padded C-string field: unit_of_measure in an instrument definition.

CStr4

A fixed 4-byte NUL-padded C-string field: currency, settl_currency and strike_price_currency in an instrument definition.

CStr5

A fixed 5-byte NUL-padded C-string field: exchange in an instrument definition.

CStr6

A fixed 6-byte NUL-padded C-string field: secsubtype in an instrument definition.

CStr64

A fixed 64-byte NUL-padded C-string field: err and msg in the DBN v1 error and system messages (302 and 303 bytes from v2 on).

CStr7

A fixed 7-byte NUL-padded C-string field: cfi and security_type in an instrument definition, and asset in the DBN v1 and v2 layouts.

CStr71

A fixed 71-byte NUL-padded C-string field: every symbol field from DBN v2 on — raw_symbol, leg_raw_symbol and the two SymbolMappingMsg symbols (22 bytes in v1).

CbboMsg

A subsampled consolidated best bid and offer. The record of the Cbbo1S and Cbbo1M schemas.

Cmbp1Msg

Consolidated market-by-price with a book depth of 1. The record of the Cmbp1 and Tcbbo schemas.

ConsolidatedBidAskPair

One consolidated price level: the bid and ask sides of a single book level, each tagged with the publisher the quote came from.

ConsolidatedBidAskPairArray1

A one-element inline array of ConsolidatedBidAskPair: the levels field of Cmbp1Msg and CbboMsg.

ErrorMsg

An error from the Databento Live Subscription Gateway.

ErrorMsgV1

The DBN v1 layout of ErrorMsg, 80 bytes.

ImbalanceMsg

An auction imbalance. The record of the Imbalance schema.

InstrumentDefMsg

The definition of an instrument. The record of the Definition schema, and the largest record in DBN at 520 bytes.

InstrumentDefMsgV1

The DBN v1 layout of InstrumentDefMsg, 360 bytes.

InstrumentDefMsgV2

The DBN v2 layout of InstrumentDefMsg, 400 bytes.

MappingInterval

The symbol a raw symbol resolved to over one half-open date range.

MboMsg

A market-by-order (MBO) tick. The record of the Mbo schema.

Mbp10Msg

Market-by-price with a book depth of 10. The record of the Mbp10 schema.

Mbp1Msg

Market-by-price with a book depth of 1. The record of the Mbp1 and Tbbo schemas.

OhlcvMsg

Open, high, low, close and volume for one bar. The record of the OHLCV schemas at every cadence.

RecordHeader

The 16-byte header that begins every DBN record.

RecordRef

A non-owning, runtime-polymorphic view over one DBN record that still sits in the decoder's read buffer. Downcast it to a concrete record struct with Has<T>() plus Get<T>(), or with TryGet<T>(out T).

StatMsg

A statistic disseminated by a publisher. The record of the Statistics schema; StatType says which statistic it carries.

StatMsgV1

The DBN v1 and v2 layout of StatMsg, 64 bytes.

StatusMsg

An exchange status change. The record of the Status schema.

SymbolMappingMsg

A symbol mapping from the live API, mapping a symbol from one SType to another over an interval.

SymbolMappingMsgV1

The DBN v1 layout of SymbolMappingMsg, 80 bytes.

SystemMsg

A non-error message from the Databento Live Subscription Gateway, also used for heartbeats.

SystemMsgV1

The DBN v1 layout of SystemMsg, 80 bytes.

TradeMsg

A trade. The record of the Trades schema, and market-by-price with a book depth of 0.

WithTsOut<T>

A record plus the live gateway's send timestamp: eight more bytes on the wire, appended after the record itself.

Interfaces

IRecord<TSelf>

Associates a record struct with the record types (RType) it can decode and with its exact size on the wire.

ISymbolIndex

Resolves a symbol for a decoded record, without the caller having to know which timestamp the record indexes on or which kind of symbol map is answering. Implemented by TsSymbolMap and PitSymbolMap.

Enums

Action

An order event or order book operation.

Compression

A compression format, or none if uncompressed.

Encoding

A data encoding format.

ErrorCode

An error code from the live subscription gateway.

FlagSet

Bit-set flags carried by MboMsg and the record types derived from it.

InstrumentClass

The class of instrument.

MatchAlgorithm

The type of matching algorithm used for the instrument at the exchange.

ProcessStatus

What one step of Process(out int, out RecordRef) produced.

RType

A record type: a sentinel for the concrete record layout, carried in every record's RawRType field and surfaced typed as RType.

SType

A symbology type, i.e. the namespace a symbol string is drawn from.

Schema

A data record schema. Each schema has a particular record type associated with it.

SecurityUpdateAction

The type of InstrumentDefMsg update.

Side

The side of the market: for resting orders, the side of the book; for trades, the side of the aggressor.

StatType

The type of statistic contained in a StatMsg.

StatUpdateAction

The type of StatMsg update.

StatusAction

The primary enum for a StatusMsg update: what the instrument's trading status changed to.

StatusReason

The secondary enum for a StatusMsg update: the cause of a halt or other change in StatusAction.

SystemCode

A SystemMsg code indicating the type of message from the live subscription gateway.

TradingEvent

Further information about a StatusMsg update.

TriState

Represents an unknown, true, or false value. Equivalent to a nullable bool but with a human-readable wire representation.

UserDefinedInstrument

Whether the instrument is user-defined.

VersionUpgradePolicy

How to handle decoding DBN data from other versions.