@@ -66,36 +66,6 @@ def _parse_trade(tData, symbol):
6666 'symbol' : symbol
6767 }
6868
69- def _parse_account_trade (tData ):
70- return {
71- 'id' : tData [0 ],
72- 'symbol' : tData [1 ],
73- 'mts_create' : tData [2 ],
74- 'order_id' : tData [3 ],
75- 'exec_amount' : tData [4 ],
76- 'exec_price' : tData [5 ],
77- 'order_type' : tData [6 ],
78- 'order_price' : tData [7 ],
79- 'maker' : tData [8 ],
80- 'cid' : tData [11 ],
81- }
82-
83-
84- def _parse_account_trade_update (tData ):
85- return {
86- 'id' : tData [0 ],
87- 'symbol' : tData [1 ],
88- 'mts_create' : tData [2 ],
89- 'order_id' : tData [3 ],
90- 'exec_amount' : tData [4 ],
91- 'exec_price' : tData [5 ],
92- 'order_type' : tData [6 ],
93- 'order_price' : tData [7 ],
94- 'maker' : tData [8 ],
95- 'fee' : tData [9 ],
96- 'fee_currency' : tData [10 ],
97- 'cid' : tData [11 ],
98- }
9969
10070def _parse_deriv_status_update (sData , symbol ):
10171 return {
@@ -309,15 +279,19 @@ async def _system_auth_handler(self, socketId, data):
309279
310280 async def _trade_update_handler (self , data ):
311281 tData = data [2 ]
312- # [0,"tu",[738045455,"tTESTBTC:TESTUSD",1622169615771,66635385225,0.001,38175,"EXCHANGE LIMIT",39000,-1,-0.000002,"TESTBTC",1622169615685]]
313- tradeObj = _parse_account_trade_update (tData )
314- self ._emit ('trade_update' , tradeObj )
282+ # [209, 'tu', [312372989, 1542303108930, 0.35, 5688.61834032]]
283+ if self .subscriptionManager .is_subscribed (data [0 ]):
284+ symbol = self .subscriptionManager .get (data [0 ]).symbol
285+ tradeObj = _parse_trade (tData , symbol )
286+ self ._emit ('trade_update' , tradeObj )
315287
316288 async def _trade_executed_handler (self , data ):
317289 tData = data [2 ]
318- # [0,"te",[738045455,"tTESTBTC:TESTUSD",1622169615771,66635385225,0.001,38175,"EXCHANGE LIMIT",39000,-1,null,null,1622169615685]]
319- tradeObj = _parse_account_trade (tData )
320- self ._emit ('new_trade' , tradeObj )
290+ # [209, 'te', [312372989, 1542303108930, 0.35, 5688.61834032]]
291+ if self .subscriptionManager .is_subscribed (data [0 ]):
292+ symbol = self .subscriptionManager .get (data [0 ]).symbol
293+ tradeObj = _parse_trade (tData , symbol )
294+ self ._emit ('new_trade' , tradeObj )
321295
322296 async def _wallet_update_handler (self , data ):
323297 # [0,"wu",["exchange","USD",89134.66933283,0]]
@@ -436,7 +410,12 @@ async def _trade_handler(self, data):
436410 # connection
437411 data .reverse ()
438412 for t in data :
439- trade = _parse_trade (t , symbol )
413+ trade = {
414+ 'mts' : t [1 ],
415+ 'amount' : t [2 ],
416+ 'price' : t [3 ],
417+ 'symbol' : symbol
418+ }
440419 self ._emit ('seed_trade' , trade )
441420
442421 async def _candle_handler (self , data ):
0 commit comments