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

> Taker-side dry run that evaluates a prospective RFQ (its legs and intended direction) without creating anything. Returns the best available maker quote if one exists. It returns no quote when the best quote breaks the RFQ's max_total_cost or min_total_cost. The response also includes the expected fee, validity, projected liquidation prices, and realized-PnL estimate for taking it.



## OpenAPI

````yaml /openapi.json post /private/rfq_get_best_quote
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: Other
    description: Uncategorized.
paths:
  /private/rfq_get_best_quote:
    post:
      tags:
        - RFQ
      summary: private/rfq_get_best_quote
      description: >-
        Taker-side dry run that evaluates a prospective RFQ (its legs and
        intended direction) without creating anything. Returns the best
        available maker quote if one exists. It returns no quote when the best
        quote breaks the RFQ's max_total_cost or min_total_cost. The response
        also includes the expected fee, validity, projected liquidation prices,
        and realized-PnL estimate for taking it.
      operationId: private_rfq_get_best_quote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RfqGetBestQuoteRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RfqGetBestQuoteResponse'
        default:
          description: JSON-RPC error (see Error Codes)
components:
  schemas:
    RfqGetBestQuoteRequest:
      type: object
      required:
        - subaccount_id
      properties:
        client:
          default: ''
          type: string
        direction:
          $ref: '#/components/schemas/Direction'
          default: buy
        extra_fee:
          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
          default: '0'
          type: string
          format: decimal
        legs:
          default: []
          type: array
          items:
            $ref: '#/components/schemas/LegUnpricedParams'
        rfq_id:
          description: |-
            RFQ ID to get best quote for.

            If not provided, will return estimates based on mark prices.
          default: null
          type:
            - string
            - 'null'
          format: uuid
        subaccount_id:
          type: integer
          format: uint64
          minimum: 0
    RfqGetBestQuoteResponse:
      type: object
      required:
        - direction
        - down_liquidation_price
        - estimated_fee
        - estimated_realized_pnl
        - estimated_realized_pnl_excl_fees
        - estimated_total_cost
        - filled_pct
        - is_valid
        - orderbook_total_cost
        - post_initial_margin
        - post_liquidation_price
        - pre_initial_margin
        - suggested_max_fee
        - up_liquidation_price
      properties:
        best_quote:
          anyOf:
            - $ref: '#/components/schemas/PublicQuote'
            - type: 'null'
        direction:
          $ref: '#/components/schemas/Direction'
        down_liquidation_price:
          description: >-
            Optional decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits, or null; a string or JSON number is accepted
          type:
            - string
            - 'null'
          format: decimal
        estimated_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
        estimated_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
        estimated_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
        estimated_total_cost:
          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
        filled_pct:
          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
        invalid_reason:
          type:
            - string
            - 'null'
        is_valid:
          type: boolean
        orderbook_total_cost:
          description: >-
            Optional decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits, or null; a string or JSON number is accepted
          type:
            - string
            - 'null'
          format: decimal
        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
        post_liquidation_price:
          description: >-
            Optional decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits, or null; a string or JSON number is accepted
          type:
            - string
            - 'null'
          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
        suggested_max_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
        up_liquidation_price:
          description: >-
            Optional decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits, or null; a string or JSON number is accepted
          type:
            - string
            - 'null'
          format: decimal
    Direction:
      type: string
      enum:
        - buy
        - sell
    LegUnpricedParams:
      type: object
      required:
        - amount
        - direction
        - instrument_name
      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
    PublicQuote:
      type: object
      required:
        - cancel_reason
        - creation_timestamp
        - direction
        - fill_pct
        - last_update_timestamp
        - legs
        - legs_hash
        - liquidity_role
        - quote_id
        - rfq_id
        - status
        - subaccount_id
        - wallet
      properties:
        cancel_reason:
          $ref: '#/components/schemas/RFQCancelReason'
        creation_timestamp:
          type: integer
          format: int64
        direction:
          $ref: '#/components/schemas/Direction'
        fill_pct:
          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
        last_update_timestamp:
          type: integer
          format: int64
        legs:
          type: array
          items:
            $ref: '#/components/schemas/PricedLegParamsAndResponse'
        legs_hash:
          type: string
        liquidity_role:
          $ref: '#/components/schemas/LiquidityRole'
        quote_id:
          description: UUID v4 string
          type: string
          format: uuid
        rfq_id:
          description: UUID v4 string
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/RFQStatus'
        subaccount_id:
          type: integer
          format: int64
        wallet:
          $ref: '#/components/schemas/Address'
    RFQCancelReason:
      type: string
      enum:
        - ''
        - user_request
        - insufficient_margin
        - signed_max_fee_too_low
        - mmp_trigger
        - cancel_on_disconnect
        - session_key_deregistered
        - subaccount_withdrawn
        - rfq_no_longer_open
        - compliance
        - validation_failed
    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
    LiquidityRole:
      type: string
      enum:
        - maker
        - taker
    RFQStatus:
      type: string
      enum:
        - open
        - filled
        - cancelled
        - expired
    Address:
      description: 20-byte Ethereum address as a 0x-prefixed lowercase hex string.
      type: string
      maxLength: 42
      minLength: 42
      pattern: ^0x[0-9a-fA-F]{40}$

````

## Related topics

- [RFQ Trading](/trading/rfq.md)
- [Builder Fees on Derive](/integrators/programs/builder-fees.md)
- [private/send_rfq](/api-reference/rfq/privatesend_rfq.md)


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