diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index c694756f5..36f5ecd39 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -67,6 +67,8 @@ class Exchange: "ohlcv_params": {}, "ohlcv_candle_limit": 500, "ohlcv_partial_candle": True, + # Check https://github.com/ccxt/ccxt/issues/10767 for removal of ohlcv_volume_currency + "ohlcv_volume_currency": "base", # "base" or "quote" "trades_pagination": "time", # Possible are "time" or "id" "trades_pagination_arg": "since", "l2_limit_range": None, diff --git a/freqtrade/exchange/ftx.py b/freqtrade/exchange/ftx.py index 6cd549d60..e9eb2fe19 100644 --- a/freqtrade/exchange/ftx.py +++ b/freqtrade/exchange/ftx.py @@ -19,6 +19,7 @@ class Ftx(Exchange): _ft_has: Dict = { "stoploss_on_exchange": True, "ohlcv_candle_limit": 1500, + "ohlcv_volume_currency": "quote", } def market_is_tradable(self, market: Dict[str, Any]) -> bool: diff --git a/freqtrade/plugins/pairlist/VolumePairList.py b/freqtrade/plugins/pairlist/VolumePairList.py index 204bc7bea..5d78422bb 100644 --- a/freqtrade/plugins/pairlist/VolumePairList.py +++ b/freqtrade/plugins/pairlist/VolumePairList.py @@ -184,12 +184,16 @@ class VolumePairList(IPairList): ] if (p['symbol'], self._lookback_timeframe) in candles else None # in case of candle data calculate typical price and quoteVolume for candle if pair_candles is not None and not pair_candles.empty: - pair_candles['typical_price'] = (pair_candles['high'] + pair_candles['low'] - + pair_candles['close']) / 3 - pair_candles['quoteVolume'] = ( - pair_candles['volume'] * pair_candles['typical_price'] - ) + if self._exchange._ft_has["ohlcv_volume_currency"] == "base": + pair_candles['typical_price'] = (pair_candles['high'] + pair_candles['low'] + + pair_candles['close']) / 3 + pair_candles['quoteVolume'] = ( + pair_candles['volume'] * pair_candles['typical_price'] + ) + else: + # Exchange ohlcv data is in quote volume already. + pair_candles['quoteVolume'] = pair_candles['volume'] # ensure that a rolling sum over the lookback_period is built # if pair_candles contains more candles than lookback_period quoteVolume = (pair_candles['quoteVolume']