Add TODO-lev for "stoploss_from_absolute".
This commit is contained in:
parent
120639e84b
commit
1fb48a1f53
@ -104,6 +104,7 @@ def stoploss_from_open(
|
|||||||
|
|
||||||
def stoploss_from_absolute(stop_rate: float, current_rate: float) -> float:
|
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
|
Given current price and desired stop price, return a stop loss value that is relative to current
|
||||||
price.
|
price.
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ def test_stoploss_from_open():
|
|||||||
|
|
||||||
# there is no correct answer if the expected stop price is above
|
# there is no correct answer if the expected stop price is above
|
||||||
# the current price
|
# the current price
|
||||||
if (side == 'long' and expected_stop_price > current_price) \
|
if ((side == 'long' and expected_stop_price > current_price)
|
||||||
or (side == 'short' and expected_stop_price < current_price):
|
or (side == 'short' and expected_stop_price < current_price)):
|
||||||
assert stoploss == 0
|
assert stoploss == 0
|
||||||
else:
|
else:
|
||||||
assert isclose(stop_price, expected_stop_price, rel_tol=0.00001)
|
assert isclose(stop_price, expected_stop_price, rel_tol=0.00001)
|
||||||
|
Loading…
Reference in New Issue
Block a user