POST /v1/lab/backtests
Queue a backtest of one of the caller’s strategies (strategy_id) or of an unsaved spec, over [from, to) (at most 366 days), optionally with explicit re-rank cuts. Answers 202 with the run; poll GET /lab/backtests/:id. The spec and a Builder source’s config are frozen into the run. Results are SIMULATED: every report names its fill model and the measured optimism. A strategy that copies no wallet (own rules, Quant and above) is tested on the recorded order books: 400 `rules_before_book_history` for a window before 2026-07-23; its report covers the first three quarters of the window unless final_test asks for the sealed last quarter (400 `final_test_rules_only` for a copy strategy; 400 `final_test_needs_strategy` for an unsaved spec; 409 `final_test_already_run` once the strategy’s final test was run — once per strategy, a failed run aside). 403 `plan_required` (strategy_lab; own rules); 429 `lab_daily_limit` at the plan’s backtests per UTC day (Retry-After = seconds to midnight UTC); 429 `lab_busy` with 3 runs already queued or running. 404 `lab_disabled` while LAB_ENABLED is off.
Queue a backtest of one of the caller’s strategies (strategy_id) or of an unsaved spec, over [from, to) (at most 366 days), optionally with explicit re-rank cuts. Answers 202 with the run; poll GET /lab/backtests/:id. The spec and a Builder source’s config are frozen into the run. Results are SIMULATED: every report names its fill model and the measured optimism. A strategy that copies no wallet (own rules, Quant and above) is tested on the recorded order books: 400 rules_before_book_history for a window before 2026-07-23; its report covers the first three quarters of the window unless final_test asks for the sealed last quarter (400 final_test_rules_only for a copy strategy; 400 final_test_needs_strategy for an unsaved spec; 409 final_test_already_run once the strategy’s final test was run — once per strategy, a failed run aside). 403 plan_required (strategy_lab; own rules); 429 lab_daily_limit at the plan’s backtests per UTC day (Retry-After = seconds to midnight UTC); 429 lab_busy with 3 runs already queued or running. 404 lab_disabled while LAB_ENABLED is off.
API key: Authorization: Bearer pk_live_… (mint at polyrank.app/api-keys)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/lab/backtests" \ -H "Content-Type: application/json" \ -d '{ "from": "string", "to": "string" }'{ "id": "string", "strategy_id": "string", "status": "queued", "error": "string", "from": "string", "to": "string", "source": "string", "created_at": "string", "finished_at": "string", "duration_ms": 0, "per10": 0, "copies": 0, "purpose": "user", "final_test": true}{ "error": "string", "message": "string", "feature": "string", "field": "string", "plan": "string", "retry_after_sec": 0, "retry_after_seconds": 0, "reason": "string", "issues": [ null ], "trace_id": "string"}{ "error": "string", "message": "string", "feature": "string", "field": "string", "plan": "string", "retry_after_sec": 0, "retry_after_seconds": 0, "reason": "string", "issues": [ null ], "trace_id": "string"}{ "error": "string", "message": "string", "feature": "string", "field": "string", "plan": "string", "retry_after_sec": 0, "retry_after_seconds": 0, "reason": "string", "issues": [ null ], "trace_id": "string"}{ "error": "string", "message": "string", "feature": "string", "field": "string", "plan": "string", "retry_after_sec": 0, "retry_after_seconds": 0, "reason": "string", "issues": [ null ], "trace_id": "string"}{ "error": "string", "message": "string", "feature": "string", "field": "string", "plan": "string", "retry_after_sec": 0, "retry_after_seconds": 0, "reason": "string", "issues": [ null ], "trace_id": "string"}{ "error": "string", "message": "string", "feature": "string", "field": "string", "plan": "string", "retry_after_sec": 0, "retry_after_seconds": 0, "reason": "string", "issues": [ null ], "trace_id": "string"}{ "error": "string", "message": "string", "feature": "string", "field": "string", "plan": "string", "retry_after_sec": 0, "retry_after_seconds": 0, "reason": "string", "issues": [ null ], "trace_id": "string"}