From 1fb48a1f531839958fbe18ffbc730e23c37d87c3 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 18 Jan 2022 16:52:34 +0100 Subject: [PATCH] Add TODO-lev for "stoploss_from_absolute". --- freqtrade/strategy/strategy_helper.py | 1 + tests/strategy/test_strategy_helpers.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/freqtrade/strategy/strategy_helper.py b/freqtrade/strategy/strategy_helper.py index a87239a71..97a8ec960 100644 --- a/freqtrade/strategy/strategy_helper.py +++ b/freqtrade/strategy/strategy_helper.py @@ -104,6 +104,7 @@ def stoploss_from_open( def stoploss_from_absolute(stop_rate: float, current_rate: float) -> float: """ + TODO-lev: Update this method with "is_short" formula Given current price and desired stop price, return a stop loss value that is relative to current price. diff --git a/tests/strategy/test_strategy_helpers.py b/tests/strategy/test_strategy_helpers.py index ef4b7f4e2..6c933d2f1 100644 --- a/tests/strategy/test_strategy_helpers.py +++ b/tests/strategy/test_strategy_helpers.py @@ -145,8 +145,8 @@ def test_stoploss_from_open(): # there is no correct answer if the expected stop price is above # the current price - if (side == 'long' and expected_stop_price > current_price) \ - or (side == 'short' and expected_stop_price < current_price): + if ((side == 'long' and expected_stop_price > current_price) + or (side == 'short' and expected_stop_price < current_price)): assert stoploss == 0 else: assert isclose(stop_price, expected_stop_price, rel_tol=0.00001)