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

# Get trades

> Historical **fills** for an account and/or instrument — time-range mode or cursor-based **latest trades** pagination.

### Parameters

| Parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| account | yes | string (hex) | Account address (hex-encoded, `0x...`). Required if `instrument` is not provided. |
| instrument | yes | string (decimal) | Instrument id (hex string, `0x...`). Required if `account` is not provided. |
| startTime | yes | integer (int64) | Start timestamp in milliseconds (optional, defaults to 24h ago). |
| endTime | yes | integer (int64) | End timestamp in milliseconds (optional, defaults to now). |
| limit | yes | integer | null | Maximum number of trades to return (optional, defaults to 500, max 1000). |
| count | yes | integer | null | Alternative to `startTime`/`endTime`: number of latest trades per page (max 100). |
| cursor | yes | string | null | Opaque cursor returned by the previous `count` mode response. |

### Response fields

| Parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| `count` | no | integer \| null | Number of trades requested per page when `count` pagination mode is used. |
| `nextCursor` | no | string \| null | Cursor for the next page when `count` pagination mode is used. |
| `trades` | yes | object[] | Fill events for the requested account and/or instrument. |
| `trades[].account` | yes | string (hex) | An Ethereum-style account address (20 bytes). |
| `trades[].eventIndex` | yes | integer (int32) | — |
| `trades[].feeAmount` | yes | string | — |
| `trades[].feeRate` | yes | string | — |
| `trades[].instrument` | yes | string (decimal) | An instrument identifier (8-byte hash). |
| `trades[].isAdl` | yes | boolean | — |
| `trades[].isLiquidation` | yes | boolean | — |
| `trades[].isPassive` | yes | boolean | — |
| `trades[].orderId` | yes | integer (int64) | — |
| `trades[].pnl` | yes | string | — |
| `trades[].price` | yes | string | — |
| `trades[].round` | yes | integer (int64) | — |
| `trades[].settlementAsset` | yes | integer | — |
| `trades[].size` | yes | string | — |
| `trades[].ticker` | yes | string | Canonical instrument ticker from the indexed `instruments` table (empty if unknown). |
| `trades[].timestamp` | yes | integer (int64) | — |
| `trades[].txIndex` | yes | integer (int32) | — |

### Response example

A sample **`200`** response body is attached to this operation as an OpenAPI **example** — see the **Example** panel on this page.



## OpenAPI

````yaml /specs/indexer-openapi.json get /trades
openapi: 3.1.0
info:
  title: Rocket Indexer API Documentation
  description: >-
    Welcome to the RocketChain Indexer API documentation!


    The indexer REST API serves historical and aggregated market data from
    ClickHouse. Endpoints cover candles, trades, order history, portfolio
    curves, funding events, bridge events, vault events, current/historical
    instruments, and live instrument details.
  license:
    name: MIT
    url: https://github.com/rocketfoundation/rocket-sdk-rust/blob/main/LICENSE
  version: '1.0'
  x-logo:
    altText: ROCKET
    backgroundColor: '#00000000'
    url: https://www.rocketfoundation.io/assets/rocket-logo.svg
servers:
  - url: https://beta.rocket-cluster-1.com/indexer
    description: Beta
  - url: https://testnet.rocket-cluster-1.com/indexer
    description: Testnet
  - url: https://devnet.rocket-cluster-1.com/indexer
    description: Devnet
security: []
tags:
  - name: Indexer REST-API
    description: >-
      Read-only REST endpoints backed by the RocketChain indexer. All routes are
      served over HTTP GET.
paths:
  /trades:
    get:
      tags:
        - Indexer REST-API
      summary: Get trades
      description: >-
        Historical **fills** for an account and/or instrument — time-range mode
        or cursor-based **latest trades** pagination.


        ### Parameters


        | Parameter | Required | Type | Description |

        | --------- | -------- | ---- | ----------- |

        | account | yes | string (hex) | Account address (hex-encoded, `0x...`).
        Required if `instrument` is not provided. |

        | instrument | yes | string (decimal) | Instrument id (hex string,
        `0x...`). Required if `account` is not provided. |

        | startTime | yes | integer (int64) | Start timestamp in milliseconds
        (optional, defaults to 24h ago). |

        | endTime | yes | integer (int64) | End timestamp in milliseconds
        (optional, defaults to now). |

        | limit | yes | integer | null | Maximum number of trades to return
        (optional, defaults to 500, max 1000). |

        | count | yes | integer | null | Alternative to `startTime`/`endTime`:
        number of latest trades per page (max 100). |

        | cursor | yes | string | null | Opaque cursor returned by the previous
        `count` mode response. |


        ### Response fields


        | Parameter | Required | Type | Description |

        | --------- | -------- | ---- | ----------- |

        | `count` | no | integer \| null | Number of trades requested per page
        when `count` pagination mode is used. |

        | `nextCursor` | no | string \| null | Cursor for the next page when
        `count` pagination mode is used. |

        | `trades` | yes | object[] | Fill events for the requested account
        and/or instrument. |

        | `trades[].account` | yes | string (hex) | An Ethereum-style account
        address (20 bytes). |

        | `trades[].eventIndex` | yes | integer (int32) | — |

        | `trades[].feeAmount` | yes | string | — |

        | `trades[].feeRate` | yes | string | — |

        | `trades[].instrument` | yes | string (decimal) | An instrument
        identifier (8-byte hash). |

        | `trades[].isAdl` | yes | boolean | — |

        | `trades[].isLiquidation` | yes | boolean | — |

        | `trades[].isPassive` | yes | boolean | — |

        | `trades[].orderId` | yes | integer (int64) | — |

        | `trades[].pnl` | yes | string | — |

        | `trades[].price` | yes | string | — |

        | `trades[].round` | yes | integer (int64) | — |

        | `trades[].settlementAsset` | yes | integer | — |

        | `trades[].size` | yes | string | — |

        | `trades[].ticker` | yes | string | Canonical instrument ticker from
        the indexed `instruments` table (empty if unknown). |

        | `trades[].timestamp` | yes | integer (int64) | — |

        | `trades[].txIndex` | yes | integer (int32) | — |


        ### Response example


        A sample **`200`** response body is attached to this operation as an
        OpenAPI **example** — see the **Example** panel on this page.
      operationId: getTrades
      parameters:
        - name: account
          in: path
          description: >-
            Account address (hex-encoded, `0x...`). Required if `instrument` is
            not provided.
          required: true
          schema:
            type: string
            format: hex
          example: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'
        - name: instrument
          in: path
          description: >-
            Instrument id (hex string, `0x...`). Required if `account` is not
            provided.
          required: true
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/InstrumentId'
          example: '0x85d55cb42a3e6b50'
        - name: startTime
          in: path
          description: Start timestamp in milliseconds (optional, defaults to 24h ago).
          required: true
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/u64'
          example: 1710000000000
        - name: endTime
          in: path
          description: End timestamp in milliseconds (optional, defaults to now).
          required: true
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/u64'
          example: 1710086400000
        - name: limit
          in: path
          description: >-
            Maximum number of trades to return (optional, defaults to 500, max
            1000).
          required: true
          schema:
            type:
              - integer
              - 'null'
            default: 500
            minimum: 0
          example: 500
        - name: count
          in: path
          description: >-
            Alternative to `startTime`/`endTime`: number of latest trades per
            page (max 100).
          required: true
          schema:
            type:
              - integer
              - 'null'
            maximum: 100
            minimum: 0
          example: 50
        - name: cursor
          in: path
          description: Opaque cursor returned by the previous `count` mode response.
          required: true
          schema:
            type:
              - string
              - 'null'
          example: >-
            eyJ0aW1lc3RhbXAiOjE3NzQzNjgxMDc1OTAsInJvdW5kIjoyOTA4MzQwMSwidHhJbmRleCI6MCwiZXZlbnRJbmRleCI6MCwiZXZlbnRJZCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifQ
      responses:
        '200':
          description: Trades
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTradesResponse'
              example:
                trades:
                  - account: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'
                    eventIndex: 0
                    feeAmount: '0'
                    feeRate: '0'
                    instrument: '0x85d55cb42a3e6b50'
                    isAdl: false
                    isLiquidation: false
                    isPassive: true
                    orderId: 989078
                    pnl: '0'
                    price: '89.701'
                    round: 29083401
                    settlementAsset: 0
                    size: '0.5'
                    ticker: PERP_ETH_USDC
                    timestamp: 1774368107590
                    txIndex: 0
        '400':
          description: Invalid query parameters
          content:
            text/plain:
              schema:
                type: string
        '500':
          description: Internal server error
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    InstrumentId:
      type: string
      format: decimal
      description: An instrument identifier (8-byte hash).
      example: '42'
    u64:
      type: integer
      format: int64
      minimum: 0
    GetTradesResponse:
      type: object
      required:
        - trades
      properties:
        count:
          type:
            - integer
            - 'null'
          description: >-
            Number of trades requested per page when `count` pagination mode is
            used.
          example: 50
          minimum: 0
        nextCursor:
          type:
            - string
            - 'null'
          description: Cursor for the next page when `count` pagination mode is used.
          example: >-
            eyJ0aW1lc3RhbXAiOjE3NzQzNjgxMDc1OTAsInJvdW5kIjoyOTA4MzQwMSwidHhJbmRleCI6MCwiZXZlbnRJbmRleCI6MCwiZXZlbnRJZCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifQ
        trades:
          type: array
          items:
            $ref: '#/components/schemas/TradeResponseItem'
          description: Fill events for the requested account and/or instrument.
      examples:
        - trades:
            - account: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'
              eventIndex: 0
              feeAmount: '0'
              feeRate: '0'
              instrument: '0x85d55cb42a3e6b50'
              isAdl: false
              isLiquidation: false
              isPassive: true
              orderId: 989078
              pnl: '0'
              price: '89.701'
              round: 29083401
              settlementAsset: 0
              size: '0.5'
              ticker: PERP_ETH_USDC
              timestamp: 1774368107590
              txIndex: 0
    TradeResponseItem:
      type: object
      required:
        - timestamp
        - round
        - txIndex
        - eventIndex
        - account
        - instrument
        - ticker
        - orderId
        - price
        - size
        - settlementAsset
        - pnl
        - feeAmount
        - feeRate
        - isPassive
        - isLiquidation
        - isAdl
      properties:
        account:
          $ref: '#/components/schemas/AccountAddress'
        eventIndex:
          type: integer
          format: int32
          minimum: 0
        feeAmount:
          type: string
        feeRate:
          type: string
        instrument:
          $ref: '#/components/schemas/InstrumentId'
        isAdl:
          type: boolean
        isLiquidation:
          type: boolean
        isPassive:
          type: boolean
        orderId:
          $ref: '#/components/schemas/u64'
        pnl:
          type: string
        price:
          type: string
        round:
          type: integer
          format: int64
          minimum: 0
        settlementAsset:
          $ref: '#/components/schemas/usize'
        size:
          type: string
        ticker:
          type: string
          description: >-
            Canonical instrument ticker from the indexed `instruments` table
            (empty if unknown).
        timestamp:
          $ref: '#/components/schemas/u64'
        txIndex:
          type: integer
          format: int32
          minimum: 0
    AccountAddress:
      type: string
      format: hex
      description: An Ethereum-style account address (20 bytes).
      example: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'
    usize:
      type: integer
      minimum: 0

````