logs added in case stop loss on exchange is hit
This commit is contained in:
parent
da94e97c60
commit
fb755880fa
@ -255,6 +255,7 @@ class Trade(_DECL_BASE):
|
||||
self.close(order['price'])
|
||||
elif order_type == 'stop_loss_limit':
|
||||
self.stoploss_order_id = None
|
||||
logger.info('STOP_LOSS_LIMIT is hit for %s.', self)
|
||||
self.close(order['price'])
|
||||
else:
|
||||
raise ValueError(f'Unknown order type: {order_type}')
|
||||
|
@ -899,7 +899,7 @@ def test_add_stoploss_on_exchange(mocker, default_conf, limit_buy_order) -> None
|
||||
assert trade.is_open is True
|
||||
|
||||
|
||||
def test_handle_stoploss_on_exchange(mocker, default_conf, fee,
|
||||
def test_handle_stoploss_on_exchange(mocker, default_conf, fee, caplog,
|
||||
markets, limit_buy_order, limit_sell_order) -> None:
|
||||
stoploss_limit = MagicMock(return_value={'id': 13434334})
|
||||
patch_RPCManager(mocker)
|
||||
@ -961,6 +961,7 @@ def test_handle_stoploss_on_exchange(mocker, default_conf, fee,
|
||||
})
|
||||
mocker.patch('freqtrade.exchange.Exchange.get_order', stoploss_order_hit)
|
||||
assert freqtrade.handle_stoploss_on_exchange(trade) is True
|
||||
assert log_has('STOP_LOSS_LIMIT is hit for {}.'.format(trade), caplog.record_tuples)
|
||||
assert trade.stoploss_order_id is None
|
||||
assert trade.is_open is False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user