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

# private/get_block_trades

> Returns a paginated history of the caller's block trades for a wallet or one of its subaccounts, newest first. Pages count blocks, not trades. Each block has its time, the caller's liquidity role and the caller's trades, one per leg, in the private/get_trade_history shape. Optional filters: a time window, an instrument name and a direction. A block matches the instrument filter if it has a trade in that instrument, and the direction filter if any of the caller's trades has that direction. A matching block returns all of its trades. A session key restricted to some subaccounts sees only their blocks.



## OpenAPI

````yaml /openapi.json post /private/get_block_trades
openapi: 3.1.0
info:
  title: Derive v3 API
  version: 0.2.0
  description: JSON-RPC 2.0 methods, served over WebSocket and HTTP POST.
servers:
  - url: https://api.derive.xyz/v3
    description: Production (HTTP POST base)
  - url: https://testnet.api.derive.xyz/v3
    description: Testnet (HTTP POST base)
security: []
tags:
  - name: Subaccounts
    description: >-
      List, inspect, and label subaccounts, portfolios, positions, and
      collateral.
  - name: Session Keys
    description: Register, edit, and list delegated signing keys.
  - name: Account
    description: Wallet-level account information and settings.
  - name: Orderbook
    description: Place, replace, cancel, and query orders, trigger orders, and algos.
  - name: RFQ
    description: 'Request-for-quote: send RFQs, quote, and execute block trades.'
  - name: Liquidations
    description: >-
      Open a Dutch auction against a breaching subaccount, quote the auctions
      running right now, bid on them, and review past ones.
  - name: Vault Shareholders
    description: >-
      Deposit into and withdraw from vaults, and track shares, requests, and
      performance.
  - name: Vault Curators
    description: >-
      Create and operate curated vaults: settle deposit and withdrawal requests,
      and manage vault metadata.
  - name: History
    description: >-
      Per-account historical records: orders, trades, transfers, and
      settlements.
  - name: Market Maker Protection
    description: Configure, read, and reset market-maker protection.
  - name: Transfers & Withdrawals
    description: Move collateral between subaccounts, to other wallets, and on-chain.
  - name: Onchain Actions
    description: >-
      L1 onchain actions submitted via OnchainActionManager: register deposit
      addresses, list pending deposits, and inspect onchain action history.
  - name: System
    description: Rate limits, transaction lookups, and live incidents.
  - name: Market Data
    description: Instruments, currencies, tickers, and market-wide feeds.
  - name: Maker Scoring
    description: Maker programs, score breakdowns, and detailed scoring snapshots.
  - name: Referrals
    description: Referral codes and program performance.
  - name: Chat
    description: Anonymous chat rooms and conversations with the concierge.
  - name: Other
    description: Uncategorized.
paths:
  /private/get_block_trades:
    post:
      tags:
        - RFQ
      summary: private/get_block_trades
      description: >-
        Returns a paginated history of the caller's block trades for a wallet or
        one of its subaccounts, newest first. Pages count blocks, not trades.
        Each block has its time, the caller's liquidity role and the caller's
        trades, one per leg, in the private/get_trade_history shape. Optional
        filters: a time window, an instrument name and a direction. A block
        matches the instrument filter if it has a trade in that instrument, and
        the direction filter if any of the caller's trades has that direction. A
        matching block returns all of its trades. A session key restricted to
        some subaccounts sees only their blocks.
      operationId: private_get_block_trades
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetBlockTradesRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedBlockTradesResult'
        default:
          description: JSON-RPC error (see Error Codes)
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    $ref: '#/components/schemas/RPCError'
      security:
        - DeriveWallet: []
          DeriveTimestamp: []
          DeriveSignature: []
components:
  schemas:
    GetBlockTradesRequest:
      type: object
      properties:
        direction:
          description: >-
            Returns the blocks in which any of the caller's trades has this
            direction.
          default: null
          anyOf:
            - $ref: '#/components/schemas/Direction'
            - type: 'null'
        from_timestamp:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        instrument_name:
          description: Returns the blocks with a trade in this instrument.
          default: null
          type:
            - string
            - 'null'
        page:
          default: null
          type:
            - integer
            - 'null'
          format: uint32
          minimum: 0
        page_size:
          default: null
          type:
            - integer
            - 'null'
          format: uint32
          minimum: 0
        subaccount_id:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        to_timestamp:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        wallet:
          default: null
          type:
            - string
            - 'null'
    PaginatedBlockTradesResult:
      type: object
      required:
        - block_trades
        - pagination
      properties:
        block_trades:
          type: array
          items:
            $ref: '#/components/schemas/BlockTradeHistoryResponse'
        pagination:
          $ref: '#/components/schemas/Pagination'
    RPCError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int64
        data:
          type:
            - string
            - 'null'
        message:
          type: string
    Direction:
      type: string
      enum:
        - buy
        - sell
    BlockTradeHistoryResponse:
      description: >-
        A block trade as returned by `private/get_block_trades` and
        `private/get_block_trade`. It holds the caller's side only: the two
        sides of a block belong to different wallets.
      type: object
      required:
        - block_trade_id
        - liquidity_role
        - timestamp
        - trades
      properties:
        block_trade_id:
          description: UUID v4 string
          type: string
          format: uuid
        liquidity_role:
          $ref: '#/components/schemas/LiquidityRole'
        timestamp:
          type: integer
          format: int64
        trades:
          description: One trade per leg.
          type: array
          items:
            $ref: '#/components/schemas/TradeHistoryResponse'
    Pagination:
      description: Response envelope for paginated RPCs.
      type: object
      required:
        - count
        - num_pages
      properties:
        count:
          type: integer
          format: uint64
          minimum: 0
        num_pages:
          type: integer
          format: uint64
          minimum: 0
    LiquidityRole:
      type: string
      enum:
        - maker
        - taker
    TradeHistoryResponse:
      description: >-
        A trade as returned by `private/get_trade_history`. Mirrors a private
        trades subscription event, except `batch_status` is the settlement
        status (`null` until the batch settles).
      type: object
      required:
        - block_trade_id
        - direction
        - expected_rebate
        - extra_fee
        - index_price
        - instrument_name
        - is_transfer
        - label
        - liquidity_role
        - mark_price
        - op_uuid
        - order_id
        - quote_id
        - realized_pnl
        - realized_pnl_excl_fees
        - rfq_id
        - subaccount_id
        - timestamp
        - trade_amount
        - trade_fee
        - trade_id
        - trade_price
      properties:
        batch_status:
          anyOf:
            - $ref: '#/components/schemas/BatchStatus'
            - type: 'null'
        block_trade_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        direction:
          $ref: '#/components/schemas/Direction'
        expected_rebate:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        extra_fee:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        index_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        instrument_name:
          type: string
        is_transfer:
          type: boolean
        label:
          type: string
        liquidity_role:
          $ref: '#/components/schemas/LiquidityRole'
        mark_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        op_uuid:
          type: string
        order_id:
          type: string
        quote_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        realized_pnl:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        realized_pnl_excl_fees:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        rfq_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        subaccount_id:
          type: integer
          format: int64
        timestamp:
          type: integer
          format: int64
        trade_amount:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        trade_fee:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        trade_id:
          type: string
        trade_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        tx_hash:
          type:
            - string
            - 'null'
    BatchStatus:
      description: >-
        Batch lifecycle status — the single source of lifecycle truth for every
        operation in the batch (individual ops carry no status of their own).
        Each stage has a healthy variant and a corresponding `...Error` variant
        meaning that stage failed. Serialized as the variant name (string) in
        API responses.
      type: string
      enum:
        - Batching
        - Executing
        - Da
        - Proving
        - Settling
        - Settled
        - BatchingError
        - ExecutingError
        - DaError
        - ProvingError
        - SettlingError
        - SettledError
  securitySchemes:
    DeriveWallet:
      type: apiKey
      in: header
      name: X-DeriveWallet
      description: The wallet the request acts for.
    DeriveTimestamp:
      type: apiKey
      in: header
      name: X-DeriveTimestamp
      description: The current time in milliseconds, as a decimal string.
    DeriveSignature:
      type: apiKey
      in: header
      name: X-DeriveSignature
      description: >-
        EIP-191 signature of the timestamp, by the wallet or one of its session
        keys.

````

## Related topics

- [private/get_block_trade](https://docs.derive.xyz/api-reference/rfq/privateget_block_trade.md)
- [RFQ Trading](https://docs.derive.xyz/trading/rfq.md)
- [Changelog](https://docs.derive.xyz/changelog.md)


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