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

# fetch_trades

> Fetch a paginated tape of recent public trades for one market.

Fetch a paginated tape of recent public trades for one market.


## OpenAPI

````yaml /openpx.openapi.yaml GET /v1/trades/fetch_trades
openapi: 3.1.0
info:
  title: OpenPX Unified API
  description: >-
    Unified API surface across prediction-market exchanges. One `Exchange`
    trait, one set of models, one shape — implemented in Rust with
    auto-generated Python and TypeScript SDKs.


    This OpenAPI spec is **auto-generated** from
    `engine/core/src/exchange/traits.rs` and `schema/openpx.schema.json`. Edit
    the trait or the schema, then regenerate via `just openapi`. The spec models
    trait methods as REST operations for documentation rendering only — OpenPX
    is an in-process Rust library, not a REST service.
  version: 0.3.1
  license:
    name: MIT
servers:
  - url: https://github.com/openpx-trade/openpx
    description: >-
      Documentation surface only. OpenPX is an in-process Rust library; there is
      no hosted REST endpoint.
security: []
tags:
  - name: Markets
  - name: Orders
  - name: Positions
  - name: Balance
  - name: Orderbook
  - name: Trades
  - name: Fills
  - name: Server
paths:
  /v1/trades/fetch_trades:
    get:
      tags:
        - Trades
      summary: Fetch trades
      description: Fetch a paginated tape of recent public trades for one market.
      operationId: fetch_trades
      parameters:
        - name: asset_id
          in: query
          required: true
          schema:
            type: string
          description: >-
            Market identifier — Kalshi market ticker or Polymarket Gamma slug
            (e.g. `"KXBTCD-25APR1517"`).
        - name: cursor
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
          description: Opaque cursor returned by a prior page (e.g. `"eyJvIjoxMDB9"`).
        - name: end_ts
          in: query
          required: false
          schema:
            format: int64
            type:
              - integer
              - 'null'
          description: Inclusive upper bound, unix seconds (e.g. `1714608000`).
        - name: limit
          in: query
          required: false
          schema:
            format: uint
            minimum: 0
            type:
              - integer
              - 'null'
          description: >-
            Max trades to return; capped at 1000 (Kalshi) / 500 (Polymarket)
            (e.g. `100`).
        - name: start_ts
          in: query
          required: false
          schema:
            format: int64
            type:
              - integer
              - 'null'
          description: Inclusive lower bound, unix seconds (e.g. `1714521600`).
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketTradesPage'
        default:
          description: Unified error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenPxError'
components:
  schemas:
    MarketTradesPage:
      type: object
      description: >-
        One page of `MarketTrade` results. `cursor` is `null` on the last page;
        otherwise pass it back in the next request to continue.
      required:
        - trades
      properties:
        trades:
          type: array
          items:
            $ref: '#/components/schemas/MarketTrade'
        cursor:
          type:
            - string
            - 'null'
    OpenPxError:
      type: object
      description: >-
        Unified error type returned when an exchange call fails. The `kind`
        field is the canonical category; `message` carries the upstream
        explanation. Per-exchange variants are mapped into this shape before
        they cross the trait boundary.
      required:
        - kind
        - message
      properties:
        kind:
          type: string
          enum:
            - Authentication
            - InsufficientFunds
            - MarketNotFound
            - OrderNotFound
            - RateLimited
            - NetworkError
            - Api
            - Config
            - NotSupported
        message:
          type: string
    MarketTrade:
      description: A public trade off the market tape.
      properties:
        aggressor_side:
          description: >-
            Direction of the taker relative to YES. Options: `buy`, `sell`;
            `null` when unknown.
          type:
            - string
            - 'null'
        exchange_ts:
          description: Upstream trade time in UTC (e.g. `"2026-04-25T12:00:00Z"`).
          format: date-time
          type: string
        id:
          description: Globally-unique exchange trade id (e.g. `"t-9c2..."`).
          type: string
        no_price:
          description: NO-side reference price for binary markets (e.g. `0.38`).
          format: double
          type:
            - number
            - 'null'
        openpx_ts:
          description: Wall-clock time OpenPX served the trade (UTC).
          format: date-time
          type: string
        outcome:
          description: Outcome label (e.g. `"Yes"`, `"No"`); `null` when not exposed.
          type:
            - string
            - 'null'
        price:
          description: Trade price as YES probability in `[0, 1]` (e.g. `0.62`).
          format: double
          type: number
        size:
          description: Filled size in contracts (e.g. `25.0`).
          format: double
          type: number
        taker_address:
          description: Polymarket taker wallet address (e.g. `"0x..."`); `null` on Kalshi.
          type:
            - string
            - 'null'
        yes_price:
          description: YES-side reference price for binary markets (e.g. `0.62`).
          format: double
          type:
            - number
            - 'null'
      required:
        - exchange_ts
        - id
        - openpx_ts
        - price
        - size
      title: MarketTrade
      type: object

````