From 01d31dd61d284221c0f9c89ae901a2cfb38f0875 Mon Sep 17 00:00:00 2001 From: Joel Lehtonen Date: Mon, 5 Dec 2022 18:44:05 +0200 Subject: [PATCH] exchange_rate: Add precisions of some cryptocurrencies There are many cryptocurrencies available in CoinGecko and some other exchange rate providers. If the user wants to use a cryptocurrency as a display currency, the precisions used to be 2. This patch adds precisions of some cryptocurrencies. --- electrum/exchange_rate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electrum/exchange_rate.py b/electrum/exchange_rate.py index cdd6d76ab..a47923660 100644 --- a/electrum/exchange_rate.py +++ b/electrum/exchange_rate.py @@ -34,7 +34,10 @@ CCY_PRECISIONS = {'BHD': 3, 'BIF': 0, 'BYR': 0, 'CLF': 4, 'CLP': 0, 'JOD': 3, 'JPY': 0, 'KMF': 0, 'KRW': 0, 'KWD': 3, 'LYD': 3, 'MGA': 1, 'MRO': 1, 'OMR': 3, 'PYG': 0, 'RWF': 0, 'TND': 3, 'UGX': 0, 'UYI': 0, 'VND': 0, - 'VUV': 0, 'XAF': 0, 'XAU': 4, 'XOF': 0, 'XPF': 0} + 'VUV': 0, 'XAF': 0, 'XAU': 4, 'XOF': 0, 'XPF': 0, + # Cryptocurrencies + 'BTC': 8, 'LTC': 8, 'XRP': 6, 'ETH': 18, + } def to_decimal(x: Union[str, float, int, Decimal]) -> Decimal: