# 0DTESPX > 0DTESPX.com is a paper-trading platform for zero-days-to-expiration (0DTE) SPX index options. Replay any past trading session or trade today's market in real time, track positions and live Greeks, build and backtest strategies, and drive it all through a public HTTP + WebSocket API. ## Getting started - [Overview](https://www.0dtespx.com/docs): What 0DTESPX.com is and how the platform fits together. - [Quick start](https://www.0dtespx.com/docs/quick-start): Run your first paper-trading session in a few minutes. - [Access & accounts](https://www.0dtespx.com/docs/access): What visitors and registered users can do. ## Core concepts - [0DTE & SPX options](https://www.0dtespx.com/docs/options-basics): A primer on zero-days-to-expiration SPX index options. - [Simulations](https://www.0dtespx.com/docs/simulations): How a trading day is recreated, with a clock you control. - [Option chain & Greeks](https://www.0dtespx.com/docs/option-chain): Reading bids, asks, and live delta, gamma, theta, vega and IV. - [Orders & order types](https://www.0dtespx.com/docs/orders): Market, limit, stop, and multi-leg orders and how they fill. - [Positions & P&L](https://www.0dtespx.com/docs/positions): Tracking direction, cost basis, and realized vs unrealized P&L. - [Buying power & margin](https://www.0dtespx.com/docs/buying-power): FINRA maintenance-margin rules for shorts, spreads, and condors. - [Fees](https://www.0dtespx.com/docs/fees): The brokerage fee schedule applied to every order. - [End-of-day settlement](https://www.0dtespx.com/docs/settlement): What happens to open options at the 4:00 PM ET close. ## Trading & research - [Live trading](https://www.0dtespx.com/docs/live-trading): Paper trade today's session against the real-time tick stream. - [Historical replay](https://www.0dtespx.com/docs/historical-replay): Scrub through any past trading day at your own pace. - [Strategy builder](https://www.0dtespx.com/docs/strategy-builder): Define a 0DTE strategy with a structured form. - [AI strategy assistant](https://www.0dtespx.com/docs/ai-assistant): Describe a strategy in plain English and let the AI author it. - [Strategy results](https://www.0dtespx.com/docs/backtesting): Every saved strategy owns shared backtest results over the recorded history. - [Market data & charts](https://www.0dtespx.com/docs/market-data): Live and historical SPX/VIX data, option chains, and overlays. ## API reference - [Overview & authentication](https://www.0dtespx.com/docs/api/overview): Base URL, auth, access levels, and conventions. - [API walkthrough](https://www.0dtespx.com/docs/api/walkthrough): An end-to-end paper-trading tutorial with copy-pasteable curl examples. - [Rate limits](https://www.0dtespx.com/docs/api/rate-limits): The market-data credit budget and per-endpoint costs. - [Simulations API](https://www.0dtespx.com/docs/api/simulations): Create simulations, advance the clock, and read financials. - [Orders API](https://www.0dtespx.com/docs/api/orders): Place, preview, and cancel orders, including multi-leg. - [Positions & transactions](https://www.0dtespx.com/docs/api/positions-transactions): Read computed positions with Greeks and the transaction log. - [Market data API](https://www.0dtespx.com/docs/api/market-data): Sessions, strikes, history, and option-chain snapshots. - [Live trading API](https://www.0dtespx.com/docs/api/live-trading): Trade today's session: orders, positions, idempotency. - [Strategies API](https://www.0dtespx.com/docs/api/strategies): Preview, save, and read content-addressed strategies and their shared backtest results. - [WebSocket streams](https://www.0dtespx.com/docs/api/websocket): Real-time market data and per-simulation event channels. ## Reference - [Glossary](https://www.0dtespx.com/docs/glossary): Definitions for the terms used across the platform. - [FAQ](https://www.0dtespx.com/docs/faq): Answers to the questions we hear most often. ## API > The HTTP API exposes historical simulations, live trading, orders, positions, transactions, market data, saved strategies (each owning its shared backtest results), account flows, and a WebSocket channel for live data and per-simulation event streams. Errors are plain-text bodies with the appropriate HTTP status code. Authentication is a bearer session token from `POST /auth/sessions`, sent as the bare value of the `Authorization` header (no `Bearer ` prefix). Base URL: https://api.0dtespx.com. - [OpenAPI specification](https://www.0dtespx.com/openapi.yaml): Full HTTP and WebSocket reference — paths, parameters, request and response schemas, status codes, and security schemes (OpenAPI 3.0.3). - [API walkthrough](https://www.0dtespx.com/docs/api/walkthrough): End-to-end walkthrough with copy-pasteable `curl` examples — register, log in, list market sessions, create a simulation, advance the clock, place market/limit/stop orders, view positions/Greeks/P&L, end-of-day settlement, and the WebSocket live data feed. - [API overview](https://www.0dtespx.com/docs/api/overview): Base URL, authentication, access levels, conventions, and status codes for the HTTP + WebSocket API. ## API — core concepts - [Simulations](https://www.0dtespx.com/docs/simulations): A simulation recreates one trading day; time advance recomputes positions, Greeks, P&L, and buying power; per-second history is materialized on order create or delete. - [Order lifecycle](https://www.0dtespx.com/docs/orders): Placement, validation, creation (with pre-computed `fill_datetime`, `fill_price`, `fill_price_effect`, and settlement transactions), fill or pending, optional deletion, 16:00 ET settlement. - [Order types](https://www.0dtespx.com/docs/orders): Market, limit, and stop. ONLY limit orders may be multi-leg — market and stop orders must be single-leg (a multi-leg market/stop is rejected with HTTP 400). Stop orders that would trigger immediately at placement are rejected. - [Fill price rules](https://www.0dtespx.com/docs/orders): Market orders fill at the natural price (ask for a buy, bid for a sell). Limit/stop orders fill at the mid-based execution price: the mid, unless the bid/ask is exactly one tick wide (then the natural price) or the spread is an odd number of ticks (then the mid rounded one tick toward the market maker — up for a debit, down for a credit). Multi-leg limits use the combo's net price under the same even/odd-tick rule. Single-leg equities use a synthetic ±$0.01 spread (market → natural, limit → trade price). - [Slippage](https://www.0dtespx.com/docs/orders): a single per-account setting (Settings → Simulator Costs), NOT a per-order field or query param — a multiple of $0.05 from $0.00 to $1.00 (new accounts default to $0.05) applied identically to backtest, live, and historical fills. It affects limit/stop orders only (market orders fill at the natural price): the order fills once the mid reaches `price ∓ slippage` (debit −, credit +) and fills at `mid ± slippage`, with the stored `execution_price` as that threshold. The order's `slippage`/`execution_price` echo the applied value. Backtests apply it as a per-contract cost overlay at read time, resolved from your account setting, not in strategy code. - [SPX option price ticks](https://www.0dtespx.com/docs/orders): Single-leg < $3.00 → $0.05; single-leg ≥ $3.00 → $0.10; multi-leg → $0.05 always. Limit and stop prices must already land on the tick or HTTP 400. - Max-profit cap: a `limit` order's `price` cannot exceed the structural maximum profit of the leg combination (e.g. a $5-wide vertical caps at $5.00). Skipped when max profit is unbounded — naked long calls, ratio backspreads, calendars, mixed underlyings. Applies to historical place / dry-run and live place / dry-run / replace. - [Mid-price calculation](https://www.0dtespx.com/docs/orders): SPX options round to nickel (< $3.00) or dime (≥ $3.00); other options to penny. One-tick spread uses ask for buys, bid for sells; an odd-tick spread rounds the mid one tick toward the market maker. - [End-of-day settlement](https://www.0dtespx.com/docs/settlement): At 16:00 ET, OTM expires worthless; ITM exercises or is assigned. SPX/NDX/VIX/XSP are cash-settled at `(underlying − strike) × 100`. Covered shorts are netted against their long legs. - [Portfolio and financials](https://www.0dtespx.com/docs/positions): Positions, delta, brokerage fee schedule, unrealized/realized/total P&L, net-liquidation value, and FINRA maintenance-margin formulas (naked short, vertical, iron condor, covered). `delta` is decimal 0..1 unsigned (Abs applied; calls and puts both positive at the market layer — position direction provides the sign). Other Greeks (gamma, theta, vega, theo price, IV) are no longer recorded. - [Market data and rate limiting](https://www.0dtespx.com/docs/api/rate-limits): one leaky bucket per account — 10,000-credit capacity, ~0.116 credits/second drain (a request 429s when its cost exceeds remaining headroom `cap − used`, so `credits_used` can be below `credits_cap` and still reject). Metered market-data endpoints (all authenticated users — per-request costs 0–150, full-range snapshot priced per snapshot returned) and the per-session strategy drill-in `GET /strategies/{id}/results/days/{date}` (10 credits — it re-runs the session through the engine) draw on the bucket; unauthenticated traffic isn't metered but can only reach the most recent completed session at 30-second resolution. Backtest RUNS cost no credits: the backtester is protected by a per-user cap of 3 concurrently-executing runs (`429 too_many_active_backtests`, retry with backoff) and a priority queue. Everything else (auth, simulations, orders, positions, transactions, account management) is free; the unauthenticated `/auth/*` endpoints carry a separate small per-IP abuse throttle (burst 20, refill 10/min — `429` with `Retry-After`). - [WebSocket protocol](https://www.0dtespx.com/docs/api/websocket): `GET /__ws` upgrades to WebSocket; client has 5 seconds to send `{"auth": "public"}` or `{"token": ""}`. Every server-sent message is a JSON object with a top-level `channel` field (the routing key); `simulation_events` / `backtest_events` carry top-level `id` and `data`/`type` siblings instead of a nested `payload`. Client-to-server: auth + `{action:"subscribe"|"unsubscribe", channels|channel}`; for `simulation_events` add `live_simulation_id` (and an optional `last_event_by_sim` map) to scope to one sim; for `backtest_events` add `source_hash` to scope to one strategy's results (authorized against your saved strategy or live preview interest). Channels: `live_aggregate_data` (opt-in, 1s), `live_option_chain` (opt-in, 1s, token-authenticated users only; each strike's `call`/`put` carries only `bid`/`ask`/`delta`), `simulation_events` (opt-in per sim id), `backtest_events` (per-source-hash strategy-results progress frames — each carries the full fee-overlaid results snapshot under `data.snapshot`, so render straight from it; no replay; the HTTP results endpoint backs the initial load + reconnect; a dropped socket never stops a run), `end_of_data` (terminal sentinel). Public connections have a 5-minute stream cap and may subscribe to `live_aggregate_data`, but not `live_option_chain`. - [Live trading](https://www.0dtespx.com/docs/live-trading): Today's session, registered (authenticated) users only, `POST /live` is allowed only once the current time has reached the session's `data-start-time`, one active simulation per user at a time with no daily creation cap; persisted order lifecycle (no time-travel), `409` on cancel/replace of non-pending orders, post-close gate at 16:00 ET, automatic settlement once the close-time tick is published, `503` returns are always safe to retry. - [User accounts](https://www.0dtespx.com/docs/api/overview): Email + password registration with 6-digit verification (locked after 5 failed submissions), token-based sessions; verification codes are single-use and `POST /auth/register` consumes the code and returns the first session's token directly (no follow-up login call). Accounts are free and all registered users have full access. ## API — endpoints - [Authentication](https://www.0dtespx.com/openapi.yaml): `POST /auth/check-email`, `POST /auth/verify-email`, `POST /auth/register` (returns `{token}` — the first session), `POST /auth/forgot-password`, `POST /auth/reset-password`, `POST /auth/sessions` (login), `DELETE /auth/sessions` (logout). - [User account](https://www.0dtespx.com/openapi.yaml): `GET/PATCH /user` (`GET` returns `id`, `email`, `usage_percent`, `fee_schedule`; `PATCH` accepts `email`/`verification_code`, `password`/`verification_code`, `fee_schedule`). - [Simulations (historical)](https://www.0dtespx.com/openapi.yaml): `GET /simulations`, `POST /simulations` (rejects `date == today` — use `POST /live`), `GET /simulations/{id}`, `PATCH /simulations/{id}` (advance or rewind clock), `DELETE /simulations/{id}`, `GET /simulations/{id}/history` (per-second financial snapshots). - [Orders (historical)](https://www.0dtespx.com/openapi.yaml): `GET /simulations/{id}/orders`, `POST /simulations/{id}/orders`, `GET /simulations/{id}/orders/{orderId}`, `DELETE /simulations/{id}/orders/{orderId}`. - [Positions and transactions (historical)](https://www.0dtespx.com/openapi.yaml): `GET /simulations/{id}/positions` (computed at sim time, includes Greeks and P&L), `GET /simulations/{id}/transactions` (filtered by `datetime <= sim.time`). - [Live trading](https://www.0dtespx.com/openapi.yaml): `POST /live` (start today's live simulation), `GET /live`, `DELETE /live`, `POST /live/orders`, `POST /live/orders/dry-run`, `PUT /live/orders/{id}` (atomic cancel + replace; `price` and `price_effect` only), `DELETE /live/orders/{id}`, `GET /live/orders`, `GET /live/orders/{id}`, `GET /live/positions`, `GET /live/history` (per-second P&L history for the live chart line; empty array when no active sim), `GET /live/transactions`. Live orders never time-travel — `status` is `pending`/`filled`/`canceled`/`expired`/`rejected` and stays terminal once set. Mutating endpoints accept an `Idempotency-Key` request header; a `503` always means no state was changed and is safe to retry. `DELETE /live` may answer `202` when the live subsystem is briefly unreachable — the deletion completes in the background. `POST /live/orders` also accepts an optional `client_order_id` UUID — when omitted the API derives one from the `Idempotency-Key` (or fresh UUID) so a replay-after-crash returns the existing terminal `live_orders` row instead of re-running. - [Market data](https://www.0dtespx.com/openapi.yaml): `GET /market-data/sessions`, `GET /market-data/strikes/{date}`, `GET /market-data/historical/{date}` (selectable series via `?series=`), `GET /market-data/option-chain-snapshots/{timestamp}`, `GET /market-data/option-chain-snapshots/{startTime}/{endTime}`, `GET /market-data/average-expected-move`. - [WebSocket](https://www.0dtespx.com/openapi.yaml): `GET /__ws` — live market data feed, plus `backtest_events`: per-source-hash strategy-results progress frames (subscribe with `source_hash`; each frame carries the fee-overlaid results snapshot under `data.snapshot`; the HTTP results endpoints back the initial load + reconnect; any authenticated user). - [Saved strategies](https://www.0dtespx.com/openapi.yaml): strategies are content-addressed, immutable, and shared — identical configurations are ONE strategy with ONE set of backtest results, reused across users; results always cover every recorded session at a fixed $100k per-session capital, fees are applied at read time from the caller's fee schedule, and every user sees the full recorded history (the window is labeled explicitly and is always all recorded sessions). Each saved link has a per-user `privacy` flag — `private` (default) or `public`; public means UNLISTED ("anyone with the link"), NOT discoverable — there is no directory of public strategies and the id is an unguessable UUID, so a public strategy is reachable only by someone given its link, and once they have it any user or unauthenticated visitor can view AND clone it (a private one is owner-only). Cloning is just reading a public strategy's `config` and saving it as your own (no clone endpoint). `POST /strategies/preview` (`{config, abandon_hash?}` — the builder's per-change action; every distinct config IS a persisted backtest keyed by its source hash; returns the current fee-overlaid snapshot, instant for known configs; `400 invalid_config` with a `fields` map creates nothing; `429 too_many_active_backtests` at the 3-active-runs cap, retry with backoff), `GET /strategies/preview/{source_hash}/results` (the pre-save read path; doubles as the interest heartbeat keeping an unsaved preview's run alive), `POST /strategies/preview/abandon` (`{source_hash}`; stops the run at the next session boundary iff nobody else watches and it was never saved; interest also self-expires after 15 min), `POST /strategies` (`{config, privacy?}` — SAVE = publish: upserts the shared immutable strategy by hash, links it to you, and adopts the already-running/done backtest; `privacy` optional, defaults `private`; never 429s — at the cap the run is parked and auto-starts later; re-saving a config you removed resurrects the same id), `GET /strategies` (the leaderboard: each row carries full-history headline metrics net of the default fee schedule, coverage, staleness, and `privacy`), `GET /strategies/{id}` (immutable logic + full-history results snapshot + `new_sessions_available` + `privacy` + `is_owner`; AUTH OPTIONAL — public strategies readable by anyone incl. unauthenticated visitors, a private one you don't own returns 404), `PATCH /strategies/{id}` (owner only; per-user metadata: `description` override and `privacy` toggle — clone to change logic), `DELETE /strategies/{id}` (soft-unlink; shared results survive for other users), `GET /strategies/{id}/results/days` (full day list: gross, fees under your schedule, net), `GET /strategies/{id}/results/days.csv` (the same day list as a CSV attachment, plus the engine's fee-free `intraday_max_dd` and `spx_close`), `GET /strategies/{id}/results/days/{date}` (session drill-in RECOMPUTED ON DEMAND by re-running that day through the engine — seconds, not ms; orders + transactions with `overlay_fee` + decision log + the cost-adjusted (fees + slippage) intraday curve (always included); the headline `net_pnl` is gross minus both `fees` and `slippage`; `reconciliation_warning` flags engine drift; 10 rate-limit credits), `POST /strategies/{id}/results/update` (append newly recorded sessions — allowed for any user whenever new sessions exist; `202` queued; `429` at the cap). There are NO `/backtests*` endpoints and no run credits — results are served through the strategy. ## API — health - [Health probe](https://www.0dtespx.com/openapi.yaml): `GET /health` — liveness check, no auth.