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

# Protected_trial_update

> Real-time protected trial updates for the user. Each push replaces the active set (absence = removal); terminal DTOs are advisory. Degraded reset DTOs omit open-sourced fields like market and opened_at_ms.



## AsyncAPI

````yaml api-reference/asyncapi.json protected_trial_update
id: protected_trial_update
title: Protected_trial_update
description: >-
  Real-time protected trial updates for the user. Each push replaces the active
  set (absence = removal); terminal DTOs are advisory. Degraded reset DTOs omit
  open-sourced fields like market and opened_at_ms.
servers:
  - id: testnet
    protocol: wss
    host: api.testnet.aptoslabs.com/decibel/ws
    bindings: []
    variables: []
address: protected_trial_update:{userAddr}
parameters:
  - id: userAddr
    jsonSchema:
      type: string
      description: User wallet address (Aptos address format, e.g. 0x123...)
    description: User wallet address (Aptos address format, e.g. 0x123...)
    type: string
    required: true
    deprecated: false
bindings: []
operations:
  - &ref_19
    id: receiveprotected_trial_update
    title: Receiveprotected_trial_update
    description: >-
      Receive updates for real-time protected trial updates for the user. each
      push replaces the active set (absence = removal); terminal dtos are
      advisory. degraded reset dtos omit open-sourced fields like market and
      opened_at_ms.
    type: receive
    messages:
      - &ref_20
        id: ProtectedTrialUpdateMessage
        payload:
          - name: ProtectedTrialUpdateMessage
            description: >-
              Real-time protected trial updates for the user. Each push replaces
              the active set (absence = removal); terminal DTOs are advisory.
              Degraded reset DTOs omit open-sourced fields like market and
              opened_at_ms.
            type: object
            properties:
              - name: topic
                type: string
                required: true
              - name: trials
                type: array
                required: true
                properties:
                  - name: campaign_addr
                    type: string
                    required: true
                  - name: close_stalled
                    type: &ref_0
                      - boolean
                      - 'null'
                    description: >-
                      Active trial parked in `Closing` with a residual position
                      after a

                      settle IOC couldn't fully close. `None` = not evaluated
                      (history rows,

                      WS path, old backend); `Some(true)` = stalled.
                    required: false
                  - name: closed_at_ms
                    type: &ref_1
                      - integer
                      - 'null'
                    required: false
                  - name: closed_by
                    type: &ref_2
                      - string
                      - 'null'
                    required: false
                  - name: expires_at_ms
                    type: &ref_3
                      - integer
                      - 'null'
                    required: false
                  - name: leverage_at_open
                    type: &ref_4
                      - integer
                      - 'null'
                    required: false
                  - name: mark_at_close
                    type: &ref_5
                      - integer
                      - 'null'
                    required: false
                  - name: mark_at_close_usd
                    type: &ref_6
                      - number
                      - 'null'
                    required: false
                  - name: mark_at_open
                    type: &ref_7
                      - integer
                      - 'null'
                    required: false
                  - name: mark_at_open_usd
                    type: &ref_8
                      - number
                      - 'null'
                    required: false
                  - name: market
                    type: &ref_9
                      - string
                      - 'null'
                    required: false
                  - name: opened_at_ms
                    type: &ref_10
                      - integer
                      - 'null'
                    required: false
                  - name: prior_status
                    type: string
                    required: false
                  - name: protected_amount
                    type: &ref_11
                      - integer
                      - 'null'
                    required: false
                  - name: protected_amount_usd
                    type: &ref_12
                      - number
                      - 'null'
                    required: false
                  - name: settle_reason
                    type: string
                    required: false
                  - name: side
                    type: string
                    required: false
                  - name: size
                    type: &ref_13
                      - number
                      - 'null'
                    description: >-
                      Normalized size; null when the market is unknown. Always
                      present (not skipped).
                    required: false
                  - name: status
                    type: string
                    description: >-
                      `Active` collapses on-chain Opening/Open/Closing; terminal
                      states come from

                      the closed/reset events.
                    enumValues:
                      - Active
                      - Settled
                      - SettledLiquidated
                    required: true
                  - name: trial_id
                    type: integer
                    required: true
                  - name: trial_subaccount
                    type: &ref_14
                      - string
                      - 'null'
                    required: false
                  - name: user
                    type: string
                    required: true
                  - name: user_payout
                    type: &ref_15
                      - integer
                      - 'null'
                    required: false
                  - name: user_payout_usd
                    type: &ref_16
                      - number
                      - 'null'
                    required: false
                  - name: vault_returned
                    type: &ref_17
                      - integer
                      - 'null'
                    required: false
                  - name: vault_returned_usd
                    type: &ref_18
                      - number
                      - 'null'
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          description: >-
            Real-time protected trial update pushed over WebSocket.


            `STREAMING_ONLY`: no snapshot on subscribe, seed via HTTP `GET
            /api/v1/protected_trials`.

            Active entries are an authoritative snapshot of the owner's active
            trials (absence =

            removal); terminal DTOs are advisory and should trigger a history
            refetch. A degraded

            reset DTO (source row gap) omits open-sourced fields like `market`
            and `opened_at_ms`.
          required:
            - topic
            - trials
          properties:
            topic:
              type: string
              x-parser-schema-id: <anonymous-schema-74>
            trials:
              type: array
              items:
                type: object
                description: >-
                  A protected trial. Presence rules: open-sourced fields are
                  absent only on

                  degraded WS reset rows (enrichment miss); `size` is always
                  emitted, null on

                  unknown market; mark_at_close appears on organic closes only;
                  the remaining

                  terminal fields appear on closed/reset rows only.
                required:
                  - trial_id
                  - user
                  - campaign_addr
                  - status
                properties:
                  campaign_addr:
                    type: string
                    x-parser-schema-id: <anonymous-schema-76>
                  close_stalled:
                    type: *ref_0
                    description: >-
                      Active trial parked in `Closing` with a residual position
                      after a

                      settle IOC couldn't fully close. `None` = not evaluated
                      (history rows,

                      WS path, old backend); `Some(true)` = stalled.
                    x-parser-schema-id: <anonymous-schema-77>
                  closed_at_ms:
                    type: *ref_1
                    format: int64
                    x-parser-schema-id: <anonymous-schema-78>
                  closed_by:
                    type: *ref_2
                    x-parser-schema-id: <anonymous-schema-79>
                  expires_at_ms:
                    type: *ref_3
                    format: int64
                    x-parser-schema-id: <anonymous-schema-80>
                  leverage_at_open:
                    type: *ref_4
                    format: int64
                    minimum: 0
                    x-parser-schema-id: <anonymous-schema-81>
                  mark_at_close:
                    type: *ref_5
                    format: int64
                    minimum: 0
                    x-parser-schema-id: <anonymous-schema-82>
                  mark_at_close_usd:
                    type: *ref_6
                    format: double
                    x-parser-schema-id: <anonymous-schema-83>
                  mark_at_open:
                    type: *ref_7
                    format: int64
                    minimum: 0
                    x-parser-schema-id: <anonymous-schema-84>
                  mark_at_open_usd:
                    type: *ref_8
                    format: double
                    x-parser-schema-id: <anonymous-schema-85>
                  market:
                    type: *ref_9
                    x-parser-schema-id: <anonymous-schema-86>
                  opened_at_ms:
                    type: *ref_10
                    format: int64
                    x-parser-schema-id: <anonymous-schema-87>
                  prior_status:
                    oneOf:
                      - type: 'null'
                        x-parser-schema-id: <anonymous-schema-89>
                      - type: string
                        description: >-
                          Status a trial held before an admin reset. Resets are
                          only allowed from

                          Opening(0)/Open(1), both of which the wire collapses
                          to `Active`.
                        enum:
                          - Active
                        x-parser-schema-id: TrialPriorStatus
                    x-parser-schema-id: <anonymous-schema-88>
                  protected_amount:
                    type: *ref_11
                    format: int64
                    minimum: 0
                    x-parser-schema-id: <anonymous-schema-90>
                  protected_amount_usd:
                    type: *ref_12
                    format: double
                    x-parser-schema-id: <anonymous-schema-91>
                  settle_reason:
                    oneOf:
                      - type: 'null'
                        x-parser-schema-id: <anonymous-schema-93>
                      - type: string
                        description: >-
                          Why a trial closed. Chain values 0-5 mirror
                          `protected_trial.move` settle-reason

                          constants; `AdminReset` is synthetic (reset rows only)
                          and is never produced

                          by [`SettleReason::parse_chain`]. `SweptAfterStall`
                          (5) marks an organic

                          stalled trial drained by the sweep tail with funds
                          intact; `AdminForced`

                          marks admin-origin residual settles.
                        enum:
                          - ExpiredClean
                          - LiquidatedEmpty
                          - PartialLoss
                          - NeverFilled
                          - AdminForced
                          - SweptAfterStall
                          - AdminReset
                        x-parser-schema-id: SettleReason
                    x-parser-schema-id: <anonymous-schema-92>
                  side:
                    oneOf:
                      - type: 'null'
                        x-parser-schema-id: <anonymous-schema-95>
                      - type: string
                        description: >-
                          Trial direction. Maps from on-chain `side_is_buy:
                          bool`.
                        enum:
                          - Buy
                          - Sell
                        x-parser-schema-id: TradeSide
                    x-parser-schema-id: <anonymous-schema-94>
                  size:
                    type: *ref_13
                    format: double
                    description: >-
                      Normalized size; null when the market is unknown. Always
                      present (not skipped).
                    x-parser-schema-id: <anonymous-schema-96>
                  status:
                    type: string
                    description: >-
                      `Active` collapses on-chain Opening/Open/Closing; terminal
                      states come from

                      the closed/reset events.
                    enum:
                      - Active
                      - Settled
                      - SettledLiquidated
                    x-parser-schema-id: TrialStatus
                  trial_id:
                    type: integer
                    format: int64
                    minimum: 0
                    x-parser-schema-id: <anonymous-schema-97>
                  trial_subaccount:
                    type: *ref_14
                    x-parser-schema-id: <anonymous-schema-98>
                  user:
                    type: string
                    x-parser-schema-id: <anonymous-schema-99>
                  user_payout:
                    type: *ref_15
                    format: int64
                    minimum: 0
                    x-parser-schema-id: <anonymous-schema-100>
                  user_payout_usd:
                    type: *ref_16
                    format: double
                    x-parser-schema-id: <anonymous-schema-101>
                  vault_returned:
                    type: *ref_17
                    format: int64
                    minimum: 0
                    x-parser-schema-id: <anonymous-schema-102>
                  vault_returned_usd:
                    type: *ref_18
                    format: double
                    x-parser-schema-id: <anonymous-schema-103>
                x-parser-schema-id: TrialDto
              x-parser-schema-id: <anonymous-schema-75>
          x-parser-schema-id: ProtectedTrialUpdateResponse
        title: Protected trial update message
        description: >-
          Real-time protected trial updates for the user. Each push replaces the
          active set (absence = removal); terminal DTOs are advisory. Degraded
          reset DTOs omit open-sourced fields like market and opened_at_ms.
        example: |-
          {
            "topic": "protected_trial_update:0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
            "trials": [
              {
                "trial_id": 7,
                "user": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
                "campaign_addr": "0xfedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210",
                "market": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
                "trial_subaccount": "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba",
                "side": "Buy",
                "protected_amount": 5000000,
                "protected_amount_usd": 5,
                "size": 0.5,
                "mark_at_open": 65000000000,
                "mark_at_open_usd": 65000,
                "leverage_at_open": 10,
                "opened_at_ms": 1699564800000,
                "expires_at_ms": 1699651200000,
                "status": "Active"
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: ProtectedTrialUpdateMessage
          - id: x-parser-message-name
            value: ProtectedTrialUpdateMessage
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: protected_trial_update
sendOperations:
  - *ref_19
receiveOperations: []
sendMessages:
  - *ref_20
receiveMessages: []
extensions:
  - id: x-parser-unique-object-id
    value: protected_trial_update
securitySchemes: []

````