Backtesting Arena On Chain API

The On-Chain API from Backtesting Arena — 2 operation(s) for on-chain.

GitHub OpenAPI

Operations 2

GET /api/v1/onchain/max-pain/latest Deribit BTC Max Pain — latest expiry + upcoming #
GET /api/v1/onchain/max-pain/history Deribit BTC Max Pain — historical expiries #

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/tradingstrategies-work:tradingstrategies-work-on-chain-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

tradingstrategies-work-on-chain-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Backtesting Arena — Public On Chain API
  description: 'Battle-tested market intelligence for humans and AI agents — every claim backtested, versioned, and explainable. Evidence and base rates, never financial advice.


    **No execution, no custody:** No tool on this server can place an order, access an exchange account, or take a position — the platform holds no custody and executes no trades. Writes are limited to alert subscriptions and saved backtests; paid endpoints charge a fixed, pre-quoted per-call fee and nothing else.


    Programmatic access to daily Bitcoin/crypto cycle scoring, on-chain indicators, aggregated strategy/sentiment insights, and on-demand backtests. Three channels:


    - **REST** — Bearer-Token-Auth, this spec. Available now.

    - **MCP** — same Bearer-Tokens, 104 tools at https://tradingstrategies.work/api/mcp. Available now.

    - **x402** — pay-per-call USDC on Base, no account. 28 endpoints under /api/v1/agent/* from $0.01-$0.50. Available now.


    **Your agent can produce, not just consume:** every authenticated backtest (POST /api/v1/backtests/run, MCP arena_run_backtest) is persisted and feeds the public evidence library (Strategy Insights, Edge Library, sentiment) — agent runs count exactly like human runs. x402-anonymous runs stay ephemeral.


    Tiers: Free / API Pro €9,99/Mo / API Power €29,99/Mo. Live-Subscriptions (signal alerts, cycle changes, etc.) push updates via polling or webhook. Get a Free-tier key at /dashboard/account/api-keys (no credit-card required).'
  version: 1.0.0
  contact:
    name: Backtesting Arena
    url: https://tradingstrategies.work
    email: info@tradingstrategies.work
  license:
    name: See terms
    url: https://tradingstrategies.work/agb
  x-logo:
    url: https://tradingstrategies.work/og-image.png
servers:
- url: https://tradingstrategies.work
  description: Production
tags:
- name: On Chain
paths:
  /api/v1/onchain/max-pain/latest:
    get:
      summary: Deribit BTC Max Pain — latest expiry + upcoming
      description: 'Last finalized Deribit BTC options expiry (max_pain_strike, spot_at_expiry, spot_minus_max_pain_pct, put_call_ratio, total_notional_usd, is_monthly/is_quarterly) plus up to 10 upcoming expiries with the max-pain level of the latest daily snapshot, days_to_expiry and open_interest_contracts. days_to_expiry is clamped at 0 and cannot distinguish "settles later today" from "settled earlier today" — use settles_at (full ISO settlement timestamp) and hours_to_settlement (signed; negative = already settled, not yet finalized). settlement_time_utc names the assumed settlement time (08:00:00Z for DERIBIT_BTC, measured against the exchange: 868/868 open instruments at exactly 08:00:00 UTC). Markets without an evidenced settlement time return null for all three instead of a guess. Every expiry — upcoming included — now carries is_monthly, is_quarterly and expiry_type (daily | weekly | monthly | quarterly). These NEST rather than partition: quarterly is also monthly. expiry_type is the only field separating a Friday expiry from a mid-week one. All three derive from the calendar, which is why upcoming expiries can carry them at all. Read the open interest alongside the level: a daily expiry with 4,000 contracts and a monthly one with 150,000 are not the same observation. oi_available distinguishes "null" from "not collected". Note (2026-07-30): the monthly/quarterly flags were corrected — they previously marked a 7-day window rather than the actual last-Friday expiry. spot_at_expiry is the exchange settlement price (DERIBIT_BTC: Deribit delivery price, 30-min index TWAP before 08:00 UTC; IBIT: ETF close of the expiry day) — recomputed 2026-08-31 for all earlier rows, which had carried the BTCUSDT daily close. `include_strike_ladder=true` adds a `strike_ladder` per expiry: open interest per 2.5 % price band around the snapshot spot (±25 %, calls/puts separate, absolute contracts, share_pct), below_range/above_range sums, max_pain_recomputed and a day-over-day `delta` on the same band grid (null with delta_reason when no prior snapshot; settled expiry: anchored at the settlement price, delta_reason=settled). Open interest is a stock, not a side — no hedge direction follows; `strike_ladder_note` travels with the response. Omit the flag for the unchanged payload. Cron collects daily 02:00 UTC. [Free tier]'
      operationId: getMaxPainLatest
      tags:
      - On Chain
      security:
      - bearerAuth: []
      parameters:
      - name: market
        in: query
        schema:
          type: string
          enum:
          - DERIBIT_BTC
          default: DERIBIT_BTC
        description: 'Options market. Only DERIBIT_BTC is served: IBIT is still collected daily but no longer delivered (unlicensed source, no redistribution — 2026-09-24).'
      - name: include_strike_ladder
        in: query
        schema:
          type: boolean
          default: false
        description: true ⇒ each expiry carries strike_ladder (OI per 2.5 % band around spot, ±25 %, calls/puts, absolute contracts, day-over-day delta). Omit for the unchanged payload.
      - name: expiry_date
        in: query
        schema:
          type: string
          format: date
        description: 'Optional: restrict upcoming[] (with strike_ladder/gex) to ONE open expiry — keeps ladder/GEX responses small; gex_totals still covers the whole book. A date that is not open returns invalid_input listing the open expiries; upcoming_filter echoes the choice.'
      - name: include_gex
        in: query
        schema:
          type: boolean
          default: false
        description: 'true ⇒ (DERIBIT_BTC only) each upcoming expiry carries a gex block + gex_totals across the book: BS gamma notional (USD per 1 % move) per 2.5 % band from live Deribit mark IV. The dealer sign is an ASSUMPTION — both conventions published side by side; zero_gamma_level flips only under the SqueezeMetrics convention (short-all has no zero crossing by construction, its null is structural — zero_gamma_level.note says so). Tau floor 2 h; instruments without usable IV excluded and counted. gex_data_as_of names the live fetch (different observation time than the 02:00 UTC snapshot fields).'
      responses:
        '200':
          description: Latest max-pain expiry snapshot + upcoming expiries.
        '400':
          description: Invalid input — fehlt Pflichtfeld oder Wert außerhalb des erlaubten Bereichs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthenticated — kein gültiger Bearer-Token im Authorization-Header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Tier-Insufficient — Endpoint braucht höheren API-Tier. Response enthält upgrade_url.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not-Found — Resource existiert nicht oder gehört nicht dem aktuellen User.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate-Limit überschritten — Tier-Quota (hourly/daily) oder Per-Endpoint-Quota erreicht. Retry-After-Header gesetzt.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Upstream-Failure — Datenquelle nicht erreichbar (Binance, EODHD, etc.).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-min-tier: free
  /api/v1/onchain/max-pain/history:
    get:
      summary: Deribit BTC Max Pain — historical expiries
      description: 'History of finalized Deribit BTC options expiries in one call — a complete base rate, not a page. Each row: expiry_date, max_pain_strike, spot_at_expiry, %-diff, put_call_ratio, notional, total_contracts here is the open interest at the LAST daily snapshot BEFORE expiry -- the same measurement as open_interest_contracts on upcoming expiries, only observed at a different time. contracts_as_of names the snapshot the contracts came from -- equal to expiry_date in all 64 measured rows, so contracts and settlement price are same-day; the field makes a future gap visible. is_quarterly, is_monthly (the latter two corrected 2026-07-30 — they previously marked a 7-day window rather than the last-Friday expiry). spot_at_expiry = Deribit delivery price (30-min index TWAP before 08:00 UTC); rows before 2026-08-31 were recomputed from that series (they had carried the BTCUSDT daily close), so base rates computed before that date differ. Days capped by tier: Pro 365d, Power 3650d. [API Pro tier]'
      operationId: getMaxPainHistory
      tags:
      - On Chain
      security:
      - bearerAuth: []
      parameters:
      - name: days
        in: query
        schema:
          type: integer
          default: 90
        description: 'Days back from today. Capped by tier: Pro 365, Power 3650.'
      - name: market
        in: query
        schema:
          type: string
          enum:
          - DERIBIT_BTC
          default: DERIBIT_BTC
        description: Options market. Currently only DERIBIT_BTC.
      - name: expiry_type
        in: query
        schema:
          type: string
          enum:
          - daily
          - weekly
          - monthly
          - quarterly
        description: 'E27: filter expiries AND open_snapshots to one expiry class (label = highest level; booleans nest). base_rates are computed before this filter.'
      - name: min_contracts
        in: query
        schema:
          type: integer
        description: 'E27: only finalized expiries with total_contracts >= this.'
      - name: snapshot_expiry_date
        in: query
        schema:
          type: string
          format: date
        description: 'E27: reduce open_snapshots[] to exactly this expiry (with include_open_snapshots=true).'
      - name: include_open_snapshots
        in: query
        schema:
          type: boolean
          default: false
        description: Adds open_snapshots[] + open_snapshot_coverage.
      responses:
        '200':
          description: Historical max-pain expiry records + mandatory base_rates per expiry class (n, median |diff|, shares within 1%/2%, max, sample_adequate at n>=30 — present even at n=0) + filters block.
        '400':
          description: Invalid input — fehlt Pflichtfeld oder Wert außerhalb des erlaubten Bereichs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthenticated — kein gültiger Bearer-Token im Authorization-Header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Tier-Insufficient — Endpoint braucht höheren API-Tier. Response enthält upgrade_url.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not-Found — Resource existiert nicht oder gehört nicht dem aktuellen User.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate-Limit überschritten — Tier-Quota (hourly/daily) oder Per-Endpoint-Quota erreicht. Retry-After-Header gesetzt.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Upstream-Failure — Datenquelle nicht erreichbar (Binance, EODHD, etc.).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-min-tier: api_pro
components:
  schemas:
    ErrorResponse:
      type: object
      required:
      - error
      - message
      properties:
        error:
          type: string
          enum:
          - invalid_input
          - unauthenticated
          - tier_insufficient
          - not_found
          - rate_limited
          - upstream_failed
          - compute_failed
          - internal
          description: Stable error-code; map to client-side handling.
        message:
          type: string
          description: Human-readable error message.
        required_tier:
          type:
          - string
          - 'null'
          enum:
          - api_pro
          - api_power
          - null
        current_tier:
          type:
          - string
          - 'null'
          enum:
          - free
          - api_pro
          - api_power
          - null
        upgrade_url:
          type:
          - string
          - 'null'
          format: uri
        retry_after_seconds:
          type:
          - integer
          - 'null'
        details:
          type:
          - object
          - 'null'
          additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API-Key
      description: Get a Free-tier key at https://tradingstrategies.work/dashboard/account/api-keys
externalDocs:
  description: Developer landing + curl examples
  url: https://tradingstrategies.work/api