From da73e754b4c6310c00382b39a96baa4c58a9423b Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 6 Feb 2022 14:19:21 +0100 Subject: [PATCH] Explicit map coingecko symbol to ID for bnb and sol closes #6361 --- freqtrade/rpc/fiat_convert.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/freqtrade/rpc/fiat_convert.py b/freqtrade/rpc/fiat_convert.py index f65fd2d54..82a6a4778 100644 --- a/freqtrade/rpc/fiat_convert.py +++ b/freqtrade/rpc/fiat_convert.py @@ -17,6 +17,15 @@ from freqtrade.constants import SUPPORTED_FIAT logger = logging.getLogger(__name__) +# Manually map symbol to ID for some common coins +# with duplicate coingecko entries +coingecko_mapping = { + 'eth': 'ethereum', + 'bnb': 'binancecoin', + 'sol': 'solana', +} + + class CryptoToFiatConverter: """ Main class to initiate Crypto to FIAT. @@ -77,8 +86,9 @@ class CryptoToFiatConverter: else: return None found = [x for x in self._coinlistings if x['symbol'] == crypto_symbol] - if crypto_symbol == 'eth': - found = [x for x in self._coinlistings if x['id'] == 'ethereum'] + + if crypto_symbol in coingecko_mapping.keys(): + found = [x for x in self._coinlistings if x['id'] == coingecko_mapping[crypto_symbol]] if len(found) == 1: return found[0]['id']