dirty fix for exchange rates
This commit is contained in:
parent
a6de60aab7
commit
e532ce1971
1 changed files with 4 additions and 2 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import httpx
|
|
||||||
from typing import Callable, NamedTuple
|
from typing import Callable, NamedTuple
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
currencies = {
|
currencies = {
|
||||||
"AED": "United Arab Emirates Dirham",
|
"AED": "United Arab Emirates Dirham",
|
||||||
"AFN": "Afghan Afghani",
|
"AFN": "Afghan Afghani",
|
||||||
|
|
@ -244,14 +245,15 @@ async def btc_price(currency: str) -> float:
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
data = r.json()
|
data = r.json()
|
||||||
rate = float(provider.getter(data, replacements))
|
rate = float(provider.getter(data, replacements))
|
||||||
|
rates.append(rate)
|
||||||
await send_channel.put(rate)
|
await send_channel.put(rate)
|
||||||
except Exception:
|
except Exception:
|
||||||
await send_channel.put(None)
|
await send_channel.put(None)
|
||||||
|
|
||||||
# asyncio.create_task(controller, nursery)
|
# asyncio.create_task(controller, nursery)
|
||||||
for key, provider in exchange_rate_providers.items():
|
for key, provider in exchange_rate_providers.items():
|
||||||
|
await fetch_price(key, provider)
|
||||||
asyncio.create_task(fetch_price(key, provider))
|
asyncio.create_task(fetch_price(key, provider))
|
||||||
|
|
||||||
if not rates:
|
if not rates:
|
||||||
return 9999999999
|
return 9999999999
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue