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

# Get recent trades

> The latest trades on each venue leg of the market, newest first. Pass `venue` to read one venue only; a venue symbol reads only the listing it names. Pass the `next_cursor` of a page as `cursor` to read older trades.



## OpenAPI

````yaml api-reference/openapi.json GET /markets/{id}/trades
openapi: 3.0.0
info:
  title: Lean API
  version: 0.1.0
  description: >-
    Programmatic access to Lean: canonical sports markets, quotes, orders,
    positions and balances.
servers:
  - url: '{baseUrl}/v1'
    description: Lean API
    variables:
      baseUrl:
        default: https://api.lean.xyz
        description: >-
          The Lean API base URL, without /v1. Same value as LEAN_API_URL in the
          guides.
security:
  - apiKey: []
paths:
  /markets/{id}/trades:
    get:
      tags:
        - Markets
      summary: Get recent trades
      description: >-
        The latest trades on each venue leg of the market, newest first. Pass
        `venue` to read one venue only; a venue symbol reads only the listing it
        names. Pass the `next_cursor` of a page as `cursor` to read older
        trades.
      operationId: getMarketTrades
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 512
            description: >-
              A market id from GET /markets, or a venue symbol that names one
              market: a Polymarket token id, a Hyperliquid book coin (`#…`,
              written `%23…` in a path), or a leg `ticker` (`pm:…`, `hl:…`,
              `pmus:…` or a Kalshi market ticker) that lists only this outcome.
              A symbol that names more than one market, such as a Polymarket
              condition id, is refused with 400; use the token id or the market
              id instead.
            example: >-
              mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
          required: true
          description: >-
            A market id from GET /markets, or a venue symbol that names one
            market: a Polymarket token id, a Hyperliquid book coin (`#…`,
            written `%23…` in a path), or a leg `ticker` (`pm:…`, `hl:…`,
            `pmus:…` or a Kalshi market ticker) that lists only this outcome. A
            symbol that names more than one market, such as a Polymarket
            condition id, is refused with 400; use the token id or the market id
            instead.
          name: id
          in: path
        - schema:
            type: string
            enum:
              - kalshi
              - polymarket
              - polymarket_us
              - hyperliquid
          required: false
          name: venue
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
          required: false
          name: limit
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 512
            description: '`next_cursor` of the previous page, for older trades.'
          required: false
          description: '`next_cursor` of the previous page, for older trades.'
          name: cursor
          in: query
      responses:
        '200':
          description: The market's most recent venue trades, newest first
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          market_id:
                            type: string
                            minLength: 1
                            description: >-
                              The market id from GET /markets, however the
                              request named the market.
                          trades:
                            type: array
                            items:
                              type: object
                              properties:
                                trade_id:
                                  type: string
                                  minLength: 1
                                venue:
                                  type: string
                                  enum:
                                    - kalshi
                                    - polymarket
                                    - polymarket_us
                                    - hyperliquid
                                ticker:
                                  type: string
                                  minLength: 1
                                side:
                                  type: string
                                  enum:
                                    - 'yes'
                                    - 'no'
                                price:
                                  type: string
                                quantity:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                taker_side:
                                  type: string
                                  enum:
                                    - 'yes'
                                    - 'no'
                                executed_at:
                                  type: string
                                  format: date-time
                              required:
                                - trade_id
                                - venue
                                - ticker
                                - side
                                - price
                                - quantity
                                - taker_side
                                - executed_at
                          next_cursor:
                            type: string
                            nullable: true
                            minLength: 1
                            maxLength: 512
                          livemode:
                            type: boolean
                        required:
                          - market_id
                          - trades
                          - next_cursor
                          - livemode
                      meta:
                        type: object
                        properties:
                          timestampMs:
                            type: integer
                            minimum: 0
                          requestId:
                            type: string
                            minLength: 1
                          traceId:
                            type: string
                            minLength: 1
                          cachedAtMs:
                            type: integer
                            minimum: 0
                          source:
                            type: string
                            enum:
                              - cache
                              - database
                              - clickhouse
                              - upstream
                              - fallback
                              - internal
                        required:
                          - timestampMs
                          - requestId
                    required:
                      - success
                      - data
                      - meta
                  - $ref: '#/components/schemas/ApiError'
              example:
                success: true
                data:
                  market_id: >-
                    mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                  trades:
                    - trade_id: '18342977'
                      venue: polymarket
                      ticker: >-
                        pm:0x2222222222222222222222222222222222222222222222222222222222222222
                      side: 'yes'
                      price: '0.55'
                      quantity: '25'
                      taker_side: 'yes'
                      executed_at: '2026-10-29T17:59:12.000Z'
                    - trade_id: '90517'
                      venue: hyperliquid
                      ticker: hl:9999
                      side: 'yes'
                      price: '0.54'
                      quantity: '40'
                      taker_side: 'no'
                      executed_at: '2026-10-29T17:58:47.000Z'
                  next_cursor: >-
                    eyJ0c01zIjoxNzkzMjk2NzI3MDAwLCJyZWNlaXZlZEF0TXMiOjE3OTMyOTY3MjcxMTQsInRyYWRlSWQiOiI5MDUxNyJ9
                  livemode: true
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '400':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Invalid request
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '401':
          description: Missing, invalid, expired or revoked API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid, expired or revoked API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '403':
          description: The key lacks the scope this route needs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: This API key lacks the scope this route needs
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '404':
          description: No market with this id, or none on the requested venue
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: No market with this id, or none on the requested venue
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '429':
          description: API error
          headers:
            Retry-After:
              description: Seconds remaining in the upstream read cooldown, when available
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: RATE_LIMITED
                  message: Too many requests for this API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '500':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: INTERNAL_ERROR
                  message: An internal error occurred.
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
components:
  schemas:
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - VALIDATION_ERROR
                - NOT_FOUND
                - UNAUTHORIZED
                - FORBIDDEN
                - CONFLICT
                - UPSTREAM_ERROR
                - RATE_LIMITED
                - INTERNAL_ERROR
                - FEATURE_DISABLED
                - CONDITIONAL_SELL_REJECTED
                - CONDITIONAL_SELL_ACTIVE
            message:
              type: string
              minLength: 1
            details:
              nullable: true
          required:
            - code
            - message
        meta:
          type: object
          properties:
            timestampMs:
              type: integer
              minimum: 0
            requestId:
              type: string
              minLength: 1
            traceId:
              type: string
              minLength: 1
            cachedAtMs:
              type: integer
              minimum: 0
            source:
              type: string
              enum:
                - cache
                - database
                - clickhouse
                - upstream
                - fallback
                - internal
          required:
            - timestampMs
            - requestId
      required:
        - success
        - error
        - meta
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A Lean API key, sent as `Authorization: Bearer <key>`. A test key
        (`lean_sk_test_...`) simulates orders and fills with no money; a live
        key (`lean_sk_live_...`) trades for real within the key's limits. Every
        successful response says which mode answered in `data.livemode`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.