Merge pull request #4513 from freqtrade/fix/4511
Fix stoploss order problem with FTX
This commit is contained in:
commit
441d3fad39
@ -1056,7 +1056,8 @@ class Exchange:
|
|||||||
:param order: Order dict as returned from fetch_order()
|
:param order: Order dict as returned from fetch_order()
|
||||||
:return: True if order has been cancelled without being filled, False otherwise.
|
:return: True if order has been cancelled without being filled, False otherwise.
|
||||||
"""
|
"""
|
||||||
return order.get('status') in ('closed', 'canceled') and order.get('filled') == 0.0
|
return (order.get('status') in ('closed', 'canceled', 'cancelled')
|
||||||
|
and order.get('filled') == 0.0)
|
||||||
|
|
||||||
@retrier
|
@retrier
|
||||||
def cancel_order(self, order_id: str, pair: str) -> Dict:
|
def cancel_order(self, order_id: str, pair: str) -> Dict:
|
||||||
|
@ -1023,13 +1023,13 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
was_trade_fully_canceled = False
|
was_trade_fully_canceled = False
|
||||||
|
|
||||||
# Cancelled orders may have the status of 'canceled' or 'closed'
|
# Cancelled orders may have the status of 'canceled' or 'closed'
|
||||||
if order['status'] not in ('canceled', 'closed'):
|
if order['status'] not in ('cancelled', 'canceled', 'closed'):
|
||||||
corder = self.exchange.cancel_order_with_result(trade.open_order_id, trade.pair,
|
corder = self.exchange.cancel_order_with_result(trade.open_order_id, trade.pair,
|
||||||
trade.amount)
|
trade.amount)
|
||||||
# Avoid race condition where the order could not be cancelled coz its already filled.
|
# Avoid race condition where the order could not be cancelled coz its already filled.
|
||||||
# Simply bailing here is the only safe way - as this order will then be
|
# Simply bailing here is the only safe way - as this order will then be
|
||||||
# handled in the next iteration.
|
# handled in the next iteration.
|
||||||
if corder.get('status') not in ('canceled', 'closed'):
|
if corder.get('status') not in ('cancelled', 'canceled', 'closed'):
|
||||||
logger.warning(f"Order {trade.open_order_id} for {trade.pair} not cancelled.")
|
logger.warning(f"Order {trade.open_order_id} for {trade.pair} not cancelled.")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
@ -432,7 +432,7 @@ class LocalTrade():
|
|||||||
self.close_rate_requested = self.stop_loss
|
self.close_rate_requested = self.stop_loss
|
||||||
if self.is_open:
|
if self.is_open:
|
||||||
logger.info(f'{order_type.upper()} is hit for {self}.')
|
logger.info(f'{order_type.upper()} is hit for {self}.')
|
||||||
self.close(order['average'])
|
self.close(safe_value_fallback(order, 'average', 'price'))
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Unknown order type: {order_type}')
|
raise ValueError(f'Unknown order type: {order_type}')
|
||||||
cleanup_db()
|
cleanup_db()
|
||||||
|
Loading…
Reference in New Issue
Block a user