generated from orcfax/python-template-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cer-feeds.json describes the feeds currently supported by Orcfax. The file should be added during deployment and will be maintained separately from this repository.
1 parent
43c1c3a
commit 79074ae
Showing
7 changed files
with
208 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,3 +132,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Custom | ||
*.bk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"meta": { | ||
"description": "active Orcfax CER feeds", | ||
"version": "2024.08.06.0002" | ||
}, | ||
"feeds": [ | ||
{ | ||
"pair": "ADA-IUSD", | ||
"label": "ADA-iUSD", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "ADA-USDM", | ||
"label": "ADA-USDM", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "ADA-DJED", | ||
"label": "ADA-DJED", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "SHEN-ADA", | ||
"label": "SHEN-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "MIN-ADA", | ||
"label": "MIN-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "FACT-ADA", | ||
"label": "FACT-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "subsidized", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "ADA-USD", | ||
"label": "ADA-USD", | ||
"interval": 3600, | ||
"deviation": 1, | ||
"source": "cex", | ||
"calculation": "median", | ||
"status": "subsidized", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "LQ-ADA", | ||
"label": "LQ-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "SNEK-ADA", | ||
"label": "SNEK-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "LENFI-ADA", | ||
"label": "LENFI-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "HUNT-ADA", | ||
"label": "HUNT-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "IBTC-ADA", | ||
"label": "iBTC-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
}, | ||
{ | ||
"pair": "IETH-ADA", | ||
"label": "iETH-ADA", | ||
"interval": 3600, | ||
"deviation": 2, | ||
"source": "dex", | ||
"calculation": "weighted mean", | ||
"status": "showcase", | ||
"type": "CER" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# requirements for the production project. | ||
|
||
certifi==2024.7.4 | ||
pydantic==2.8.2 | ||
tenacity==9.0.0 | ||
websockets==12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Helpers for processing feed specification data.""" | ||
|
||
# pylint: disable=E0611,R0902 | ||
|
||
import json | ||
import logging | ||
|
||
from pydantic.dataclasses import dataclass | ||
from pydantic.tools import parse_obj_as | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@dataclass | ||
class FeedSpec: | ||
pair: str | ||
label: str | ||
interval: int | ||
deviation: int | ||
source: str | ||
calculation: str | ||
status: str | ||
type: str = "CER" | ||
|
||
|
||
async def read_feed_data(feed_data: str) -> list[FeedSpec]: | ||
""" "Read feed data into memory for use in the script.""" | ||
feed_dict = None | ||
with open(feed_data, "r", encoding="utf-8") as json_feeds: | ||
feed_dict = json.loads(json_feeds.read()) | ||
logger.info("cer-feeds version: %s", feed_dict["meta"]["version"]) | ||
logger.info("number of feeds: %s", len(feed_dict["feeds"])) | ||
feeds = [] | ||
for item in feed_dict["feeds"]: | ||
feed = parse_obj_as(FeedSpec, item) | ||
feeds.append(feed) | ||
return feeds | ||
|
||
|
||
def get_deviation(feed_id: str, feeds: list[FeedSpec]): | ||
"""Retrieve deviation for a given price pair.""" | ||
for feed in feeds: | ||
if feed.pair != feed_id: | ||
continue | ||
return feed.deviation |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export ORCFAX_VALIDATOR= |