Merge pull request #6309 from freqtrade/fix_krakenci

Filter tickers on stake-currency for kraken
This commit is contained in:
Matthias 2022-01-28 08:08:00 +01:00 committed by GitHub
commit e062188a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View File

@ -953,7 +953,7 @@ class Exchange:
raise OperationalException(e) from e raise OperationalException(e) from e
@retrier @retrier
def get_tickers(self, cached: bool = False) -> Dict: def get_tickers(self, symbols: List[str] = None, cached: bool = False) -> Dict:
""" """
:param cached: Allow cached result :param cached: Allow cached result
:return: fetch_tickers result :return: fetch_tickers result
@ -963,7 +963,7 @@ class Exchange:
if tickers: if tickers:
return tickers return tickers
try: try:
tickers = self._api.fetch_tickers() tickers = self._api.fetch_tickers(symbols)
self._fetch_tickers_cache['fetch_tickers'] = tickers self._fetch_tickers_cache['fetch_tickers'] = tickers
return tickers return tickers
except ccxt.NotSupported as e: except ccxt.NotSupported as e:

View File

@ -1,6 +1,6 @@
""" Kraken exchange subclass """ """ Kraken exchange subclass """
import logging import logging
from typing import Any, Dict from typing import Any, Dict, List
import ccxt import ccxt
@ -33,6 +33,12 @@ class Kraken(Exchange):
return (parent_check and return (parent_check and
market.get('darkpool', False) is False) market.get('darkpool', False) is False)
def get_tickers(self, symbols: List[str] = None, cached: bool = False) -> Dict:
# Only fetch tickers for current stake currency
# Otherwise the request for kraken becomes too large.
symbols = list(self.get_markets(quote_currencies=[self._config['stake_currency']]))
return super().get_tickers(symbols=symbols, cached=cached)
@retrier @retrier
def get_balances(self) -> dict: def get_balances(self) -> dict:
if self._config['dry_run']: if self._config['dry_run']:

View File

@ -29,12 +29,12 @@ EXCHANGES = {
'hasQuoteVolume': True, 'hasQuoteVolume': True,
'timeframe': '5m', 'timeframe': '5m',
}, },
# 'kraken': { 'kraken': {
# 'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
# 'stake_currency': 'USDT', 'stake_currency': 'USDT',
# 'hasQuoteVolume': True, 'hasQuoteVolume': True,
# 'timeframe': '5m', 'timeframe': '5m',
# }, },
'ftx': { 'ftx': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
'stake_currency': 'USDT', 'stake_currency': 'USDT',