From 519f2d93ba57d18d2beb20bc17b5bf3762fd67b2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Feb 2026 07:15:23 +0100 Subject: [PATCH] test: update tests for new stoploss_from_absolute behavior --- tests/strategy/test_strategy_helpers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/strategy/test_strategy_helpers.py b/tests/strategy/test_strategy_helpers.py index 92216db89..8e1111a76 100644 --- a/tests/strategy/test_strategy_helpers.py +++ b/tests/strategy/test_strategy_helpers.py @@ -348,8 +348,11 @@ def test_stoploss_from_absolute(): assert pytest.approx(stoploss_from_absolute(105, 100, True, 5)) == 0.05 * 5 assert pytest.approx(stoploss_from_absolute(100, 0, True)) == 1 assert pytest.approx(stoploss_from_absolute(0, 100, True)) == 0 - assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True)) == 1 - assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True, leverage=5)) == 5 + assert pytest.approx(stoploss_from_absolute(100, 99, is_short=True)) == 0.01010101 + assert pytest.approx(stoploss_from_absolute(100, 90, is_short=True)) == 0.1111111 + assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True)) == 99.0 + assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True, leverage=5)) == 495.0 + assert pytest.approx(stoploss_from_absolute(100, 90, is_short=True, leverage=5)) == 0.55555555 @pytest.mark.parametrize("trading_mode", ["futures", "spot"])