Struct RecordHeader
- Namespace
- DatabentoDotNet.Dbn
- Assembly
- DatabentoDotNet.Dbn.dll
The 16-byte header that begins every DBN record.
public readonly struct RecordHeader
- Inherited Members
Remarks
Layout must match the #[repr(C)] Rust definition byte for byte; it is reinterpreted
directly over the read buffer rather than parsed field by field.
Fields
InstrumentId
Numeric instrument ID.
public readonly uint InstrumentId
Field Value
Length
Length of the whole record in 32-bit words. Use SizeInBytes for a byte count.
public readonly byte Length
Field Value
PublisherId
Publisher ID assigned by Databento, denoting the dataset and venue. Not validated on decode — pass it to TryFromPublisher(ushort, out Publisher) for a checked conversion, the same way RawRType goes through TryFromRType(byte, out RType).
public readonly ushort PublisherId
Field Value
Remarks
Casting this straight to Publisher compiles for any word the wire
happens to carry, and the mistake only surfaces later, as an
ArgumentOutOfRangeException from inside
ToVenue(Publisher) or
ToDataset(Publisher) — by which point
the record it came from is out of sight. Databento adds publishers between dbn
releases, so an id this build does not know about is an ordinary occurrence rather than a
corrupt stream.
RawRType
The raw wire byte behind RType. Not validated on decode — pass it to
TryFromRType(byte, out RType) for a checked
conversion. Values 0x00..0x0F encode market-by-price book depth, so 0x00,
0x01 and 0x0A are depths 0, 1 and 10 rather than arbitrary tags.
public readonly byte RawRType
Field Value
TsEvent
Matching-engine-received timestamp, in nanoseconds since the UNIX epoch.
public readonly ulong TsEvent
Field Value
Remarks
Kept as raw nanoseconds because this field's type is its wire layout: the record
is reinterpreted in place over the read buffer, so anything other than the 8-byte
u64 the wire carries would be silent data corruption rather than a compile error.
Convert at the boundary with ToInstant(ulong), which checks UndefTimestamp rather than wrapping it into a pre-epoch time.
Properties
RType
The record type. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawRType.
public RType RType { get; }
Property Value
SizeInBytes
The record's total length in bytes.
public int SizeInBytes { get; }