mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 04:03:55 +00:00
Support per exchange params for OHLCV endpoint
This commit is contained in:
parent
37d8e3c758
commit
0b280a59bc
|
@ -14,5 +14,6 @@ from freqtrade.exchange.exchange import (available_exchanges, ccxt_exchanges,
|
||||||
timeframe_to_seconds, validate_exchange,
|
timeframe_to_seconds, validate_exchange,
|
||||||
validate_exchanges)
|
validate_exchanges)
|
||||||
from freqtrade.exchange.ftx import Ftx
|
from freqtrade.exchange.ftx import Ftx
|
||||||
|
from freqtrade.exchange.hitbtc import Hitbtc
|
||||||
from freqtrade.exchange.kraken import Kraken
|
from freqtrade.exchange.kraken import Kraken
|
||||||
from freqtrade.exchange.kucoin import Kucoin
|
from freqtrade.exchange.kucoin import Kucoin
|
||||||
|
|
|
@ -59,6 +59,7 @@ class Exchange:
|
||||||
_ft_has_default: Dict = {
|
_ft_has_default: Dict = {
|
||||||
"stoploss_on_exchange": False,
|
"stoploss_on_exchange": False,
|
||||||
"order_time_in_force": ["gtc"],
|
"order_time_in_force": ["gtc"],
|
||||||
|
"ohlcv_params": {},
|
||||||
"ohlcv_candle_limit": 500,
|
"ohlcv_candle_limit": 500,
|
||||||
"ohlcv_partial_candle": True,
|
"ohlcv_partial_candle": True,
|
||||||
"trades_pagination": "time", # Possible are "time" or "id"
|
"trades_pagination": "time", # Possible are "time" or "id"
|
||||||
|
@ -874,17 +875,11 @@ class Exchange:
|
||||||
"Fetching pair %s, interval %s, since %s %s...",
|
"Fetching pair %s, interval %s, since %s %s...",
|
||||||
pair, timeframe, since_ms, s
|
pair, timeframe, since_ms, s
|
||||||
)
|
)
|
||||||
#fixing support for HitBTC #4778
|
params = self._ft_has.get('ohlcv_params', {})
|
||||||
if self.name== 'HitBTC':
|
|
||||||
data = await self._api_async.fetch_ohlcv(pair, timeframe=timeframe,
|
data = await self._api_async.fetch_ohlcv(pair, timeframe=timeframe,
|
||||||
since=since_ms,
|
since=since_ms,
|
||||||
limit=self.ohlcv_candle_limit(timeframe),
|
limit=self.ohlcv_candle_limit(timeframe),
|
||||||
params={"sort": "DESC"}
|
params=params)
|
||||||
)
|
|
||||||
else:
|
|
||||||
data = await self._api_async.fetch_ohlcv(pair, timeframe=timeframe,
|
|
||||||
since=since_ms,
|
|
||||||
limit=self.ohlcv_candle_limit(timeframe))
|
|
||||||
|
|
||||||
# Some exchanges sort OHLCV in ASC order and others in DESC.
|
# 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)
|
# Ex: Bittrex returns the list of OHLCV in ASC order (oldest first, newest last)
|
||||||
|
|
26
freqtrade/exchange/hitbtc.py
Normal file
26
freqtrade/exchange/hitbtc.py
Normal file
|
@ -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"}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user