mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-13 03:33:55 +00:00
Fix calculate_backoff implementation
This commit is contained in:
parent
cbcbb4bdb5
commit
6362bfc36e
|
@ -91,11 +91,11 @@ MAP_EXCHANGE_CHILDCLASS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def calculate_backoff(retry, max_retries):
|
def calculate_backoff(retrycount, max_retries):
|
||||||
"""
|
"""
|
||||||
Calculate backoff
|
Calculate backoff
|
||||||
"""
|
"""
|
||||||
return retry ** 2 + 1
|
return (max_retries - retrycount) ** 2 + 1
|
||||||
|
|
||||||
|
|
||||||
def retrier_async(f):
|
def retrier_async(f):
|
||||||
|
|
|
@ -2298,13 +2298,13 @@ def test_calculate_fee_rate(mocker, default_conf, order, expected) -> None:
|
||||||
assert ex.calculate_fee_rate(order) == expected
|
assert ex.calculate_fee_rate(order) == expected
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('retry,max_retries,expected', [
|
@pytest.mark.parametrize('retrycount,max_retries,expected', [
|
||||||
(0, 3, 1),
|
(0, 3, 10),
|
||||||
(1, 3, 2),
|
(1, 3, 5),
|
||||||
(2, 3, 5),
|
(2, 3, 2),
|
||||||
(3, 3, 10),
|
(3, 3, 1),
|
||||||
(0, 1, 1),
|
(0, 1, 2),
|
||||||
(1, 1, 2),
|
(1, 1, 1),
|
||||||
])
|
])
|
||||||
def test_calculate_backoff(retry, max_retries, expected):
|
def test_calculate_backoff(retrycount, max_retries, expected):
|
||||||
assert calculate_backoff(retry, max_retries) == expected
|
assert calculate_backoff(retrycount, max_retries) == expected
|
||||||
|
|
Loading…
Reference in New Issue
Block a user