Update test to ensure direction of movement is correct

This commit is contained in:
Matthias 2021-08-18 20:20:11 +02:00
parent d97fc1e484
commit 9951f51079
2 changed files with 6 additions and 10 deletions

View File

@ -1411,11 +1411,7 @@ class FreqtradeBot(LoggingMixin):
min_custom_price_allowed = proposed_price - (proposed_price * cust_p_max_dist_r)
max_custom_price_allowed = proposed_price + (proposed_price * cust_p_max_dist_r)
if valid_custom_price > max_custom_price_allowed:
valid_price = max_custom_price_allowed
elif valid_custom_price < min_custom_price_allowed:
valid_price = min_custom_price_allowed
else:
valid_price = valid_custom_price
return valid_price
# Bracket between min_custom_price_allowed and max_custom_price_allowed
return max(
min(valid_custom_price, max_custom_price_allowed),
min_custom_price_allowed)

View File

@ -4624,8 +4624,8 @@ def test_get_valid_price(mocker, default_conf) -> None:
assert valid_price_from_int == custom_price_int
assert valid_price_from_float == custom_price_float
assert valid_price_at_max_alwd != custom_price_over_max_alwd
assert valid_price_at_max_alwd < custom_price_over_max_alwd
assert valid_price_at_max_alwd > proposed_price
assert valid_price_at_min_alwd != custom_price_under_min_alwd
assert valid_price_at_min_alwd > custom_price_under_min_alwd
assert valid_price_at_min_alwd < proposed_price