refactor: Consolidate all py interop into single lib

It was just too hard trying to make it work with separate libs. The
main issue was getting the python md and execution modules to
recognize PySecurityList and other types defined in the core module.
This commit is contained in:
John Colvin committed 2025-06-09 06:06:50 +00:00
1 parent 44948ab4db
commit 2174162081
87 files changed
+1125 -1181

No files matched your search

@@ -0,0 +1,49 @@
import json
from typing import Optional
from pathlib import Path
test_data_dir = Path("/").joinpath(
"home",
"bts",
".local",
"share",
"bts",
"sparkd",
"data",
"test_data",
"binance",
)
def load_securities() -> list:
with open(test_data_dir.joinpath("exch_info.json")) as f:
return json.load(f)["symbols"]
return []
def load_books() -> list:
with open(test_data_dir.joinpath("books.json")) as f:
return json.load(f)["books"]
return []
if __name__ == "__main__":
raw_secs = load_securities()
for s in raw_secs:
obj = {
"venue": "Binance",
"name": s["symbol"],
"asset": s["baseAsset"],
"group": s["baseAsset"],
"currency": s["quoteAsset"],
}
print(json.dumps(obj))
raw_books = load_books()
for b in raw_books:
obj = {
"name": b["name"],
"bids": b["bids"],
"asks": b["asks"],
}
print(json.dumps(obj))