Fix remaining coingecko spellings

This commit is contained in:
Matthias
2024-04-25 10:28:25 +02:00
parent 2d9be6c818
commit 96bb4db68e
2 changed files with 9 additions and 9 deletions

View File

@@ -84,7 +84,7 @@ class CryptoToFiatConverter(LoggingMixin):
logger.error(
f"Could not load FIAT Cryptocurrency map for the following problem: {exception}")
def _get_gekko_id(self, crypto_symbol):
def _get_gecko_id(self, crypto_symbol):
if not self._coinlistings:
if self._backoff <= datetime.now().timestamp():
self._load_cryptomap()
@@ -180,9 +180,9 @@ class CryptoToFiatConverter(LoggingMixin):
if crypto_symbol == fiat_symbol:
return 1.0
_gekko_id = self._get_gekko_id(crypto_symbol)
_gecko_id = self._get_gecko_id(crypto_symbol)
if not _gekko_id:
if not _gecko_id:
# return 0 for unsupported stake currencies (fiat-convert should not break the bot)
self.log_once(
f"unsupported crypto-symbol {crypto_symbol.upper()} - returning 0.0",
@@ -192,9 +192,9 @@ class CryptoToFiatConverter(LoggingMixin):
try:
return float(
self._coingecko.get_price(
ids=_gekko_id,
ids=_gecko_id,
vs_currencies=fiat_symbol
)[_gekko_id][fiat_symbol]
)[_gecko_id][fiat_symbol]
)
except Exception as exception:
logger.error("Error in _find_price: %s", exception)

View File

@@ -90,7 +90,7 @@ def test_loadcryptomap(mocker):
fiat_convert = CryptoToFiatConverter()
assert len(fiat_convert._coinlistings) == 2
assert fiat_convert._get_gekko_id("btc") == "bitcoin"
assert fiat_convert._get_gecko_id("btc") == "bitcoin"
def test_fiat_init_network_exception(mocker):
@@ -152,9 +152,9 @@ def test_fiat_multiple_coins(mocker, caplog):
{'id': 'ethereum-wormhole', 'symbol': 'eth', 'name': 'Ethereum Wormhole'},
]
assert fiat_convert._get_gekko_id('btc') == 'bitcoin'
assert fiat_convert._get_gekko_id('hnt') is None
assert fiat_convert._get_gekko_id('eth') == 'ethereum'
assert fiat_convert._get_gecko_id('btc') == 'bitcoin'
assert fiat_convert._get_gecko_id('hnt') is None
assert fiat_convert._get_gecko_id('eth') == 'ethereum'
assert log_has('Found multiple mappings in CoinGecko for hnt.', caplog)