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.
50 lines
1.0 KiB
Python
50 lines
1.0 KiB
Python
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))
|