mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-03 04:41:23 +00:00
Fix some tests and comments
This commit is contained in:
@@ -1198,8 +1198,7 @@ def test_handle_stoploss_on_exchange(mocker, default_conf_usdt, fee, caplog, is_
|
||||
assert trade.amount == amount_before
|
||||
|
||||
# Fourth case: when stoploss is set and it is hit
|
||||
# should unset stoploss_order_id and return true
|
||||
# as a trade actually happened
|
||||
# should return true as a trade actually happened
|
||||
caplog.clear()
|
||||
stop_order_dict.update({'id': "103_1"})
|
||||
|
||||
@@ -1871,7 +1870,6 @@ def test_stoploss_on_exchange_price_rounding(
|
||||
price_to_precision=price_mock,
|
||||
)
|
||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||
open_trade_usdt.stoploss_order_id = '13434334'
|
||||
open_trade_usdt.stop_loss = 222.55
|
||||
|
||||
freqtrade.handle_trailing_stoploss_on_exchange(open_trade_usdt, {})
|
||||
@@ -2078,7 +2076,7 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, limit_orde
|
||||
freqtrade.enter_positions()
|
||||
trade = Trade.session.scalars(select(Trade)).first()
|
||||
trade.is_open = True
|
||||
trade.stoploss_order_id = '100'
|
||||
|
||||
trade.stoploss_last_update = dt_now()
|
||||
trade.orders.append(
|
||||
Order(
|
||||
@@ -4194,8 +4192,7 @@ def test_may_execute_trade_exit_after_stoploss_on_exchange_hit(
|
||||
assert not trade.has_open_orders
|
||||
|
||||
# Assuming stoploss on exchange is hit
|
||||
# stoploss_order_id should become None
|
||||
# and trade should be sold at the price of stoploss
|
||||
# trade should be sold at the price of stoploss, with exit_reaeon STOPLOSS_ON_EXCHANGE
|
||||
stoploss_executed = MagicMock(return_value={
|
||||
"id": "123",
|
||||
"timestamp": 1542707426845,
|
||||
@@ -5721,7 +5718,6 @@ def test_handle_insufficient_funds(mocker, default_conf_usdt, fee, is_short, cap
|
||||
|
||||
def reset_open_orders(trade):
|
||||
|
||||
trade.stoploss_order_id = None
|
||||
trade.is_short = is_short
|
||||
|
||||
create_mock_trades(fee, is_short=is_short)
|
||||
@@ -5779,7 +5775,7 @@ def test_handle_insufficient_funds(mocker, default_conf_usdt, fee, is_short, cap
|
||||
assert log_has_re(r"Trying to refind Order\(.*", caplog)
|
||||
assert mock_fo.call_count == 1
|
||||
assert mock_uts.call_count == 2
|
||||
# stoploss_order_id is "refound" and added to the trade
|
||||
# stoploss order is "refound" and added to the trade
|
||||
assert not trade.has_open_orders
|
||||
assert trade.has_open_sl_orders is True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user