From 4182a7891a261e0dd7facd605a2667f9d2169412 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 17 Sep 2022 10:41:48 +0200 Subject: [PATCH] Allow leverage tier cache to be 4 weeks old. we've seen from binance that it's not changing this often. --- freqtrade/exchange/exchange.py | 2 +- tests/exchange/test_okx.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 33a56c530..a2ddc16e8 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2304,7 +2304,7 @@ class Exchange: updated = tiers.get('updated') if updated: updated_dt = parser.parse(updated) - if updated_dt < datetime.now(timezone.utc) - timedelta(days=1): + if updated_dt < datetime.now(timezone.utc) - timedelta(weeks=4): logger.info("Cached leverage tiers are outdated. Will update.") return None return tiers['data'] diff --git a/tests/exchange/test_okx.py b/tests/exchange/test_okx.py index 12322acae..ac5c81ebb 100644 --- a/tests/exchange/test_okx.py +++ b/tests/exchange/test_okx.py @@ -472,7 +472,7 @@ def test_load_leverage_tiers_okx(default_conf, mocker, markets, tmpdir, caplog, api_mock.fetch_market_leverage_tiers.call_count == 0 # 2 day passes ... - time_machine.move_to(datetime.now() + timedelta(days=2)) + time_machine.move_to(datetime.now() + timedelta(weeks=5)) exchange.load_leverage_tiers() assert log_has(logmsg, caplog)