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
25
wowlet_backend/wsparse.py
Normal file
25
wowlet_backend/wsparse.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# Copyright (c) 2020, The Monero Project.
|
||||
# Copyright (c) 2020, dsc@xmr.pm
|
||||
|
||||
|
||||
class WebsocketParse:
|
||||
@staticmethod
|
||||
async def parser(cmd: str, data=None):
|
||||
if cmd == "txFiatHistory":
|
||||
return await WebsocketParse.txFiatHistory(data)
|
||||
|
||||
@staticmethod
|
||||
async def txFiatHistory(data=None):
|
||||
if not data or not isinstance(data, dict):
|
||||
return
|
||||
if "year" not in data or not isinstance(data['year'], int):
|
||||
return
|
||||
if "month" in data and not isinstance(data['month'], int):
|
||||
return
|
||||
|
||||
year = data.get('year')
|
||||
month = data.get('month')
|
||||
|
||||
from wowlet_backend.tasks.historical_prices import HistoricalPriceTask
|
||||
return await HistoricalPriceTask.get(year, month)
|
Loading…
Add table
Add a link
Reference in a new issue