From e532ce19718044119162fd4f9f689b46f250bb00 Mon Sep 17 00:00:00 2001 From: Tiago vasconcelos Date: Fri, 22 Oct 2021 11:00:15 +0100 Subject: [PATCH] dirty fix for exchange rates --- lnbits/utils/exchange_rates.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lnbits/utils/exchange_rates.py b/lnbits/utils/exchange_rates.py index 7e2e782ca..0e9207b36 100644 --- a/lnbits/utils/exchange_rates.py +++ b/lnbits/utils/exchange_rates.py @@ -1,7 +1,8 @@ import asyncio -import httpx from typing import Callable, NamedTuple +import httpx + currencies = { "AED": "United Arab Emirates Dirham", "AFN": "Afghan Afghani", @@ -244,14 +245,15 @@ async def btc_price(currency: str) -> float: r.raise_for_status() data = r.json() rate = float(provider.getter(data, replacements)) + rates.append(rate) await send_channel.put(rate) except Exception: await send_channel.put(None) # asyncio.create_task(controller, nursery) for key, provider in exchange_rate_providers.items(): + await fetch_price(key, provider) asyncio.create_task(fetch_price(key, provider)) - if not rates: return 9999999999