Post Backtest
Backtest
Post Backtest
Submit a backtest job.
Two modes:
- Async (default,
wait_for_result=false): returns HTTP 202 +job_idimmediately. Client pollsGET /v1/backtest/{job_id}. Best for UI and long jobs; survives client disconnects. - Sync-style (
wait_for_result=true): the API holds the connection while a worker processes the job, then returns HTTP 200 with the completed result inline. Matches the curl-friendly pattern PolyBackTest data customers expect. Caps at 30 s of wait; longer than that and you get a 504 + the job_id so you can keep polling.
Tier gates (rate limit already checked in authed_key):
market_limitcap from the tier prevents Free users from queueing a 500-market scan.- Per-key concurrent in-flight cap (
tier.concurrent_backtests): users can’t flood the queue with their own work and starve others.
POST
Post Backtest
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
If true, hold the HTTP connection until the backtest finishes (up to 30 s) and return the completed result inline — like a synchronous endpoint. If 30 s isn't enough, you'll get a 504 with the job_id so you can poll GET /v1/backtest/{job_id} instead. Use false (default) for UI / long jobs.
Body
application/json
Examples:
{
"direction": "below",
"side": "buy_yes",
"size_usd": 100,
"threshold": 0.3,
"type": "threshold_entry"
}
{
"lookback": 30,
"size_usd": 100,
"type": "mean_reversion",
"z_threshold": 2
}
Required range:
x <= 500