Return ticker_interval from async routine
used to identify calls in refresh_latest_ohlcv
This commit is contained in:
parent
e503d811bd
commit
d6df3e55c0
@ -522,7 +522,7 @@ class Exchange(object):
|
|||||||
|
|
||||||
# Combine tickers
|
# Combine tickers
|
||||||
data: List = []
|
data: List = []
|
||||||
for p, ticker in tickers:
|
for p, ticker_interval, ticker in tickers:
|
||||||
if p == pair:
|
if p == pair:
|
||||||
data.extend(ticker)
|
data.extend(ticker)
|
||||||
# Sort data again after extending the result - above calls return in "async order"
|
# Sort data again after extending the result - above calls return in "async order"
|
||||||
@ -558,7 +558,8 @@ class Exchange(object):
|
|||||||
logger.warning("Async code raised an exception: %s", res.__class__.__name__)
|
logger.warning("Async code raised an exception: %s", res.__class__.__name__)
|
||||||
continue
|
continue
|
||||||
pair = res[0]
|
pair = res[0]
|
||||||
ticks = res[1]
|
tick_interval[1]
|
||||||
|
ticks = res[2]
|
||||||
# keeping last candle time as last refreshed time of the pair
|
# keeping last candle time as last refreshed time of the pair
|
||||||
if ticks:
|
if ticks:
|
||||||
self._pairs_last_refresh_time[pair] = ticks[-1][0] // 1000
|
self._pairs_last_refresh_time[pair] = ticks[-1][0] // 1000
|
||||||
@ -568,7 +569,11 @@ class Exchange(object):
|
|||||||
|
|
||||||
@retrier_async
|
@retrier_async
|
||||||
async def _async_get_candle_history(self, pair: str, tick_interval: str,
|
async def _async_get_candle_history(self, pair: str, tick_interval: str,
|
||||||
since_ms: Optional[int] = None) -> Tuple[str, List]:
|
since_ms: Optional[int] = None) -> Tuple[str, str, List]:
|
||||||
|
"""
|
||||||
|
Asyncronously gets candle histories using fetch_ohlcv
|
||||||
|
returns tuple: (pair, tick_interval, ohlcv_list)
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
# fetch ohlcv asynchronously
|
# fetch ohlcv asynchronously
|
||||||
logger.debug("fetching %s since %s ...", pair, since_ms)
|
logger.debug("fetching %s since %s ...", pair, since_ms)
|
||||||
@ -587,7 +592,7 @@ class Exchange(object):
|
|||||||
logger.exception("Error loading %s. Result was %s.", pair, data)
|
logger.exception("Error loading %s. Result was %s.", pair, data)
|
||||||
return pair, []
|
return pair, []
|
||||||
logger.debug("done fetching %s ...", pair)
|
logger.debug("done fetching %s ...", pair)
|
||||||
return pair, data
|
return pair, tick_interval, data
|
||||||
|
|
||||||
except ccxt.NotSupported as e:
|
except ccxt.NotSupported as e:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
|
Loading…
Reference in New Issue
Block a user