> ## 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 balances

> Channel name: `{subaccount_id}.balances`. Private channel (requires authentication) that streams balance and position updates for one of your subaccounts, where {subaccount_id} is the numeric subaccount identifier.



## AsyncAPI

````yaml subscriptions.asyncapi.json subaccountBalances
id: subaccountBalances
title: Subaccount balances
description: >-
  Channel name: `{subaccount_id}.balances`. Private channel (requires
  authentication) that streams balance and position updates for one of your
  subaccounts, 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_6
    id: receive_subaccountBalances
    title: Receive_subaccount balances
    type: send
    messages:
      - &ref_9
        id: subaccountBalancesNotification
        payload:
          - name: subaccountBalancesNotification
            description: Pushed as a JSON array; each element has the fields below.
            type: object
            properties:
              - name: name
                type: string
                required: true
              - name: new_balance
                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: previous_balance
                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: update_type
                type: string
                enumValues:
                  - trade
                  - asset_deposit
                  - asset_withdrawal
                  - transfer
                  - subaccount_deposit
                  - subaccount_withdrawal
                  - liquidation
                  - liquidator
                  - onchain_drift_fix
                  - perp_settlement
                  - option_settlement
                  - interest_accrual
                  - onchain_revert
                  - double_revert
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - name
            - new_balance
            - previous_balance
            - update_type
          properties:
            name:
              type: string
              x-parser-schema-id: <anonymous-schema-51>
            new_balance:
              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-52>
            previous_balance:
              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-53>
            update_type:
              type: string
              enum:
                - trade
                - asset_deposit
                - asset_withdrawal
                - transfer
                - subaccount_deposit
                - subaccount_withdrawal
                - liquidation
                - liquidator
                - onchain_drift_fix
                - perp_settlement
                - option_settlement
                - interest_accrual
                - onchain_revert
                - double_revert
              x-parser-schema-id: BalanceUpdateType
          x-parser-schema-id: BalanceUpdate
        title: Subaccount balances notification
        description: Pushed as a JSON array; each element has the fields below.
        example: |-
          {
            "name": "<string>",
            "new_balance": "<string>",
            "previous_balance": "<string>",
            "update_type": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subaccountBalancesNotification
    bindings: []
    extensions: &ref_4
      - id: x-parser-unique-object-id
        value: subaccountBalances
  - &ref_5
    id: send_subscribe_subaccountBalances
    title: Send_subscribe_subaccount balances
    type: receive
    messages:
      - &ref_7
        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_0
                  - 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_0
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-16>
            id: &ref_2
              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_8
        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_1
                  - 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_3
                      - array
                      - 'null'
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_1
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-24>
            id: *ref_2
            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_3
                  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_4
sendOperations:
  - *ref_5
receiveOperations:
  - *ref_6
sendMessages:
  - *ref_7
  - *ref_8
receiveMessages:
  - *ref_9
extensions:
  - id: x-parser-unique-object-id
    value: subaccountBalances
securitySchemes: []

````

## Related topics

- [Get collateral balances for a subaccount](/api-reference/subaccounts/get-collateral-balances-for-a-subaccount.md)
- [Get a wallet's vault share balances](/api-reference/vault-shareholders/get-a-wallets-vault-share-balances.md)
- [Subscriptions](/subscriptions.md)
