-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_array.py
More file actions
39 lines (31 loc) · 1.19 KB
/
Copy pathdebug_array.py
File metadata and controls
39 lines (31 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import asyncio
import os
import httpx
from dotenv import load_dotenv
load_dotenv()
async def debug():
api_key = os.getenv("BLOCKSIZE_API_KEY")
url = "https://data.blocksize.capital/marketdata/v1/api"
async with httpx.AsyncClient() as client:
res = await client.post(
url,
headers={"x-api-key": api_key, "Content-Type": "application/json"},
json={
"jsonrpc": "2.0",
"method": "bidask_getSnapshot",
"params": {"ticker": ""},
"id": 1
}
)
snapshot = res.json().get('result', {}).get('snapshot', [])
tickers = [item.get("ticker", "").upper() for item in snapshot]
# Are there any typical equities? e.g. TSLA, MSFT?
for t in ["TSLA", "MSFT", "AAPL", "GOOGL", "NVDA", "Rates.US10Y", "US10Y", "RATES.US2Y"]:
if t in tickers:
print(f"FOUND EXACT: {t}")
# Let's see if there are ANY rates
for t in tickers:
if "US10Y" in t or "RATE" in t:
print(f"FOUND MATCH: {t}")
print(f"Total Tickers: {len(tickers)}")
asyncio.run(debug())