cache ticker-data per pair
fixes bug in telegram which shows very high ROI percentage
This commit is contained in:
parent
ce243a04b3
commit
afcb15c8fa
@ -200,10 +200,10 @@ def get_ticker(pair: str, refresh: Optional[bool] = True) -> dict:
|
|||||||
global _TICKER_CACHE
|
global _TICKER_CACHE
|
||||||
try:
|
try:
|
||||||
if not refresh:
|
if not refresh:
|
||||||
if _TICKER_CACHE:
|
if _TICKER_CACHE and pair in _TICKER_CACHE:
|
||||||
return _TICKER_CACHE
|
return _TICKER_CACHE[pair]
|
||||||
_TICKER_CACHE = _API.fetch_ticker(pair)
|
_TICKER_CACHE[pair] = _API.fetch_ticker(pair)
|
||||||
return _TICKER_CACHE
|
return _TICKER_CACHE[pair]
|
||||||
except ccxt.NetworkError as e:
|
except ccxt.NetworkError as e:
|
||||||
raise NetworkException(
|
raise NetworkException(
|
||||||
'Could not load tickers due to networking error. Message: {}'.format(e)
|
'Could not load tickers due to networking error. Message: {}'.format(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user