Check can_short in live-mode as well.

This commit is contained in:
Matthias
2022-03-11 19:43:00 +01:00
parent 20fc9459f2
commit 0aa170ac95
3 changed files with 11 additions and 2 deletions

View File

@@ -78,6 +78,12 @@ def test_returns_latest_signal(ohlcv_history):
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
_STRATEGY.config['trading_mode'] = 'futures'
# Short signal get's ignored as can_short is not set.
assert _STRATEGY.get_entry_signal(
'ETH/BTC', '5m', mocked_history) == (None, None)
_STRATEGY.can_short = True
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)
@@ -93,6 +99,7 @@ def test_returns_latest_signal(ohlcv_history):
assert _STRATEGY.get_exit_signal(
'ETH/BTC', '5m', mocked_history, True) == (False, True, 'sell_signal_02')
_STRATEGY.can_short = False
_STRATEGY.config['trading_mode'] = 'spot'