Improve resiliance when showing older backtest results

This commit is contained in:
Matthias
2023-07-22 19:43:20 +02:00
parent e5f01ab2e8
commit 955a63725a
3 changed files with 13 additions and 3 deletions

View File

@@ -353,6 +353,15 @@ def test_calculate_expectancy(testdatadir):
assert pytest.approx(expectancy) == 5.820687070932315e-06
assert pytest.approx(expectancy_ratio) == 0.07151374226574791
data = {
'profit_abs': [100, 200, 50, -150, 300, -100, 80, -30]
}
df = DataFrame(data)
expectancy, expectancy_ratio = calculate_expectancy(df)
assert pytest.approx(expectancy) == 56.25
assert pytest.approx(expectancy_ratio) == 0.60267857
def test_calculate_sortino(testdatadir):
filename = testdatadir / "backtest_results/backtest-result.json"