Skip to content

Commit 519f2d9

Browse files
committed
test: update tests for new stoploss_from_absolute behavior
1 parent 646c091 commit 519f2d9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/strategy/test_strategy_helpers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,11 @@ def test_stoploss_from_absolute():
348348
assert pytest.approx(stoploss_from_absolute(105, 100, True, 5)) == 0.05 * 5
349349
assert pytest.approx(stoploss_from_absolute(100, 0, True)) == 1
350350
assert pytest.approx(stoploss_from_absolute(0, 100, True)) == 0
351-
assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True)) == 1
352-
assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True, leverage=5)) == 5
351+
assert pytest.approx(stoploss_from_absolute(100, 99, is_short=True)) == 0.01010101
352+
assert pytest.approx(stoploss_from_absolute(100, 90, is_short=True)) == 0.1111111
353+
assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True)) == 99.0
354+
assert pytest.approx(stoploss_from_absolute(100, 1, is_short=True, leverage=5)) == 495.0
355+
assert pytest.approx(stoploss_from_absolute(100, 90, is_short=True, leverage=5)) == 0.55555555
353356

354357

355358
@pytest.mark.parametrize("trading_mode", ["futures", "spot"])

0 commit comments

Comments
 (0)