Live trading API
Trade today's session: orders, positions, idempotency.
The live trading API trades today's session against the real-time market. It mirrors the historical orders API but lives under /live and operates on a single, in-progress simulation per user. See Live trading for the concepts. Requires a registered account.
Endpoints
| Method | Path | Purpose |
|---|---|---|
POST |
/live |
Start today's live simulation |
GET |
/live |
Get your current live simulation |
DELETE |
/live |
End your live simulation |
POST |
/live/orders |
Place an order |
POST |
/live/orders/dry-run |
Validate + preview without persisting |
PUT |
/live/orders |
Atomically cancel + replace a pending limit order |
DELETE |
/live/orders/{id} |
Cancel a pending order |
GET |
/live/orders · /live/orders/{id} |
List / get orders |
GET |
/live/positions |
Current positions |
GET |
/live/history |
Per-second P&L history (chart line) |
GET |
/live/transactions |
Transaction log |
Start a session
curl -s https://api.0dtespx.com/live \
-X POST -H "Authorization: $TOKEN" -H 'Content-Type: application/json' \
-d '{"starting_capital":"100000","description":"my live session"}'
Returns 201 with the live-simulation object. The date is implicitly today, and you can only have one active live simulation at a time — there is no daily cap on how many you create. A session can only be created while the market is open and live data is flowing — otherwise you get 400.
Place an order
The request body matches the historical orders API. Two additions make retries safe:
curl -s https://api.0dtespx.com/live/orders \
-X POST -H "Authorization: $TOKEN" -H 'Content-Type: application/json' \
-H 'Idempotency-Key: ord-2025-05-07-001' \
-d '{
"type":"limit","price":"5.00","price_effect":"debit",
"legs":[{"instrument":"SPXW 260507C05950000","quantity":"1","action":"buy to open"}]
}'
Idempotency-Key(header, optional but recommended) — a duplicate submission within the retention window returns the original response instead of placing a second order.client_order_id(body, optional UUID) — used as the order's id; a replay with the same id resolves to the existing order. When omitted, one is derived from the idempotency key, so most clients never need to set it.
Order lifecycle
Live orders never time-travel — status is the persisted state and stays terminal once set:
| Status | Meaning |
|---|---|
pending |
Accepted, awaiting a matching tick |
filled |
Executed |
canceled |
You canceled the pending order |
expired |
Auto-expired at the 4:00 PM ET close |
rejected |
Failed a buying-power recheck at fill time (rejection_reason explains) |
No orders are accepted after the close (400, kind market_closed).
Cancel and replace
# cancel a pending order
curl -s -X DELETE https://api.0dtespx.com/live/orders/$ORDER_ID -H "Authorization: $TOKEN"
# atomically cancel + replace a pending LIMIT order's price
curl -s -X PUT https://api.0dtespx.com/live/orders \
-H "Authorization: $TOKEN" -H 'Content-Type: application/json' \
-d '{"order_id":"'"$ORDER_ID"'","type":"limit","price":"5.50","price_effect":"debit","legs":[ … ]}'
Only price and price_effect may change in a replacement; type, legs, and underlying are fixed. Cancelling or replacing a non-pending order returns 409. Replacing a non-limit order returns 400.
Read your state
curl -s https://api.0dtespx.com/live -H "Authorization: $TOKEN" # current sim
curl -s https://api.0dtespx.com/live/orders -H "Authorization: $TOKEN" # orders
curl -s https://api.0dtespx.com/live/positions -H "Authorization: $TOKEN" # positions
curl -s https://api.0dtespx.com/live/history -H "Authorization: $TOKEN" # per-second P&L history
curl -s https://api.0dtespx.com/live/transactions -H "Authorization: $TOKEN" # transactions
Live state also pushes over the WebSocket — REST is authoritative for an operation you just performed; the WebSocket is the source of truth for changes you didn't initiate (other tabs, fills, the close). De-dupe orders by id and prefer the newer updated_at. After a disconnect, refetch positions/orders/transactions to recover.
Settlement and ending
Settlement runs automatically once the closing tick is recorded; the session then moves into your historical endpoints and GET /live returns null. End a session early with DELETE /live, after which you can POST /live again for a fresh session the same day.
Error semantics
| Status | Meaning |
|---|---|
400 |
Validation error (insufficient buying power, market closed, …) |
409 |
Order is no longer pending — can't cancel or replace |
503 |
Live trading briefly unavailable — always safe to retry; no state changed |