mirror of
https://git.wownero.com/wowlet/wowlet-backend.git
synced 2024-08-15 01:03:13 +00:00
feather-ws -> wowlet-backend
This commit is contained in:
parent
04e10f6d2b
commit
abfe22e89c
20 changed files with 72 additions and 75 deletions
23
wowlet_backend/tasks/rates_fiat.py
Normal file
23
wowlet_backend/tasks/rates_fiat.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# Copyright (c) 2020, The Monero Project.
|
||||
# Copyright (c) 2020, dsc@xmr.pm
|
||||
|
||||
from wowlet_backend.utils import httpget
|
||||
from wowlet_backend.tasks import FeatherTask
|
||||
|
||||
|
||||
class FiatRatesTask(FeatherTask):
|
||||
def __init__(self, interval: int = 600):
|
||||
super(FiatRatesTask, self).__init__(interval)
|
||||
|
||||
self._cache_key = "fiat_rates"
|
||||
self._cache_expiry = self.interval * 10
|
||||
|
||||
self._websocket_cmd = "fiat_rates"
|
||||
|
||||
self._http_endpoint = "https://api.exchangeratesapi.io/latest?base=USD"
|
||||
|
||||
async def task(self):
|
||||
"""Fetch fiat rates"""
|
||||
result = await httpget(self._http_endpoint, json=True)
|
||||
return result
|
Loading…
Add table
Add a link
Reference in a new issue