Remove candle_count from dataframe before backtesting

closes #3754
This commit is contained in:
Matthias
2021-03-29 20:22:52 +02:00
parent 00d8f3a479
commit 89bbfd2324
4 changed files with 25 additions and 7 deletions

View File

@@ -197,6 +197,16 @@ def test_trim_dataframe(testdatadir) -> None:
assert all(data_modify.iloc[-1] == data.iloc[-1])
assert all(data_modify.iloc[0] == data.iloc[30])
data_modify = data.copy()
tr = TimeRange('date', None, min_date + 1800, 0)
# Remove first 20 candles - ignores min date
data_modify = trim_dataframe(data_modify, tr, startup_candles=20)
assert not data_modify.equals(data)
assert len(data_modify) < len(data)
assert len(data_modify) == len(data) - 20
assert all(data_modify.iloc[-1] == data.iloc[-1])
assert all(data_modify.iloc[0] == data.iloc[20])
data_modify = data.copy()
# Remove last 30 minutes (1800 s)
tr = TimeRange(None, 'date', 0, max_date - 1800)