@@ -27,6 +27,9 @@ std::size_t Record::SizeOfType(const std::uint8_t rtype) {
2727 case OhlcvMsg::kTypeId : {
2828 return sizeof (OhlcvMsg);
2929 }
30+ case InstrumentDefMsg::kTypeId : {
31+ return sizeof (InstrumentDefMsg);
32+ }
3033 default : {
3134 throw InvalidArgumentError{
3235 " Record::SizeOfType" , " rtype" ,
@@ -58,6 +61,9 @@ std::uint8_t Record::TypeIdFromSchema(const Schema schema) {
5861 case Schema::Ohlcv1S: {
5962 return OhlcvMsg::kTypeId ;
6063 }
64+ case Schema::Definition: {
65+ return InstrumentDefMsg::kTypeId ;
66+ }
6167 default : {
6268 throw InvalidArgumentError{
6369 " Record::TypeIdFromSchema" , " schema" ,
@@ -67,6 +73,65 @@ std::uint8_t Record::TypeIdFromSchema(const Schema schema) {
6773 }
6874}
6975
76+ using databento::InstrumentDefMsg;
77+
78+ bool databento::operator ==(const InstrumentDefMsg& lhs,
79+ const InstrumentDefMsg& rhs) {
80+ return lhs.hd == rhs.hd && lhs.ts_recv == rhs.ts_recv &&
81+ lhs.min_price_increment == rhs.min_price_increment &&
82+ lhs.display_factor == rhs.display_factor &&
83+ lhs.expiration == rhs.expiration && lhs.activation == rhs.activation &&
84+ lhs.high_limit_price == rhs.high_limit_price &&
85+ lhs.low_limit_price == rhs.low_limit_price &&
86+ lhs.max_price_variation == rhs.max_price_variation &&
87+ lhs.trading_reference_price == rhs.trading_reference_price &&
88+ lhs.unit_of_measure_qty == rhs.unit_of_measure_qty &&
89+ lhs.min_price_increment_amount == rhs.min_price_increment_amount &&
90+ lhs.price_ratio == rhs.price_ratio &&
91+ lhs.inst_attrib_value == rhs.inst_attrib_value &&
92+ lhs.underlying_id == rhs.underlying_id &&
93+ lhs.cleared_volume == rhs.cleared_volume &&
94+ lhs.market_depth_implied == rhs.market_depth_implied &&
95+ lhs.market_depth == rhs.market_depth &&
96+ lhs.market_segment_id == rhs.market_segment_id &&
97+ lhs.max_trade_vol == rhs.max_trade_vol &&
98+ lhs.min_lot_size == rhs.min_lot_size &&
99+ lhs.min_lot_size_block == rhs.min_lot_size_block &&
100+ lhs.min_lot_size_round_lot == rhs.min_lot_size_round_lot &&
101+ lhs.min_trade_vol == rhs.min_trade_vol &&
102+ lhs.open_interest_qty == rhs.open_interest_qty &&
103+ lhs.contract_multiplier == rhs.contract_multiplier &&
104+ lhs.decay_quantity == rhs.decay_quantity &&
105+ lhs.original_contract_size == rhs.original_contract_size &&
106+ lhs.related_security_id == rhs.related_security_id &&
107+ lhs.trading_reference_date == rhs.trading_reference_date &&
108+ lhs.appl_id == rhs.appl_id && lhs.maturity_year == rhs.maturity_year &&
109+ lhs.decay_start_date == rhs.decay_start_date &&
110+ lhs.channel_id == rhs.channel_id && lhs.currency == rhs.currency &&
111+ lhs.settl_currency == rhs.settl_currency &&
112+ lhs.secsubtype == rhs.secsubtype && lhs.symbol == rhs.symbol &&
113+ lhs.group == rhs.group && lhs.exchange == rhs.exchange &&
114+ lhs.asset == rhs.asset && lhs.cfi == rhs.cfi &&
115+ lhs.security_type == rhs.security_type &&
116+ lhs.unit_of_measure == rhs.unit_of_measure &&
117+ lhs.underlying == rhs.underlying && lhs.related == rhs.related &&
118+ lhs.match_algorithm == rhs.match_algorithm &&
119+ lhs.md_security_trading_status == rhs.md_security_trading_status &&
120+ lhs.main_fraction == rhs.main_fraction &&
121+ lhs.price_display_format == rhs.price_display_format &&
122+ lhs.settl_price_type == rhs.settl_price_type &&
123+ lhs.sub_fraction == rhs.sub_fraction &&
124+ lhs.underlying_product == rhs.underlying_product &&
125+ lhs.security_update_action == rhs.security_update_action &&
126+ lhs.maturity_month == rhs.maturity_month &&
127+ lhs.maturity_day == rhs.maturity_day &&
128+ lhs.maturity_week == rhs.maturity_week &&
129+ lhs.user_defined_instrument == rhs.user_defined_instrument &&
130+ lhs.contract_multiplier_unit == rhs.contract_multiplier_unit &&
131+ lhs.flow_schedule_type == rhs.flow_schedule_type &&
132+ lhs.tick_rule == rhs.tick_rule ;
133+ }
134+
70135namespace databento {
71136namespace detail {
72137template <>
@@ -206,4 +271,81 @@ std::ostream& operator<<(std::ostream& stream, const OhlcvMsg& ohlcv_msg) {
206271 .AddField (" volume" , ohlcv_msg.volume )
207272 .Finish ();
208273}
274+ std::string ToString (const InstrumentDefMsg& instr_def_msg) {
275+ return MakeString (instr_def_msg);
276+ }
277+ std::ostream& operator <<(std::ostream& stream,
278+ const InstrumentDefMsg& instr_def_msg) {
279+ return StreamOpBuilder{stream}
280+ .SetSpacer (" \n " )
281+ .SetTypeName (" InstrumentDefMsg" )
282+ .Build ()
283+ .AddField (" hd" , instr_def_msg.hd )
284+ .AddField (" ts_recv" , instr_def_msg.ts_recv )
285+ .AddField (" min_price_increment" , instr_def_msg.min_price_increment )
286+ .AddField (" display_factor" , instr_def_msg.display_factor )
287+ .AddField (" expiration" , instr_def_msg.expiration )
288+ .AddField (" activation" , instr_def_msg.activation )
289+ .AddField (" high_limit_price" , instr_def_msg.high_limit_price )
290+ .AddField (" low_limit_price" , instr_def_msg.low_limit_price )
291+ .AddField (" max_price_variation" , instr_def_msg.max_price_variation )
292+ .AddField (" trading_reference_price" ,
293+ instr_def_msg.trading_reference_price )
294+ .AddField (" unit_of_measure_qty" , instr_def_msg.unit_of_measure_qty )
295+ .AddField (" min_price_increment_amount" ,
296+ instr_def_msg.min_price_increment_amount )
297+ .AddField (" price_ratio" , instr_def_msg.price_ratio )
298+ .AddField (" inst_attrib_value" , instr_def_msg.inst_attrib_value )
299+ .AddField (" underlying_id" , instr_def_msg.underlying_id )
300+ .AddField (" cleared_volume" , instr_def_msg.cleared_volume )
301+ .AddField (" market_depth_implied" , instr_def_msg.market_depth_implied )
302+ .AddField (" market_depth" , instr_def_msg.market_depth )
303+ .AddField (" market_segment_id" , instr_def_msg.market_segment_id )
304+ .AddField (" max_trade_vol" , instr_def_msg.max_trade_vol )
305+ .AddField (" min_lot_size" , instr_def_msg.min_lot_size )
306+ .AddField (" min_lot_size_block" , instr_def_msg.min_lot_size_block )
307+ .AddField (" min_lot_size_round_lot" , instr_def_msg.min_lot_size_round_lot )
308+ .AddField (" min_trade_vol" , instr_def_msg.min_trade_vol )
309+ .AddField (" open_interest_qty" , instr_def_msg.open_interest_qty )
310+ .AddField (" contract_multiplier" , instr_def_msg.contract_multiplier )
311+ .AddField (" decay_quantity" , instr_def_msg.decay_quantity )
312+ .AddField (" original_contract_size" , instr_def_msg.original_contract_size )
313+ .AddField (" related_security_id" , instr_def_msg.related_security_id )
314+ .AddField (" trading_reference_date" , instr_def_msg.trading_reference_date )
315+ .AddField (" appl_id" , instr_def_msg.appl_id )
316+ .AddField (" maturity_year" , instr_def_msg.maturity_year )
317+ .AddField (" decay_start_date" , instr_def_msg.decay_start_date )
318+ .AddField (" channel_id" , instr_def_msg.channel_id )
319+ .AddField (" currency" , instr_def_msg.currency )
320+ .AddField (" settl_currency" , instr_def_msg.settl_currency )
321+ .AddField (" secsubtype" , instr_def_msg.secsubtype )
322+ .AddField (" symbol" , instr_def_msg.symbol )
323+ .AddField (" group" , instr_def_msg.group )
324+ .AddField (" exchange" , instr_def_msg.exchange )
325+ .AddField (" asset" , instr_def_msg.asset )
326+ .AddField (" cfi" , instr_def_msg.cfi )
327+ .AddField (" security_type" , instr_def_msg.security_type )
328+ .AddField (" unit_of_measure" , instr_def_msg.unit_of_measure )
329+ .AddField (" underlying" , instr_def_msg.underlying )
330+ .AddField (" related" , instr_def_msg.related )
331+ .AddField (" match_algorithm" , instr_def_msg.match_algorithm )
332+ .AddField (" md_security_trading_status" ,
333+ instr_def_msg.md_security_trading_status )
334+ .AddField (" main_fraction" , instr_def_msg.main_fraction )
335+ .AddField (" price_display_format" , instr_def_msg.price_display_format )
336+ .AddField (" settl_price_type" , instr_def_msg.settl_price_type )
337+ .AddField (" sub_fraction" , instr_def_msg.sub_fraction )
338+ .AddField (" underlying_product" , instr_def_msg.underlying_product )
339+ .AddField (" security_update_action" , instr_def_msg.security_update_action )
340+ .AddField (" maturity_month" , instr_def_msg.maturity_month )
341+ .AddField (" maturity_day" , instr_def_msg.maturity_day )
342+ .AddField (" maturity_week" , instr_def_msg.maturity_week )
343+ .AddField (" user_defined_instrument" ,
344+ instr_def_msg.user_defined_instrument )
345+ .AddField (" contract_multiplier_unit" ,
346+ instr_def_msg.contract_multiplier_unit )
347+ .AddField (" flow_schedule_type" , instr_def_msg.flow_schedule_type )
348+ .AddField (" tick_rule" , instr_def_msg.tick_rule )
349+ .Finish ();
350+ }
209351} // namespace databento
0 commit comments