{"openapi":"3.1.0","info":{"title":"TextToQuant API","version":"1.1.0","description":"Parse plain-English trading strategies, run backtests, manage custom indicators, read results — and read and control a live trading account under /v1/trading.\n\nEvery response uses one envelope: {success, data} on success, {success:false, code, error} on failure. Branch on `code`, never on the message text.\n\nLIVE TRADING — two things to know before you call anything under /v1/trading:\n1. Scopes. Those routes need `trading:read` on the API key, and `trading:write` to act. The default is neither: a key issued before this surface existed reaches none of it until the scope is granted at Account → API keys. A missing scope is a 403 `insufficient_scope`, not a 401. Each operation names its requirement in `x-ttq-scope`. A paid plan with live trading is required on top.\n2. What the writes can do — and cannot. Every write REDUCES risk: pause, cancel, close, protect, halt. There is deliberately NO endpoint that opens a position, places a resting order, or moves funds between venues or out of an account. An automated caller acquiring new exposure is a different risk class, so those stay in the UI. The worst outcome of a mistaken call here is being flat, protected or paused.\n\nFull guide: https://docs.texttoquant.com"},"servers":[{"url":"https://app.texttoquant.com/api","description":"v1 REST API base (hosted MCP at https://www.texttoquant.com/api/mcp, served by this API at /api/v1/mcp)"}],"security":[{"apiKey":[]},{"bearer":[]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"ttq_… key from Account → API Keys"},"bearer":{"type":"http","scheme":"bearer","description":"Authorization: Bearer ttq_…"}},"schemas":{"Error":{"type":"object","required":["success","code","error"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","description":"Stable machine readable error code: branch on this."},"error":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string","description":"Echo of X-Request-Id: quote when contacting support."}}},"SymbolRefusal":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"code":{"type":"string","enum":["SYMBOL_UNRESOLVED","SYMBOL_AMBIGUOUS"]},"retryable":{"type":"boolean","const":false},"asset":{"type":"string","description":"The symbol as sent, or as the condition that reads it resolves it."},"scope":{"type":"string","enum":["condition"],"description":"Present when a condition reads the symbol, not the run's asset: fix it in that condition and leave asset as it is."},"suggestion":{"type":["object","null"],"description":"SYMBOL_UNRESOLVED only: the near company, {listing, name}, or null."},"candidates":{"type":"object","description":"SYMBOL_AMBIGUOUS only: the two readings, {crypto: pair, stock: ticker}."},"storedRun":{"type":"boolean","description":"Present on a re-run of a saved backtest. With scope \"condition\" there is nothing to patch in place: edit that condition and run the strategy as a new backtest."},"details":{"type":"object","properties":{"blockers":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"The repair card: code, term, headline, explain, candidates[{id, label, plain, patch}]; for a condition symbol (scope \"condition\") locator, guard and candidates[{id, label, plain, condition}] instead, or no candidates."}}}}}}]},"ParsedQuery":{"type":"object","additionalProperties":true,"description":"The structured strategy returned by POST /v1/parse: pass verbatim to POST /v1/backtests."},"BacktestRow":{"type":"object","additionalProperties":true,"description":"A saved run: scalar metrics (total_return, sharpe_ratio, max_drawdown, win_rate, …), grade, effective params (timeframe, stop_loss, fees_bps, …), edit lineage (strategy_session_id, iteration_label). winning_trades / losing_trades: on runs saved before 2026-08-30 the stored counts can be 0 beside a real win_rate; such rows are served with counts approximated as round(win_rate × total_trades / 100) and carry trade_counts_approximated: true. Rows with persisted counts never carry the field."}}},"paths":{}}