Python SDK for Headless Oracle V5 — signed market status receipts for AI agents
Project description
headless-oracle (Python SDK)
Prevent your trading bot from executing orders against closed, halted, or holiday-closed markets. Handles ~1,300 schedule edge cases per year across 7 global exchanges.
Built on Headless Oracle V5 — every status assertion is Ed25519-signed and expires in 60 seconds, so stale receipts never reach your execution layer.
Installation
pip install headless-oracle
With LangChain integration:
pip install "headless-oracle[langchain]"
With CrewAI integration:
pip install "headless-oracle[crewai]"
Quick start
from headless_oracle import OracleClient, verify
client = OracleClient(api_key="ok_live_...")
# Fetch a signed receipt and verify it
receipt = client.get_status("XNYS")
result = verify(receipt)
if not result.valid:
raise RuntimeError(f"Receipt invalid: {result.reason}")
# Fail-closed: treat anything that isn't OPEN as CLOSED
if receipt["status"] != "OPEN":
print("Market is not open — halting all execution")
else:
print("Market is OPEN — proceed with trading logic")
Verification without a network call
For high-throughput use cases, pass the public key directly to skip the key registry fetch:
PUBLIC_KEY = "03dc27993a2c90856cdeb45e228ac065f18f69f0933c917b2336c1e75712f178"
result = verify(receipt, public_key=PUBLIC_KEY)
Batch queries
receipts = client.get_batch(["XNYS", "XNAS", "XLON"])
for r in receipts["receipts"]:
print(r["mic"], r["status"])
Verifying receipt fields
| Field | Description |
|---|---|
receipt_id |
UUID, unique per receipt |
issued_at |
ISO 8601 UTC timestamp |
expires_at |
Act before this time (60s TTL) |
issuer |
"headlessoracle.com" — resolve {issuer}/v5/keys to find the public key |
mic |
Exchange MIC code (e.g. XNYS) |
status |
OPEN, CLOSED, HALTED, or UNKNOWN |
source |
SCHEDULE, OVERRIDE, or SYSTEM |
receipt_mode |
demo or live |
schema_version |
v5.0 |
public_key_id |
Key identifier (matches /v5/keys registry) |
signature |
128-char hex Ed25519 signature of canonical payload |
Always treat UNKNOWN as CLOSED. It means the oracle encountered an internal error and failed safely.
Integrations
Supported exchanges
| MIC | Exchange | Timezone |
|---|---|---|
| XNYS | New York Stock Exchange | America/New_York |
| XNAS | NASDAQ | America/New_York |
| XLON | London Stock Exchange | Europe/London |
| XJPX | Japan Exchange Group | Asia/Tokyo |
| XPAR | Euronext Paris | Europe/Paris |
| XHKG | Hong Kong Exchanges | Asia/Hong_Kong |
| XSES | Singapore Exchange | Asia/Singapore |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file headless_oracle-0.1.0.tar.gz.
File metadata
- Download URL: headless_oracle-0.1.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99965672a60229650f9541fcb90ff8c0b0d9eed4fdf2cee6405bed461f2c79e3
|
|
| MD5 |
faff29390e306a7e63b31c54df7efdac
|
|
| BLAKE2b-256 |
a3b45707c04d22f2023049cac6b39f01fdad869c933108ffd5c81c2b7cb0f7c2
|
File details
Details for the file headless_oracle-0.1.0-py3-none-any.whl.
File metadata
- Download URL: headless_oracle-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e03250e340d9ca311a6546517b9ed57f3022b1928af0112c58d081d4726729c
|
|
| MD5 |
56cf799fe1914181c6565e8ef92b3985
|
|
| BLAKE2b-256 |
c5b34b58f08dfca9d0192f2f196c359cabfa118d399a2d2fd26ad6deea3048f7
|