ZeroGEX Backtesting (v2) API

The Backtesting (v2) API from ZeroGEX, for backtesting (v2).

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 20

GET /api/v2/backtest/meta Api V2 Backtest Meta Get #
GET /api/v2/backtest/insights/patterns Api V2 Backtest Insights Patterns Get #
POST /api/v2/backtest/runs Api V2 Backtest Runs Post #
GET /api/v2/backtest/runs Api V2 Backtest Runs Get #
GET /api/v2/backtest/runs/{run_id} Api V2 Backtest Runs Run Id Get #
POST /api/v2/backtest/runs/{run_id}/share Api V2 Backtest Runs Run Id Share Post #
GET /api/v2/backtest/runs/shared/{share_token} Api V2 Backtest Runs Shared Share Token Get #
GET /api/v2/backtest/runs/shared/{share_token}/equity Api V2 Backtest Runs Shared Share Token Equity Get #
GET /api/v2/backtest/runs/{run_id}/trades Api V2 Backtest Runs Run Id Trades Get #
GET /api/v2/backtest/runs/{run_id}/trades.csv Api V2 Backtest Runs Run Id Trades.Csv Get #
GET /api/v2/backtest/runs/{run_id}/equity Api V2 Backtest Runs Run Id Equity Get #
GET /api/v2/backtest/configs Api V2 Backtest Configs Get #
POST /api/v2/backtest/configs Api V2 Backtest Configs Post #
GET /api/v2/backtest/configs/shared/{share_token} Api V2 Backtest Configs Shared Share Token Get #
GET /api/v2/backtest/configs/{config_id} Api V2 Backtest Configs Config Id Get #
PUT /api/v2/backtest/configs/{config_id} Api V2 Backtest Configs Config Id Put #
DELETE /api/v2/backtest/configs/{config_id} Api V2 Backtest Configs Config Id Delete #
POST /api/v2/backtest/sweeps Api V2 Backtest Sweeps Post #
GET /api/v2/backtest/sweeps Api V2 Backtest Sweeps Get #
GET /api/v2/backtest/sweeps/{sweep_id} Api V2 Backtest Sweeps Sweep Id Get #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/zerogex-io:zerogex-io-backtesting-v2-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

zerogex-io-backtesting-v2-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: ZeroGEX Backtesting (v2) API
  description: 'Real-time options analytics API.


    **Two versions are served.**


    * **v2 (recommended)** — `/api/v2/*`. Every endpoint returns `{"data": ..., "freshness": {...}}`, where the `freshness` block reports response evaluation time, the underlying data''s source timestamp, the market session, the expected update cadence, and a rolled-up `freshness_status` — so endpoint health and data age are separate, machine-readable facts on every response.

    * **v1 (stable)** — `/api/*` and `/api/v1/levels/*`. Unchanged and supported; `data` in a v2 response is byte-for-byte the v1 body.


    See "API versions & the freshness envelope" in API_Guide.md for the field contract and the per-endpoint cadence table.'
  version: 2.0.0
tags:
- name: Backtesting (v2)
paths:
  /api/v2/backtest/meta:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Meta Get
      description: 'Catalog for the configuration form: underlyings, patterns, data window, defaults.'
      operationId: api_v2_backtest_meta_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
      security:
      - HTTPBearer: []
  /api/v2/backtest/insights/patterns:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Insights Patterns Get
      description: 'Strategy scoreboard: latest stats row per (catalog strategy, underlying).


        Read-only roll-up of ``playbook_pattern_stats`` folded onto canonical

        strategy-catalog ids — n, win rate, dollar economics, derived PF /

        expectancy, window dates, most-recent ``computed_at``, plus the catalog''s

        name / family / tier / research stage.


        ``source`` picks the measurement feed: ``option_pnl`` (realized P&L from

        the strategy''s own live-emitted Action Cards — the default and the

        strongest claim), ``bot_replay`` (realized P&L from replaying a bot-bound

        strategy''s entry rule over history — same pricing, reconstructed entries),

        or ``underlying_touch`` (the price-touch proxy, no dollar economics).


        ``include_unmeasured`` (default true) appends an explicit "no data yet"

        row for every catalog strategy absent from this source, so the page shows

        the whole catalog rather than only what happens to have been screened.

        Ignored when ``underlying`` narrows to one symbol.'
      operationId: api_v2_backtest_insights_patterns_get
      security:
      - HTTPBearer: []
      parameters:
      - name: source
        in: query
        required: false
        schema:
          type: string
          pattern: ^(option_pnl|underlying_touch|bot_replay)$
          default: option_pnl
          title: Source
      - name: underlying
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            pattern: ^[A-Za-z]{1,10}$
          - type: 'null'
          title: Underlying
      - name: include_unmeasured
        in: query
        required: false
        schema:
          type: boolean
          default: true
          title: Include Unmeasured
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_list_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs:
    post:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Post
      description: Validate a BacktestSpec, persist a queued run, and schedule execution.
      operationId: api_v2_backtest_runs_post
      security:
      - HTTPBearer: []
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Get
      description: Recent runs for the calling end-user (anonymous runs when unauthenticated).
      operationId: api_v2_backtest_runs_get
      security:
      - HTTPBearer: []
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 25
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_list_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs/{run_id}:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Run Id Get
      description: Status + summary for one run.
      operationId: api_v2_backtest_runs_run_id_get
      security:
      - HTTPBearer: []
      parameters:
      - name: run_id
        in: path
        required: true
        schema:
          type: integer
          title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs/{run_id}/share:
    post:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Run Id Share Post
      description: 'Mint (or return) a public share token for a completed run.


        Turns a run into a shareable "prove it" report at

        ``/backtesting/shared/``. Owner-scoped; only completed runs qualify.'
      operationId: api_v2_backtest_runs_run_id_share_post
      security:
      - HTTPBearer: []
      parameters:
      - name: run_id
        in: path
        required: true
        schema:
          type: integer
          title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs/shared/{share_token}:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Shared Share Token Get
      description: Public read of a shared run's result (no owner scoping).
      operationId: api_v2_backtest_runs_shared_share_token_get
      security:
      - HTTPBearer: []
      parameters:
      - name: share_token
        in: path
        required: true
        schema:
          type: string
          title: Share Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs/shared/{share_token}/equity:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Shared Share Token Equity Get
      description: Public equity curve for a shared run.
      operationId: api_v2_backtest_runs_shared_share_token_equity_get
      security:
      - HTTPBearer: []
      parameters:
      - name: share_token
        in: path
        required: true
        schema:
          type: string
          title: Share Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_list_dict__'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs/{run_id}/trades:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Run Id Trades Get
      description: Paginated trade blotter for a run.
      operationId: api_v2_backtest_runs_run_id_trades_get
      security:
      - HTTPBearer: []
      parameters:
      - name: run_id
        in: path
        required: true
        schema:
          type: integer
          title: Run Id
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 500
          minimum: 1
          default: 100
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs/{run_id}/trades.csv:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Run Id Trades.Csv Get
      description: Download the full trade blotter for a run as CSV.
      operationId: api_v2_backtest_runs_run_id_trades.csv_get
      security:
      - HTTPBearer: []
      parameters:
      - name: run_id
        in: path
        required: true
        schema:
          type: integer
          title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_Any_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/runs/{run_id}/equity:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Runs Run Id Equity Get
      description: Equity curve points for a run.
      operationId: api_v2_backtest_runs_run_id_equity_get
      security:
      - HTTPBearer: []
      parameters:
      - name: run_id
        in: path
        required: true
        schema:
          type: integer
          title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_list_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/configs:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Configs Get
      description: Saved configs for the calling end-user (anonymous pool when unauthenticated).
      operationId: api_v2_backtest_configs_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_list_'
      security:
      - HTTPBearer: []
    post:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Configs Post
      description: Save a named, validated BacktestSpec; returns its summary + share token.
      operationId: api_v2_backtest_configs_post
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
      security:
      - HTTPBearer: []
  /api/v2/backtest/configs/shared/{share_token}:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Configs Shared Share Token Get
      description: Public read-only fetch of a shared config by token (clone into the form).
      operationId: api_v2_backtest_configs_shared_share_token_get
      security:
      - HTTPBearer: []
      parameters:
      - name: share_token
        in: path
        required: true
        schema:
          type: string
          title: Share Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/configs/{config_id}:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Configs Config Id Get
      description: Fetch one saved config (incl. spec), scoped to its owner.
      operationId: api_v2_backtest_configs_config_id_get
      security:
      - HTTPBearer: []
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: integer
          title: Config Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Configs Config Id Put
      description: Rename and/or replace a saved config's spec (owner only).
      operationId: api_v2_backtest_configs_config_id_put
      security:
      - HTTPBearer: []
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: integer
          title: Config Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Configs Config Id Delete
      description: Delete a saved config (owner only).
      operationId: api_v2_backtest_configs_config_id_delete
      security:
      - HTTPBearer: []
      parameters:
      - name: config_id
        in: path
        required: true
        schema:
          type: integer
          title: Config Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/sweeps:
    post:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Sweeps Post
      description: Run a base spec across a parameter grid; one queued child run per cell.
      operationId: api_v2_backtest_sweeps_post
      security:
      - HTTPBearer: []
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Sweeps Get
      description: Recent sweeps for the calling end-user.
      operationId: api_v2_backtest_sweeps_get
      security:
      - HTTPBearer: []
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 100
          minimum: 1
          default: 25
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_list_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v2/backtest/sweeps/{sweep_id}:
    get:
      tags:
      - Backtesting (v2)
      summary: Api V2 Backtest Sweeps Sweep Id Get
      description: Sweep header + per-cell run status/metrics (used while polling).
      operationId: api_v2_backtest_sweeps_sweep_id_get
      security:
      - HTTPBearer: []
      parameters:
      - name: sweep_id
        in: path
        required: true
        schema:
          type: integer
          title: Sweep Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope_dict_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Freshness:
      properties:
        evaluated_at:
          type: string
          format: date-time
          title: Evaluated At
          description: 'When the API evaluated this response (server wall clock, UTC). Endpoint-health signal: advances on every request even when the underlying data is unchanged.'
        generated_at:
          type: string
          format: date-time
          title: Generated At
          description: When the served data was computed. Equals the snapshot stamp for cycle-backed endpoints, or evaluated_at for endpoints computed on demand for this request.
        source_timestamp:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Source Timestamp
          description: Timestamp of the upstream market observation the payload derives from. This is what freshness_status is measured against. Null when the endpoint has no upstream feed or returned no rows.
        latest_event_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Latest Event At
          description: Newest event timestamp present in the payload (last bar, last trade, last scored row). Best-effort on very large responses, which are sampled rather than fully walked.
        age_seconds:
          anyOf:
          - type: number
          - type: 'null'
          title: Age Seconds
          description: evaluated_at - source_timestamp, in seconds. Null when source_timestamp is null.
        market_session_status:
          type: string
          title: Market Session Status
          description: pre-market | regular | after-hours | closed (US/Eastern).
        expected_update_cadence:
          anyOf:
          - type: string
          - type: 'null'
          title: Expected Update Cadence
          description: ISO-8601 duration for how often this endpoint's data is expected to change right now, e.g. PT60S. Null means no updates are expected (weekend, holiday, or a feed that only runs during the session).
        expected_update_cadence_seconds:
          anyOf:
          - type: number
          - type: 'null'
          title: Expected Update Cadence Seconds
          description: expected_update_cadence as a number of seconds.
        cadence_profile:
          type: string
          title: Cadence Profile
          description: Identifier of the cadence class this endpoint belongs to, e.g. analytics_cycle. Stable across releases; the seconds behind it may be retuned.
        stale_after:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Stale After
          description: Instant after which this payload should be treated as stale. Null whenever expected_update_cadence is null.
        freshness_status:
          $ref: '#/components/schemas/FreshnessStatus'
          description: fresh | aging | stale | session_closed | static | unknown.
      type: object
      required:
      - evaluated_at
      - generated_at
      - market_session_status
      - cadence_profile
      - freshness_status
      title: Freshness
      description: The v2 freshness envelope. Present on every ``/api/v2/*`` response.
    Envelope_list_dict__:
      properties:
        data:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Data
        freshness:
          $ref: '#/components/schemas/Freshness'
      type: object
      required:
      - data
      - freshness
      title: Envelope[list[dict]]
    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
    FreshnessStatus:
      type: string
      enum:
      - fresh
      - aging
      - stale
      - session_closed
      - static
      - unknown
      title: FreshnessStatus
      description: "The rolled-up freshness verdict for one response.\n\n``fresh``\n    ``source_timestamp`` is within one expected update cadence.\n``aging``\n    Past one cadence but not yet past ``stale_after`` — the grace band\n    that absorbs normal cycle jitter.  Not an error; a client that\n    polls faster than the cadence sees this routinely.\n``stale``\n    Past ``stale_after`` while updates *were* expected.  This is the\n    actionable state: the feed behind this endpoint is late.\n``session_closed``\n    A feed-backed endpoint whose feed is not due to produce anything\n    right now (weekend, holiday, or a feed that only runs during the\n    session).  The payload is the last good value — deliberately NOT\n    reported as ``stale``, because an overnight consumer polling a\n    closed market is not observing a fault and should not page on it.\n``static``\n    The endpoint is not feed-backed at all: completed history, or a\n    result computed from the caller's own inputs.  Age here carries no\n    health meaning and never becomes a fault.\n``unknown``\n    No source timestamp could be resolved from the payload (e.g. a\n    pure calculator, an admin endpoint, or an empty result set).  A\n    consumer should fall back to ``evaluated_at`` for endpoint health\n    and make no claim about data age."
    Envelope_list_:
      properties:
        data:
          items: {}
          type: array
          title: Data
        freshness:
          $ref: '#/components/schemas/Freshness'
      type: object
      required:
      - data
      - freshness
      title: Envelope[list]
    Envelope_dict_:
      properties:
        data:
          additionalProperties: true
          type: object
          title: Data
        freshness:
          $ref: '#/components/schemas/Freshness'
      type: object
      required:
      - data
      - freshness
      title: Envelope[dict]
    Envelope_Any_:
      properties:
        data:
          title: Data
        freshness:
          $ref: '#/components/schemas/Freshness'
      type: object
      required:
      - data
      - freshness
      title: Envelope[Any]
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: API-Key