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

# Orders

> Track order state, remaining size, and conditional-order transitions.

Use `orderUpdate` to maintain an account's open orders. Subscribe through the
public [account stream](https://docs.bulk.trade/api-reference/ws-account.md), without a signature.
This page focuses on orders; the network endpoint does not filter the subscription by
event type, so snapshots, fills, and other account messages may also arrive.

## When it arrives

Order updates report placement, modification, fills, cancellation, rejection,
and conditional-order transitions. Each carries the order's state. Delivery
is asynchronous relative to the trading `post` response; either can arrive first.

## Handling

Initialize from an [account snapshot](https://docs.bulk.trade/api-reference/ws-account/snapshot.md),
then apply updates by order ID, retaining the account and `isoPubkey` identity.
`origSz` and remaining `sz` are signed: positive means buy, negative means sell.
`fillSz` is a non-negative cumulative filled quantity. Trigger baskets have
zero size because their nested actions carry the trading intent.

Remove terminal orders based on `status`, even if `sz` still shows an unfilled
remainder. A reconnect requires a fresh snapshot; there is no replay cursor.

> [accordion] Partial fills and conditional transitions
>
> `working` remains active; `partiallyFilled` is terminal. `filled`, cancellation
> and rejection statuses, `siblingCancelled`, and `triggerFailed` are terminal.
> `triggered` means a conditional root fired; it does not itself establish a fill
> or terminal execution outcome. Follow subsequent order and fill events.
>
> `pendingOnFill` represents an unfired first-fill registration, not an already
> executed consequent order. Do not infer consequent execution from its removal.


## AsyncAPI

````yaml api-reference/asyncapi.yaml account-orders
id: account-orders
title: Order updates
description: >-
  Public read-only account subscription; no signature. This channel is a
  documentation view of selected messages, not a network-side event filter.
  Every view sends the same account subscription and the live connection can
  receive all account event types. Wait for accountSnapshot before treating
  account state as ready. Snapshot replaces state; identify positions by symbol
  and isoPubkey and subscribe to subaccounts separately. No replay cursor. Save
  the acknowledged topic for unsubscribe. Unsubscribe using the acknowledged
  topic; see [Connection Management](/api-reference/ws-connection#unsubscribe).
servers:
  - id: mainnet
    protocol: wss
    host: mainnet-ws1.bulk.trade
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: exchange-ws1.bulk.trade
    bindings: []
    variables: []
address: /
parameters: []
bindings: []
operations:
  - &ref_1
    id: account-ordersSubscribe
    title: Subscribe
    type: receive
    messages:
      - &ref_3
        id: subscribe
        contentType: application/json
        payload:
          - name: Subscribe
            description: >-
              Schema defaults on this request are playground example prefills,
              not omitted-field defaults accepted by the network endpoint.
            type: object
            properties:
              - name: method
                type: string
                enumValues:
                  - subscribe
                required: true
              - name: subscription
                type: array
                description: >-
                  Playground form template only. Paste an account public key
                  into user before sending; the blank value is not a valid
                  account and no account is preselected.
                required: true
                properties:
                  - name: type
                    type: string
                    enumValues:
                      - account
                    required: true
                  - name: user
                    type: oneOf
                    description: >-
                      Paste the account public key to observe. No account is
                      preselected.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            method:
              type: string
              enum:
                - subscribe
              default: subscribe
              x-parser-schema-id: <anonymous-schema-312>
            subscription:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - account
                    default: account
                    x-parser-schema-id: <anonymous-schema-315>
                  user:
                    oneOf:
                      - type: string
                        description: Account public key in base58.
                        x-parser-schema-id: <anonymous-schema-317>
                      - type: array
                        minItems: 1
                        items:
                          type: string
                          x-parser-schema-id: <anonymous-schema-319>
                        x-parser-schema-id: <anonymous-schema-318>
                    description: >-
                      Paste the account public key to observe. No account is
                      preselected.
                    x-parser-schema-id: <anonymous-schema-316>
                required:
                  - type
                  - user
                x-parser-schema-id: <anonymous-schema-314>
              minItems: 1
              default:
                - type: account
                  user: ''
              description: >-
                Playground form template only. Paste an account public key into
                user before sending; the blank value is not a valid account and
                no account is preselected.
              x-parser-schema-id: <anonymous-schema-313>
          required:
            - method
            - subscription
          x-parser-schema-id: <anonymous-schema-311>
        title: Subscribe
        description: >-
          Schema defaults on this request are playground example prefills, not
          omitted-field defaults accepted by the network endpoint.
        example: |-
          {
            "method": "subscribe",
            "subscription": [
              {
                "type": "account",
                "user": "FuueqefENiGEW6uMqZQgmwjzgpnb85EgUcZa5Em4PQh7"
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: account-orders
  - &ref_2
    id: account-ordersEvents
    title: Receive events
    type: send
    messages:
      - &ref_4
        id: orderUpdate
        contentType: application/json
        payload:
          - name: Order update
            description: Network-published orderUpdate
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - account
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: type
                    type: string
                    enumValues:
                      - orderUpdate
                    required: true
                  - name: ot
                    type: string
                    required: false
                  - name: status
                    type: string
                    required: false
                  - name: sym
                    type: string
                    required: false
                  - name: oid
                    type: string
                    required: false
                  - name: px
                    type: number
                    required: false
                  - name: origSz
                    type: number
                    required: false
                  - name: sz
                    type: number
                    required: false
                  - name: fillSz
                    type: number
                    required: false
                  - name: vwap
                    type: number
                    required: false
                  - name: tif
                    type: string
                    required: false
                  - name: r
                    type: boolean
                    required: false
                  - name: mk
                    type: boolean
                    required: false
                  - name: trigger
                    type: object
                    required: false
                    properties:
                      - name: isAbove
                        type: boolean
                        required: false
                      - name: px
                        type: number
                        required: false
                      - name: lim
                        type: number
                        required: false
                  - name: ts
                    type: number
                    required: false
                  - name: iso
                    type: boolean
                    required: false
                  - name: reason
                    type: string
                    required: false
              - name: topic
                type: string
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - account
              x-parser-schema-id: <anonymous-schema-477>
            data:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - orderUpdate
                  x-parser-schema-id: <anonymous-schema-479>
                ot:
                  type: string
                  x-parser-schema-id: <anonymous-schema-480>
                status:
                  type: string
                  x-parser-schema-id: <anonymous-schema-481>
                sym:
                  type: string
                  x-parser-schema-id: <anonymous-schema-482>
                oid:
                  type: string
                  x-parser-schema-id: <anonymous-schema-483>
                px:
                  type: number
                  x-parser-schema-id: <anonymous-schema-484>
                origSz:
                  type: number
                  x-parser-schema-id: <anonymous-schema-485>
                sz:
                  type: number
                  x-parser-schema-id: <anonymous-schema-486>
                fillSz:
                  type: number
                  x-parser-schema-id: <anonymous-schema-487>
                vwap:
                  type: number
                  x-parser-schema-id: <anonymous-schema-488>
                tif:
                  type: string
                  x-parser-schema-id: <anonymous-schema-489>
                r:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-490>
                mk:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-491>
                trigger:
                  anyOf:
                    - type: 'null'
                      x-parser-schema-id: <anonymous-schema-493>
                    - type: object
                      properties:
                        isAbove:
                          type: boolean
                          x-parser-schema-id: <anonymous-schema-495>
                        px:
                          type: number
                          x-parser-schema-id: <anonymous-schema-496>
                        lim:
                          type: number
                          x-parser-schema-id: <anonymous-schema-497>
                      x-parser-schema-id: <anonymous-schema-494>
                  x-parser-schema-id: <anonymous-schema-492>
                ts:
                  type: number
                  x-parser-schema-id: <anonymous-schema-498>
                iso:
                  type: boolean
                  x-parser-schema-id: <anonymous-schema-499>
                reason:
                  type: string
                  x-parser-schema-id: <anonymous-schema-500>
              required:
                - type
              x-parser-schema-id: <anonymous-schema-478>
            topic:
              type: string
              x-parser-schema-id: <anonymous-schema-501>
          required:
            - type
            - data
            - topic
          x-parser-schema-id: <anonymous-schema-476>
        title: Order update
        description: Network-published orderUpdate
        example: |-
          {
            "type": "account",
            "data": {
              "type": "orderUpdate",
              "ot": "limit",
              "status": "resting",
              "sym": "BTC-USD",
              "oid": "Fpa3oVuL3UzjNANAMZZdmrn6D1Zhk83GmBuJpuAWG51F",
              "px": 102000,
              "origSz": 0.1,
              "sz": 0.1,
              "fillSz": 0,
              "vwap": 0,
              "tif": "gtc",
              "r": false,
              "mk": true,
              "trigger": null,
              "ts": 1763316177219383300,
              "iso": false
            },
            "topic": "account.FuueqefENiGEW6uMqZQgmwjzgpnb85EgUcZa5Em4PQh7"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: orderUpdate
      - &ref_5
        id: subscribed
        contentType: application/json
        payload:
          - name: Subscribed
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - subscriptionResponse
                required: true
              - name: topics
                type: array
                required: false
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - subscriptionResponse
              x-parser-schema-id: <anonymous-schema-418>
            topics:
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-420>
              x-parser-schema-id: <anonymous-schema-419>
          required:
            - type
          x-parser-schema-id: <anonymous-schema-417>
        title: Subscribed
        example: |-
          {
            "type": "subscriptionResponse",
            "topics": [
              "account.FuueqefENiGEW6uMqZQgmwjzgpnb85EgUcZa5Em4PQh7"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribed
      - &ref_6
        id: unsubscribed
        contentType: application/json
        payload:
          - name: Unsubscribed
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - unsubscribeResponse
                required: true
              - name: topic
                type: string
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              enum:
                - unsubscribeResponse
              x-parser-schema-id: <anonymous-schema-422>
            topic:
              type: string
              x-parser-schema-id: <anonymous-schema-423>
          required:
            - type
          x-parser-schema-id: <anonymous-schema-421>
        title: Unsubscribed
        example: |-
          {
            "type": "unsubscribeResponse",
            "topic": "account.FuueqefENiGEW6uMqZQgmwjzgpnb85EgUcZa5Em4PQh7"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribed
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
receiveOperations:
  - *ref_2
sendMessages:
  - *ref_3
receiveMessages:
  - *ref_4
  - *ref_5
  - *ref_6
extensions:
  - id: x-parser-unique-object-id
    value: account-orders
securitySchemes: []

````

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