From 07e07bd66b2272dabba813c07eea63d65835e445 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 29 Aug 2023 21:58:15 +0200 Subject: [PATCH] Improve test, ensuring we calculate profits correctly --- tests/persistence/test_persistence.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/persistence/test_persistence.py b/tests/persistence/test_persistence.py index 692c50659..23e5398d0 100644 --- a/tests/persistence/test_persistence.py +++ b/tests/persistence/test_persistence.py @@ -1161,6 +1161,8 @@ def test_calc_profit( profit_res = trade.calc_profit_combined(close_rate) assert pytest.approx(profit_res.profit_abs) == round(profit, 8) assert pytest.approx(profit_res.profit_ratio) == round(profit_ratio, 8) + val = trade.open_trade_value * (profit_res.profit_ratio) / lev + assert pytest.approx(val) == profit_res.profit_abs assert pytest.approx(profit_res.total_profit) == round(profit, 8) # assert pytest.approx(profit_res.total_profit_ratio) == round(profit_ratio, 8)