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

# Margin watch

> Channel name: `margin.watch`. Public channel that streams margin and mark-to-market state for all accounts, letting you monitor collateralization and liquidation risk across the exchange. Takes no parameters.



## AsyncAPI

````yaml subscriptions.asyncapi.json marginWatch
id: marginWatch
title: Margin watch
description: >-
  Channel name: `margin.watch`. Public channel that streams margin and
  mark-to-market state for all accounts, letting you monitor collateralization
  and liquidation risk across the exchange. Takes no parameters.
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_marginWatch
    title: Receive_margin watch
    type: send
    messages:
      - &ref_9
        id: marginWatchNotification
        payload:
          - name: marginWatchNotification
            description: Pushed as a JSON array; each element has the fields below.
            type: object
            properties:
              - name: collaterals
                type: array
                required: true
              - name: currency
                type: string
                required: true
              - name: initial_margin
                type: string
                required: true
              - name: maintenance_margin
                type: string
                required: true
              - name: margin_type
                type: string
                required: true
              - name: positions
                type: array
                required: true
              - name: subaccount_id
                type: integer
                required: true
              - name: subaccount_value
                type: string
                required: true
              - name: valuation_timestamp
                type: integer
                required: true
        headers: []
        jsonPayloadSchema:
          description: Payload for `margin.watch`.
          type: object
          required:
            - collaterals
            - currency
            - initial_margin
            - maintenance_margin
            - margin_type
            - positions
            - subaccount_id
            - subaccount_value
            - valuation_timestamp
          properties:
            collaterals:
              type: array
              items: true
              x-parser-schema-id: <anonymous-schema-28>
            currency:
              type: string
              x-parser-schema-id: <anonymous-schema-29>
            initial_margin:
              type: string
              x-parser-schema-id: <anonymous-schema-30>
            maintenance_margin:
              type: string
              x-parser-schema-id: <anonymous-schema-31>
            margin_type:
              type: string
              x-parser-schema-id: <anonymous-schema-32>
            positions:
              type: array
              items: true
              x-parser-schema-id: <anonymous-schema-33>
            subaccount_id:
              type: integer
              format: int64
              x-parser-schema-id: <anonymous-schema-34>
            subaccount_value:
              type: string
              x-parser-schema-id: <anonymous-schema-35>
            valuation_timestamp:
              type: integer
              format: int64
              x-parser-schema-id: <anonymous-schema-36>
          x-parser-schema-id: MarginWatchResult
        title: Margin watch 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: marginWatchNotification
    bindings: []
    extensions: &ref_4
      - id: x-parser-unique-object-id
        value: marginWatch
  - &ref_5
    id: send_subscribe_marginWatch
    title: Send_subscribe_margin watch
    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: marginWatch
securitySchemes: []

````

## Related topics

- [Subscriptions](/subscriptions.md)
- [Auctions watch](/api-reference/channels/auctionswatch.md)
- [Estimate the cost and margin impact of an order](/api-reference/orderbook/estimate-the-cost-and-margin-impact-of-an-order.md)
