Filter tickers on stake-currency for kraken

This commit is contained in:
Matthias 2022-01-28 07:20:47 +01:00
parent 9df7014de3
commit 138e867a68
3 changed files with 15 additions and 9 deletions

View File

@ -953,7 +953,7 @@ class Exchange:
raise OperationalException(e) from e
@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
:return: fetch_tickers result
@ -963,7 +963,7 @@ class Exchange:
if tickers:
return tickers
try:
tickers = self._api.fetch_tickers()
tickers = self._api.fetch_tickers(symbols)
self._fetch_tickers_cache['fetch_tickers'] = tickers
return tickers
except ccxt.NotSupported as e:

View File

@ -1,6 +1,6 @@
""" Kraken exchange subclass """
import logging
from typing import Any, Dict
from typing import Any, Dict, List
import ccxt
@ -33,6 +33,12 @@ class Kraken(Exchange):
return (parent_check and
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
def get_balances(self) -> dict:
if self._config['dry_run']:

View File

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