From 0ef59ad8e8c15346d976f6281dd18076353156fd Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 29 Oct 2023 16:03:27 -0700 Subject: [PATCH] Fix exclude ARS from blockchain.info --- api/utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/api/utils.py b/api/utils.py index d992f3c2..6e24f586 100644 --- a/api/utils.py +++ b/api/utils.py @@ -92,12 +92,16 @@ def get_exchange_rates(currencies): blockchain_prices = session.get(api_url).json() blockchain_rates = [] for currency in currencies: - try: # If a currency is missing place a None - blockchain_rates.append( - float(blockchain_prices[currency]["last"]) - ) - except Exception: + # Do not include ARS from Blockchain.info . This pricing is estimated wrongly. + if currency == "ARS": blockchain_rates.append(np.nan) + else: + try: # If a currency is missing place a None + blockchain_rates.append( + float(blockchain_prices[currency]["last"]) + ) + except Exception: + blockchain_rates.append(np.nan) api_rates.append(blockchain_rates) elif "yadio.io" in api_url: