mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-17 05:11:15 +00:00
remove lock
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Lock
|
|
||||||
|
|
||||||
import ccxt
|
import ccxt
|
||||||
from cachetools import TTLCache
|
from cachetools import TTLCache
|
||||||
@@ -73,7 +72,6 @@ class Binance(Exchange):
|
|||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._spot_delist_schedule_cache: TTLCache = TTLCache(maxsize=100, ttl=300)
|
self._spot_delist_schedule_cache: TTLCache = TTLCache(maxsize=100, ttl=300)
|
||||||
self._spot_delist_schedule_cache_lock = Lock()
|
|
||||||
|
|
||||||
def get_proxy_coin(self) -> str:
|
def get_proxy_coin(self) -> str:
|
||||||
"""
|
"""
|
||||||
@@ -493,35 +491,32 @@ class Binance(Exchange):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
cache = self._spot_delist_schedule_cache
|
cache = self._spot_delist_schedule_cache
|
||||||
lock = self._spot_delist_schedule_cache_lock
|
|
||||||
|
|
||||||
if not refresh:
|
if not refresh:
|
||||||
with lock:
|
delist_time = cache.get(pair, None)
|
||||||
delist_time = cache.get(pair, None)
|
|
||||||
|
|
||||||
if delist_time:
|
if delist_time:
|
||||||
return delist_time
|
return delist_time
|
||||||
|
|
||||||
delist_schedule = self.get_spot_delist_schedule()
|
delist_schedule = self.get_spot_delist_schedule()
|
||||||
|
|
||||||
if delist_schedule is None:
|
if delist_schedule is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
with lock:
|
for schedule in delist_schedule:
|
||||||
for schedule in delist_schedule:
|
delist_dt = dt_from_ts(int(schedule["delistTime"]))
|
||||||
delist_dt = dt_from_ts(int(schedule["delistTime"]))
|
for symbol in schedule["symbols"]:
|
||||||
for symbol in schedule["symbols"]:
|
ft_symbol = next(
|
||||||
ft_symbol = next(
|
(
|
||||||
(
|
pair
|
||||||
pair
|
for pair, market in self.markets.items()
|
||||||
for pair, market in self.markets.items()
|
if market.get("id", None) == symbol
|
||||||
if market.get("id", None) == symbol
|
),
|
||||||
),
|
None,
|
||||||
None,
|
)
|
||||||
)
|
if ft_symbol is None:
|
||||||
if ft_symbol is None:
|
continue
|
||||||
continue
|
|
||||||
|
|
||||||
cache[ft_symbol] = delist_dt
|
cache[ft_symbol] = delist_dt
|
||||||
|
|
||||||
return cache.get(pair, None)
|
return cache.get(pair, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user