Browse Source

exchange_rate: "BTC" to "BTC" rate is not guaranteed to be present

Which ccy rates are available depends on the configured
exchange (config key use_exchange) and the configured currency (config
key currency). Only for some exchanges, the fx.ccy-BTC fx rate is
available (depends on the ExchangeBase.get_rates implementation).

As they say, for hodlers 1 BTC = 1 BTC.
master
Joel Lehtonen 3 years ago
parent
commit
0b540956fb
  1. 2
      electrum/exchange_rate.py

2
electrum/exchange_rate.py

@ -176,6 +176,8 @@ class ExchangeBase(Logger):
def get_cached_spot_quote(self, ccy: str) -> Decimal: def get_cached_spot_quote(self, ccy: str) -> Decimal:
"""Returns the cached exchange rate as a Decimal""" """Returns the cached exchange rate as a Decimal"""
if ccy == 'BTC':
return Decimal(1)
rate = self._quotes.get(ccy) rate = self._quotes.get(ccy)
if rate is None: if rate is None:
return Decimal('NaN') return Decimal('NaN')

Loading…
Cancel
Save