mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
fixed trades handling error
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
-) Added User Settings Write/Read/Delete endpoints (REST)
|
-) Added User Settings Write/Read/Delete endpoints (REST)
|
||||||
-) Added Balance Available for Orders/Offers endpoint (REST)
|
-) Added Balance Available for Orders/Offers endpoint (REST)
|
||||||
-) Added Alerts endpoints (REST)
|
-) Added Alerts endpoints (REST)
|
||||||
|
-) Fixed trades handling error
|
||||||
|
|
||||||
2.0.0
|
2.0.0
|
||||||
-) Implemented Movement endpoints (REST)
|
-) Implemented Movement endpoints (REST)
|
||||||
|
|||||||
@@ -66,36 +66,6 @@ def _parse_trade(tData, symbol):
|
|||||||
'symbol': symbol
|
'symbol': symbol
|
||||||
}
|
}
|
||||||
|
|
||||||
def _parse_account_trade(tData):
|
|
||||||
return {
|
|
||||||
'id': tData[0],
|
|
||||||
'symbol': tData[1],
|
|
||||||
'mts_create': tData[2],
|
|
||||||
'order_id': tData[3],
|
|
||||||
'exec_amount': tData[4],
|
|
||||||
'exec_price': tData[5],
|
|
||||||
'order_type': tData[6],
|
|
||||||
'order_price': tData[7],
|
|
||||||
'maker': tData[8],
|
|
||||||
'cid': tData[11],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _parse_account_trade_update(tData):
|
|
||||||
return {
|
|
||||||
'id': tData[0],
|
|
||||||
'symbol': tData[1],
|
|
||||||
'mts_create': tData[2],
|
|
||||||
'order_id': tData[3],
|
|
||||||
'exec_amount': tData[4],
|
|
||||||
'exec_price': tData[5],
|
|
||||||
'order_type': tData[6],
|
|
||||||
'order_price': tData[7],
|
|
||||||
'maker': tData[8],
|
|
||||||
'fee': tData[9],
|
|
||||||
'fee_currency': tData[10],
|
|
||||||
'cid': tData[11],
|
|
||||||
}
|
|
||||||
|
|
||||||
def _parse_deriv_status_update(sData, symbol):
|
def _parse_deriv_status_update(sData, symbol):
|
||||||
return {
|
return {
|
||||||
@@ -309,15 +279,19 @@ class BfxWebsocket(GenericWebsocket):
|
|||||||
|
|
||||||
async def _trade_update_handler(self, data):
|
async def _trade_update_handler(self, data):
|
||||||
tData = data[2]
|
tData = data[2]
|
||||||
# [0,"tu",[738045455,"tTESTBTC:TESTUSD",1622169615771,66635385225,0.001,38175,"EXCHANGE LIMIT",39000,-1,-0.000002,"TESTBTC",1622169615685]]
|
# [209, 'tu', [312372989, 1542303108930, 0.35, 5688.61834032]]
|
||||||
tradeObj = _parse_account_trade_update(tData)
|
if self.subscriptionManager.is_subscribed(data[0]):
|
||||||
self._emit('trade_update', tradeObj)
|
symbol = self.subscriptionManager.get(data[0]).symbol
|
||||||
|
tradeObj = _parse_trade(tData, symbol)
|
||||||
|
self._emit('trade_update', tradeObj)
|
||||||
|
|
||||||
async def _trade_executed_handler(self, data):
|
async def _trade_executed_handler(self, data):
|
||||||
tData = data[2]
|
tData = data[2]
|
||||||
# [0,"te",[738045455,"tTESTBTC:TESTUSD",1622169615771,66635385225,0.001,38175,"EXCHANGE LIMIT",39000,-1,null,null,1622169615685]]
|
# [209, 'te', [312372989, 1542303108930, 0.35, 5688.61834032]]
|
||||||
tradeObj = _parse_account_trade(tData)
|
if self.subscriptionManager.is_subscribed(data[0]):
|
||||||
self._emit('new_trade', tradeObj)
|
symbol = self.subscriptionManager.get(data[0]).symbol
|
||||||
|
tradeObj = _parse_trade(tData, symbol)
|
||||||
|
self._emit('new_trade', tradeObj)
|
||||||
|
|
||||||
async def _wallet_update_handler(self, data):
|
async def _wallet_update_handler(self, data):
|
||||||
# [0,"wu",["exchange","USD",89134.66933283,0]]
|
# [0,"wu",["exchange","USD",89134.66933283,0]]
|
||||||
@@ -436,7 +410,12 @@ class BfxWebsocket(GenericWebsocket):
|
|||||||
# connection
|
# connection
|
||||||
data.reverse()
|
data.reverse()
|
||||||
for t in data:
|
for t in data:
|
||||||
trade = _parse_trade(t, symbol)
|
trade = {
|
||||||
|
'mts': t[1],
|
||||||
|
'amount': t[2],
|
||||||
|
'price': t[3],
|
||||||
|
'symbol': symbol
|
||||||
|
}
|
||||||
self._emit('seed_trade', trade)
|
self._emit('seed_trade', trade)
|
||||||
|
|
||||||
async def _candle_handler(self, data):
|
async def _candle_handler(self, data):
|
||||||
|
|||||||
Reference in New Issue
Block a user