Skip to content

Commit

Permalink
Explicit map coingecko symbol to ID for bnb and sol
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Feb 6, 2022
1 parent c5e0daf commit da73e75
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions freqtrade/rpc/fiat_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
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.
Expand Down Expand Up @@ -77,8 +86,9 @@ def _get_gekko_id(self, crypto_symbol):
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']
Expand Down

0 comments on commit da73e75

Please sign in to comment.