mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-13 03:33:55 +00:00
removing unnecessary guard
This commit is contained in:
parent
12e8108015
commit
1cd5abde37
|
@ -652,18 +652,6 @@ class FreqtradeBot(object):
|
||||||
# if trailing stoploss is enabled we check if stoploss value has changed
|
# if trailing stoploss is enabled we check if stoploss value has changed
|
||||||
# in which case we cancel stoploss order and put another one with new
|
# in which case we cancel stoploss order and put another one with new
|
||||||
# value immediately
|
# value immediately
|
||||||
|
|
||||||
# This is a guard: there is a situation where market is going doing down fast
|
|
||||||
# the stoploss on exchange checked previously is not hit but
|
|
||||||
# it is too late and too risky to cancel the previous stoploss
|
|
||||||
if trade.stop_loss > self.exchange.get_ticker(trade.pair)['bid']:
|
|
||||||
logger.warning(
|
|
||||||
'stoploss on exchange update: too risky to update stoploss as '
|
|
||||||
'current best bid price (%s) is higher than stoploss value (%s).',
|
|
||||||
self.exchange.get_ticker(trade.pair)['bid'], trade.stop_loss
|
|
||||||
)
|
|
||||||
return result
|
|
||||||
|
|
||||||
if trade.stop_loss > order['info']['stopPrice']:
|
if trade.stop_loss > order['info']['stopPrice']:
|
||||||
# we check also if the update is neccesary
|
# we check also if the update is neccesary
|
||||||
update_beat = self.strategy.order_types['stoploss_on_exchange_interval']
|
update_beat = self.strategy.order_types['stoploss_on_exchange_interval']
|
||||||
|
|
|
@ -1071,6 +1071,7 @@ def test_handle_stoploss_on_exchange_trailing(mocker, default_conf, fee, caplog,
|
||||||
|
|
||||||
# stoploss initially at 5%
|
# stoploss initially at 5%
|
||||||
assert freqtrade.handle_trade(trade) is False
|
assert freqtrade.handle_trade(trade) is False
|
||||||
|
assert freqtrade.handle_stoploss_on_exchange(trade) is False
|
||||||
|
|
||||||
# price jumped 2x
|
# price jumped 2x
|
||||||
mocker.patch('freqtrade.exchange.Exchange.get_ticker', MagicMock(return_value={
|
mocker.patch('freqtrade.exchange.Exchange.get_ticker', MagicMock(return_value={
|
||||||
|
|
Loading…
Reference in New Issue
Block a user