Remove cache from get_ticker

This commit is contained in:
enenn
2018-03-26 21:33:14 +02:00
parent 916165a7c5
commit 954e5c095f
3 changed files with 5 additions and 33 deletions

View File

@@ -26,7 +26,6 @@ API_RETRY_COUNT = 4
# Holds all open sell orders for dry_run
_DRY_RUN_OPEN_ORDERS: Dict[str, Any] = {}
_TICKER_CACHE: dict = {}
def retrier(f):
def wrapper(*args, **kwargs):
@@ -218,15 +217,11 @@ def get_balances() -> dict:
raise OperationalException(e)
# TODO: remove refresh argument, keeping it to keep track of where it was intended to be used
@retrier
def get_ticker(pair: str, refresh: Optional[bool] = True) -> dict:
global _TICKER_CACHE
try:
if not refresh:
if _TICKER_CACHE and pair in _TICKER_CACHE:
return _TICKER_CACHE[pair]
_TICKER_CACHE[pair] = _API.fetch_ticker(pair)
return _TICKER_CACHE[pair]
return _API.fetch_ticker(pair)
except ccxt.NetworkError as e:
raise NetworkException(
'Could not load tickers due to networking error. Message: {}'.format(e)