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

# Recent Trades

> Recent Trades

 Get recent trades for a trading pair sorted by execution time.



## OpenAPI

````yaml /proto-openapi/api/openapi.yaml get /api/v1/trades/{tradingPairId}
openapi: 3.0.3
info:
  title: Monaco Protocol API
  description: REST API for the Monaco Protocol hybrid CLOB exchange.
  version: 1.0.0
servers:
  - url: https://staging.apimonaco.xyz
    description: Staging server (Testnet)
security: []
tags:
  - name: AccountsService
  - name: ApplicationsService
  - name: AuthService
  - name: BuildercodeRewardsService
  - name: CopyTradingService
  - name: DelegatedAgentsService
  - name: FaucetService
  - name: FeesService
  - name: HealthService
  - name: ManagedMarketsService
    description: |-
      Wallet-authenticated maker assignments. The signed session must match both
       configured maker user and application. Owner IDs are process fences, never auth.
       Only wallet sessions are supported; delegated-agent sessions receive 403.
  - name: MarginAccountsService
    description: |-
      Current public isolated-margin semantics:
       - a user has one parent margin account per application scope
       - opening orders create or reuse isolated position buckets under that parent
       - parent account creation is handled internally by margin workflows
  - name: MarketService
  - name: OrderbookService
  - name: OrdersService
  - name: PositionsService
    description: |-
      Current public isolated-margin semantics:
       - positions link to a parent margin account and, when applicable, a bucket id
       - opening orders create or reuse isolated position buckets under the parent
       - users can open another isolated position by reusing the parent account with a different market bucket
  - name: PulseService
  - name: SweeperService
  - name: TraderCodeService
  - name: TradesService
  - name: WhitelistService
  - name: WithdrawalsService
paths:
  /api/v1/trades/{tradingPairId}:
    get:
      tags:
        - TradesService
        - Trades
      summary: Recent Trades
      description: |-
        Recent Trades

         Get recent trades for a trading pair sorted by execution time.
      operationId: get_trades
      parameters:
        - name: tradingPairId
          in: path
          required: true
          schema:
            type: string
            default: 893d2add-2f36-4ee7-b660-893d2add2f36
          example: 893d2add-2f36-4ee7-b660-893d2add2f36
        - name: pageSize
          in: query
          schema:
            type: integer
            format: uint32
            minimum: 1
            maximum: 1000
            default: 25
          description: Max trades to return (max 1000)
        - name: pageToken
          in: query
          description: |-
            Pagination cursor with two states:
              - Omitted or empty string (""): start a cursor walk with no prior
                position, from the most recent trade (this listing always sorts
                newest-first).
              - Non-empty: an opaque cursor from a previous response's
                `next_page_token`; results resume immediately after that position.

             The walk is a keyset seek on `(executed_at, id)`, both immutable once a
             trade is written, so a page can neither repeat nor skip a trade when new
             fills land mid-walk — the failure the removed page number had by
             construction on a table this endpoint appends to continuously.
             `trading_pair_id` is pinned inside the token, so a token minted for one
             pair is rejected rather than seeking into another pair's history.
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTradesResponse'
        '400':
          description: Invalid trading pair ID
        '404':
          description: Trading pair not found
        '500':
          description: Internal server error
components:
  schemas:
    GetTradesResponse:
      type: object
      properties:
        trades:
          type: array
          items:
            $ref: '#/components/schemas/PublicTrade'
          nullable: true
        pageSize:
          example: 25
          type: integer
          description: Maximum number of trades returned
          format: uint32
          nullable: true
        nextPageToken:
          type: string
          description: >-
            Cursor for the next page, under **proven** semantics: the read
            over-fetches
             one row past `page_size`, so an empty token means the walk is finished and
             a non-empty token means a further trade was actually seen. Unlike
             `ListUserTradesResponse.next_page_token` (AIP-158 "maybe more"), a client
             can stop here on the empty token without a confirming extra request — this
             listing reads one table, so there is no hot/archive interleave that could
             hide rows behind a short page.

             That one table is the hot `trades` table, so a walk reaches the end of the
             archiver's retention window rather than the end of the pair's history. This
             is the endpoint's long-standing scope, unchanged by the cursor.

             There is no public walk over a pair's ARCHIVED history, and this endpoint is
             not a partial one — do not point market-data consumers at the user trade
             listings to continue it. `GetUserTrades` / `ListUserTrades` do merge the
             archive, but they are authenticated and user-scoped (`auth.user_id` is the
             read's first mandatory filter), so they return only trades where the caller
             was maker or taker. Following them to extend a public pair tape would
             silently drop every fill between two other parties. An individual archived
             trade does stay publicly reachable by id: `GetTradeById` falls back to the
             archive table on a hot miss.
          nullable: true
      description: Recent trades for a trading pair.
    PublicTrade:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/TradeData'
        eventType:
          example: trade
          type: string
          description: Event type identifier
          nullable: true
        tradingPairId:
          example: 456e7890-e12b-12d3-a456-426614174000
          type: string
          description: Trading pair UUID
          format: uuid
          nullable: true
        tradingMode:
          example: SPOT
          type: string
          description: 'Trading mode: SPOT or MARGIN'
          nullable: true
      description: >-
        A public trade event. Serializes to the REST envelope: { data: { ... },
        eventType, tradingPairId, tradingMode }. The WebSocket surface emits the
        equivalent envelope with snake_case keys.
    TradeData:
      type: object
      properties:
        executedAt:
          example: '2023-11-13T10:30:00Z'
          type: string
          description: >-
            Trade execution timestamp (ISO 8601). Omitted when the trade has no
            execution time.
          nullable: true
        makerSide:
          example: BUY
          type: string
          description: 'Maker order side: BUY or SELL'
          nullable: true
        price:
          example: '35000.00'
          type: string
          description: Execution price
          nullable: true
        quantity:
          example: '0.5'
          type: string
          description: Traded quantity in base token (normalized)
          nullable: true
        quantityRaw:
          example: '50000000'
          type: string
          description: Traded quantity in raw base-token units
          nullable: true
        tradeId:
          example: 123e4567-e89b-12d3-a456-426614174000
          type: string
          description: Trade UUID
          format: uuid
          nullable: true
      description: >-
        Core fields of a single executed trade, nested under `data` in the
        public trade event envelope.

````

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