Update order structure to ccxt generic structure instead of bittrex specific
This commit is contained in:
@@ -111,20 +111,20 @@ class Trade(_DECL_BASE):
|
||||
:return: None
|
||||
"""
|
||||
# Ignore open and cancelled orders
|
||||
if not order['closed'] or order['rate'] is None:
|
||||
if order['status'] == 'open' or order['price'] is None:
|
||||
return
|
||||
|
||||
logger.info('Updating trade (id=%d) ...', self.id)
|
||||
|
||||
getcontext().prec = 8 # Bittrex do not go above 8 decimal
|
||||
if order['type'] == 'LIMIT_BUY':
|
||||
if order['type'] == 'limit' and order['side'] == 'buy':
|
||||
# Update open rate and actual amount
|
||||
self.open_rate = Decimal(order['rate'])
|
||||
self.open_rate = Decimal(order['price'])
|
||||
self.amount = Decimal(order['amount'])
|
||||
logger.info('LIMIT_BUY has been fulfilled for %s.', self)
|
||||
self.open_order_id = None
|
||||
elif order['type'] == 'LIMIT_SELL':
|
||||
self.close(order['rate'])
|
||||
elif order['type'] == 'limit' and order['side'] == 'sell':
|
||||
self.close(order['price'])
|
||||
else:
|
||||
raise ValueError('Unknown order type: {}'.format(order['type']))
|
||||
cleanup()
|
||||
|
||||
Reference in New Issue
Block a user