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

# Get price history

> Returns OHLCV bars. Without a range, the most recent ~500 bars. `from`/`to` (epoch seconds) narrow the window. `countBack` asks for the last N bars at or before `to` and outranks `from` (the scroll-back page); an empty countBack answer carries `noData: true`, the stop-scrolling-back signal. `stale: true` marks a countBack answer served entirely from before the asked window (closed market), so a consumer never mistakes Friday bars for a live Saturday session. The instrument may be a spread expression over instruments (`ES-NQ`, `1/ESU6`, `(ES+NQ)/2`): operators `+ - * / ^`, parentheses, numeric literals, up to four instrument legs. The engine evaluates server-side over the bucket intersection of the legs (a spread bar exists only where every leg printed that bucket); spread bars carry volume 0. A string that matches a catalog symbol exactly (such as the slash pair BTC/USD) is always that symbol, never arithmetic.



## OpenAPI

````yaml /partner-platform/openapi.json get /api/market/history
openapi: 3.1.0
info:
  title: trdrs Engine API
  version: 1.1.0
  description: >-
    ## API Reference


    This is the served OpenAPI contract for the trdrs engine: market data,
    trading and account

    routes for your firm's traders, trdrs Connect account-registration handoff,
    and preview

    challenge routes.


    See Quick Start for the first integration path: key setup, market config,
    chart data, Connect

    account registrations, idempotency, stream reconnects, and conformance.


    See Overview and API Standards for the cross-cutting contract rules.
servers:
  - url: https://app.trdrs.co
    description: Production
  - url: /
    description: This engine
security: []
tags:
  - name: Market data
    description: >-
      Symbol search and resolution, OHLCV history, quote snapshots, the server
      clock, and the live bar stream. Crypto rides each venue’s public feed;
      futures stream from the caller’s own connected Rithmic account. With none
      connected, futures requests answer 503 `feed_requires_connection`.
  - name: News
    description: >-
      Aggregated market news and the economic calendar, from licensed/open
      sources, keyword-tagged with futures roots at ingest. Platform-wide
      content (nothing per-user), admitted exactly like Market data: a licensed
      origin, a session, or a firm API key. Headlines page by published time,
      scope by instrument root, and stream live over SSE; thumbnails serve
      through the image proxy.
  - name: Trading
    description: >-
      The money surface: entries, exits, replaces, cancels, and position/account
      flattening. Every order-placing call uses `clientOrderId` as its
      idempotency key.
  - name: Account
    description: >-
      Reading a connected account. You do not create trading accounts here: a
      trader connects their own broker account (or creates a free demo account)
      in the app, and firms create evaluation accounts through the Partner API
      (Firm accounts → Create evaluation accounts) or register venue accounts
      through Connect (Create an account registration). Account state and the
      durable ledgers: balances, positions, working orders, fills, P&L history,
      and the live account stream.
  - name: Connect
    description: >-
      trdrs Connect account registration, for partner firms. Register an account
      you issued on your own venue — a pending account registration — with the
      trader’s sign-in email, optionally the venue account id and the login name
      your venue issued. The trader finds it waiting in the connect flow the
      moment they sign in with that email: the connect step is pre-filled with
      everything except the credential, which the trader always enters
      themselves. A registration never transmits a password and never grants
      access to anything before the trader’s own login succeeds. These routes
      answer a partner-scoped key only; a firm API key or a user session gets
      401. Registrations expire after 30 days; re-registering the same email +
      account refreshes the expiry instead of duplicating. The end-to-end flow
      guide is **[Quick Start](/docs/guides/quick-start)**.
  - name: Firm accounts
    description: >-
      Evaluation accounts your firm issues on the trdrs venue, through your
      partner key — the other half of account setup. Connect registrations hand
      off accounts that exist on your venue; these routes create and manage
      accounts on ours: the trader trades them on trdrs, and your firm owns the
      lifecycle. Every route is scoped to accounts your firm created through
      this API — an account the same trader opened themselves is invisible and
      untouchable here, by construction. Creation is batched with per-item
      results, and every write carries your own `referenceId`, so a crashed
      pipeline retries safely. Served when the deployment runs the prop engine;
      without it, every route in this group answers `404`.
  - name: Webhooks
    description: >-
      The outbound event bus: register an https endpoint and the platform pushes
      events to it instead of your back office polling us. Every delivery is
      signed (`trdrs-signature: t=<unix>,v1=<hmac-sha256>` over
      `${t}.${rawBody}`) so you can prove it came from us and is fresh, and
      every delivery is durable — a failed attempt is retried with backoff for
      about nine hours and the whole log is readable, so an endpoint that was
      down is a delay rather than a lost event. Serves brokers and prop firms
      alike: the account-registration (`registration.*`) events fire wherever
      Connect does, and the account events fire where the prop engine runs.
  - name: Challenges
    description: >-
      The prop evaluation surface: challenge programs and a trader’s own
      enrollments. **Preview: the one group on this page outside the
      additive-only guarantee** (the pre-contract v1 scaffold; the Phase-1
      rebuild will change these shapes; see Stability). **Cookie-authenticated,
      not key-authenticated**, and served only when the engine runs with
      `CHALLENGES_ENABLED`; without that flag the bundle is absent and every
      route below returns `404`. The firm-console/admin half of this surface is
      deliberately not documented here. It is back office, not licensed surface.
paths:
  /api/market/history:
    get:
      tags:
        - Market data
      summary: Get price history
      description: >-
        Returns OHLCV bars. Without a range, the most recent ~500 bars.
        `from`/`to` (epoch seconds) narrow the window. `countBack` asks for the
        last N bars at or before `to` and outranks `from` (the scroll-back
        page); an empty countBack answer carries `noData: true`, the
        stop-scrolling-back signal. `stale: true` marks a countBack answer
        served entirely from before the asked window (closed market), so a
        consumer never mistakes Friday bars for a live Saturday session. The
        instrument may be a spread expression over instruments (`ES-NQ`,
        `1/ESU6`, `(ES+NQ)/2`): operators `+ - * / ^`, parentheses, numeric
        literals, up to four instrument legs. The engine evaluates server-side
        over the bucket intersection of the legs (a spread bar exists only where
        every leg printed that bucket); spread bars carry volume 0. A string
        that matches a catalog symbol exactly (such as the slash pair BTC/USD)
        is always that symbol, never arithmetic.
      parameters:
        - name: instrument
          in: query
          required: true
          schema:
            type: string
        - name: tf
          in: query
          required: true
          schema:
            type: string
          description: Timeframe token, e.g. 1m / 4h / 1d / 100t
        - name: from
          in: query
          schema:
            type: integer
          description: Epoch seconds, inclusive
        - name: to
          in: query
          schema:
            type: integer
          description: Epoch seconds, inclusive
        - name: countBack
          in: query
          schema:
            type: integer
      responses:
        '200':
          description: HistoryResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoryResponse'
        '400':
          description: Malformed timeframe token or parameters (fails closed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limited (Retry-After header set)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            No feed serves this instrument. On futures the body carries a typed
            code: feed_requires_connection (futures data streams from your own
            connected Rithmic account, so connect one), feed_capacity (the
            per-user session ceiling; retry shortly), or feed_displaced (another
            application took over this login's market-data session).
            market_data_unavailable otherwise.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - tenantKey: []
      x-codeSamples:
        - lang: javascript
          label: TypeScript
          source: >-
            const res = await
            fetch('https://app.trdrs.co/api/market/history?instrument=ESU6&tf=5m',
            {
              headers: { Authorization: `Bearer ${process.env.TRDRS_API_KEY}` },
            })

            const data = await res.json()
        - lang: shell
          label: cURL
          source: >-
            curl 'https://app.trdrs.co/api/market/history?instrument=ESU6&tf=5m'
            \
              -H "Authorization: Bearer $TRDRS_API_KEY"
components:
  schemas:
    HistoryResponse:
      type: object
      properties:
        instrument:
          type: string
        tf:
          type: string
        bars:
          type: array
          items:
            $ref: '#/components/schemas/WireBar'
        noData:
          type: boolean
          description: Present (true) only on an empty countBack answer
        stale:
          type: boolean
          description: >-
            Present (true) only when every served bar predates the asked
            countBack window
      required:
        - instrument
        - tf
        - bars
      example:
        instrument: ESU6
        tf: 5m
        bars:
          - t: 1787581200
            o: 6478.25
            h: 6481.5
            l: 6477.75
            c: 6480.5
            v: 12841
          - t: 1787581500
            o: 6480.5
            h: 6483.25
            l: 6479.5
            c: 6482.75
            v: 9973
          - t: 1787581800
            o: 6482.75
            h: 6484
            l: 6480.25
            c: 6481.25
            v: 11204
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
      example:
        error: invalid_instrument
    WireBar:
      type: object
      description: One OHLCV bar (WireBar). `t` is epoch seconds at bar open.
      properties:
        t:
          type: number
          description: Bar open time, epoch seconds
        o:
          type: number
        h:
          type: number
        l:
          type: number
        c:
          type: number
        v:
          type: number
      required:
        - t
        - o
        - h
        - l
        - c
        - v
  securitySchemes:
    tenantKey:
      type: http
      scheme: bearer
      description: >-
        Your firm’s API key (the API calls this the `tenant` key; `trdrs_sk_…`),
        server-to-server only.

````