Allow leverage tier cache to be 4 weeks old.
we've seen from binance that it's not changing this often.
This commit is contained in:
parent
6682ae35b3
commit
4182a7891a
@ -2304,7 +2304,7 @@ class Exchange:
|
|||||||
updated = tiers.get('updated')
|
updated = tiers.get('updated')
|
||||||
if updated:
|
if updated:
|
||||||
updated_dt = parser.parse(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.")
|
logger.info("Cached leverage tiers are outdated. Will update.")
|
||||||
return None
|
return None
|
||||||
return tiers['data']
|
return tiers['data']
|
||||||
|
@ -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
|
api_mock.fetch_market_leverage_tiers.call_count == 0
|
||||||
# 2 day passes ...
|
# 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()
|
exchange.load_leverage_tiers()
|
||||||
|
|
||||||
assert log_has(logmsg, caplog)
|
assert log_has(logmsg, caplog)
|
||||||
|
Loading…
Reference in New Issue
Block a user