{"openapi":"3.1.0","info":{"title":"Sequence Markets API","description":"Cross-venue execution engine.\nPrices use fixed-point 1e9, quantities 1e8; timestamps are nanoseconds since Unix epoch. Auth: static operator key or Supabase JWT.\n\n## Core flow\n\n1. **Discover symbols** — `GET /v1/symbols`\n2. **Check venue connectivity** — `GET /v1/edges`\n3. **Get quotes / depth** — `GET /v1/quotes/BTC-USD?depth=20`\n4. **Submit order** — `POST /v1/orders`\n5. **Track fills** — `WS /v1/stream` (fills channel) or `GET /v1/fills`\n6. **Check positions** — `GET /v1/positions`\n\n## Real-time streams\n\n- `WS /v1/stream` — `prices:{symbol}`, `book:{symbol}`, `orders`, `fills`\n\n## Advanced\n\n- **Intelligence**: `/v1/intelligence/{depth,venues,slippage,routing}`\n- **Deployments**: `/v1/deployments/*` (native strategy deployment)\n- **Risk**: `/v1/risk` (informational read-out), `/v1/kill_switch`","license":{"name":""},"version":"1.0.0"},"servers":[{"url":"http://localhost:50052","description":"Local CC"}],"paths":{"/v1/deployments":{"get":{"tags":["Algos"],"summary":"List deployments with live edge data","operationId":"list_deployments","responses":{},"security":[{"bearer":[]}]},"post":{"tags":["Algos"],"summary":"Create deployment","operationId":"create_deployment_handler","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDeploymentRequest"}}},"required":true},"responses":{},"security":[{"bearer":[]}]}},"/v1/deployments/{deployment_id}":{"get":{"tags":["Algos"],"summary":"Get deployment with live edge data","operationId":"get_deployment_handler","parameters":[{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{},"security":[{"bearer":[]}]},"delete":{"tags":["Algos"],"summary":"Delete deployment","operationId":"delete_deployment_handler","parameters":[{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{},"security":[{"bearer":[]}]}},"/v1/deployments/{deployment_id}/start":{"post":{"tags":["Algos"],"summary":"Start deployment","operationId":"start_deployment","parameters":[{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{},"security":[{"bearer":[]}]}},"/v1/deployments/{deployment_id}/stop":{"post":{"tags":["Algos"],"summary":"Stop deployment","operationId":"stop_deployment","parameters":[{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{},"security":[{"bearer":[]}]}},"/v1/edges":{"get":{"tags":["Market Data"],"summary":"List connected venue edges","description":"Shows all connected exchanges and the symbols they're streaming. Use /v1/pairs for trading pair details.","operationId":"get_edges","responses":{"200":{"description":"Edge list","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EdgeStatusResponse"}}}}}},"security":[{"bearer":[]}]}},"/v1/fees":{"get":{"tags":["Market Data"],"summary":"Maker/taker fees per venue for a ticker","description":"Returns one row per requested venue with maker/taker bps for the given ticker, resolved to the AUTHENTICATED CLIENT'S effective tier (live per-pair tier from the venue's private API, falling back to the published base tier). `null` fees mean missing data, not zero. For size-aware fee + slippage estimates, use POST /v1/orders/preview.","operationId":"get_fees","parameters":[{"name":"ticker","in":"query","description":"Ticker / symbol to look up fees for. Required.","required":true,"schema":{"type":"string"}},{"name":"venues","in":"query","description":"Comma-separated venue list. Omit for every connected venue carrying the ticker.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Per-venue fees for the ticker","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeesResponse"}}}}},"security":[{"bearer":[]}]}},"/v1/fills":{"get":{"tags":["Orders"],"summary":"List fills","description":"Returns execution fills with cursor-based pagination. Optionally filtered by order ID or symbol.","operationId":"list_fills","parameters":[{"name":"node_order_id","in":"query","description":"Filter fills by order ID","required":false,"schema":{"type":"string"}},{"name":"symbol","in":"query","description":"Filter fills by symbol","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum number of fills to return (default 100, max 1000)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"after","in":"query","description":"Forward pagination cursor (opaque, from previous response `next_cursor`)","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fill list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListFillsResp"}}}}},"security":[{"bearer":[]}]}},"/v1/health":{"get":{"tags":["Health"],"summary":"Detailed health check","operationId":"health_check","responses":{"200":{"description":"Health status","content":{"application/json":{}}}}}},"/v1/health/edges":{"get":{"tags":["Health"],"summary":"Edge drift detection","description":"Compares EXPECTED_VENUES env list against currently connected edges (local + remote). Surfaces venues that have silently dropped from the universe.","operationId":"health_edges","responses":{"200":{"description":"Edge drift status","content":{"application/json":{}}}}}},"/v1/health/feeds":{"get":{"tags":["Health"],"summary":"Per-symbol data feed health","description":"Freshness, ring buffer utilization, gap detection, venue health, and reconciliation for every active symbol.","operationId":"data_health","responses":{"200":{"description":"Data health status","content":{"application/json":{}}}},"security":[{"bearer":[]}]}},"/v1/health/live":{"get":{"tags":["Health"],"summary":"Liveness probe","operationId":"health_live","responses":{"200":{"description":"Process is alive"}}}},"/v1/health/ready":{"get":{"tags":["Health"],"summary":"Readiness probe","operationId":"health_ready","responses":{"200":{"description":"Service ready"},"503":{"description":"Service not ready"}}}},"/v1/health/safety":{"get":{"tags":["Health"],"summary":"Execution safety probe","operationId":"health_safety","responses":{"200":{"description":"Execution admission is safe"},"503":{"description":"New dispatch is safety-halted"}}}},"/v1/kill_switch":{"put":{"tags":["Risk"],"summary":"Toggle kill switch","description":"Activate or deactivate the global kill switch. When active, all new orders are rejected and existing orders are cancelled. Admin-only.","operationId":"set_kill_switch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetKillSwitchReq"}}},"required":true},"responses":{"200":{"description":"Kill switch toggled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KillSwitchResp"}}}},"403":{"description":"Forbidden — admin only","content":{"application/json":{"schema":{"type":"object","description":"Wrapper schema for error responses: `{ \"error\": { ... } }`","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ApiErrorBody"}}}}}}},"security":[{"bearer":[]}]}},"/v1/market_data/pools":{"get":{"tags":["Market Data"],"summary":"Get DEX liquidity pools","description":"Per-pool data from PoolBookCache for a symbol.","operationId":"get_pools","parameters":[{"name":"symbol","in":"query","description":"Trading pair (e.g., ETH-USD)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Pool list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PoolsResponse"}}}}},"security":[{"bearer":[]}]}},"/v1/orders":{"get":{"tags":["Orders"],"summary":"List orders","description":"Global live working set by default (local engine + fresh peer mirrors + live venue observations). Set history=true or request a terminal status for the DB-backed history projection. Optional region is a diagnostic home filter.","operationId":"list_orders","parameters":[{"name":"symbol","in":"query","description":"Filter by symbol","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","description":"Filter by status. Fuzzy: \"open\" (the working set). Exact canonical:\nACCEPTED, RUNNING, PARTIAL, ACTIVE, COMPLETED, CANCELLED, REJECTED,\nUNCONFIRMED, UNRESOLVED, WAITING.","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum number of orders to return (default 100, max 1000)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"offset","in":"query","description":"Offset for pagination (legacy — use `after` cursor instead)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"after","in":"query","description":"Forward pagination cursor (opaque, from previous response `next_cursor`)","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","description":"Diagnostic home-region filter. Reads are global when omitted.","required":false,"schema":{"type":"string"}},{"name":"history","in":"query","description":"Read DB-backed terminal/history rows instead of the live global working set.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Paginated order list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOrdersResp"}}}}},"security":[{"bearer":[]}]}},"/v1/orders/{node_order_id}":{"get":{"tags":["Orders"],"summary":"Get a order by ID","description":"Returns order details. Use `?expand=fills` to inline fills.","operationId":"get_order","parameters":[{"name":"node_order_id","in":"path","description":"Order ID","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","description":"Comma-separated expansions: fills","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Order details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderRest"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"type":"object","description":"Wrapper schema for error responses: `{ \"error\": { ... } }`","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ApiErrorBody"}}}}}}},"security":[{"bearer":[]}]},"delete":{"tags":["Orders"],"summary":"Cancel an order","description":"Cancel a live order. Multi-venue splits cancel every venue leg.","operationId":"cancel_order","parameters":[{"name":"node_order_id","in":"path","description":"Order ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Order cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelOrderResp"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"type":"object","description":"Wrapper schema for error responses: `{ \"error\": { ... } }`","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ApiErrorBody"}}}}}}},"security":[{"bearer":[]}]}},"/v1/quotes":{"get":{"tags":["Market Data"],"summary":"Get NBBO for all symbols","description":"Returns NBBO + per-venue BBO for every symbol with valid quotes. Optional `?symbols=A,B,C` filter restricts to a comma-separated allow-list.","operationId":"get_all_quotes","parameters":[{"name":"symbols","in":"query","description":"Optional comma-separated symbol filter","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"All quotes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllQuotesResponse"}}}}},"security":[{"bearer":[]}]}},"/v1/quotes/{symbol}":{"get":{"tags":["Market Data"],"summary":"Get unified quote for a symbol","description":"NBBO + per-venue BBO + merged order book in one response.","operationId":"get_quotes","parameters":[{"name":"symbol","in":"path","description":"Trading pair (e.g., BTC-USD)","required":true,"schema":{"type":"string"}},{"name":"depth","in":"query","description":"Book depth per side (default 10, max 50)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"nowait","in":"query","description":"Skip the up-to-2s dynamic-subscribe wait. Research-grade only — trading code must not use this.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Quote data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}},"404":{"description":"No data for symbol"}},"security":[{"bearer":[]}]}},"/v1/quotes_batch":{"post":{"tags":["Market Data"],"summary":"Batch-fetch quotes for many symbols","description":"One round-trip for N symbols. Server-side tokio fan-out with bounded concurrency. Returns partials on per-symbol errors rather than failing the whole batch.","operationId":"post_quotes_batch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchQuotesRequest"}}},"required":true},"responses":{"200":{"description":"Batch quote data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchQuotesResponse"}}}},"400":{"description":"Bad request (empty symbol list, depth out of range)"}},"security":[{"bearer":[]}]}}},"components":{"schemas":{"AllQuoteEntry":{"type":"object","required":["symbol","nbbo","venues"],"properties":{"nbbo":{"$ref":"#/components/schemas/QuoteNbbo"},"symbol":{"type":"string"},"venues":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/QuoteVenue"},"propertyNames":{"type":"string"}}}},"AllQuotesResponse":{"type":"object","required":["quotes"],"properties":{"quotes":{"type":"array","items":{"$ref":"#/components/schemas/AllQuoteEntry"}}}},"ApiErrorBody":{"type":"object","description":"Structured API error body.","required":["code","message","request_id"],"properties":{"code":{"type":"string","description":"Machine-readable error code (e.g., \"VALIDATION_ERROR\", \"NOT_FOUND\")."},"details":{"type":"array","items":{"$ref":"#/components/schemas/FieldError"},"description":"Field-level validation errors (empty for non-validation errors)."},"message":{"type":"string","description":"Human-readable description."},"outcome_token_ids":{"type":"array","items":{"type":"string"},"description":"For `AMBIGUOUS_MULTI_OUTCOME` errors: the candidate token ids the\ncaller should retry with. Empty for all other error types."},"outcomes":{"type":"array","items":{"type":"string"},"description":"For `AMBIGUOUS_MULTI_OUTCOME` errors: the candidate human labels,\nparallel to `outcome_token_ids` (so consumers can render a\npick-one UI). Empty for all other error types."},"request_id":{"type":"string","description":"Correlation ID (from `X-Request-Id` header or auto-generated)."}}},"ApiErrorEnvelope":{"type":"object","description":"Wrapper schema for error responses: `{ \"error\": { ... } }`","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ApiErrorBody"}}},"BatchQuoteEntry":{"oneOf":[{"$ref":"#/components/schemas/QuoteResponse","description":"Successful quote — same shape as the singleton endpoint."},{"type":"object","description":"Per-symbol error — caller gets partial results instead of the whole\nbatch failing on one bad input.","required":["symbol","error"],"properties":{"error":{"type":"string"},"symbol":{"type":"string"}}}]},"BatchQuotesRequest":{"type":"object","required":["symbols"],"properties":{"concurrency":{"type":"integer","description":"Max concurrent upstream quote-fetches inside the batch. Default\n64; cap 256. Higher values fan out faster but risk rate-limiting\nat venue REST fallbacks (Polymarket CLOB, Kalshi public orderbook).","minimum":0},"depth":{"type":"integer","description":"Book depth per side (default 10, max 100). Applied uniformly.","minimum":0},"instrument_type":{"type":["string","null"],"description":"Optional override for `instrument_type` (applied uniformly). Leave\nunset to auto-detect per symbol (token_id/Kalshi-ticker →\nPrediction, everything else → Spot)."},"nowait":{"type":"boolean","description":"Skip the up-to-2s dynamic-subscribe wait per symbol. Strongly\nrecommended for bulk calls — without it, one cold symbol in the\nbatch can still stall everything else for up to 2s."},"symbols":{"type":"array","items":{"type":"string"},"description":"List of symbols (tickers, token_ids, slugs, URLs). Same resolution\nrules as the singleton `/v1/quotes/:symbol` path — slugs resolve via\nthe slug-resolver, token_ids route through Polymarket, etc."}}},"BatchQuotesResponse":{"type":"object","required":["quotes","count","elapsed_ms"],"properties":{"count":{"type":"integer","minimum":0},"elapsed_ms":{"type":"integer","format":"int64","description":"Wall time from request-received to all quotes resolved. Useful for\nclient-side pacing and backoff.","minimum":0},"quotes":{"type":"array","items":{"$ref":"#/components/schemas/BatchQuoteEntry"}}}},"CancelOrderResp":{"type":"object","required":["node_order_id","status"],"properties":{"node_order_id":{"type":"string"},"status":{"type":"string"}}},"CreateDeploymentRequest":{"type":"object","required":["symbols"],"properties":{"artifact_base64":{"type":["string","null"]},"bundle_id":{"type":["string","null"]},"config":{},"deployment_id":{"type":["string","null"],"description":"Optional override for the kernel deployment_id. When the caller\nalready created a fund-layer deployment (`POST /v1/fund/deployments`),\npassing that fund deployment's UUID here makes the kernel record\nshare the ID — so the algo's `PreTradeGate` lookups (keyed by\ndeployment_id) hit the gate entry CC pushed via `GateUpsert` on\nfund-deployment creation. Without this, kernel and fund IDs diverge\nand every algo order fail-closes at the gate."},"mesh_group":{"type":["string","null"],"description":"Mesh group — deployments sharing the same group form a cross-deployment mesh.\nInstances in different deployments with the same mesh_group can send messages\nto each other via `messaging::send(label, payload)`."},"mesh_label":{"type":["string","null"],"description":"Mesh label for this deployment (e.g., \"maker\", \"hedger\").\nUsed by mesh algos to identify peers. Defaults to edge_id if not set."},"name":{"type":["string","null"]},"start_immediately":{"type":"boolean"},"symbols":{"type":"array","items":{"type":"string"}},"venue":{"type":["string","null"]},"venues":{"type":["array","null"],"items":{"type":"string"},"description":"Target specific venues (e.g., [\"kraken\", \"coinbase\", \"dex-sol\"]).\nOverrides `venue` if both are set. None = all capable edges."}}},"EdgeStatusResponse":{"type":"object","required":["edge_id","connected","symbol_count","symbols","last_seen_ms","supports_algo_runtime"],"properties":{"connected":{"type":"boolean"},"edge_id":{"type":"string"},"last_seen_ms":{"type":"integer","format":"int64","minimum":0},"region":{"type":["string","null"],"description":"Region where this edge is connected (e.g., \"us-east-1\", \"eu-west-1\", \"ap-northeast-1\").\nLocal edges inherit the CC's region; remote edges report their peer CC's region."},"remote":{"type":["boolean","null"],"description":"True if this edge is connected to a remote peer CC, not this one directly."},"supports_algo_runtime":{"type":"boolean","description":"Whether this edge supports WASM algo deployment/execution"},"symbol_count":{"type":"integer","description":"Count of markets the edge has subscribed to. Equal to `symbols.len()`.\nAll prediction edges run universe-eager — there's no longer a \"hot\nvs cold\" distinction.","minimum":0},"symbols":{"type":"array","items":{"$ref":"#/components/schemas/EdgeSymbol"},"description":"Full list of symbols this edge is subscribed to, each tagged with\nits `instrument_type`. Without the tag, perp and spot edges that\nshare a canonical (Binance, Bybit, OKX) are indistinguishable here."}}},"EdgeSymbol":{"type":"object","required":["symbol","instrument_type"],"properties":{"instrument_type":{"type":"string","description":"`\"spot\"` / `\"perp\"` / `\"prediction\"`. Sourced from each edge's\nPairSpec (CC-LINK Hello + SubscriptionAck). Distinguishes\n`venue-edge-binance` (spot BTC-USDT) from `venue-edge-binance-perp`\n(perp BTC-USDT on the same canonical)."},"symbol":{"type":"string","description":"Canonical symbol the edge advertises (e.g. `BTC-USDT`). Perp and\nspot share the same canonical when the venue exposes both — the\n`instrument_type` field is what disambiguates the books."}}},"ExecutionType":{"type":"string","enum":["graph","armed","adopted"]},"FeeFormula":{"type":"object","required":["taker_fee_usd","maker_fee_usd"],"properties":{"maker_fee_usd":{"type":"string","description":"Plain-string formula for the maker fee in USD. May reference the\nsame variables as `taker_fee_usd`."},"taker_fee_usd":{"type":"string","description":"Plain-string formula for the taker fee in USD. Variables are\n`qty` (contracts), `price` (in [0, 1] for prediction markets, in\nquote-currency for CEX), and the named entries inside `components`\n(e.g. `rate_bps`, `exponent`, `multiplier`)."}}},"FeeRow":{"type":"object","required":["venue","fee_model","components","formula"],"properties":{"components":{"description":"Venue-specific curve parameters. Always a JSON object (possibly\nempty for `linear`). Stable keys per `fee_model`:\n - `binary_quadratic` (Polymarket): `{ rate_bps, exponent }`\n - `binary_quadratic` (Kalshi):     `{ rate_bps, multiplier, rounding }`\n - `linear`:                          `{}` (no extra params; `taker_bps` is the rate)"},"fee_model":{"type":"string","description":"Curve model:\n - `\"linear\"`             — CEX/DEX. `fee = qty × price × bps / 10_000`.\n - `\"binary_quadratic\"`   — Polymarket / Kalshi prediction markets.\n                             `fee = qty × price × (1-price) × rate_bps / 10_000`."},"formula":{"$ref":"#/components/schemas/FeeFormula","description":"Plain-string formulas the client can evaluate locally. Designed\nfor latency-sensitive callers that want to skip the\n`/v1/orders/preview` round-trip — fetch this once per ticker,\ncache, evaluate per (qty, price)."},"maker_bps":{"type":["integer","null"],"format":"int32","description":"Maker fee in basis points. For prediction venues (binary_quadratic)\nthis is the at-mid value; the realized maker rate is constant\ntoday (0% on Polymarket; 0% on Kalshi outside liquidity-program\nmarkets). For linear venues this is the published flat rate.","minimum":0},"taker_bps":{"type":["integer","null"],"format":"int32","description":"Taker fee in basis points. For prediction venues (binary_quadratic)\nthis is the **at-mid** value — the rate the venue charges at\np=0.5. Apply `formula.taker_fee_usd` (with `components.rate_bps`)\nfor the exact fee at any fill price. For linear venues this is\nthe published flat rate.","minimum":0},"venue":{"type":"string"}}},"FeesResponse":{"type":"object","required":["ticker","fees"],"properties":{"fees":{"type":"array","items":{"$ref":"#/components/schemas/FeeRow"}},"ticker":{"type":"string"}}},"FieldError":{"type":"object","description":"A single field-level validation error.","required":["field","message"],"properties":{"field":{"type":"string"},"message":{"type":"string"}}},"FillRecord":{"allOf":[{"$ref":"#/components/schemas/LineageFields"},{"type":"object","required":["id","fill_id","node_order_id","venue","symbol","side","instrument_type","qty_1e8","price_1e9","fee_1e9","ts_unix_ns"],"properties":{"commission_asset":{"type":["string","null"],"description":"Asset the commission was charged in (e.g. \"USD\", \"USDT\", \"BNB\").\nNeeded for FX reconciliation on venues that debit non-quote assets."},"exchange_ts_ns":{"type":["integer","null"],"format":"int64","minimum":0},"execution_region":{"type":["string","null"]},"fee_1e9":{"type":"integer","format":"int64"},"fee_breakdown":{"description":"Decomposed attribution (`commission_1e9`, `lp_fee_1e9`, `gas_1e9`,\n`priority_fee_1e9`, `mev_tip_1e9`, `funding_1e9`, `rebate_1e9`,\n`hop_fees_1e9`, `commission_asset`) — JSONB round-trip of\n`edge_core::cex::FeeBreakdown`."},"fill_id":{"type":"string"},"id":{"type":"integer","format":"int64"},"instrument_type":{"type":"string","description":"Instrument class of the parent order (\"spot\" | \"perp\" | \"prediction\"),\njoined from `orders`. Lets the fills blotter render the INSTR column\nwithout a second lookup."},"is_maker":{"type":["boolean","null"]},"maker_fee_bps_applied":{"type":["integer","null"],"format":"int32","description":"Maker rate (bps) the venue applied to *this* fill. Set when\n`is_maker == Some(true)` and the venue reports the inline rate."},"node_order_id":{"type":"string"},"price_1e9":{"type":"integer","format":"int64"},"qty_1e8":{"type":"integer","format":"int64"},"side":{"type":"string"},"symbol":{"type":"string"},"taker_fee_bps_applied":{"type":["integer","null"],"format":"int32","description":"Taker rate (bps) the venue applied to *this* fill."},"trade_id":{"type":["string","null"],"description":"Venue's own trade/execution id."},"ts_unix_ns":{"type":"integer","format":"int64","minimum":0},"venue":{"type":"string"},"venue_reported_cum_fee_1e9":{"type":["integer","null"],"format":"int64","description":"Cumulative commission the venue reports for this order at the\nmoment of this fill. Reconciliation compares `sum(fee_1e9)` to\nthe terminal value of this column."}}}],"description":"Fill record from database (fills table)"},"GasContext":{"type":"object","required":["chain","chain_id","base_fee_native","priority_fee_native","estimated_gas_units","native_price_1e9","estimated_cost_usd","last_update_ns"],"properties":{"base_fee_native":{"type":"integer","format":"int64","minimum":0},"chain":{"type":"string"},"chain_id":{"type":"integer","format":"int32","minimum":0},"estimated_cost_usd":{"type":"number","format":"double"},"estimated_gas_units":{"type":"integer","format":"int64","minimum":0},"last_update_ns":{"type":"integer","format":"int64","minimum":0},"native_price_1e9":{"type":"integer","format":"int64","minimum":0},"priority_fee_native":{"type":"integer","format":"int64","minimum":0}}},"KillSwitchResp":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}}},"LineageFields":{"type":"object","description":"Deployment lineage column persisted on every order/fill/position row.\n`Default` produces a `None` row — the canonical \"no lineage available\"\nvalue used by every legacy call site until lineage is wired in.\n\nThe field uses a `lineage_` prefix in serde JSON so this struct can be\n`#[serde(flatten)]`-embedded into storage records (`FillRecord`,\n`ParentOrderRecord`, `Position`, `PositionView`) without changing the\nexisting flat wire shape.","properties":{"lineage_deployment_id":{"type":["string","null"]}}},"ListFillsResp":{"type":"object","required":["fills","total","limit","has_more"],"properties":{"fills":{"type":"array","items":{"$ref":"#/components/schemas/FillRecord"}},"has_more":{"type":"boolean"},"limit":{"type":"integer","minimum":0},"next_cursor":{"type":["string","null"]},"total":{"type":"integer","minimum":0}}},"ListOrdersResp":{"type":"object","required":["scope","region","orders","total","limit","has_more","sources","counts"],"properties":{"counts":{"$ref":"#/components/schemas/ProjectionCounts"},"has_more":{"type":"boolean"},"limit":{"type":"integer","minimum":0},"next_cursor":{"type":["string","null"]},"offset":{"type":["integer","null"],"minimum":0},"orders":{"type":"array","items":{"$ref":"#/components/schemas/OrderRest"}},"region":{"type":"string"},"scope":{"type":"string"},"sources":{"type":"array","items":{"$ref":"#/components/schemas/SourceStatus"}},"total":{"type":"integer","description":"Count in the selected projection: global engine/mirror/venue working set\nby default, or the DB projection when history/terminal is requested.","minimum":0},"venue_view":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/VenueView","description":"Freshness contract for the live venue-truth merge (only present when the\nmerge was in scope — first page, no symbol filter, live account). An\nempty order list with `venue_view.all_succeeded == false` means the view\nis INCOMPLETE, not that nothing is resting."}]}}},"OrderConstraintsRest":{"type":"object","properties":{"horizon_ms":{"type":["integer","null"],"format":"int64","description":"Execution time horizon in milliseconds","minimum":0},"max_price_1e9":{"type":["integer","null"],"format":"int64","description":"Maximum execution price in 1e9 format"},"participation_limit_bps":{"type":["integer","null"],"format":"int32","description":"Max participation rate in basis points (e.g., 500 = 5%)","minimum":0},"urgency":{"type":["string","null"],"description":"Urgency level: \"low\", \"medium\", \"high\""}}},"OrderRest":{"allOf":[{"$ref":"#/components/schemas/LineageFields","description":"Deployment-attribution lineage. Flattened so `lineage_deployment_id`\nappears as a top-level key on the wire, matching the column on the\n`orders` and `fills` tables and the join in `/v1/fund/pnl`.\n`None` for legacy / manual / pre-fund-rollout orders."},{"type":"object","required":["node_order_id","client_id","client_order_id","side","symbol","qty_1e8","filled_qty_1e8","status","execution_type","venue_state","reconciliation_state","created_unix_ns","updated_unix_ns"],"properties":{"client_id":{"type":"string"},"client_order_id":{"type":"string"},"constraints":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/OrderConstraintsRest"}]},"created_unix_ns":{"type":"integer","format":"int64","description":"Order creation timestamp (nanoseconds since epoch)","minimum":0},"engine_phase":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Phase","description":"Engine lifecycle is distinct from venue/reconciliation state."}]},"execution_type":{"$ref":"#/components/schemas/ExecutionType"},"expected_fee_1e9":{"type":["integer","null"],"format":"int64","description":"Pre-trade fee estimate in 1e9 USD units."},"expected_fee_bps":{"type":["integer","null"],"format":"int32","description":"Pre-trade fee estimate (bps) from `FeeModel::worst_case_bps` at\nrouting time. Fee-prediction error vs realized surfaces as\n`fee_cost_bps - expected_fee_bps`."},"failure_class":{"type":["string","null"]},"failure_reason":{"type":["string","null"]},"filled_qty_1e8":{"type":"integer","format":"int64","description":"Filled quantity so far in 1e8 format"},"fills":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FillRecord"},"description":"Inline fills (only when `?expand=fills` is requested)"},"first_fill_ts_ns":{"type":["integer","null"],"format":"int64","description":"Exchange timestamp of the first fill in ns."},"graph_id":{"type":["string","null"],"description":"Owning execution-graph id. Present for graph rows (incl. ARMED\nsubmit-and-hold) — the handle to activate (`POST\n/v1/execution_graphs/:id/activate`) or cancel the whole graph. `None`\nfor venue-only rows."},"graph_name":{"type":["string","null"],"description":"Optional human tag on the owning graph (set at submit). Lets a dashboard\nlabel a parked/active strategy."},"home_region":{"type":["string","null"],"description":"Graph home region. Null only for a manually adopted venue order."},"node_id":{"type":["string","null"],"description":"Engine node id. Null only for a manually adopted venue order."},"node_order_id":{"type":"string"},"placed_price_1e9":{"type":["integer","null"],"format":"int64","description":"Limit / max price submitted to the venue (1e9 fixed-point).\n`None` for market orders with no explicit cap."},"pool_id":{"type":["string","null"],"description":"Pool-targeted execution: full PoolId string (\"{chain}:{address}\" or \"{chain}:{address}:{pair_index}\")"},"qty_1e8":{"type":"integer","format":"int64","description":"Requested quantity in 1e8 format"},"reconciliation_state":{"$ref":"#/components/schemas/ReconciliationState"},"side":{"type":"string","description":"\"buy\" or \"sell\""},"status":{"type":"string","description":"Canonical lifecycle status: ACCEPTED, RUNNING, PARTIAL, ACTIVE, COMPLETED,\nCANCELLED, REJECTED, UNCONFIRMED (in doubt — reconciling), UNRESOLVED,\nWAITING. Venue-merged rows (`execution_type:\"adopted\"`) carry the venue's\nown reported status. ARMED rows (`execution_type:\"armed\"`) are parked\nsubmit-and-hold graphs with zero venue footprint — activate them via\n`POST /v1/execution_graphs/:graph_id/activate`."},"symbol":{"type":"string","description":"Trading pair, e.g. \"ETH-USD\""},"tca":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TcaRest","description":"Transaction Cost Analysis — populated for completed orders"}]},"time_to_first_fill_ms":{"type":["integer","null"],"format":"int32","description":"Latency (ms) from parent arrival to the first fill. Distinct from\nTCA's `execution_time_ms` which measures to the last fill."},"updated_unix_ns":{"type":"integer","format":"int64","description":"Last update timestamp (nanoseconds since epoch)","minimum":0},"venue_state":{"$ref":"#/components/schemas/VenueState"}}}]},"Phase":{"type":"string","description":"Lifecycle of a single node.","enum":["gated","sent","working","cancelling","filled","partial","cancelled","cancel_unconfirmed","submit_unconfirmed","rejected","expired","unresolved"]},"PoolEntry":{"type":"object","required":["pool_id","pair_index","protocol","protocol_id","chain","chain_id","fee_bps","bid","ask","bid_size","ask_size","last_update_ms","estimated_gas_units"],"properties":{"ask":{"type":"number","format":"double"},"ask_size":{"type":"number","format":"double"},"bid":{"type":"number","format":"double"},"bid_size":{"type":"number","format":"double"},"block_number":{"type":["integer","null"],"format":"int64","minimum":0},"chain":{"type":"string"},"chain_id":{"type":"integer","format":"int32","minimum":0},"estimated_gas_units":{"type":"integer","format":"int64","minimum":0},"fee_bps":{"type":"integer","format":"int32","minimum":0},"gas_context":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/GasContext"}]},"last_update_ms":{"type":"integer","format":"int64","minimum":0},"liquidity":{"type":["string","null"]},"pair_index":{"type":"integer","format":"int32","minimum":0},"pool_id":{"type":"string","description":"Opaque pool reference for DEX order routing — pass in a node's\n`exec.pool_id` when submitting via POST /v1/orders. Raw on-chain pool\naddresses are never exposed; the engine resolves this reference at\ndispatch."},"protocol":{"type":"string"},"protocol_id":{"type":"integer","format":"int32","minimum":0},"reserve0":{"type":["string","null"]},"reserve1":{"type":["string","null"]},"sqrt_price_x96":{"type":["string","null"]},"tick":{"type":["integer","null"],"format":"int32"}}},"PoolsResponse":{"type":"object","required":["symbol","pools"],"properties":{"pools":{"type":"array","items":{"$ref":"#/components/schemas/PoolEntry"}},"symbol":{"type":"string"}}},"ProjectionCounts":{"type":"object","required":["resting","in_flight","gated","adopted","reconciling"],"properties":{"adopted":{"type":"integer","minimum":0},"gated":{"type":"integer","minimum":0},"in_flight":{"type":"integer","minimum":0},"reconciling":{"type":"integer","minimum":0},"resting":{"type":"integer","minimum":0}}},"QuoteBook":{"type":"object","required":["bids","asks"],"properties":{"asks":{"type":"array","items":{"$ref":"#/components/schemas/QuoteBookLevel"}},"bids":{"type":"array","items":{"$ref":"#/components/schemas/QuoteBookLevel"}}}},"QuoteBookLevel":{"type":"object","required":["price","size","venue"],"properties":{"price":{"type":"number","format":"double"},"size":{"type":"number","format":"double"},"venue":{"type":"string"}}},"QuoteNbbo":{"type":"object","required":["bid","ask","mid","spread_bps","staleness"],"properties":{"age_ms":{"type":"integer","format":"int64","description":"Age of the NBBO in milliseconds — min `age_ms` across the venues\nwhose bid+ask were chosen for this NBBO. Lets callers refuse trades\non quotes older than their tolerance instead of having to walk the\nper-venue `venues.{v}.age_ms` map themselves.","minimum":0},"ask":{"type":"number","format":"double"},"bid":{"type":"number","format":"double"},"mid":{"type":"number","format":"double"},"spread_bps":{"type":"number","format":"double"},"staleness":{"type":"string","description":"Discrete staleness class derived from `age_ms`. Trip-wire for\ntrading code: never act on `dead`, prefer not to act on `stale`.\n  `fresh`  — < 1 s     (real-time, kernel-bus origin)\n  `recent` — < 10 s    (acceptable for non-latency-sensitive use)\n  `stale`  — < 60 s    (probable edge-side feed stall, refresh first)\n  `dead`   — ≥ 60 s    (do not trade — feed is presumed broken)"}}},"QuoteResponse":{"type":"object","required":["symbol","instrument_type","nbbo","venues","book","source"],"properties":{"book":{"$ref":"#/components/schemas/QuoteBook"},"instrument_type":{"type":"string","description":"Disambiguates which book this quote came from. Spot vs perp on the\nsame `symbol` (e.g. `BTC-USDT`) are separate NBBOs because their\nprices differ by basis. `\"spot\"` / `\"perp\"` / `\"prediction\"`."},"nbbo":{"$ref":"#/components/schemas/QuoteNbbo"},"source":{"type":"string","description":"Provenance of the quote data. Three values:\n  `edge_nbbo`        — in-memory NBBO from a live venue-edge WS stream\n                       (sub-millisecond update latency, every tick).\n  `venue_public_api` — HTTP fallback against the venue's public\n                       orderbook endpoint. 2-second cache, ~100-500ms\n                       staleness. Research-grade, not trading-grade.\n  `unavailable`      — neither path produced data. Caller sees zero\n                       bid/ask and empty book; this is distinct from\n                       a true empty-book edge NBBO because the venue\n                       literally doesn't publish liquidity for this\n                       symbol (resolved market, invalid token, etc.)."},"symbol":{"type":"string"},"venues":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/QuoteVenue"},"propertyNames":{"type":"string"}}}},"QuoteVenue":{"type":"object","required":["bid","ask","bid_size","ask_size","age_ms"],"properties":{"age_ms":{"type":"integer","format":"int64","minimum":0},"ask":{"type":"number","format":"double"},"ask_size":{"type":"number","format":"double"},"bid":{"type":"number","format":"double"},"bid_size":{"type":"number","format":"double"},"mid":{"type":["number","null"],"format":"double","description":"Per-venue mid = (bid + ask) / 2. Internally consistent — each\nvenue's book has bid < ask, so this is always a real number when\nboth sides are present. Distinct from the top-level `nbbo.mid`,\nwhich is computed across venues and goes to 0 on a cross-venue\ncross. For routing decisions and inventory marks, prefer this."},"spread_bps":{"type":["number","null"],"format":"double","description":"Per-venue spread in basis points. None when bid or ask is missing."}}},"ReconciliationState":{"type":"string","enum":["in_sync","reconciling","missing_graph"]},"SetKillSwitchReq":{"type":"object","required":["active"],"properties":{"active":{"type":"boolean","description":"Whether the kill switch should be active"},"reason":{"type":["string","null"],"description":"Human-readable reason (auto-generated if omitted)"}}},"SourceState":{"type":"string","enum":["ok","incomplete","stale","unavailable"]},"SourceStatus":{"type":"object","required":["region","as_of_ns","state","complete","count"],"properties":{"as_of_ns":{"type":"integer","format":"int64","minimum":0},"complete":{"type":"boolean","description":"True only while this region is fresh and has completed at least one full\nresync. Stale/unavailable regions are never presented as complete."},"count":{"type":"integer","minimum":0},"region":{"type":"string"},"state":{"$ref":"#/components/schemas/SourceState"}}},"TcaRest":{"type":"object","required":["arrival_mid_1e9","benchmark_vwap_1e9","benchmark_venue","achieved_vwap_1e9","implementation_shortfall_bps","spread_cost_bps","fee_cost_bps","market_impact_bps","effective_spread_bps","execution_time_ms","total_fees_1e9","num_venues","num_fills","tca_quality"],"properties":{"achieved_vwap_1e9":{"type":"integer","format":"int64"},"arrival_mid_1e9":{"type":"integer","format":"int64","description":"Arrival mid price in 1e9 format"},"benchmark_venue":{"type":"string"},"benchmark_vwap_1e9":{"type":"integer","format":"int64"},"effective_spread_bps":{"type":"number","format":"double","description":"Effective spread: round-trip cost (CFA Institute 2024)"},"execution_time_ms":{"type":"integer","format":"int64"},"fee_cost_bps":{"type":"number","format":"double","description":"Explicit fee cost in bps (Elkins/McSherry)"},"implementation_shortfall_bps":{"type":"number","format":"double","description":"Implementation Shortfall: total cost vs arrival mid (Perold 1988)"},"market_impact_bps":{"type":"number","format":"double","description":"Market impact: residual IS - spread - fees (Almgren 2005)"},"num_fills":{"type":"integer","format":"int32","minimum":0},"num_venues":{"type":"integer","format":"int32","minimum":0},"savings_usd":{"type":["number","null"],"format":"double","description":"Absolute dollar savings (null when benchmark unavailable)"},"savings_vs_benchmark_bps":{"type":["number","null"],"format":"double","description":"Savings vs best single venue in bps (null when benchmark unavailable)"},"spread_cost_bps":{"type":"number","format":"double","description":"Half-spread cost at arrival (Collins & Fabozzi 1991)"},"tca_quality":{"type":"string","description":"\"direct\" (persisted from live TCA) or \"reconstructed\" (backfilled estimate)"},"total_fees_1e9":{"type":"integer","format":"int64"}}},"VenueObservationRest":{"type":"object","required":["venue","complete","observed"],"properties":{"complete":{"type":"boolean"},"error":{"type":["string","null"]},"observed":{"type":"boolean"},"venue":{"type":"string"}}},"VenueState":{"type":"string","enum":["none","in_flight","resting","unknown"]},"VenueView":{"type":"object","description":"Completeness signal for the venue-truth rows folded into `GET /v1/orders`.","required":["attempted","all_succeeded","venues","untracked_count"],"properties":{"all_succeeded":{"type":"boolean","description":"Whether every credentialed venue answered. `false` ⇒ the merged view is\npartial; some resting orders may be missing — do not treat absence as\nproof an order is gone."},"attempted":{"type":"boolean","description":"Whether a live venue-truth fetch was attempted for this response."},"untracked_count":{"type":"integer","description":"Number of venue-resting orders merged in that our DB projection did not\nalready track.","minimum":0},"venues":{"type":"array","items":{"$ref":"#/components/schemas/VenueObservationRest"},"description":"Per-venue evidence. Unsupported and missing-credential venues remain\nexplicit incomplete entries instead of disappearing from the set."}}}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Orders","description":"Order lifecycle: submit, amend, cancel, list, fills, positions, traces"},{"name":"Market Data","description":"Real-time quotes, order books, venue depth, trades"},{"name":"Portfolio","description":"Portfolio state: positions, balances, P&L, cross-venue view"},{"name":"TCA","description":"Transaction cost analysis: execution quality, venue attribution"},{"name":"Analytics","description":"Execution analytics, venue quality, market microstructure"},{"name":"Risk","description":"Kill switch, informational risk read-out, compliance screening"},{"name":"Account","description":"Account info, credentials, API keys, organization"},{"name":"Wallets","description":"Wallet management and withdrawals"},{"name":"Algos","description":"WASM algo deployment and management"},{"name":"Alerts","description":"Price, volume, drawdown, and PnL alerts"},{"name":"Streaming","description":"Real-time SSE event streams"},{"name":"Health","description":"Service health, readiness probes, feed health"}]}