@@ -170,6 +170,20 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
170170 ("dummy" , "S1" ),
171171]
172172
173+ STATISTICS_MSG : List [Tuple [str , Union [type , str ]]] = RECORD_HEADER + [
174+ ("ts_recv" , np .uint64 ),
175+ ("ts_ref" , np .uint64 ),
176+ ("price" , np .int64 ),
177+ ("quantity" , np .int32 ),
178+ ("sequence" , np .uint32 ),
179+ ("ts_in_delta" , np .int32 ),
180+ ("stat_type" , np .uint16 ),
181+ ("channel_id" , np .uint16 ),
182+ ("update_action" , np .uint8 ),
183+ ("stat_flags" , np .uint8 ),
184+ ("dummy" , "S6" ),
185+ ]
186+
173187
174188STRUCT_MAP : Dict [Schema , List [Tuple [str , Union [type , str ]]]] = {
175189 Schema .MBO : MBO_MSG ,
@@ -193,6 +207,7 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
193207 Schema .OHLCV_1D : OHLCV_MSG ,
194208 Schema .DEFINITION : DEFINITION_MSG ,
195209 Schema .IMBALANCE : IMBALANCE_MSG ,
210+ Schema .STATISTICS : STATISTICS_MSG ,
196211}
197212
198213
@@ -288,6 +303,13 @@ def get_deriv_ba_fields(level: int) -> List[str]:
288303 "dummy" ,
289304]
290305
306+ STATISTICS_DROP_COLUMNS = [
307+ "ts_recv" ,
308+ "length" ,
309+ "rtype" ,
310+ "dummy" ,
311+ ]
312+
291313DEFINITION_COLUMNS = [
292314 x
293315 for x in (np .dtype (DEFINITION_MSG ).names or ())
@@ -298,6 +320,12 @@ def get_deriv_ba_fields(level: int) -> List[str]:
298320 x for x in (np .dtype (IMBALANCE_MSG ).names or ()) if x not in IMBALANCE_DROP_COLUMNS
299321]
300322
323+ STATISTICS_COLUMNS = [
324+ x
325+ for x in (np .dtype (STATISTICS_MSG ).names or ())
326+ if x not in STATISTICS_DROP_COLUMNS
327+ ]
328+
301329COLUMNS = {
302330 Schema .MBO : [
303331 "ts_event" ,
@@ -333,4 +361,5 @@ def get_deriv_ba_fields(level: int) -> List[str]:
333361 Schema .OHLCV_1D : OHLCV_HEADER_COLUMNS ,
334362 Schema .DEFINITION : DEFINITION_COLUMNS ,
335363 Schema .IMBALANCE : IMBALANCE_COLUMNS ,
364+ Schema .STATISTICS : STATISTICS_COLUMNS ,
336365}
0 commit comments