1
0

Add yadio.io api to exchange rate

This commit is contained in:
Arian Ventura Rodríguez
2022-09-23 15:27:00 -04:00
committed by accumulator
parent 444dc7fb7f
commit 7de1c604c6
2 changed files with 100 additions and 0 deletions

View File

@@ -181,6 +181,15 @@ class ExchangeBase(Logger):
return Decimal('NaN')
return Decimal(rate)
class Yadio(ExchangeBase):
async def get_currencies(self):
dicts = await self.get_json('api.yadio.io', '/currencies')
return list(dicts.keys())
async def get_rates(self, ccy: str) -> Mapping[str, Optional[Decimal]]:
json = await self.get_json('api.yadio.io', '/rate/%s/BTC' % ccy)
return {ccy: to_decimal(json['rate'])}
class BitcoinAverage(ExchangeBase):
# note: historical rates used to be freely available