Parametrize ohlcv_candle_limit (per call)

This commit is contained in:
Matthias
2019-06-09 14:52:17 +02:00
parent 3380543878
commit 9f2e0b11d1
2 changed files with 11 additions and 7 deletions

View File

@@ -74,6 +74,7 @@ class Exchange(object):
_ft_has_default: Dict = {
"stoploss_on_exchange": False,
"order_time_in_force": ["gtc"],
"ohlcv_candle_limit": 500,
"ohlcv_partial_candle": True,
}
_ft_has: Dict = {}
@@ -112,7 +113,8 @@ class Exchange(object):
logger.info("Overriding exchange._ft_has with config params, result: %s", self._ft_has)
# Assign this directly for easy access
self._drop_incomplete = self._ft_has['ohlcv_partial_candle']
self._ohlcv_candle_limit = self._ft_has['ohlcv_candle_limit']
self._ohlcv_partial_candle = self._ft_has['ohlcv_partial_candle']
# Initialize ccxt objects
self._api: ccxt.Exchange = self._init_ccxt(
@@ -521,10 +523,8 @@ class Exchange(object):
async def _async_get_history(self, pair: str,
ticker_interval: str,
since_ms: int) -> List:
# Assume exchange returns 500 candles
_LIMIT = 500
one_call = timeframe_to_msecs(ticker_interval) * _LIMIT
one_call = timeframe_to_msecs(ticker_interval) * self._ohlcv_candle_limit
logger.debug(
"one_call: %s msecs (%s)",
one_call,
@@ -581,7 +581,8 @@ class Exchange(object):
self._pairs_last_refresh_time[(pair, ticker_interval)] = ticks[-1][0] // 1000
# keeping parsed dataframe in cache
self._klines[(pair, ticker_interval)] = parse_ticker_dataframe(
ticks, ticker_interval, fill_missing=True, drop_incomplete=self._drop_incomplete)
ticks, ticker_interval, fill_missing=True,
drop_incomplete=self._ohlcv_partial_candle)
return tickers
def _now_is_time_to_refresh(self, pair: str, ticker_interval: str) -> bool: