Struct ImbalanceMsg
- Namespace
- DatabentoDotNet.Dbn
- Assembly
- DatabentoDotNet.Dbn.dll
An auction imbalance. The record of the Imbalance schema.
public readonly struct ImbalanceMsg : IRecord<ImbalanceMsg>
- Implements
- Inherited Members
Examples
if (record.TryGet(out ImbalanceMsg imbalance))
{
// Most price fields here are optional, and an absent one is UndefPrice rather than zero.
// Scaling the sentinel produces a confidently wrong number, so the check comes first.
string reference = imbalance.RefPrice == DbnConstants.UndefPrice
? "(none)"
: ((decimal)imbalance.RefPrice / DbnConstants.FixedPriceScale).ToString();
Console.WriteLine(
$"{DbnTime.ToInstant(imbalance.IndexTs)} ref {reference} "
+ $"paired {imbalance.PairedQty} imbalance {imbalance.TotalImbalanceQty} {imbalance.SideChar}");
// The auction time is a timestamp of its own, and it too can be absent — which is why the
// crossing is TryToInstant here and ToInstant above.
if (DbnTime.TryToInstant(imbalance.AuctionTime, out Instant auction))
{
Console.WriteLine($"auction at {auction}");
}
}
Remarks
Byte-identical in every DBN version, so there is no version-specific variant of it. Field
order is transcribed from the #[repr(C)] Rust declaration, not from its
encode_order attributes.
Fields
AuctInterestClrPrice
The hypothetical auction-clearing price for cross orders only, where every 1 unit corresponds to 1e-9. UndefPrice when unused.
public readonly long AuctInterestClrPrice
Field Value
AuctionStatus
A venue-specific status code.
public readonly byte AuctionStatus
Field Value
AuctionTime
The projected auction timestamp, in nanoseconds since the UNIX epoch. UndefTimestamp when unused.
public readonly ulong AuctionTime
Field Value
ContBookClrPrice
The hypothetical auction-clearing price for both cross and continuous orders, where every 1 unit corresponds to 1e-9. UndefPrice when unused.
public readonly long ContBookClrPrice
Field Value
FreezeStatus
A venue-specific status code.
public readonly byte FreezeStatus
Field Value
Header
The common header.
public readonly RecordHeader Header
Field Value
IndMatchPrice
The price at which the highest number of shares would trade, subject to auction collars, where every 1 unit corresponds to 1e-9. UndefPrice when unused.
public readonly long IndMatchPrice
Field Value
LowerCollar
The lower limit of the auction collar, where every 1 unit corresponds to 1e-9. UndefPrice when unused.
public readonly long LowerCollar
Field Value
MarketImbalanceQty
The total market-order imbalance quantity at RefPrice. UndefOrderSize when unused.
public readonly uint MarketImbalanceQty
Field Value
NumExtensions
The number of times the halt period has been extended.
public readonly byte NumExtensions
Field Value
PairedQty
The quantity of shares eligible to be matched at RefPrice. UndefOrderSize when unused.
public readonly uint PairedQty
Field Value
RawAuctionType
The raw wire byte behind AuctionTypeChar: a venue-specific auction type
code, '~' when unused. This one has no enum in the DBN spec — refer to the
venue-specific documentation.
public readonly byte RawAuctionType
Field Value
RawSide
The raw wire byte behind Side. Not validated on decode — pass it to TryFromSide(byte, out Side) for a checked conversion.
public readonly byte RawSide
Field Value
RawSignificantImbalance
The raw wire byte behind SignificantImbalanceChar: a venue-specific code. For Nasdaq this is the raw Price Variation Indicator. No enum in the DBN spec.
public readonly byte RawSignificantImbalance
Field Value
RawUnpairedSide
The raw wire byte behind UnpairedSide. Not validated on decode — pass it to TryFromSide(byte, out Side) for a checked conversion.
public readonly byte RawUnpairedSide
Field Value
RefPrice
The price the imbalance shares are calculated at, where every 1 unit corresponds to 1e-9. UndefPrice when unused.
public readonly long RefPrice
Field Value
SsrFillingPrice
The price sell-short interest will be filled at while a short-sell restriction is in effect, where every 1 unit corresponds to 1e-9. UndefPrice when unused.
public readonly long SsrFillingPrice
Field Value
TotalImbalanceQty
The quantity of shares not paired at RefPrice. UndefOrderSize when unused.
public readonly uint TotalImbalanceQty
Field Value
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
UnpairedQty
During the closing auction, the number of unpaired shares priced at or better than RefPrice. UndefOrderSize when unused.
public readonly uint UnpairedQty
Field Value
UpperCollar
The upper limit of the auction collar, where every 1 unit corresponds to 1e-9. UndefPrice when unused.
public readonly long UpperCollar
Field Value
Properties
AuctionTypeChar
The venue-specific auction type as its raw ASCII character.
public char AuctionTypeChar { get; }
Property Value
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
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.
Side
The market side of TotalImbalanceQty. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawSide.
public Side Side { get; }
Property Value
SideChar
The market side of TotalImbalanceQty, as its raw ASCII character.
public char SideChar { get; }
Property Value
SignificantImbalanceChar
The venue-specific significant-imbalance code as its raw ASCII character.
public char SignificantImbalanceChar { get; }
Property Value
UnpairedSide
The side of UnpairedQty. Undefined wire bytes cast through to an unnamed value rather than throwing; see RawUnpairedSide.
public Side UnpairedSide { get; }
Property Value
UnpairedSideChar
The side of UnpairedQty, as its raw ASCII character.
public char UnpairedSideChar { get; }
Property Value
WireSize
The struct's exact size on the wire, in bytes, excluding any trailing ts_out.
public static int WireSize { get; }
Property Value
Methods
HasRType(RType)
Reports whether ImbalanceMsg is the layout for records carrying
rtype.
public static bool HasRType(RType rtype)
Parameters
rtypeRTypeThe record type read from a record header.
Returns
- bool
true if
rtypeis one of the record types this struct decodes. This is necessary but not sufficient to identify the record — see the remarks on IRecord<TSelf>.