@@ -114,7 +114,7 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
114114 ("contract_multiplier" , np .int32 ),
115115 ("decay_quantity" , np .int32 ),
116116 ("original_contract_size" , np .int32 ),
117- ("related_security_id " , np . uint32 ),
117+ ("reserved1 " , "S4" ),
118118 ("trading_reference_date" , np .uint16 ),
119119 ("appl_id" , np .int16 ),
120120 ("maturity_year" , np .uint16 ),
@@ -131,7 +131,11 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
131131 ("security_type" , "S7" ), # 7 byte chararray
132132 ("unit_of_measure" , "S31" ), # 31 byte chararray
133133 ("underlying" , "S21" ), # 21 byte chararray
134- ("related" , "S21" ), # 21 byte chararray
134+ ("strike_price_currency" , "S4" ),
135+ ("instrument_class" , "S1" ),
136+ ("reserved2" , "S2" ),
137+ ("strike_price" , np .int64 ),
138+ ("reserved3" , "S6" ),
135139 ("match_algorithm" , "S1" ), # 1 byte chararray
136140 ("md_security_trading_status" , np .uint8 ),
137141 ("main_fraction" , np .uint8 ),
@@ -150,6 +154,30 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
150154 ("dummy" , "S3" ), # 3 byte chararray (Adjustment filler for 8-bytes alignment)
151155]
152156
157+ IMBALANCE_MSG : List [Tuple [str , Union [type , str ]]] = RECORD_HEADER + [
158+ ("ts_recv" , np .uint64 ),
159+ ("ref_price" , np .int64 ),
160+ ("auction_time" , np .uint64 ),
161+ ("cont_book_clr_price" , np .int64 ),
162+ ("auct_interest_clr_price" , np .int64 ),
163+ ("ssr_filling_price" , np .int64 ),
164+ ("ind_match_price" , np .int64 ),
165+ ("upper_collar" , np .int64 ),
166+ ("lower_collar" , np .int64 ),
167+ ("paired_qty" , np .uint32 ),
168+ ("total_imbalance_qty" , np .uint32 ),
169+ ("market_imbalance_qty" , np .uint32 ),
170+ ("unpaired_qty" , np .uint32 ),
171+ ("auction_type" , "S1" ),
172+ ("side" , "S1" ),
173+ ("auction_status" , np .uint8 ),
174+ ("freeze_status" , np .uint8 ),
175+ ("num_extensions" , np .uint8 ),
176+ ("unpaired_side" , "S1" ),
177+ ("significant_imbalance" , "S1" ),
178+ ("dummy" , "S1" ),
179+ ]
180+
153181
154182STRUCT_MAP : Dict [Schema , List [Tuple [str , Union [type , str ]]]] = {
155183 Schema .MBO : MBO_MSG ,
@@ -173,6 +201,7 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
173201 Schema .OHLCV_1D : OHLCV_MSG ,
174202 Schema .STATUS : STATUS_MSG ,
175203 Schema .DEFINITION : DEFINITION_MSG ,
204+ Schema .IMBALANCE : IMBALANCE_MSG ,
176205 Schema .GATEWAY_ERROR : RECORD_HEADER
177206 + [
178207 ("error" , "S64" ),
@@ -199,10 +228,10 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
199228 "security_type" ,
200229 "unit_of_measure" ,
201230 "underlying" ,
202- "related" ,
203231 "match_algorithm" ,
204232 "security_update_action" ,
205233 "user_defined_instrument" ,
234+ "strike_price_currency" ,
206235]
207236
208237DEFINITION_PRICE_COLUMNS = [
@@ -213,6 +242,7 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
213242 "max_price_variation" ,
214243 "trading_reference_price" ,
215244 "min_price_increment_amount" ,
245+ "strike_price" ,
216246]
217247
218248DEFINITION_TYPE_MAX_MAP = {
@@ -261,14 +291,37 @@ def get_deriv_ba_fields(level: int) -> List[str]:
261291 "volume" ,
262292]
263293
264- STATUS_COLUMNS = [x for x in np .dtype (STATUS_MSG ).names or ()]
265- STATUS_COLUMNS .remove ("ts_recv" ) # Index
294+ STATUS_DROP_COLUMNS = ["ts_recv" ]
295+ DEFINITION_DROP_COLUMNS = [
296+ "ts_recv" ,
297+ "length" ,
298+ "rtype" ,
299+ "reserved1" ,
300+ "reserved2" ,
301+ "reserved3" ,
302+ "dummy" ,
303+ ]
304+
305+ IMBALANCE_DROP_COLUMNS = [
306+ "ts_recv" ,
307+ "length" ,
308+ "rtype" ,
309+ "dummy" ,
310+ ]
266311
267- DEFINITION_COLUMNS = [x for x in np .dtype (DEFINITION_MSG ).names or ()]
268- DEFINITION_COLUMNS .remove ("ts_recv" ) # Index
269- DEFINITION_COLUMNS .remove ("length" )
270- DEFINITION_COLUMNS .remove ("rtype" )
271- DEFINITION_COLUMNS .remove ("dummy" )
312+ STATUS_COLUMNS = [
313+ x for x in (np .dtype (STATUS_MSG ).names or ()) if x not in STATUS_DROP_COLUMNS
314+ ]
315+
316+ DEFINITION_COLUMNS = [
317+ x
318+ for x in (np .dtype (DEFINITION_MSG ).names or ())
319+ if x not in DEFINITION_DROP_COLUMNS
320+ ]
321+
322+ IMBALANCE_COLUMNS = [
323+ x for x in (np .dtype (IMBALANCE_MSG ).names or ()) if x not in IMBALANCE_DROP_COLUMNS
324+ ]
272325
273326
274327COLUMNS = {
@@ -306,4 +359,5 @@ def get_deriv_ba_fields(level: int) -> List[str]:
306359 Schema .OHLCV_1D : OHLCV_HEADER_COLUMNS ,
307360 Schema .STATUS : STATUS_COLUMNS ,
308361 Schema .DEFINITION : DEFINITION_COLUMNS ,
362+ Schema .IMBALANCE : IMBALANCE_COLUMNS ,
309363}
0 commit comments