0DTESPX.com

Simulations API

Create simulations, advance the clock, and read financials.

A simulation is a single historical trading day you drive through the API. You create it, advance its clock, and read financials, positions, and transactions at the current time. See Simulations for the concepts. All endpoints require authentication.

Endpoints

Method Path Purpose
GET /simulations List your simulations
POST /simulations Create a simulation
GET /simulations/{id} Get one simulation with financials
PATCH /simulations/{id} Set or advance the clock
DELETE /simulations/{id} Delete a simulation
GET /simulations/{id}/history Per-second financial history

Historical simulations reject date == today — use the live trading API for today's session.

Create a simulation

curl -s https://api.0dtespx.com/simulations \
  -X POST -H "Authorization: $TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "date": "2025-01-15",
    "starting_capital": 100000,
    "description": "Iron condor day"
  }'

Starting capital ranges from 1000 to 10000000. Remember that naked shorts need large margin (strike × 0.20 × qty × 100) while spreads are cheap — see Buying power. The response is the simulation object with its id and a full financial snapshot:

{
	"id": "f3c88e1a-…",
	"date": "2025-01-15",
	"starting_capital": "100000",
	"ended": false,
	"start_time": "2025-01-15T14:30:00Z",
	"end_time": "2025-01-15T21:00:00Z",
	"available_buying_power": "100000",
	"net_liquidation_value": "100000",
	"unrealized_profit_loss": "0",
	"realized_profit_loss": "0",
	"profit_loss": "0"
}

The full object also breaks financials out into equities vs equity-options components. time is null until the first PATCH. Constraints: one simulation per date per user; there is no cap on how many simulations you keep.

Advance the clock

A fresh simulation is parked at start_time with no clock. Set the time with PATCH:

curl -s https://api.0dtespx.com/simulations/$SIM \
  -X PATCH -H "Authorization: $TOKEN" -H 'Content-Type: application/json' \
  -d '{"time":"2025-01-15T17:00:00Z"}'

The response is the same shape, with time filled in and all financials recomputed at the new moment. Time must satisfy start_time ≤ time ≤ end_time, or you get 400. Moving time is read-only — it recomputes positions, delta, P&L, and buying power from existing trades; it never writes orders or transactions. Setting the time backward reverts not-yet-filled orders to pending and hides later trades; setting it to end_time triggers settlement and flips ended to true.

Per-second history

curl -s https://api.0dtespx.com/simulations/$SIM/history -H "Authorization: $TOKEN"

Returns an array of per-second snapshots (net liquidation value, P&L, buying power, fees, …) for charting, sampled at 1-second resolution. History is recomputed and stored whenever you create or delete an order; advancing time alone doesn't change it.

Delete

curl -s -X DELETE https://api.0dtespx.com/simulations/$SIM -H "Authorization: $TOKEN"

Returns 204.

Next: place orders and read positions.