Explicitly raise ValueError if trades are empty

This commit is contained in:
Matthias
2020-05-21 07:12:23 +02:00
parent ff7bcb5aae
commit 1a984ac677
2 changed files with 7 additions and 0 deletions

View File

@@ -178,6 +178,10 @@ def test_create_cum_profit1(testdatadir):
assert cum_profits.iloc[0]['cum_profits'] == 0
assert cum_profits.iloc[-1]['cum_profits'] == 0.0798005
with pytest.raises(ValueError, match='Trade dataframe empty.'):
create_cum_profit(df.set_index('date'), bt_data[bt_data["pair"] == 'NOTAPAIR'],
"cum_profits", timeframe="5m")
def test_calculate_max_drawdown(testdatadir):
filename = testdatadir / "backtest-result_test.json"