mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
@@ -2431,14 +2431,17 @@ class Exchange:
|
|||||||
def load_cached_leverage_tiers(self, stake_currency: str) -> Optional[Dict[str, List[Dict]]]:
|
def load_cached_leverage_tiers(self, stake_currency: str) -> Optional[Dict[str, List[Dict]]]:
|
||||||
filename = self._config['datadir'] / "futures" / f"leverage_tiers_{stake_currency}.json"
|
filename = self._config['datadir'] / "futures" / f"leverage_tiers_{stake_currency}.json"
|
||||||
if filename.is_file():
|
if filename.is_file():
|
||||||
tiers = file_load_json(filename)
|
try:
|
||||||
updated = tiers.get('updated')
|
tiers = file_load_json(filename)
|
||||||
if updated:
|
updated = tiers.get('updated')
|
||||||
updated_dt = parser.parse(updated)
|
if updated:
|
||||||
if updated_dt < datetime.now(timezone.utc) - timedelta(weeks=4):
|
updated_dt = parser.parse(updated)
|
||||||
logger.info("Cached leverage tiers are outdated. Will update.")
|
if updated_dt < datetime.now(timezone.utc) - timedelta(weeks=4):
|
||||||
return None
|
logger.info("Cached leverage tiers are outdated. Will update.")
|
||||||
return tiers['data']
|
return None
|
||||||
|
return tiers['data']
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Error loading cached leverage tiers. Refreshing.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def fill_leverage_tiers(self) -> None:
|
def fill_leverage_tiers(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user