mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-20 02:28:10 +01:00
dirty fix for exchange rates
This commit is contained in:
parent
a6de60aab7
commit
e532ce1971
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user