Python
The stream drops when your connection does. Reconnect in a loop, and keep
seen bounded (for example, the last 100,000 keys) in a long-running process.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Follow the live tape and print every fill over $10,000, with the trader’s name.
import json, os, requests
seen = set()
with requests.get(
"https://codex-api.nomos.trade/v1/stream/fills",
headers={"Authorization": f"Bearer {os.environ['CODEX_KEY']}"},
stream=True, timeout=(10, 60),
) as r:
for line in r.iter_lines(decode_unicode=True):
if not line.startswith("data: "):
continue
block = json.loads(line[6:])
for f in block["fills"]:
key = (f["tx"], f["logIndex"])
if key in seen or f["usd"] < 10_000:
continue
seen.add(key)
who = (f.get("profile") or {}).get("name") or f["wallet"]
print(f"{who} {f['side']} ${f['usd']:,.0f} at {f['price']:.3f} in {f['conditionId']}")
seen bounded (for example, the last 100,000 keys) in a long-running process.