@@ -40,8 +40,8 @@ def get_deriv_ba_types(level: int) -> list[tuple[str, type | str]]:
4040 (f"ask_px_{ level :02d} " , np .int64 ),
4141 (f"bid_sz_{ level :02d} " , np .uint32 ),
4242 (f"ask_sz_{ level :02d} " , np .uint32 ),
43- (f"bid_oq_ { level :02d} " , np .uint32 ),
44- (f"ask_oq_ { level :02d} " , np .uint32 ),
43+ (f"bid_ct_ { level :02d} " , np .uint32 ),
44+ (f"ask_ct_ { level :02d} " , np .uint32 ),
4545 ]
4646
4747
@@ -274,28 +274,30 @@ def get_deriv_ba_fields(level: int) -> list[str]:
274274 f"ask_px_{ level :02d} " ,
275275 f"bid_sz_{ level :02d} " ,
276276 f"ask_sz_{ level :02d} " ,
277- f"bid_oq_ { level :02d} " ,
278- f"ask_oq_ { level :02d} " ,
277+ f"bid_ct_ { level :02d} " ,
278+ f"ask_ct_ { level :02d} " ,
279279 ]
280280
281281
282- DERIV_HEADER_COLUMNS = [
282+ MBP_COLUMNS = [
283283 "ts_recv" ,
284284 "ts_event" ,
285- "ts_in_delta " ,
285+ "rtype " ,
286286 "publisher_id" ,
287287 "instrument_id" ,
288288 "action" ,
289289 "side" ,
290290 "depth" ,
291- "flags" ,
292291 "price" ,
293292 "size" ,
293+ "flags" ,
294+ "ts_in_delta" ,
294295 "sequence" ,
295296]
296297
297- OHLCV_HEADER_COLUMNS = [
298+ OHLCV_COLUMNS = [
298299 "ts_event" ,
300+ "rtype" ,
299301 "publisher_id" ,
300302 "instrument_id" ,
301303 "open" ,
@@ -305,62 +307,136 @@ def get_deriv_ba_fields(level: int) -> list[str]:
305307 "volume" ,
306308]
307309
308- DEFINITION_DROP_COLUMNS = [
309- "length" ,
310- "rtype" ,
311- "_reserved1" ,
312- "_reserved2" ,
313- "_reserved3" ,
314- "_reserved4" ,
315- "dummy" ,
316- ]
317-
318- IMBALANCE_DROP_COLUMNS = [
319- "length" ,
310+ DEFINITION_COLUMNS = [
311+ "ts_recv" ,
312+ "ts_event" ,
320313 "rtype" ,
321- "dummy" ,
314+ "publisher_id" ,
315+ "instrument_id" ,
316+ "raw_symbol" ,
317+ "security_update_action" ,
318+ "instrument_class" ,
319+ "min_price_increment" ,
320+ "display_factor" ,
321+ "expiration" ,
322+ "activation" ,
323+ "high_limit_price" ,
324+ "low_limit_price" ,
325+ "max_price_variation" ,
326+ "trading_reference_price" ,
327+ "unit_of_measure_qty" ,
328+ "min_price_increment_amount" ,
329+ "price_ratio" ,
330+ "inst_attrib_value" ,
331+ "underlying_id" ,
332+ "market_depth_implied" ,
333+ "market_depth" ,
334+ "market_segment_id" ,
335+ "max_trade_vol" ,
336+ "min_lot_size" ,
337+ "min_lot_size_block" ,
338+ "min_lot_size_round_lot" ,
339+ "min_trade_vol" ,
340+ "contract_multiplier" ,
341+ "decay_quantity" ,
342+ "original_contract_size" ,
343+ "trading_reference_date" ,
344+ "appl_id" ,
345+ "maturity_year" ,
346+ "decay_start_date" ,
347+ "channel_id" ,
348+ "currency" ,
349+ "settl_currency" ,
350+ "secsubtype" ,
351+ "group" ,
352+ "exchange" ,
353+ "asset" ,
354+ "cfi" ,
355+ "security_type" ,
356+ "unit_of_measure" ,
357+ "underlying" ,
358+ "strike_price_currency" ,
359+ "strike_price" ,
360+ "match_algorithm" ,
361+ "md_security_trading_status" ,
362+ "main_fraction" ,
363+ "price_display_format" ,
364+ "settl_price_type" ,
365+ "sub_fraction" ,
366+ "underlying_product" ,
367+ "maturity_month" ,
368+ "maturity_day" ,
369+ "maturity_week" ,
370+ "user_defined_instrument" ,
371+ "contract_multiplier_unit" ,
372+ "flow_schedule_type" ,
373+ "tick_rule" ,
322374]
323375
324- STATISTICS_DROP_COLUMNS = [
325- "length" ,
376+ STATISTICS_COLUMNS = [
377+ "ts_recv" ,
378+ "ts_event" ,
326379 "rtype" ,
327- "dummy" ,
328- ]
329-
330- DEFINITION_COLUMNS = [
331- x
332- for x in (np .dtype (DEFINITION_MSG ).names or ())
333- if x not in DEFINITION_DROP_COLUMNS
380+ "publisher_id" ,
381+ "instrument_id" ,
382+ "ts_ref" ,
383+ "price" ,
384+ "quantity" ,
385+ "sequence" ,
386+ "ts_in_delta" ,
387+ "stat_type" ,
388+ "channel_id" ,
389+ "update_action" ,
390+ "stat_flags" ,
334391]
335392
336393IMBALANCE_COLUMNS = [
337- x for x in (np .dtype (IMBALANCE_MSG ).names or ()) if x not in IMBALANCE_DROP_COLUMNS
394+ "ts_recv" ,
395+ "ts_event" ,
396+ "rtype" ,
397+ "publisher_id" ,
398+ "instrument_id" ,
399+ "ref_price" ,
400+ "auction_time" ,
401+ "cont_book_clr_price" ,
402+ "auct_interest_clr_price" ,
403+ "ssr_filling_price" ,
404+ "ind_match_price" ,
405+ "upper_collar" ,
406+ "lower_collar" ,
407+ "paired_qty" ,"total_imbalance_qty" ,
408+ "market_imbalance_qty" ,
409+ "unpaired_qty" ,
410+ "auction_type" ,
411+ "side" ,
412+ "auction_status" ,
413+ "freeze_status" ,
414+ "num_extensions" ,
415+ "unpaired_side" ,
416+ "significant_imbalance" ,
338417]
339418
340- STATISTICS_COLUMNS = [
341- x
342- for x in (np .dtype (STATISTICS_MSG ).names or ())
343- if x not in STATISTICS_DROP_COLUMNS
419+ MBO_COLUMNS = [
420+ "ts_recv" ,
421+ "ts_event" ,
422+ "rtype" ,
423+ "publisher_id" ,
424+ "instrument_id" ,
425+ "action" ,
426+ "side" ,
427+ "price" ,
428+ "size" ,
429+ "channel_id" ,
430+ "order_id" ,
431+ "flags" ,
432+ "ts_in_delta" ,
433+ "sequence" ,
344434]
345435
346436COLUMNS = {
347- Schema .MBO : [
348- "ts_recv" ,
349- "ts_event" ,
350- "ts_in_delta" ,
351- "publisher_id" ,
352- "channel_id" ,
353- "instrument_id" ,
354- "order_id" ,
355- "action" ,
356- "side" ,
357- "flags" ,
358- "price" ,
359- "size" ,
360- "sequence" ,
361- ],
362- Schema .MBP_1 : DERIV_HEADER_COLUMNS + get_deriv_ba_fields (0 ),
363- Schema .MBP_10 : DERIV_HEADER_COLUMNS
437+ Schema .MBO : MBO_COLUMNS ,
438+ Schema .MBP_1 : MBP_COLUMNS + get_deriv_ba_fields (0 ),
439+ Schema .MBP_10 : MBP_COLUMNS
364440 + get_deriv_ba_fields (0 )
365441 + get_deriv_ba_fields (1 )
366442 + get_deriv_ba_fields (2 )
@@ -371,12 +447,12 @@ def get_deriv_ba_fields(level: int) -> list[str]:
371447 + get_deriv_ba_fields (7 )
372448 + get_deriv_ba_fields (8 )
373449 + get_deriv_ba_fields (9 ),
374- Schema .TBBO : DERIV_HEADER_COLUMNS + get_deriv_ba_fields (0 ),
375- Schema .TRADES : DERIV_HEADER_COLUMNS ,
376- Schema .OHLCV_1S : OHLCV_HEADER_COLUMNS ,
377- Schema .OHLCV_1M : OHLCV_HEADER_COLUMNS ,
378- Schema .OHLCV_1H : OHLCV_HEADER_COLUMNS ,
379- Schema .OHLCV_1D : OHLCV_HEADER_COLUMNS ,
450+ Schema .TBBO : MBP_COLUMNS + get_deriv_ba_fields (0 ),
451+ Schema .TRADES : MBP_COLUMNS ,
452+ Schema .OHLCV_1S : OHLCV_COLUMNS ,
453+ Schema .OHLCV_1M : OHLCV_COLUMNS ,
454+ Schema .OHLCV_1H : OHLCV_COLUMNS ,
455+ Schema .OHLCV_1D : OHLCV_COLUMNS ,
380456 Schema .DEFINITION : DEFINITION_COLUMNS ,
381457 Schema .IMBALANCE : IMBALANCE_COLUMNS ,
382458 Schema .STATISTICS : STATISTICS_COLUMNS ,
0 commit comments