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

# Subaccount best quotes

> Channel name: `{subaccount_id}.best.quotes`. Private channel (requires authentication) that streams best-quote updates relevant to your subaccount, where {subaccount_id} is the numeric subaccount identifier.



## AsyncAPI

````yaml subscriptions.asyncapi.json subaccountBestQuotes
id: subaccountBestQuotes
title: Subaccount best quotes
description: >-
  Channel name: `{subaccount_id}.best.quotes`. Private channel (requires
  authentication) that streams best-quote updates relevant to your subaccount,
  where {subaccount_id} is the numeric subaccount identifier.
servers:
  - id: production
    protocol: wss
    host: api.derive.xyz
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: testnet.api.derive.xyz
    bindings: []
    variables: []
address: /v3/ws
parameters: []
bindings: []
operations:
  - &ref_13
    id: receive_subaccountBestQuotes
    title: Receive_subaccount best quotes
    type: send
    messages:
      - &ref_16
        id: subaccountBestQuotesNotification
        payload:
          - name: subaccountBestQuotesNotification
            description: Pushed as a JSON array; each element has the fields below.
            type: object
            properties:
              - name: error
                type: object
                required: false
                properties:
                  - name: code
                    type: integer
                    required: true
                  - name: data
                    type: &ref_0
                      - string
                      - 'null'
                    required: false
                  - name: message
                    type: string
                    required: true
              - name: result
                type: object
                required: false
                properties:
                  - name: best_quote
                    type: object
                    required: false
                    properties:
                      - name: cancel_reason
                        type: string
                        enumValues:
                          - ''
                          - user_request
                          - insufficient_margin
                          - signed_max_fee_too_low
                          - mmp_trigger
                          - cancel_on_disconnect
                          - session_key_deregistered
                          - subaccount_withdrawn
                          - rfq_no_longer_open
                          - compliance
                        required: true
                      - name: creation_timestamp
                        type: integer
                        required: true
                      - name: direction
                        type: string
                        enumValues:
                          - buy
                          - sell
                        required: true
                      - name: fill_pct
                        type: string
                        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
                        required: true
                      - name: last_update_timestamp
                        type: integer
                        required: true
                      - name: legs
                        type: array
                        required: true
                        properties:
                          - name: amount
                            type: string
                            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
                            required: true
                          - name: direction
                            type: string
                            enumValues:
                              - buy
                              - sell
                            required: true
                          - name: instrument_name
                            type: string
                            required: true
                          - name: price
                            type: string
                            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
                            required: true
                      - name: legs_hash
                        type: string
                        required: true
                      - name: liquidity_role
                        type: string
                        enumValues:
                          - maker
                          - taker
                        required: true
                      - name: quote_id
                        type: string
                        description: UUID v4 string
                        required: true
                      - name: rfq_id
                        type: string
                        description: UUID v4 string
                        required: true
                      - name: status
                        type: string
                        enumValues:
                          - open
                          - filled
                          - cancelled
                          - expired
                        required: true
                      - name: subaccount_id
                        type: integer
                        required: true
                      - name: wallet
                        type: string
                        description: >-
                          20-byte Ethereum address as a 0x-prefixed lowercase
                          hex string.
                        required: true
                  - name: direction
                    type: string
                    enumValues:
                      - buy
                      - sell
                    required: true
                  - name: down_liquidation_price
                    type: &ref_2
                      - string
                      - 'null'
                    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
                    required: true
                  - name: estimated_fee
                    type: string
                    description: >-
                      Decimal string of the human value (e.g. `"1.5"`), up to 12
                      fractional digits; a string or JSON number is accepted
                    required: true
                  - name: estimated_realized_pnl
                    type: string
                    description: >-
                      Decimal string of the human value (e.g. `"1.5"`), up to 12
                      fractional digits; a string or JSON number is accepted
                    required: true
                  - name: estimated_realized_pnl_excl_fees
                    type: string
                    description: >-
                      Decimal string of the human value (e.g. `"1.5"`), up to 12
                      fractional digits; a string or JSON number is accepted
                    required: true
                  - name: estimated_total_cost
                    type: string
                    description: >-
                      Decimal string of the human value (e.g. `"1.5"`), up to 12
                      fractional digits; a string or JSON number is accepted
                    required: true
                  - name: filled_pct
                    type: string
                    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
                    required: true
                  - name: invalid_reason
                    type: &ref_3
                      - string
                      - 'null'
                    required: false
                  - name: is_valid
                    type: boolean
                    required: true
                  - name: orderbook_total_cost
                    type: &ref_4
                      - string
                      - 'null'
                    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
                    required: true
                  - name: post_initial_margin
                    type: string
                    description: >-
                      Decimal string of the human value (e.g. `"1.5"`), up to 12
                      fractional digits; a string or JSON number is accepted
                    required: true
                  - name: post_liquidation_price
                    type: &ref_5
                      - string
                      - 'null'
                    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
                    required: true
                  - name: pre_initial_margin
                    type: string
                    description: >-
                      Decimal string of the human value (e.g. `"1.5"`), up to 12
                      fractional digits; a string or JSON number is accepted
                    required: true
                  - name: suggested_max_fee
                    type: string
                    description: >-
                      Decimal string of the human value (e.g. `"1.5"`), up to 12
                      fractional digits; a string or JSON number is accepted
                    required: true
                  - name: up_liquidation_price
                    type: &ref_6
                      - string
                      - 'null'
                    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
                    required: true
              - name: rfq_id
                type: string
                description: UUID v4 string
                required: true
        headers: []
        jsonPayloadSchema:
          description: Payload for `{subaccount_id}.best.quotes`.
          type: object
          required:
            - rfq_id
          properties:
            error:
              anyOf:
                - type: object
                  required:
                    - code
                    - message
                  properties:
                    code:
                      type: integer
                      format: int64
                      x-parser-schema-id: <anonymous-schema-55>
                    data:
                      type: *ref_0
                      x-parser-schema-id: <anonymous-schema-56>
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-57>
                  x-parser-schema-id: RPCError
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-58>
              x-parser-schema-id: <anonymous-schema-54>
            result:
              anyOf:
                - 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:
                        - 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:
                              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
                              x-parser-schema-id: RFQCancelReason
                            creation_timestamp:
                              type: integer
                              format: int64
                              x-parser-schema-id: <anonymous-schema-61>
                            direction: &ref_1
                              type: string
                              enum:
                                - buy
                                - sell
                              x-parser-schema-id: 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
                              x-parser-schema-id: <anonymous-schema-62>
                            last_update_timestamp:
                              type: integer
                              format: int64
                              x-parser-schema-id: <anonymous-schema-63>
                            legs:
                              type: array
                              items:
                                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
                                    x-parser-schema-id: <anonymous-schema-65>
                                  direction: *ref_1
                                  instrument_name:
                                    type: string
                                    x-parser-schema-id: <anonymous-schema-66>
                                  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
                                    x-parser-schema-id: <anonymous-schema-67>
                                x-parser-schema-id: PricedLegParamsAndResponse
                              x-parser-schema-id: <anonymous-schema-64>
                            legs_hash:
                              type: string
                              x-parser-schema-id: <anonymous-schema-68>
                            liquidity_role:
                              type: string
                              enum:
                                - maker
                                - taker
                              x-parser-schema-id: LiquidityRole
                            quote_id:
                              description: UUID v4 string
                              type: string
                              format: uuid
                              x-parser-schema-id: <anonymous-schema-69>
                            rfq_id:
                              description: UUID v4 string
                              type: string
                              format: uuid
                              x-parser-schema-id: <anonymous-schema-70>
                            status:
                              type: string
                              enum:
                                - open
                                - filled
                                - cancelled
                                - expired
                              x-parser-schema-id: RFQStatus
                            subaccount_id:
                              type: integer
                              format: int64
                              x-parser-schema-id: <anonymous-schema-71>
                            wallet:
                              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}$
                              x-parser-schema-id: Address
                          x-parser-schema-id: PublicQuote
                        - type: 'null'
                          x-parser-schema-id: <anonymous-schema-72>
                      x-parser-schema-id: <anonymous-schema-60>
                    direction: *ref_1
                    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: *ref_2
                      format: decimal
                      x-parser-schema-id: <anonymous-schema-73>
                    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
                      x-parser-schema-id: <anonymous-schema-74>
                    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
                      x-parser-schema-id: <anonymous-schema-75>
                    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
                      x-parser-schema-id: <anonymous-schema-76>
                    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
                      x-parser-schema-id: <anonymous-schema-77>
                    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
                      x-parser-schema-id: <anonymous-schema-78>
                    invalid_reason:
                      type: *ref_3
                      x-parser-schema-id: <anonymous-schema-79>
                    is_valid:
                      type: boolean
                      x-parser-schema-id: <anonymous-schema-80>
                    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: *ref_4
                      format: decimal
                      x-parser-schema-id: <anonymous-schema-81>
                    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
                      x-parser-schema-id: <anonymous-schema-82>
                    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: *ref_5
                      format: decimal
                      x-parser-schema-id: <anonymous-schema-83>
                    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
                      x-parser-schema-id: <anonymous-schema-84>
                    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
                      x-parser-schema-id: <anonymous-schema-85>
                    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: *ref_6
                      format: decimal
                      x-parser-schema-id: <anonymous-schema-86>
                  x-parser-schema-id: RfqGetBestQuoteResponse
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-87>
              x-parser-schema-id: <anonymous-schema-59>
            rfq_id:
              description: UUID v4 string
              type: string
              format: uuid
              x-parser-schema-id: <anonymous-schema-88>
          x-parser-schema-id: BestQuoteChannelResult
        title: Subaccount best quotes notification
        description: Pushed as a JSON array; each element has the fields below.
        example: No examples found
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subaccountBestQuotesNotification
    bindings: []
    extensions: &ref_11
      - id: x-parser-unique-object-id
        value: subaccountBestQuotes
  - &ref_12
    id: send_subscribe_subaccountBestQuotes
    title: Send_subscribe_subaccount best quotes
    type: receive
    messages:
      - &ref_14
        id: subscribeRequest
        payload:
          - name: subscribeRequest
            description: >-
              Send to subscribe: list this channel's address (with the {param}
              segments filled, e.g. orderbook.ETH-PERP.10.20) in
              params.channels.
            type: object
            properties:
              - name: headers
                type: &ref_7
                  - object
                  - 'null'
                description: Non-standard; used by `auth/login`.
                required: false
              - name: id
                type: anyOf
                required: true
              - name: method
                type: string
                description: subscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `subscribe`. `channels` is the required list of
                  channel names to subscribe to.
                required: true
                properties:
                  - name: channels
                    type: array
                    required: true
                    properties:
                      - name: item
                        type: string
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_7
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-16>
            id: &ref_9
              anyOf:
                - type: string
                  x-parser-schema-id: <anonymous-schema-17>
                - type: number
                  x-parser-schema-id: <anonymous-schema-18>
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-19>
              x-parser-schema-id: JsonRpcId
            method:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-20>
            params:
              description: >-
                Params for `subscribe`. `channels` is the required list of
                channel names to subscribe to.
              type: object
              required:
                - channels
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-22>
                  x-parser-schema-id: <anonymous-schema-21>
              x-parser-schema-id: SubscribeParams
          x-parser-schema-id: <anonymous-schema-15>
        title: Subscribe request
        description: >-
          Send to subscribe: list this channel's address (with the {param}
          segments filled, e.g. orderbook.ETH-PERP.10.20) in params.channels.
        example: |-
          {
            "id": 1,
            "method": "subscribe",
            "params": {
              "channels": [
                "orderbook.ETH-PERP.10.20"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
      - &ref_15
        id: unsubscribeRequest
        payload:
          - name: unsubscribeRequest
            description: >-
              Send to unsubscribe: list the channel addresses to drop in
              params.channels, or omit it to unsubscribe from everything.
            type: object
            properties:
              - name: headers
                type: &ref_8
                  - object
                  - 'null'
                description: Non-standard; used by `auth/login`.
                required: false
              - name: id
                type: anyOf
                required: true
              - name: method
                type: string
                description: unsubscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `unsubscribe`. `channels` is optional.


                  When omitted (or null) the connection unsubscribes from all
                  channels.
                required: true
                properties:
                  - name: channels
                    type: &ref_10
                      - array
                      - 'null'
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_8
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-24>
            id: *ref_9
            method:
              type: string
              const: unsubscribe
              x-parser-schema-id: <anonymous-schema-25>
            params:
              description: >-
                Params for `unsubscribe`. `channels` is optional.


                When omitted (or null) the connection unsubscribes from all
                channels.
              type: object
              properties:
                channels:
                  default: null
                  type: *ref_10
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-27>
                  x-parser-schema-id: <anonymous-schema-26>
              x-parser-schema-id: UnsubscribeParams
          x-parser-schema-id: <anonymous-schema-23>
        title: Unsubscribe request
        description: >-
          Send to unsubscribe: list the channel addresses to drop in
          params.channels, or omit it to unsubscribe from everything.
        example: |-
          {
            "method": "<string>",
            "params": {}
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: *ref_11
sendOperations:
  - *ref_12
receiveOperations:
  - *ref_13
sendMessages:
  - *ref_14
  - *ref_15
receiveMessages:
  - *ref_16
extensions:
  - id: x-parser-unique-object-id
    value: subaccountBestQuotes
securitySchemes: []

````

## Related topics

- [Preview the best quote for an RFQ](/api-reference/rfq/preview-the-best-quote-for-an-rfq.md)
- [Subaccount quotes](/api-reference/channels/subaccountquotes.md)
- [List a subaccount's quotes with history](/api-reference/rfq/list-a-subaccounts-quotes-with-history.md)
