Add tests for leverage tiers caching

This commit is contained in:
Matthias
2022-08-20 13:47:34 +02:00
parent b6e8b9df35
commit 738e95b875
2 changed files with 26 additions and 3 deletions

View File

@@ -2280,6 +2280,8 @@ class Exchange:
def cache_leverage_tiers(self, tiers: Dict[str, List[Dict]], stake_currency: str) -> None:
filename = self._config['datadir'] / "futures" / f"leverage_tiers_{stake_currency}.json"
if not filename.parent.is_dir():
filename.parent.mkdir(parents=True)
data = {
"updated": datetime.now(timezone.utc),
"data": tiers,
@@ -2293,7 +2295,6 @@ class Exchange:
updated = tiers.get('updated')
if updated:
updated_dt = parser.parse(updated)
print(updated_dt)
if updated_dt < datetime.now(timezone.utc) - timedelta(days=1):
logger.info("Cached leverage tiers are outdated. Will update.")
return None