mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
start fixing test_handle_stoploss_on_exchange_trailing, add temp logs
This commit is contained in:
@@ -1236,11 +1236,16 @@ class FreqtradeBot(LoggingMixin):
|
||||
self.handle_protections(trade.pair, trade.trade_direction)
|
||||
return True
|
||||
|
||||
if trade.open_entry_or_exit_orders_count != 0 or not trade.is_open:
|
||||
# Trade has an open Buy or Sell order, Stoploss-handling can't happen in this case
|
||||
# as the Amount on the exchange is tied up in another trade.
|
||||
# The trade can be closed already (sell-order fill confirmation came in this iteration)
|
||||
return False
|
||||
print("***************open_orders DEBUG***************")
|
||||
print(f"trade.open_orders: {trade.open_orders}")
|
||||
print(f"trade.open_orders_count: {trade.open_orders_count}")
|
||||
print(f"trade.open_entry_or_exit_orders_count: {trade.open_entry_or_exit_orders_count}")
|
||||
|
||||
# if trade.open_entry_or_exit_orders_count != 0 or not trade.is_open:
|
||||
# Trade has an open Buy or Sell order, Stoploss-handling can't happen in this case
|
||||
# as the Amount on the exchange is tied up in another trade.
|
||||
# The trade can be closed already (sell-order fill confirmation came in this iteration)
|
||||
# return False
|
||||
|
||||
# If enter order is fulfilled but there is no stoploss, we add a stoploss on exchange
|
||||
if not stoploss_order:
|
||||
|
||||
@@ -1484,7 +1484,7 @@ def test_handle_sle_cancel_cant_recreate(mocker, default_conf_usdt, fee, caplog,
|
||||
trade = Trade.session.scalars(select(Trade)).first()
|
||||
assert trade.is_short == is_short
|
||||
trade.is_open = True
|
||||
trade.open_order_id = None
|
||||
# trade.open_order_id = None
|
||||
trade.stoploss_order_id = "100"
|
||||
trade.orders.append(
|
||||
Order(
|
||||
@@ -1659,7 +1659,6 @@ def test_handle_stoploss_on_exchange_trailing(
|
||||
trade = Trade.session.scalars(select(Trade)).first()
|
||||
trade.is_short = is_short
|
||||
trade.is_open = True
|
||||
trade.open_order_id = None
|
||||
trade.stoploss_order_id = '100'
|
||||
trade.stoploss_last_update = dt_now() - timedelta(minutes=20)
|
||||
trade.orders.append(
|
||||
@@ -2324,7 +2323,6 @@ def test_update_trade_state_withorderdict(
|
||||
open_date=dt_now(),
|
||||
fee_open=fee.return_value,
|
||||
fee_close=fee.return_value,
|
||||
open_order_id=order_id,
|
||||
is_open=True,
|
||||
leverage=1,
|
||||
is_short=is_short,
|
||||
|
||||
Reference in New Issue
Block a user