don't allow short trades in spot mode

This commit is contained in:
Matthias
2022-02-21 19:19:12 +01:00
parent c3c815e794
commit 70f4305dfa
7 changed files with 15 additions and 6 deletions

View File

@@ -74,6 +74,10 @@ def test_returns_latest_signal(ohlcv_history):
mocked_history.loc[1, 'exit_short'] = 0
mocked_history.loc[1, 'enter_tag'] = 'sell_signal_01'
# Don't provide short signal while in spot mode
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
_STRATEGY.config['trading_mode'] = 'futures'
assert _STRATEGY.get_entry_signal(
'ETH/BTC', '5m', mocked_history) == (SignalDirection.SHORT, 'sell_signal_01')
assert _STRATEGY.get_exit_signal('ETH/BTC', '5m', mocked_history) == (False, False, None)
@@ -89,6 +93,8 @@ def test_returns_latest_signal(ohlcv_history):
assert _STRATEGY.get_exit_signal(
'ETH/BTC', '5m', mocked_history, True) == (False, True, 'sell_signal_02')
_STRATEGY.config['trading_mode'] = 'spot'
def test_analyze_pair_empty(default_conf, mocker, caplog, ohlcv_history):
mocker.patch.object(_STRATEGY.dp, 'ohlcv', return_value=ohlcv_history)