> ## 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/simulate_block_trade

> Estimates one side of a block trade for the caller's subaccount before it is signed. Takes the side's direction, the agreed priced legs and an optional extra_fee. Returns the total fee the side would pay, extra_fee included, its initial margin before and after the trade, and within_price_band, which is whether the total cost is inside the currency's RFQ price band for both sides, or null if the currency has no band. Fails with invalid_amount (11012) if a leg is smaller than 100 times its instrument's minimum_amount. A side without enough margin returns is_valid false and the reason, not an error. Requires the block_trade off-chain scope.



## OpenAPI

````yaml /openapi.json post /private/simulate_block_trade
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/simulate_block_trade:
    post:
      tags:
        - RFQ
      summary: private/simulate_block_trade
      description: >-
        Estimates one side of a block trade for the caller's subaccount before
        it is signed. Takes the side's direction, the agreed priced legs and an
        optional extra_fee. Returns the total fee the side would pay, extra_fee
        included, its initial margin before and after the trade, and
        within_price_band, which is whether the total cost is inside the
        currency's RFQ price band for both sides, or null if the currency has no
        band. Fails with invalid_amount (11012) if a leg is smaller than 100
        times its instrument's minimum_amount. A side without enough margin
        returns is_valid false and the reason, not an error. Requires the
        block_trade off-chain scope.
      operationId: private_simulate_block_trade
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimulateBlockTradeRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockTradeSideCheckResponse'
        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:
    SimulateBlockTradeRequest:
      type: object
      required:
        - direction
        - legs
        - subaccount_id
      properties:
        direction:
          $ref: '#/components/schemas/Direction'
          description: >-
            This side's direction. The taker side trades opposite the maker
            side.
        extra_fee:
          description: Broker fee for this side, in USD.
          default: '0'
          type: string
          format: decimal
        legs:
          description: The agreed priced legs, the same on both sides.
          type: array
          items:
            $ref: '#/components/schemas/PricedLegParamsAndResponse'
        subaccount_id:
          type: integer
          format: int64
    BlockTradeSideCheckResponse:
      description: >-
        Result for `private/simulate_block_trade` and
        `private/verify_block_trade`: one side's fee and margin if it executed
        now.
      type: object
      required:
        - estimated_fee
        - is_valid
        - post_initial_margin
        - pre_initial_margin
      properties:
        estimated_fee:
          description: The side's total fee, `extra_fee` included.
          type: string
          format: decimal
        expires_at_sec:
          description: >-
            The last second at which the signed side can execute. Null for an
            unsigned side.
          type:
            - integer
            - 'null'
          format: int64
        invalid_reason:
          type:
            - string
            - 'null'
        is_valid:
          description: >-
            False if the side does not have enough margin for its trade and
            fees, or if the trade takes the subaccount over its maximum asset
            count.
          type: boolean
        post_initial_margin:
          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
        pre_initial_margin:
          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
        within_price_band:
          description: >-
            Whether both sides are within the currency's RFQ price band. Null if
            it has no band.
          type:
            - boolean
            - 'null'
    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
    PricedLegParamsAndResponse:
      type: object
      required:
        - amount
        - direction
        - instrument_name
        - price
      properties:
        amount:
          description: >-
            Non-negative 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
        direction:
          $ref: '#/components/schemas/Direction'
        instrument_name:
          type: string
        price:
          description: >-
            Non-negative 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
  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/execute_block_trade](https://docs.derive.xyz/api-reference/rfq/privateexecute_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.