stoploss on exchange added as a parameter to order_types
This commit is contained in:
@@ -362,7 +362,14 @@ def test_validate_order_types(default_conf, mocker):
|
||||
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock))
|
||||
mocker.patch('freqtrade.exchange.Exchange._load_markets', MagicMock(return_value={}))
|
||||
mocker.patch('freqtrade.exchange.Exchange.validate_timeframes', MagicMock())
|
||||
default_conf['order_types'] = {'buy': 'limit', 'sell': 'limit', 'stoploss': 'market'}
|
||||
mocker.patch('freqtrade.exchange.Exchange.name', 'Bittrex')
|
||||
default_conf['order_types'] = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
|
||||
Exchange(default_conf)
|
||||
|
||||
type(api_mock).has = PropertyMock(return_value={'createMarketOrder': False})
|
||||
@@ -374,6 +381,17 @@ def test_validate_order_types(default_conf, mocker):
|
||||
match=r'Exchange .* does not support market orders.'):
|
||||
Exchange(default_conf)
|
||||
|
||||
default_conf['order_types'] = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'stoploss': 'limit',
|
||||
'stoploss_on_exchange': True
|
||||
}
|
||||
|
||||
with pytest.raises(OperationalException,
|
||||
match=r'On exchange stoploss is not supported for .*'):
|
||||
Exchange(default_conf)
|
||||
|
||||
|
||||
def test_validate_order_types_not_in_config(default_conf, mocker):
|
||||
api_mock = MagicMock()
|
||||
|
@@ -893,7 +893,7 @@ def test_add_stoploss_on_exchange(mocker, default_conf, limit_buy_order) -> None
|
||||
mocker.patch('freqtrade.exchange.Exchange.stoploss_limit', stoploss_limit)
|
||||
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
freqtrade.strategy.stoploss_on_exchange = True
|
||||
freqtrade.strategy.order_types['stoploss_on_exchange'] = True
|
||||
|
||||
trade = MagicMock()
|
||||
trade.open_order_id = None
|
||||
@@ -1595,7 +1595,7 @@ def test_execute_sell_with_stoploss_on_exchange(default_conf,
|
||||
mocker.patch('freqtrade.exchange.Exchange.cancel_order', cancel_order)
|
||||
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
freqtrade.strategy.stoploss_on_exchange = True
|
||||
freqtrade.strategy.order_types['stoploss_on_exchange'] = True
|
||||
patch_get_signal(freqtrade)
|
||||
|
||||
# Create some test data
|
||||
@@ -1647,7 +1647,7 @@ def test_may_execute_sell_after_stoploss_on_exchange_hit(default_conf,
|
||||
mocker.patch('freqtrade.exchange.Exchange.stoploss_limit', stoploss_limit)
|
||||
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
freqtrade.strategy.stoploss_on_exchange = True
|
||||
freqtrade.strategy.order_types['stoploss_on_exchange'] = True
|
||||
patch_get_signal(freqtrade)
|
||||
|
||||
# Create some test data
|
||||
@@ -2516,9 +2516,3 @@ def test_startup_messages(default_conf, mocker):
|
||||
default_conf['dynamic_whitelist'] = 20
|
||||
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
||||
assert freqtrade.state is State.RUNNING
|
||||
|
||||
|
||||
def test_check_consistency(default_conf, mocker, caplog):
|
||||
mocker.patch('freqtrade.freqtradebot.IStrategy.stoploss_on_exchange', True)
|
||||
with pytest.raises(OperationalException):
|
||||
FreqtradeBot(default_conf)
|
||||
|
Reference in New Issue
Block a user