Table of Contents

Struct InstrumentDefMsg

Namespace
DatabentoDotNet.Dbn
Assembly
DatabentoDotNet.Dbn.dll

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

public readonly struct InstrumentDefMsg : IRecord<InstrumentDefMsg>
Implements
Inherited Members

Remarks

This is the DBN v3 layout. Versions 1 and 2 are 360 and 400 bytes and differ in more than size — see InstrumentDefMsgV1 and InstrumentDefMsgV2, and UpgradeTo() for how the gap is closed.

Field order is transcribed from the #[repr(C)] Rust declaration. This struct is where that matters most: it carries 42 encode_order attributes, all of which control CSV and JSON column order only and none of which affect memory layout. A field list built from them would compile, satisfy a size assertion, and decode garbage.

Fields

Activation

The time of instrument activation, in nanoseconds since the UNIX epoch. UndefTimestamp when null, as for equities.

public readonly ulong Activation

Field Value

ulong

ApplId

The channel ID assigned at the venue.

public readonly short ApplId

Field Value

short

Asset

The underlying asset code (product code) of the instrument.

public readonly CStr11 Asset

Field Value

CStr11

Cfi

The ISO standard instrument categorization code.

public readonly CStr7 Cfi

Field Value

CStr7

ChannelId

The channel ID assigned by Databento, an integer counting up from zero.

public readonly ushort ChannelId

Field Value

ushort

ContractMultiplier

The number of deliverables per instrument, i.e. peak days.

public readonly int ContractMultiplier

Field Value

int

ContractMultiplierUnit

The type of ContractMultiplier: 1 for hours, 2 for days.

public readonly sbyte ContractMultiplierUnit

Field Value

sbyte

Currency

The currency used for price fields.

public readonly CStr4 Currency

Field Value

CStr4

DecayQuantity

The quantity a contract decays by daily once DecayStartDate is reached.

public readonly int DecayQuantity

Field Value

int

DecayStartDate

The date at which a contract begins to decay.

public readonly ushort DecayStartDate

Field Value

ushort

DisplayFactor

The multiplier converting the venue's display price to the conventional price, where every 1 unit corresponds to 1e-9.

public readonly long DisplayFactor

Field Value

long

Exchange

The exchange used to identify the instrument.

public readonly CStr5 Exchange

Field Value

CStr5

Expiration

The last eligible trade time, in nanoseconds since the UNIX epoch. UndefTimestamp when null, as for equities.

public readonly ulong Expiration

Field Value

ulong

FlowScheduleType

The schedule for delivering electricity.

public readonly sbyte FlowScheduleType

Field Value

sbyte

Group

The security group code of the instrument.

public readonly CStr21 Group

Field Value

CStr21

Header

The common header.

public readonly RecordHeader Header

Field Value

RecordHeader

HighLimitPrice

The allowable high limit price for the trading day, where every 1 unit corresponds to 1e-9.

public readonly long HighLimitPrice

Field Value

long

InstAttribValue

Venue-specific instrument attributes.

public readonly int InstAttribValue

Field Value

int

LegCount

The number of legs in the strategy or spread; 0 for outrights. New in DBN v3.

public readonly ushort LegCount

Field Value

ushort

LegDelta

The associated delta of the leg, if any, where every 1 unit corresponds to 1e-9. New in DBN v3.

public readonly long LegDelta

Field Value

long

LegIndex

The 0-based index of the leg. New in DBN v3.

public readonly ushort LegIndex

Field Value

ushort

LegInstrumentId

The numeric ID assigned to the leg instrument. New in DBN v3.

public readonly uint LegInstrumentId

Field Value

uint

LegPrice

The tied price of the leg, if any, where every 1 unit corresponds to 1e-9. New in DBN v3.

public readonly long LegPrice

Field Value

long

LegRatioPriceDenominator

The denominator of the leg's price ratio within the spread. New in DBN v3.

public readonly int LegRatioPriceDenominator

Field Value

int

LegRatioPriceNumerator

The numerator of the leg's price ratio within the spread. New in DBN v3.

public readonly int LegRatioPriceNumerator

Field Value

int

LegRatioQtyDenominator

The denominator of the leg's quantity ratio within the spread. New in DBN v3.

public readonly int LegRatioQtyDenominator

Field Value

int

LegRatioQtyNumerator

The numerator of the leg's quantity ratio within the spread. New in DBN v3.

public readonly int LegRatioQtyNumerator

Field Value

int

LegRawSymbol

The leg instrument's raw symbol assigned by the publisher. New in DBN v3.

public readonly CStr71 LegRawSymbol

Field Value

CStr71

LegUnderlyingId

The numeric ID of the leg instrument's underlying instrument. New in DBN v3.

public readonly uint LegUnderlyingId

Field Value

uint

LowLimitPrice

The allowable low limit price for the trading day, where every 1 unit corresponds to 1e-9.

public readonly long LowLimitPrice

Field Value

long

MainFraction

The price denominator of the main fraction.

public readonly byte MainFraction

Field Value

byte

MarketDepth

The outright book depth on the price-level data feed.

public readonly int MarketDepth

Field Value

int

MarketDepthImplied

The implied book depth on the price-level data feed.

public readonly int MarketDepthImplied

Field Value

int

MarketSegmentId

The market segment of the instrument.

public readonly uint MarketSegmentId

Field Value

uint

MaturityDay

The calendar day reflected in the instrument symbol, or 0.

public readonly byte MaturityDay

Field Value

byte

MaturityMonth

The calendar month reflected in the instrument symbol.

public readonly byte MaturityMonth

Field Value

byte

MaturityWeek

The calendar week reflected in the instrument symbol, or 0.

public readonly byte MaturityWeek

Field Value

byte

MaturityYear

The calendar year reflected in the instrument symbol.

public readonly ushort MaturityYear

Field Value

ushort

MaxPriceVariation

The differential value for price banding, where every 1 unit corresponds to 1e-9.

public readonly long MaxPriceVariation

Field Value

long

MaxTradeVol

The maximum trading volume for the instrument.

public readonly uint MaxTradeVol

Field Value

uint

MinLotSize

The minimum order entry quantity for the instrument.

public readonly int MinLotSize

Field Value

int

MinLotSizeBlock

The minimum quantity required for a block trade of the instrument.

public readonly int MinLotSizeBlock

Field Value

int

MinLotSizeRoundLot

The minimum quantity required for a round lot. Multiples of this quantity are round lots too.

public readonly int MinLotSizeRoundLot

Field Value

int

MinPriceIncrement

The minimum constant tick for the instrument, where every 1 unit corresponds to 1e-9.

public readonly long MinPriceIncrement

Field Value

long

MinPriceIncrementAmount

The minimum price increment amount disseminated by the venue, where every 1 unit corresponds to 1e-9.

public readonly long MinPriceIncrementAmount

Field Value

long

MinTradeVol

The minimum trading volume for the instrument.

public readonly uint MinTradeVol

Field Value

uint

OriginalContractSize

The fixed contract value assigned to each instrument.

public readonly int OriginalContractSize

Field Value

int

PriceDisplayFormat

The number of digits to the right of the tick mark, for displaying fractional prices.

public readonly byte PriceDisplayFormat

Field Value

byte

PriceRatio

The value used for price calculation in spread and leg pricing, where every 1 unit corresponds to 1e-9.

public readonly long PriceRatio

Field Value

long

RawInstrumentClass

The raw wire byte behind InstrumentClass: the classification of the instrument. Not validated on decode — pass it to TryFromInstrumentClass(byte, out InstrumentClass) for a checked conversion.

public readonly byte RawInstrumentClass

Field Value

byte

RawInstrumentId

The instrument ID assigned by the publisher, which may be the same as InstrumentId.

public readonly ulong RawInstrumentId

Field Value

ulong

RawLegInstrumentClass

The raw wire byte behind LegInstrumentClass: the classification of the leg instrument. New in DBN v3. Not validated on decode — pass it to TryFromInstrumentClass(byte, out InstrumentClass) for a checked conversion.

public readonly byte RawLegInstrumentClass

Field Value

byte

RawLegSide

The raw wire byte behind LegSide: the side taken for the leg when purchasing the spread. New in DBN v3. Not validated on decode — pass it to TryFromSide(byte, out Side) for a checked conversion.

public readonly byte RawLegSide

Field Value

byte

RawMatchAlgorithm

The raw wire byte behind MatchAlgorithm: the matching algorithm used for the instrument, typically FIFO. Not validated on decode — pass it to TryFromMatchAlgorithm(byte, out MatchAlgorithm) for a checked conversion.

public readonly byte RawMatchAlgorithm

Field Value

byte

RawSecurityUpdateAction

The raw wire byte behind SecurityUpdateAction: whether the instrument definition was added, modified, or deleted. Not validated on decode — pass it to TryFromSecurityUpdateAction(byte, out SecurityUpdateAction) for a checked conversion.

public readonly byte RawSecurityUpdateAction

Field Value

byte

RawSymbol

The instrument raw symbol assigned by the publisher.

public readonly CStr71 RawSymbol

Field Value

CStr71

RawUserDefinedInstrument

The raw wire byte behind UserDefinedInstrument: whether the instrument is user defined. Not validated on decode — pass it to TryFromUserDefinedInstrument(byte, out UserDefinedInstrument) for a checked conversion.

public readonly byte RawUserDefinedInstrument

Field Value

byte

SecSubType

The strategy type of the spread.

public readonly CStr6 SecSubType

Field Value

CStr6

SecurityType

The security type of the instrument, e.g. FUT for a future or future spread.

public readonly CStr7 SecurityType

Field Value

CStr7

SettlCurrency

The currency used for settlement, if different from Currency.

public readonly CStr4 SettlCurrency

Field Value

CStr4

StrikePrice

The strike price of the option, where every 1 unit corresponds to 1e-9.

public readonly long StrikePrice

Field Value

long

StrikePriceCurrency

The currency of StrikePrice.

public readonly CStr4 StrikePriceCurrency

Field Value

CStr4

SubFraction

The price denominator of the sub fraction.

public readonly byte SubFraction

Field Value

byte

TickRule

The tick rule of the spread.

public readonly byte TickRule

Field Value

byte

TsRecv

The capture-server-received timestamp, in nanoseconds since the UNIX epoch. This, not TsEvent, is the record's index timestamp.

public readonly ulong TsRecv

Field Value

ulong

Underlying

The symbol of the first underlying instrument.

public readonly CStr21 Underlying

Field Value

CStr21

UnderlyingId

The instrument ID of the first underlying instrument.

public readonly uint UnderlyingId

Field Value

uint

UnderlyingProduct

The product complex of the instrument.

public readonly byte UnderlyingProduct

Field Value

byte

UnitOfMeasure

The unit of measure for the instrument's original contract size, e.g. USD or LBS.

public readonly CStr31 UnitOfMeasure

Field Value

CStr31

UnitOfMeasureQty

The contract size for each instrument, paired with UnitOfMeasure, where every 1 unit corresponds to 1e-9.

public readonly long UnitOfMeasureQty

Field Value

long

Properties

IndexTs

The record's index timestamp: the one to sort by, and the one to key a symbol map with. Nanoseconds since the UNIX epoch.

public ulong IndexTs { get; }

Property Value

ulong

Remarks

This is usually ts_recv, not TsEvent. Fourteen of the twenty-one record structs carry a ts_recv and index on it; the rest have no ts_recv at all and fall back to the header's ts_event. Port of upstream's Record::raw_index_ts (record/traits.rs:52-54), whose default body is ts_event and which the #[dbn(index_ts)] field attribute overrides per struct (record.rs, compat.rs).

The distinction is not cosmetic: ts_event and ts_recv can fall on opposite sides of UTC midnight, so resolving a symbol by the wrong one silently returns the previous day's symbol, or nothing, with no error anywhere.

This is a raw timestamp and can be UndefTimestamp. Convert it with ToUtcDate(ulong) or TryToUtcDate(ulong, out LocalDate), which check the sentinel.

InstrumentClass

The classification of the instrument. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawInstrumentClass.

public InstrumentClass InstrumentClass { get; }

Property Value

InstrumentClass

InstrumentClassChar

The classification of the instrument, as its raw ASCII character.

public char InstrumentClassChar { get; }

Property Value

char

LegInstrumentClass

The classification of the leg instrument. New in DBN v3. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawLegInstrumentClass.

public InstrumentClass LegInstrumentClass { get; }

Property Value

InstrumentClass

LegInstrumentClassChar

The classification of the leg instrument, as its raw ASCII character. New in DBN v3.

public char LegInstrumentClassChar { get; }

Property Value

char

LegSide

The side taken for the leg when purchasing the spread. New in DBN v3. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawLegSide.

public Side LegSide { get; }

Property Value

Side

LegSideChar

The side taken for the leg when purchasing the spread, as its raw ASCII character. New in DBN v3.

public char LegSideChar { get; }

Property Value

char

MatchAlgorithm

The matching algorithm used for the instrument, typically FIFO. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawMatchAlgorithm.

public MatchAlgorithm MatchAlgorithm { get; }

Property Value

MatchAlgorithm

MatchAlgorithmChar

The matching algorithm used for the instrument, typically FIFO, as its raw ASCII character.

public char MatchAlgorithmChar { get; }

Property Value

char

SecurityUpdateAction

Whether the instrument definition was added, modified, or deleted. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawSecurityUpdateAction.

public SecurityUpdateAction SecurityUpdateAction { get; }

Property Value

SecurityUpdateAction

SecurityUpdateActionChar

Whether the instrument definition was added, modified, or deleted, as its raw ASCII character.

public char SecurityUpdateActionChar { get; }

Property Value

char

UserDefinedInstrument

Whether the instrument is user defined. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawUserDefinedInstrument.

public UserDefinedInstrument UserDefinedInstrument { get; }

Property Value

UserDefinedInstrument

UserDefinedInstrumentChar

Whether the instrument is user defined, as its raw ASCII character.

public char UserDefinedInstrumentChar { get; }

Property Value

char

WireSize

The struct's exact size on the wire, in bytes, excluding any trailing ts_out.

public static int WireSize { get; }

Property Value

int

Methods

HasRType(RType)

Reports whether InstrumentDefMsg is the layout for records carrying rtype.

public static bool HasRType(RType rtype)

Parameters

rtype RType

The record type read from a record header.

Returns

bool

true if rtype is one of the record types this struct decodes. This is necessary but not sufficient to identify the record — see the remarks on IRecord<TSelf>.