> ## Documentation Index
> Fetch the complete documentation index at: https://polyquantlab.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Post Backtest Sweep

> Submit a parameter-sweep job. Same async pattern as /v1/backtest —
returns 202 + job_id, client polls GET /v1/backtest/{job_id}.

Tier gates checked:
  * `market_limit` ≤ tier's max_market_limit (same as single backtest)
  * Total grid cell count ≤ tier's max_sweep_cells
  * Per-key in-flight cap (sweeps count against the same
    concurrent_backtests budget as single backtests)



## OpenAPI

````yaml post /v1/backtest/sweep
openapi: 3.1.0
info:
  title: PolyQuantLab API
  version: 0.1.0
  description: >-
    Sub-second Polymarket orderbook data, walk-the-book backtests, paper
    trading, and the live arb audit. Same endpoints the PolyQuantLab dashboard
    uses internally — Bearer-token auth, JSON-over-HTTPS, predictable
    pagination.
  contact:
    email: contact@polyquantlab.com
    url: https://polyquantlab.com/contact
  license:
    name: Proprietary
servers:
  - url: https://api.polyquantlab.com
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /v1/backtest/sweep:
    post:
      summary: Post Backtest Sweep
      description: |-
        Submit a parameter-sweep job. Same async pattern as /v1/backtest —
        returns 202 + job_id, client polls GET /v1/backtest/{job_id}.

        Tier gates checked:
          * `market_limit` ≤ tier's max_market_limit (same as single backtest)
          * Total grid cell count ≤ tier's max_sweep_cells
          * Per-key in-flight cap (sweeps count against the same
            concurrent_backtests budget as single backtests)
      operationId: post_backtest_sweep_v1_backtest_sweep_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SweepRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostBacktestSweepVBacktestSweepPostResponse
              example:
                job_id: swp_a812c0f0
                status: queued
                submitted_at: '2026-06-06T03:54:11+00:00'
                strategy_template:
                  type: threshold_entry
                sweep_params:
                  threshold:
                    - 0.25
                    - 0.27
                    - 0.3
                    - 0.33
                    - 0.35
                universe:
                  ticker: BTC
                  event_type: 5m
                result: null
                error: null
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SweepRequest:
      properties:
        strategy:
          additionalProperties: true
          type: object
          title: Strategy
          description: >-
            Base strategy spec (same shape as /v1/backtest). The x_axis (and
            y_axis if provided) override the named params; everything else stays
            fixed across every cell.
        x_axis:
          $ref: '#/components/schemas/SweepAxis'
        y_axis:
          anyOf:
            - $ref: '#/components/schemas/SweepAxis'
            - type: 'null'
        event_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Event Type
        ticker:
          anyOf:
            - type: string
            - type: 'null'
          title: Ticker
        since:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Since
        until:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Until
        market_limit:
          type: integer
          maximum: 500
          title: Market Limit
          default: 50
      type: object
      required:
        - strategy
        - x_axis
      title: SweepRequest
    PostBacktestSweepVBacktestSweepPostResponse:
      type: object
      properties:
        job_id:
          type: string
        status:
          type: string
          enum:
            - queued
            - running
            - complete
            - failed
        submitted_at:
          type: string
          format: date-time
        strategy_template:
          type: object
          properties:
            type:
              type: string
          required:
            - type
        sweep_params:
          type: object
          properties:
            threshold:
              type: array
              items:
                type: number
                format: double
          required:
            - threshold
        universe:
          type: object
          properties:
            ticker:
              type: string
              enum:
                - BTC
                - ETH
                - SOL
            event_type:
              type: string
              enum:
                - 5m
                - 15m
                - 1h
                - 4h
                - daily_up_down
          required:
            - ticker
            - event_type
        result:
          type: 'null'
        error:
          type: 'null'
      required:
        - job_id
        - status
        - submitted_at
        - strategy_template
        - sweep_params
        - universe
        - result
        - error
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SweepAxis:
      properties:
        param:
          type: string
          title: Param
          description: >-
            Which key in the base strategy spec to override on this axis. E.g.
            'threshold', 'size_usd', 'lookback'. Must be a numeric parameter of
            the chosen strategy_type.
          examples:
            - threshold
            - size_usd
        start:
          type: number
          title: Start
          description: First value on this axis.
        end:
          type: number
          title: End
          description: Last value (inclusive).
        steps:
          type: integer
          maximum: 100
          minimum: 1
          title: Steps
          description: Number of evenly-spaced points between start and end.
          default: 5
      type: object
      required:
        - param
        - start
        - end
      title: SweepAxis
      description: One axis of the parameter grid.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````