Test "get-signal"

This commit is contained in:
Matthias
2021-10-31 10:51:56 +01:00
parent dffe76f109
commit 6b90b4a144
3 changed files with 17 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ _STRATEGY = StrategyTestV2(config={})
_STRATEGY.dp = DataProvider({}, None, None)
def test_returns_latest_signal(mocker, default_conf, ohlcv_history):
def test_returns_latest_signal(ohlcv_history):
ohlcv_history.loc[1, 'date'] = arrow.utcnow()
# Take a copy to correctly modify the call
mocked_history = ohlcv_history.copy()
@@ -60,6 +60,18 @@ def test_returns_latest_signal(mocker, default_conf, ohlcv_history):
'buy_signal_01',
None)
mocked_history.loc[1, 'buy_tag'] = None
mocked_history.loc[1, 'exit_tag'] = 'sell_signal_01'
assert _STRATEGY.get_signal(
'ETH/BTC',
'5m',
mocked_history) == (
True,
False,
None,
'sell_signal_01')
def test_analyze_pair_empty(default_conf, mocker, caplog, ohlcv_history):
mocker.patch.object(_STRATEGY.dp, 'ohlcv', return_value=ohlcv_history)