mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
chore: update typing for reload function
This commit is contained in:
parent
c04cf6c5cb
commit
9f34153c84
|
@ -164,6 +164,10 @@ F = TypeVar("F", bound=Callable[..., Any])
|
||||||
def retrier(_func: F) -> F: ...
|
def retrier(_func: F) -> F: ...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def retrier(_func: F, *, retries=API_RETRY_COUNT) -> F: ...
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def retrier(*, retries=API_RETRY_COUNT) -> Callable[[F], F]: ...
|
def retrier(*, retries=API_RETRY_COUNT) -> Callable[[F], F]: ...
|
||||||
|
|
||||||
|
|
|
@ -623,7 +623,7 @@ class Exchange:
|
||||||
if self._exchange_ws:
|
if self._exchange_ws:
|
||||||
self._exchange_ws.reset_connections()
|
self._exchange_ws.reset_connections()
|
||||||
|
|
||||||
async def _api_reload_markets(self, reload: bool = False) -> None:
|
async def _api_reload_markets(self, reload: bool = False) -> Dict[str, Any]:
|
||||||
try:
|
try:
|
||||||
return await self._api_async.load_markets(reload=reload, params={})
|
return await self._api_async.load_markets(reload=reload, params={})
|
||||||
except ccxt.DDoSProtection as e:
|
except ccxt.DDoSProtection as e:
|
||||||
|
@ -662,7 +662,7 @@ class Exchange:
|
||||||
logger.debug("Performing scheduled market reload..")
|
logger.debug("Performing scheduled market reload..")
|
||||||
try:
|
try:
|
||||||
# on initial load, we retry 3 times to ensure we get the markets
|
# on initial load, we retry 3 times to ensure we get the markets
|
||||||
retries = 3 if force else 0
|
retries: int = 3 if force else 0
|
||||||
# Reload async markets, then assign them to sync api
|
# Reload async markets, then assign them to sync api
|
||||||
self._markets = retrier(self._load_async_markets, retries=retries)(reload=True)
|
self._markets = retrier(self._load_async_markets, retries=retries)(reload=True)
|
||||||
self._api.set_markets(self._api_async.markets, self._api_async.currencies)
|
self._api.set_markets(self._api_async.markets, self._api_async.currencies)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user