Fix remaining coingecko spellings
This commit is contained in:
@@ -84,7 +84,7 @@ class CryptoToFiatConverter(LoggingMixin):
|
|||||||
logger.error(
|
logger.error(
|
||||||
f"Could not load FIAT Cryptocurrency map for the following problem: {exception}")
|
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 not self._coinlistings:
|
||||||
if self._backoff <= datetime.now().timestamp():
|
if self._backoff <= datetime.now().timestamp():
|
||||||
self._load_cryptomap()
|
self._load_cryptomap()
|
||||||
@@ -180,9 +180,9 @@ class CryptoToFiatConverter(LoggingMixin):
|
|||||||
if crypto_symbol == fiat_symbol:
|
if crypto_symbol == fiat_symbol:
|
||||||
return 1.0
|
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)
|
# return 0 for unsupported stake currencies (fiat-convert should not break the bot)
|
||||||
self.log_once(
|
self.log_once(
|
||||||
f"unsupported crypto-symbol {crypto_symbol.upper()} - returning 0.0",
|
f"unsupported crypto-symbol {crypto_symbol.upper()} - returning 0.0",
|
||||||
@@ -192,9 +192,9 @@ class CryptoToFiatConverter(LoggingMixin):
|
|||||||
try:
|
try:
|
||||||
return float(
|
return float(
|
||||||
self._coingecko.get_price(
|
self._coingecko.get_price(
|
||||||
ids=_gekko_id,
|
ids=_gecko_id,
|
||||||
vs_currencies=fiat_symbol
|
vs_currencies=fiat_symbol
|
||||||
)[_gekko_id][fiat_symbol]
|
)[_gecko_id][fiat_symbol]
|
||||||
)
|
)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
logger.error("Error in _find_price: %s", exception)
|
logger.error("Error in _find_price: %s", exception)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ def test_loadcryptomap(mocker):
|
|||||||
fiat_convert = CryptoToFiatConverter()
|
fiat_convert = CryptoToFiatConverter()
|
||||||
assert len(fiat_convert._coinlistings) == 2
|
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):
|
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'},
|
{'id': 'ethereum-wormhole', 'symbol': 'eth', 'name': 'Ethereum Wormhole'},
|
||||||
]
|
]
|
||||||
|
|
||||||
assert fiat_convert._get_gekko_id('btc') == 'bitcoin'
|
assert fiat_convert._get_gecko_id('btc') == 'bitcoin'
|
||||||
assert fiat_convert._get_gekko_id('hnt') is None
|
assert fiat_convert._get_gecko_id('hnt') is None
|
||||||
assert fiat_convert._get_gekko_id('eth') == 'ethereum'
|
assert fiat_convert._get_gecko_id('eth') == 'ethereum'
|
||||||
|
|
||||||
assert log_has('Found multiple mappings in CoinGecko for hnt.', caplog)
|
assert log_has('Found multiple mappings in CoinGecko for hnt.', caplog)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user