> ## 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.

# Get Backtest Job

> Fetch the state (and result, if completed) of a backtest job.

Authorisation: callers can only read jobs they submitted. We compare
the API key id stored on the job record against the authenticated
key — a different user with the same job_id (even if guessed) gets
a 404 rather than 403 so we don't leak existence.



## OpenAPI

````yaml get /v1/backtest/{job_id}
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/{job_id}:
    get:
      summary: Get Backtest Job
      description: |-
        Fetch the state (and result, if completed) of a backtest job.

        Authorisation: callers can only read jobs they submitted. We compare
        the API key id stored on the job record against the authenticated
        key — a different user with the same job_id (even if guessed) gets
        a 404 rather than 403 so we don't leak existence.
      operationId: get_backtest_job_v1_backtest__job_id__get
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBacktestJobVBacktestJobIdGetResponse'
              example:
                job_id: bt_8421ae0c
                status: complete
                submitted_at: '2026-06-06T03:54:11+00:00'
                completed_at: '2026-06-06T03:54:38+00:00'
                strategy:
                  type: threshold_entry
                  threshold: 0.3
                  direction: below
                  side: buy_yes
                params:
                  position_size: 7.5
                  fill_mode: walk_book
                  max_fill_price: 0.985
                  taker_fee_rate: 0.072
                result:
                  trades_total: 48
                  trades_won: 31
                  total_pnl: 14.82
                  avg_pnl_per_trade: 0.309
                  win_rate: 0.646
                  profit_factor: 2.14
                  sharpe_ratio: 1.82
                  calmar_ratio: 4.21
                  max_drawdown: -3.52
                  equity_curve:
                    - market_id: 0x4a8f31...c2
                      ts: '2026-06-06T03:55:00+00:00'
                      cumulative_pnl: 0.62
                    - market_id: 0x9c12af...8b
                      ts: '2026-06-06T03:56:00+00:00'
                      cumulative_pnl: 1.18
                error: null
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    GetBacktestJobVBacktestJobIdGetResponse:
      type: object
      properties:
        job_id:
          type: string
        status:
          type: string
          enum:
            - queued
            - running
            - complete
            - failed
        submitted_at:
          type: string
          format: date-time
        completed_at:
          type: string
          format: date-time
        strategy:
          type: object
          properties:
            type:
              type: string
            threshold:
              type: number
              format: double
            direction:
              type: string
              enum:
                - BUY_YES
                - BUY_NO
                - BUY_BOTH
              description: >-
                Which side to buy. `BUY_BOTH` only used for `tier=logical` (buy
                both legs for guaranteed payoff).
            side:
              type: string
              enum:
                - buy_yes
                - sell_yes
                - buy_no
                - sell_no
                - BUY_YES
                - SELL_YES
                - BUY_NO
                - SELL_NO
          required:
            - type
            - threshold
            - direction
            - side
        params:
          type: object
          properties:
            position_size:
              type: number
              format: double
            fill_mode:
              type: string
              enum:
                - mid
                - walk_book
            max_fill_price:
              type: number
              format: double
            taker_fee_rate:
              type: number
              format: double
          required:
            - position_size
            - fill_mode
            - max_fill_price
            - taker_fee_rate
        result:
          type: object
          properties:
            trades_total:
              type: integer
              format: int64
            trades_won:
              type: integer
              format: int64
            total_pnl:
              type: number
              format: double
            avg_pnl_per_trade:
              type: number
              format: double
            win_rate:
              type: number
              format: double
            profit_factor:
              type: number
              format: double
            sharpe_ratio:
              type: number
              format: double
            calmar_ratio:
              type: number
              format: double
            max_drawdown:
              type: number
              format: double
            equity_curve:
              type: array
              items:
                type: object
                properties:
                  market_id:
                    type: string
                    description: Polymarket market identifier (hex 0x…).
                  ts:
                    type: string
                    format: date-time
                  cumulative_pnl:
                    type: number
                    format: double
                required:
                  - market_id
                  - ts
                  - cumulative_pnl
          required:
            - trades_total
            - trades_won
            - total_pnl
            - avg_pnl_per_trade
            - win_rate
            - profit_factor
            - sharpe_ratio
            - calmar_ratio
            - max_drawdown
            - equity_curve
        error:
          type: 'null'
      required:
        - job_id
        - status
        - submitted_at
        - completed_at
        - strategy
        - params
        - result
        - error
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````