1717#include " databento/publishers.hpp" // Publisher
1818
1919namespace databento {
20- // Forward declare
21- namespace v3 {
22- struct InstrumentDefMsg ;
23- struct StatMsg ;
24- } // namespace v3
25-
2620// Common data for all Databento Records.
2721struct RecordHeader {
2822 static constexpr std::size_t kLengthMultiplier =
@@ -379,7 +373,6 @@ static_assert(alignof(StatusMsg) == 8, "Must have 8-byte alignment");
379373struct InstrumentDefMsg {
380374 static bool HasRType (RType rtype) { return rtype == RType::InstrumentDef; }
381375
382- v3::InstrumentDefMsg ToV3 () const ;
383376 UnixNanos IndexTs () const { return ts_recv; }
384377 const char * Currency () const { return currency.data (); }
385378 const char * SettlCurrency () const { return settl_currency.data (); }
@@ -395,6 +388,7 @@ struct InstrumentDefMsg {
395388 const char * StrikePriceCurrency () const {
396389 return strike_price_currency.data ();
397390 }
391+ const char * LegRawSymbol () const { return leg_raw_symbol.data (); }
398392
399393 RecordHeader hd;
400394 UnixNanos ts_recv;
@@ -405,14 +399,15 @@ struct InstrumentDefMsg {
405399 std::int64_t high_limit_price;
406400 std::int64_t low_limit_price;
407401 std::int64_t max_price_variation;
408- std::int64_t trading_reference_price;
409402 std::int64_t unit_of_measure_qty;
410403 std::int64_t min_price_increment_amount;
411404 std::int64_t price_ratio;
412405 std::int64_t strike_price;
406+ std::uint64_t raw_instrument_id;
407+ std::int64_t leg_price;
408+ std::int64_t leg_delta;
413409 std::int32_t inst_attrib_value;
414410 std::uint32_t underlying_id;
415- std::uint32_t raw_instrument_id;
416411 std::int32_t market_depth_implied;
417412 std::int32_t market_depth;
418413 std::uint32_t market_segment_id;
@@ -424,11 +419,18 @@ struct InstrumentDefMsg {
424419 std::int32_t contract_multiplier;
425420 std::int32_t decay_quantity;
426421 std::int32_t original_contract_size;
427- std::uint16_t trading_reference_date;
422+ std::uint32_t leg_instrument_id;
423+ std::int32_t leg_ratio_price_numerator;
424+ std::int32_t leg_ratio_price_denominator;
425+ std::int32_t leg_ratio_qty_numerator;
426+ std::int32_t leg_ratio_qty_denominator;
427+ std::uint32_t leg_underlying_id;
428428 std::int16_t appl_id;
429429 std::uint16_t maturity_year;
430430 std::uint16_t decay_start_date;
431431 std::uint16_t channel_id;
432+ std::uint16_t leg_count;
433+ std::uint16_t leg_index;
432434 std::array<char , 4 > currency;
433435 std::array<char , 4 > settl_currency;
434436 std::array<char , 6 > secsubtype;
@@ -441,12 +443,11 @@ struct InstrumentDefMsg {
441443 std::array<char , 31 > unit_of_measure;
442444 std::array<char , 21 > underlying;
443445 std::array<char , 4 > strike_price_currency;
446+ std::array<char , kSymbolCstrLen > leg_raw_symbol;
444447 InstrumentClass instrument_class;
445448 MatchAlgorithm match_algorithm;
446- std::uint8_t md_security_trading_status;
447449 std::uint8_t main_fraction;
448450 std::uint8_t price_display_format;
449- std::uint8_t settl_price_type;
450451 std::uint8_t sub_fraction;
451452 std::uint8_t underlying_product;
452453 SecurityUpdateAction security_update_action;
@@ -457,9 +458,12 @@ struct InstrumentDefMsg {
457458 std::int8_t contract_multiplier_unit;
458459 std::int8_t flow_schedule_type;
459460 std::uint8_t tick_rule;
460- std::array<char , 10 > reserved;
461+ InstrumentClass leg_instrument_class;
462+ Side leg_side;
463+ // padding for alignment
464+ std::array<char , 17 > reserved;
461465};
462- static_assert (sizeof (InstrumentDefMsg) == 400 ,
466+ static_assert (sizeof (InstrumentDefMsg) == 520 ,
463467 " InstrumentDefMsg size must match Rust" );
464468static_assert (alignof (InstrumentDefMsg) == 8 , " Must have 8-byte alignment" );
465469
@@ -502,23 +506,22 @@ static_assert(alignof(ImbalanceMsg) == 8, "Must have 8-byte alignment");
502506struct StatMsg {
503507 static bool HasRType (RType rtype) { return rtype == RType::Statistics; }
504508
505- v3::StatMsg ToV3 () const ;
506509 UnixNanos IndexTs () const { return ts_recv; }
507510
508511 RecordHeader hd;
509512 UnixNanos ts_recv;
510513 UnixNanos ts_ref;
511514 std::int64_t price;
512- std::int32_t quantity;
515+ std::int64_t quantity;
513516 std::uint32_t sequence;
514517 TimeDeltaNanos ts_in_delta;
515518 StatType stat_type;
516519 std::uint16_t channel_id;
517520 StatUpdateAction update_action;
518521 std::uint8_t stat_flags;
519- std::array<char , 6 > reserved;
522+ std::array<char , 18 > reserved;
520523};
521- static_assert (sizeof (StatMsg) == 64 , " StatMsg size must match Rust" );
524+ static_assert (sizeof (StatMsg) == 80 , " StatMsg size must match Rust" );
522525static_assert (alignof (StatMsg) == 8 , " Must have 8-byte alignment" );
523526
524527// An error message from the Live Subscription Gateway (LSG). This will never
@@ -798,4 +801,6 @@ std::ostream& operator<<(std::ostream& stream,
798801
799802// The length in bytes of the largest record type.
800803static constexpr std::size_t kMaxRecordLen = 520 + 8 ;
804+ static_assert (kMaxRecordLen == sizeof (InstrumentDefMsg) + sizeof (UnixNanos),
805+ " v3 definition with ts_out should be the largest record" );
801806} // namespace databento
0 commit comments