mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-13 03:33:55 +00:00
Add small tests for backtest mode
This commit is contained in:
parent
00e93dad02
commit
1c408c0404
|
@ -247,6 +247,25 @@ def test_get_analyzed_dataframe(mocker, default_conf, ohlcv_history):
|
||||||
assert isinstance(time, datetime)
|
assert isinstance(time, datetime)
|
||||||
assert time == datetime(1970, 1, 1, tzinfo=timezone.utc)
|
assert time == datetime(1970, 1, 1, tzinfo=timezone.utc)
|
||||||
|
|
||||||
|
# Test backtest mode
|
||||||
|
default_conf["runmode"] = RunMode.BACKTEST
|
||||||
|
dp._set_dataframe_max_index(1)
|
||||||
|
dataframe, time = dp.get_analyzed_dataframe("XRP/BTC", timeframe)
|
||||||
|
|
||||||
|
assert len(dataframe) == 1
|
||||||
|
|
||||||
|
dp._set_dataframe_max_index(2)
|
||||||
|
dataframe, time = dp.get_analyzed_dataframe("XRP/BTC", timeframe)
|
||||||
|
assert len(dataframe) == 2
|
||||||
|
|
||||||
|
dp._set_dataframe_max_index(3)
|
||||||
|
dataframe, time = dp.get_analyzed_dataframe("XRP/BTC", timeframe)
|
||||||
|
assert len(dataframe) == 3
|
||||||
|
|
||||||
|
dp._set_dataframe_max_index(500)
|
||||||
|
dataframe, time = dp.get_analyzed_dataframe("XRP/BTC", timeframe)
|
||||||
|
assert len(dataframe) == len(ohlcv_history)
|
||||||
|
|
||||||
|
|
||||||
def test_no_exchange_mode(default_conf):
|
def test_no_exchange_mode(default_conf):
|
||||||
dp = DataProvider(default_conf, None)
|
dp = DataProvider(default_conf, None)
|
||||||
|
@ -267,3 +286,6 @@ def test_no_exchange_mode(default_conf):
|
||||||
|
|
||||||
with pytest.raises(OperationalException, match=message):
|
with pytest.raises(OperationalException, match=message):
|
||||||
dp.orderbook('XRP/USDT', 20)
|
dp.orderbook('XRP/USDT', 20)
|
||||||
|
|
||||||
|
with pytest.raises(OperationalException, match=message):
|
||||||
|
dp.available_pairs()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user