mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
Force special exit reason for "recovered" exits
This commit is contained in:
parent
24cab00479
commit
f2696c9609
|
@ -15,6 +15,7 @@ class ExitType(Enum):
|
|||
EMERGENCY_EXIT = "emergency_exit"
|
||||
CUSTOM_EXIT = "custom_exit"
|
||||
PARTIAL_EXIT = "partial_exit"
|
||||
SOLD_ON_EXCHANGE = "sold_on_exchange"
|
||||
NONE = ""
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -470,13 +470,17 @@ class FreqtradeBot(LoggingMixin):
|
|||
trade.orders.append(order_obj)
|
||||
# TODO: how do we handle open_order_id ...
|
||||
Trade.commit()
|
||||
prev_exit_reason = trade.exit_reason
|
||||
trade.exit_reason = ExitType.SOLD_ON_EXCHANGE.value
|
||||
self.update_trade_state(trade, order['id'], order)
|
||||
logger.info(f"handled order {order['id']}")
|
||||
if not trade.is_open:
|
||||
# Trade was just closed
|
||||
trade.close_date = order_obj.order_filled_date
|
||||
Trade.commit()
|
||||
continue
|
||||
break
|
||||
else:
|
||||
trade.exit_reason = prev_exit_reason
|
||||
|
||||
except ExchangeError:
|
||||
logger.warning("Error finding onexchange order")
|
||||
|
|
Loading…
Reference in New Issue
Block a user