diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index 889bb49c2..23ba2eb10 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -14,5 +14,6 @@ from freqtrade.exchange.exchange import (available_exchanges, ccxt_exchanges, timeframe_to_seconds, validate_exchange, validate_exchanges) from freqtrade.exchange.ftx import Ftx +from freqtrade.exchange.hitbtc import Hitbtc from freqtrade.exchange.kraken import Kraken from freqtrade.exchange.kucoin import Kucoin diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 809cdb4e1..6642b946d 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -59,6 +59,7 @@ class Exchange: _ft_has_default: Dict = { "stoploss_on_exchange": False, "order_time_in_force": ["gtc"], + "ohlcv_params": {}, "ohlcv_candle_limit": 500, "ohlcv_partial_candle": True, "trades_pagination": "time", # Possible are "time" or "id" @@ -874,17 +875,11 @@ class Exchange: "Fetching pair %s, interval %s, since %s %s...", pair, timeframe, since_ms, s ) - #fixing support for HitBTC #4778 - if self.name== 'HitBTC': - data = await self._api_async.fetch_ohlcv(pair, timeframe=timeframe, - since=since_ms, - limit=self.ohlcv_candle_limit(timeframe), - params={"sort": "DESC"} - ) - else: - data = await self._api_async.fetch_ohlcv(pair, timeframe=timeframe, + params = self._ft_has.get('ohlcv_params', {}) + data = await self._api_async.fetch_ohlcv(pair, timeframe=timeframe, since=since_ms, - limit=self.ohlcv_candle_limit(timeframe)) + limit=self.ohlcv_candle_limit(timeframe), + params=params) # Some exchanges sort OHLCV in ASC order and others in DESC. # Ex: Bittrex returns the list of OHLCV in ASC order (oldest first, newest last) diff --git a/freqtrade/exchange/hitbtc.py b/freqtrade/exchange/hitbtc.py new file mode 100644 index 000000000..b9d32b56d --- /dev/null +++ b/freqtrade/exchange/hitbtc.py @@ -0,0 +1,26 @@ +""" hitbtx exchange subclass """ +import logging +from typing import Dict + +from freqtrade.exchange import Exchange + + +logger = logging.getLogger(__name__) + + +class Hitbtc(Exchange): + """ + Hitbtc exchange class. Contains adjustments needed for Freqtrade to work + with this exchange. + + Please note that this exchange is not included in the list of exchanges + officially supported by the Freqtrade development team. So some features + may still not work as expected. + """ + + # fetchCurrencies API point requires authentication for Hitbtc, + _ft_has: Dict = { + "ohlcv_candle_limit": 1000, + + "ohlcv_params": {"sort": "DESC"} + }