added test

This commit is contained in:
Yazeed Al Oyoun 2020-03-11 17:44:03 +01:00
parent 1395f65872
commit d752586b32

View File

@ -79,6 +79,21 @@ def test_get_signal_empty_dataframe(default_conf, mocker, caplog, ticker_history
assert log_has('Empty dataframe for pair xyz', caplog)
def test_get_signal_old_candle(default_conf, mocker, caplog, ticker_history):
caplog.set_level(logging.INFO)
# default_conf defines a 5m interval. we check interval of previous candle
# this is necessary as the last candle is removed (partial candles) by default
oldtime = arrow.utcnow().shift(minutes=-10)
ticks = DataFrame([{'buy': 1, 'date': oldtime}])
mocker.patch.object(
_STRATEGY, '_analyze_ticker_internal',
return_value=DataFrame(ticks)
)
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['ticker_interval'],
ticker_history)
assert log_has('Old candle for pair xyz. Last candle is 10 minutes old', caplog)
def test_get_signal_old_dataframe(default_conf, mocker, caplog, ticker_history):
caplog.set_level(logging.INFO)
# default_conf defines a 5m interval. we check interval * 2 + 5m