asyncapi: 3.1.0
info:
  title: ATLAS Public API — Streams
  version: 1.0.0
  description: "Server-push stream.* messages: public market-data streams on /market/ws and account streams on /account/ws."
servers:
  market:
    host: testnet.atlas.layerzero.network
    protocol: wss
    pathname: /market/ws
    description: Market-data streams (trades, order_book, candles, ticker, bbo, mark_price).
  account:
    host: testnet.atlas.layerzero.network
    protocol: wss
    pathname: /account/ws
    description: Account streams (orders, account, funding), by accountAddress.
channels:
  marketStreams:
    address: /market/ws
    servers:
      - $ref: "#/servers/market"
    messages:
      streamTrades:
        $ref: "#/components/messages/StreamTrades"
      streamOrderBook:
        $ref: "#/components/messages/StreamOrderBook"
      streamCandles:
        $ref: "#/components/messages/StreamCandles"
      streamTicker:
        $ref: "#/components/messages/StreamTicker"
      streamClosed:
        $ref: "#/components/messages/StreamClosed"
      streamMarkPrice:
        $ref: "#/components/messages/StreamMarkPrice"
      streamBbo:
        $ref: "#/components/messages/StreamBbo"
  accountStreams:
    address: /account/ws
    servers:
      - $ref: "#/servers/account"
    messages:
      streamOrders:
        $ref: "#/components/messages/StreamOrders"
      streamAccount:
        $ref: "#/components/messages/StreamAccount"
      streamClosed:
        $ref: "#/components/messages/StreamClosed"
      streamAdvancedOrders:
        $ref: "#/components/messages/StreamAdvancedOrders"
components:
  messages:
    StreamAccount:
      name: stream.account
      x-subscribeArgs:
        - accountAddress
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      x-authRequired: false
      description: |
        The account reports of one account in the order the Log produced them:
        its balances, positions, funding payments, wallet state and account
        reports, each numbered by the account stream's report number
        (`reportNo`), plus rejects of its transactions.

        Report frames (`balance`, `position`, `payment`, `walletState`,
        `accountReport`) carry `reportNo`, which starts at "1" and rises by one
        per report of this stream for the account, the report position `gk`,
        the `logTime` of the entry, and either the `txId` of the transaction
        whose batch produced the report or the `cause` that names the system
        event. The ordinal of `gk` counts the reports of this stream in the
        entry; the order and fill reports the same entry produces are on
        `stream.orders`. A balance or position frame leaves at the end of its
        entry and names the batch that last changed it.

        Each stream is ordered on its own. `reportNo`, `gk` and the
        snapshot belong to this stream: the numbers of `stream.orders` and of
        `stream.account` are independent, and nothing orders a frame of one
        stream against a frame of the other. A client that holds both
        subscriptions must not join them by `reportNo` or `gk`.

        Other frames:

        - `snapshot` (`snapshot = true`) — the account state, as
          `atlas.getAccountState` returns it, covering every report of this
          stream through `reportNo` and the Log through `coveredThrough`. The
          client replaces the account it holds with it. One also arrives
          among the reports, numbered like them, when an entry changes the
          account in a way no balance or position frame shows: ATLAS retired
          an isolated unit.
        - `gapNotice` — the reports numbered `missing.first` through
          `missing.last` cannot be delivered; a `snapshot` that covers them follows.
        - `heartbeat` — at least every second: every report of this stream for
          the account through Log Height `watermark` has been delivered,
          filtered out or covered by a snapshot, and `scannedThrough` is the
          highest report number passed, filtered types included, so a jump in
          `reportNo` that the filter caused is not a loss.
        - `reject` — ATLAS rejected a transaction of the account without logging it. It goes out as soon as it arrives, not ordered
          against the reports; it takes no report number and is not resumed.
          A reject goes only to the stream of its command, with the command's
          `selector`: `stream.orders` for place, replace, cancel and cancel-all
          commands, `stream.account` for every other command.
        - `health` — reserved for a later release; not emitted.

        A subscription with no `afterReportNo` starts with a `snapshot`. One
        that names `afterReportNo` receives every report of this stream after
        it, once and in order, when the client was away for at most an hour and
        the missing reports are still in the recording; otherwise a `gapNotice`
        and a `snapshot`. `types` drops whole frames of the types it leaves
        out; `snapshot`, `gapNotice` and `heartbeat` always arrive.

        Field shapes inside the report bodies MUST be byte-identical to what
        the matching HTTP reads return for the same resource.
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - accountAddress
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: True only on a `snapshot` frame.
          accountAddress:
            $ref: "#/components/schemas/AccountAddress"
          data:
            type: object
            required:
              - type
            description: Discriminated payload; the `type` tag selects one frame.
            oneOf:
              - title: StreamAccountBalance
                type: object
                required:
                  - type
                  - reportNo
                  - gk
                  - logTime
                  - balance
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - balance
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  gk:
                    $ref: "#/components/schemas/ReportPosition"
                  txId:
                    $ref: "#/components/schemas/TxId"
                  cause:
                    $ref: "#/components/schemas/ReportCause"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  balance:
                    $ref: "#/components/schemas/Balance"
              - title: StreamAccountPosition
                type: object
                required:
                  - type
                  - reportNo
                  - gk
                  - logTime
                  - position
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - position
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  gk:
                    $ref: "#/components/schemas/ReportPosition"
                  txId:
                    $ref: "#/components/schemas/TxId"
                  cause:
                    $ref: "#/components/schemas/ReportCause"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  position:
                    $ref: "#/components/schemas/Position"
              - title: StreamAccountPayment
                type: object
                required:
                  - type
                  - reportNo
                  - gk
                  - logTime
                  - payment
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - payment
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  gk:
                    $ref: "#/components/schemas/ReportPosition"
                  txId:
                    $ref: "#/components/schemas/TxId"
                  cause:
                    $ref: "#/components/schemas/ReportCause"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  payment:
                    $ref: "#/components/schemas/FundingPayment"
              - title: StreamAccountWalletState
                type: object
                required:
                  - type
                  - reportNo
                  - gk
                  - logTime
                  - walletState
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - walletState
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  gk:
                    $ref: "#/components/schemas/ReportPosition"
                  txId:
                    $ref: "#/components/schemas/TxId"
                  cause:
                    $ref: "#/components/schemas/ReportCause"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  walletState:
                    $ref: "#/components/schemas/WalletState"
              - title: StreamAccountReport
                type: object
                required:
                  - type
                  - reportNo
                  - gk
                  - logTime
                  - report
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - accountReport
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  gk:
                    $ref: "#/components/schemas/ReportPosition"
                  txId:
                    $ref: "#/components/schemas/TxId"
                  cause:
                    $ref: "#/components/schemas/ReportCause"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  report:
                    $ref: "#/components/schemas/AccountReport"
              - title: StreamAccountHealth
                type: object
                required:
                  - type
                  - health
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - health
                  health:
                    $ref: "#/components/schemas/AccountHealth"
              - title: StreamAccountReject
                type: object
                required:
                  - type
                  - txId
                  - reason
                  - selector
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - reject
                  txId:
                    $ref: "#/components/schemas/TxId"
                  reason:
                    type: string
                  detail:
                    type: string
                  clientOrderId:
                    $ref: "#/components/schemas/ClientOrderId"
                  selector:
                    $ref: "#/components/schemas/CommandSelector"
              - title: StreamAccountHeartbeat
                type: object
                required:
                  - type
                  - watermark
                  - logTime
                  - scannedThrough
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - heartbeat
                  watermark:
                    $ref: "#/components/schemas/LogHeight"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  scannedThrough:
                    $ref: "#/components/schemas/ReportNo"
              - title: StreamAccountGapNotice
                type: object
                required:
                  - type
                  - missing
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - gapNotice
                  missing:
                    $ref: "#/components/schemas/ReportRange"
              - title: StreamAccountSnapshot
                type: object
                required:
                  - type
                  - reportNo
                  - coveredThrough
                  - account
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - snapshot
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  coveredThrough:
                    $ref: "#/components/schemas/LogHeight"
                  account:
                    $ref: "#/components/schemas/AccountState"
    StreamAdvancedOrders:
      name: stream.advancedOrders
      x-subscribeStream: advanced_orders
      x-subscribeArgs:
        - accountAddress
        - strategies
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      x-authRequired: true
      description: |
        Server-push events for an account's parent orders of the strategies
        named in `strategies`; a parent of another strategy is never pushed.

        Private. Before subscribing on `/account/ws`, the same connection
        must bind the requested account with `auth.signIn`. A subscribe with
        no sign-in is refused `-20002` (Authentication required); a
        connection signed in for another account is refused `-12010` (Account
        mismatch). An `OMS-Read` credential that authorizes the
        `atlas.getAdvancedOrders` / `atlas.getAdvancedOrder` HTTP reads does
        not by itself authorize this WebSocket subscription.

        The selector `advanced_orders` and the pushed method
        `stream.advancedOrders` differ on purpose: every other stream derives
        its method name from its selector. Subscribe with
        `stream = advanced_orders`.

        The first event after subscribe has `snapshot = true` and carries
        every open parent of those strategies as
        `data.type = advancedOrders` in `data.advancedOrders`. Every later
        event has `snapshot = false`, `data.type = advancedOrder`, and carries
        the complete changed parent in `data.advancedOrder`. Each parent is an
        `AdvancedOrder`.

        Child orders and fills are not carried here: they remain on
        `stream.orders`, joined through the child `clOrdId` values returned by
        `atlas.getAdvancedOrder`. The two streams have no cross-stream
        ordering guarantee.
      payload:
        $ref: "#/components/schemas/AdvancedOrderStreamPayload"
    StreamBbo:
      name: stream.bbo
      x-subscribeArgs:
        - marketId
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: |
              true  → first delivery after subscribe; clients should replace any cached BBO. false → subsequent deliveries.
          data:
            $ref: "#/components/schemas/BBO"
    StreamCandles:
      name: stream.candles
      x-subscribeArgs:
        - marketId
        - interval
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: |
              true  → data contains the initial history snapshot, whose candles carry their own finality in `x`. false → data contains one live or finalized candle update; inspect that candle's `x` value.
          data:
            type: array
            items:
              $ref: "#/components/schemas/Candle"
    StreamClosed:
      name: stream.closed
      x-subscribeArgs: []
      description: |
        Server-initiated subscription termination notice.
        Sent before the server stops delivering events for a subscription.
        Clients should treat receipt of this message as authoritative subscription termination
        and resubscribe if continued delivery is desired.
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      payload:
        $ref: "#/components/schemas/StreamClosed"
    StreamMarkPrice:
      name: stream.mark_price
      x-subscribeArgs:
        - marketId
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: |
              true  → first delivery after subscribe; data is the latest periodic snapshot if available, or absent (no frame sent) if none. false → live update on each periodic tick.
          data:
            $ref: "#/components/schemas/MarkPrice"
    StreamOrderBook:
      name: stream.order_book
      description: |
        Order book for a market: one snapshot, then incremental deltas.

        The first frame after subscribe is a snapshot (`snapshot: true`): `data`
        holds up to 500 levels per side and `updateId`, the book state it shows.
        Every later frame is a delta (`snapshot: false`) for the subscription's
        `interval` (default 50ms): only the levels that changed during that
        interval, each `[price, size]` at its new absolute size, where size "0"
        removes the level. A delta is sent only when the book changed. At
        `0ms` (real time) each delta holds one ATLAS revision's changes and is
        sent as soon as the revision commits.

        To merge, keep a book keyed by price and the `updateId` it shows:

        1. On a snapshot, replace the whole book and take its `updateId`.
        2. On a delta, skip it if `updateId` <= the book's. Apply it when
           `prevUpdateId` <= the book's `updateId`: set each level to its size,
           remove the levels whose size is "0", and take the delta's
           `updateId`. A `prevUpdateId` above the book's means a delta is
           missing: resubscribe.

        The server joins the snapshot to the deltas that follow it, so a client
        that applies frames in order only needs the checks to detect faults.
        When the server cannot continue a subscription's deltas (for example
        it fell behind), it sends a new snapshot; apply it as in step 1.

        Update ids are ATLAS revisions: they increase but are not contiguous.
        A delta for an interval longer than the snapshot period can begin
        before the snapshot it follows; sizes are absolute, so it still
        applies. Deltas cover every price level while a snapshot holds the top
        500 per side, so a deeper level appears only after it changes.
      x-subscribeArgs:
        - marketId
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: |
              true → data is the top-N book; replace the local book. The first frame is always a snapshot, and the server resends one when it cannot continue the deltas. false → data is a delta.
          data:
            $ref: "#/components/schemas/OrderBookUpdate"
    StreamOrders:
      name: stream.orders
      x-subscribeArgs:
        - accountAddress
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      x-authRequired: false
      description: |
        The order reports of one account in the order the Log produced them:
        its orders and fills, each numbered by the order stream's report
        number (`reportNo`), plus rejects of its transactions.

        Report frames (`order`, `fill`) carry `reportNo`, which starts at "1"
        and rises by one per report of this stream for the account, the report
        position `gk`, the `logTime` of the entry, and either the `txId` of the
        transaction whose batch produced the report or the `cause` that names
        the system event. The ordinal of `gk` counts the reports of this stream
        in the entry; the balance and position reports the same entry produces
        are on `stream.account`.

        Each stream is ordered on its own. `reportNo`, `gk` and the
        snapshot belong to this stream: the numbers of `stream.orders` and of
        `stream.account` are independent, and nothing orders a frame of one
        stream against a frame of the other. A client that holds both
        subscriptions must not join them by `reportNo` or `gk`.

        Other frames:

        - `snapshot` (`snapshot = true`) — every open order of the account,
          covering every report of this stream through `reportNo` and the Log
          through `coveredThrough`.
        - `gapNotice` — the reports numbered `missing.first` through
          `missing.last` cannot be delivered; a `snapshot` that covers them follows.
        - `heartbeat` — at least every second: every report of this stream for
          the account through Log Height `watermark` has been delivered,
          filtered out or covered by a snapshot, and `scannedThrough` is the
          highest report number passed, filtered types included, so a jump in
          `reportNo` that the filter caused is not a loss.
        - `reject` — ATLAS rejected a transaction of the account without logging it. It goes out as soon as it arrives, not ordered
          against the reports; it takes no report number and is not resumed.
          A reject goes only to the stream of its command, with the command's
          `selector`: `stream.orders` for place, replace, cancel and cancel-all
          commands, `stream.account` for every other command.

        A subscription with no `afterReportNo` starts with a `snapshot`. One
        that names `afterReportNo` receives every report of this stream after
        it, once and in order, when the client was away for at most an hour and
        the missing reports are still in the recording; otherwise a `gapNotice`
        and a `snapshot`. `types` drops whole frames of the types it leaves
        out; `snapshot`, `gapNotice` and `heartbeat` always arrive.

        Field shapes inside the report bodies MUST be byte-identical to what
        the matching HTTP reads return for the same resource.
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - accountAddress
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: True only on a `snapshot` frame.
          accountAddress:
            $ref: "#/components/schemas/AccountAddress"
          data:
            type: object
            required:
              - type
            description: Discriminated payload; the `type` tag selects one frame.
            oneOf:
              - title: StreamOrdersOrder
                type: object
                required:
                  - type
                  - reportNo
                  - gk
                  - logTime
                  - order
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - order
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  gk:
                    $ref: "#/components/schemas/ReportPosition"
                  txId:
                    $ref: "#/components/schemas/TxId"
                  cause:
                    $ref: "#/components/schemas/ReportCause"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  order:
                    $ref: "#/components/schemas/Order"
              - title: StreamOrdersFill
                type: object
                required:
                  - type
                  - reportNo
                  - gk
                  - logTime
                  - fill
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - fill
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  gk:
                    $ref: "#/components/schemas/ReportPosition"
                  txId:
                    $ref: "#/components/schemas/TxId"
                  cause:
                    $ref: "#/components/schemas/ReportCause"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  fill:
                    $ref: "#/components/schemas/Fill"
              - title: StreamOrdersReject
                type: object
                required:
                  - type
                  - txId
                  - reason
                  - selector
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - reject
                  txId:
                    $ref: "#/components/schemas/TxId"
                  reason:
                    type: string
                  detail:
                    type: string
                  clientOrderId:
                    $ref: "#/components/schemas/ClientOrderId"
                  selector:
                    $ref: "#/components/schemas/CommandSelector"
              - title: StreamOrdersHeartbeat
                type: object
                required:
                  - type
                  - watermark
                  - logTime
                  - scannedThrough
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - heartbeat
                  watermark:
                    $ref: "#/components/schemas/LogHeight"
                  logTime:
                    $ref: "#/components/schemas/TimestampMs"
                  scannedThrough:
                    $ref: "#/components/schemas/ReportNo"
              - title: StreamOrdersGapNotice
                type: object
                required:
                  - type
                  - missing
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - gapNotice
                  missing:
                    $ref: "#/components/schemas/ReportRange"
              - title: StreamOrdersSnapshot
                type: object
                required:
                  - type
                  - reportNo
                  - coveredThrough
                  - openOrders
                additionalProperties: false
                properties:
                  type:
                    type: string
                    enum:
                      - snapshot
                  reportNo:
                    $ref: "#/components/schemas/ReportNo"
                  coveredThrough:
                    $ref: "#/components/schemas/LogHeight"
                  openOrders:
                    type: array
                    items:
                      $ref: "#/components/schemas/Order"
    StreamTicker:
      name: stream.ticker
      x-subscribeArgs:
        - marketId
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: |
              true  → first delivery after subscribe; clients should replace any cached ticker. false → subsequent deliveries. Every frame carries the full ticker, so clients may replace cached ticker state on every frame.
          data:
            $ref: "#/components/schemas/Ticker"
    StreamTrades:
      name: stream.trades
      x-subscribeArgs:
        - marketId
      x-originSubscribeMethod: atlas.subscribe
      x-subscriptionIdLocation: $message.payload#/subscriptionId
      payload:
        type: object
        required:
          - subscriptionId
          - seq
          - snapshot
          - data
        additionalProperties: false
        properties:
          subscriptionId:
            $ref: "#/components/schemas/SubscriptionId"
          seq:
            $ref: "#/components/schemas/SeqString"
          snapshot:
            type: boolean
            description: |
              true  → data contains the most recent trades (up to 50), newest first. The first frame after subscribe is one; a later one means trades may have been missed. Clients should replace any cached tape. false → live event; data contains one new trade.
          data:
            type: array
            items:
              $ref: "#/components/schemas/Trade"
  schemas:
    AccountAddress:
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
      description: |
        ATLAS account identifier: the account's 20-byte address as `0x` plus 40 hex characters. Responses carry lowercase hex; requests accept any case. A Wallet's first account address is its owner address. EIP-712 signs it as `address`. Not a JSON number and not a decimal string.
    AccountHealth:
      type: object
      required:
        - equity
        - unrealizedPnl
        - usedMargin
        - maintenanceMargin
        - availableToTrade
        - maintenanceBuffer
        - totalEquity
      additionalProperties: false
      properties:
        equity:
          $ref: "#/components/schemas/Amount"
          description: |
            Cross-margin account value: effective collateral plus the sum of **cross** positions' unrealized PnL, exactly as ATLAS evaluates it for new orders. Excludes isolated positions — see totalEquity.
        unrealizedPnl:
          $ref: "#/components/schemas/Amount"
          description: |
            Aggregate unrealized PnL across open **cross** positions only (already included in equity). Isolated positions' uPnL is per-position and rolls up only into totalEquity.
        usedMargin:
          $ref: "#/components/schemas/Amount"
          description: |
            Committed margin: initial margin for open positions plus the open-order reserve for resting orders. The locked slice of equity; availableToTrade = equity - usedMargin.
        maintenanceMargin:
          $ref: "#/components/schemas/Amount"
          description: |
            Maintenance-margin requirement for open positions (the liquidation floor; always <= usedMargin).
        availableToTrade:
          $ref: "#/components/schemas/Amount"
          description: |
            equity − usedMargin; the admission gate — risk-increasing actions require this >= 0. The slice of equity not locked as margin — deployable into new positions or withdrawable.
        maintenanceBuffer:
          $ref: "#/components/schemas/Amount"
          description: |
            ATLAS's authoritative distance to liquidation; the account is liquidatable exactly when this is <= 0. Computed by ATLAS from its maintenance-mode collateral valuation; NOT derivable from the other fields, and NOT guaranteed to equal equity − maintenanceMargin.
        totalEquity:
          $ref: "#/components/schemas/Amount"
          description: |
            Net worth: equity plus every isolated position's equity (isolated margin + its unrealized PnL), from the same account snapshot. Display-only aggregate — never spendable balance; isolated margin cannot back cross orders.
    AccountLimits:
      type: object
      required:
        - maxIsolatedUnits
        - maxOpenOrders
      additionalProperties: false
      description: |
        The limits a new order of the account is checked against: the protocol's ceilings, the same for every account. No limit applies per market.
      properties:
        maxIsolatedUnits:
          type: integer
          minimum: 0
          description: |
            Most isolated units the account may hold at once. The account has at most one unit per market: its first isolated order on a market opens the unit, whether the order rests or fills, and the unit closes once its position is flat and it has no resting orders. The units held are the distinct markets of the account's isolated positions and isolated open orders. An order that would open one more is refused.
        maxOpenOrders:
          type: integer
          minimum: 0
          description: |
            Most resting orders the account may have across all markets, as `atlas.getOpenOrders` lists them. An order that would rest past it is refused.
    AccountReport:
      type: object
      required:
        - request
        - timestampMs
        - body
      additionalProperties: false
      properties:
        request:
          $ref: "#/components/schemas/RequestRefV1"
          description: |
            The request whose input made the change. For a native request `txHash` is its stable request ID.
        timestampMs:
          $ref: "#/components/schemas/TimestampMs"
          description: Venue time of the input that made the change.
        body:
          $ref: "#/components/schemas/AccountReportBody"
    AccountReportAgentGrantRemoved:
      type: object
      required:
        - kind
        - agent
      additionalProperties: false
      properties:
        kind:
          type: string
          enum:
            - agentGrantRemoved
        agent:
          $ref: "#/components/schemas/EvmAddress"
    AccountReportAgentGrantSet:
      type: object
      required:
        - kind
        - agent
      additionalProperties: false
      properties:
        kind:
          type: string
          enum:
            - agentGrantSet
        agent:
          $ref: "#/components/schemas/EvmAddress"
    AccountReportBody:
      description: |
        The change, selected by `kind`. Amounts are ledger amounts at the venue's 12-decimal scale.
      oneOf:
        - $ref: "#/components/schemas/AccountReportDeposit"
        - $ref: "#/components/schemas/AccountReportWithdraw"
        - $ref: "#/components/schemas/AccountReportTransfer"
        - $ref: "#/components/schemas/AccountReportOwnerKeyRotated"
        - $ref: "#/components/schemas/AccountReportAgentGrantRemoved"
        - $ref: "#/components/schemas/AccountReportAgentGrantSet"
    AccountReportDeposit:
      type: object
      required:
        - kind
        - wallet
        - assetId
        - amount
        - fee
        - balanceAfter
      additionalProperties: false
      properties:
        kind:
          type: string
          enum:
            - deposit
        wallet:
          $ref: "#/components/schemas/AccountAddress"
        assetId:
          type: integer
          minimum: 0
          maximum: 4294967295
          description: u32 asset identifier.
        amount:
          $ref: "#/components/schemas/PositiveDecimalString"
        fee:
          $ref: "#/components/schemas/PositiveDecimalString"
        balanceAfter:
          $ref: "#/components/schemas/DecimalString"
    AccountReportOwnerKeyRotated:
      type: object
      required:
        - kind
        - newOwnerKey
      additionalProperties: false
      description: |
        Addressed to the wallet whose owner key changed. `newOwnerKey` is null when the rotation leaves the wallet with no owner key.
      properties:
        kind:
          type: string
          enum:
            - ownerKeyRotated
        newOwnerKey:
          oneOf:
            - $ref: "#/components/schemas/OwnerKey"
            - type: "null"
    AccountReportTransfer:
      type: object
      required:
        - kind
        - assetId
        - amount
        - counterparty
        - balanceAfter
        - memo
      additionalProperties: false
      properties:
        kind:
          type: string
          enum:
            - transfer
        assetId:
          type: integer
          minimum: 0
          maximum: 4294967295
          description: u32 asset identifier.
        amount:
          $ref: "#/components/schemas/DecimalString"
          description: Negative for the sender, positive for the receiver.
        counterparty:
          $ref: "#/components/schemas/AccountAddress"
        balanceAfter:
          $ref: "#/components/schemas/DecimalString"
        memo:
          type: string
          pattern: ^0x[0-9a-f]{128}$
          description: The 64 signed memo bytes, unchanged. All zero means no memo.
    AccountReportWithdraw:
      type: object
      required:
        - kind
        - assetId
        - amount
        - fee
        - balanceAfter
        - zone
        - recipient
        - memo
      additionalProperties: false
      description: Value sent to another zone.
      properties:
        kind:
          type: string
          enum:
            - withdraw
        assetId:
          type: integer
          minimum: 0
          maximum: 4294967295
          description: u32 asset identifier.
        amount:
          $ref: "#/components/schemas/PositiveDecimalString"
          description: The debit, the whole amount the zone receives.
        fee:
          $ref: "#/components/schemas/PositiveDecimalString"
          description: Always zero, since a withdrawal charges no fee; the field keeps the shape a FIX reader expects.
        balanceAfter:
          $ref: "#/components/schemas/DecimalString"
        zone:
          type: integer
          minimum: 0
          maximum: 4294967295
          description: The destination zone.
        recipient:
          type: string
          pattern: ^0x([0-9a-f]{2}){1,255}$
          description: The recipient in the receiving zone's own encoding, 0x-hex.
        memo:
          type: string
          pattern: ^0x([0-9a-f]{2}){0,255}$
          description: The withdrawal memo, 0x-hex.
    AccountState:
      type: object
      required:
        - staked
        - cross
        - isolated
        - walletState
        - asOf
        - stpLevel
        - terms
      additionalProperties: false
      properties:
        asOf:
          $ref: "#/components/schemas/TimestampMs"
          description: Venue time of the account snapshot every figure here comes from.
        staked:
          type: array
          description: |
            The account's staked balance: one row for each asset in which it holds a staking position or a pending unstake, in ascending `asset`. Empty when it stakes nothing.
          items:
            $ref: "#/components/schemas/Balance"
        cross:
          $ref: "#/components/schemas/CrossUnit"
        isolated:
          type: array
          description: |
            The account's isolated units, one per market it holds in isolated margin, in ascending market id. Empty when it has none.
          items:
            $ref: "#/components/schemas/IsolatedUnit"
        terms:
          oneOf:
            - $ref: "#/components/schemas/TermsVersion"
            - type: "null"
          description: |
            The latest Atlas Terms of Use version accepted by this account's wallet, through enableTrading or enableBuilder. A Sub account returns its Main account's acceptance. Null means the acceptance read succeeded and found no acceptance. A failed read returns service unavailable (-20003), never null. Compare id, version and contentHash with atlas.getTerms to decide whether to ask for a signature. Read at request time, independently of the account snapshot's asOf.
        walletState:
          $ref: "#/components/schemas/WalletState"
        deadManTimeoutSeconds:
          type: integer
          minimum: 5
          maximum: 86400
          description: |
            The dead-man timeout the last `cancelAllOrdersAfter` set. Present while the account's dead-man clock is on; absent when it is off, whether never set, set to 0, or ended by its expiry.
        deadManDeadlineNs:
          $ref: "#/components/schemas/Uint64String"
          description: |
            When the dead-man clock expires and cancels the account's working orders, Unix nanoseconds: the `deadlineNs` the last `cancelAllOrdersAfter` returned. Present exactly when `deadManTimeoutSeconds` is. Read it after reconnecting to decide whether to post again before it passes.
        walletAddress:
          $ref: "#/components/schemas/AccountAddress"
          description: |
            The wallet that holds this account. Absent for an address that holds no account, which shows only its unclaimed balances.
        limits:
          $ref: "#/components/schemas/AccountLimits"
        stpLevel:
          $ref: "#/components/schemas/StpLevel"
          description: |
            The self-trade prevention level of this account's wallet, set by `setStpLevel`. A wallet that never set it reads `account`.
        health:
          $ref: "#/components/schemas/AccountHealth"
          description: Not returned yet; reserved for a later release. Compute unrealised PnL from the live ticker mark meanwhile.
    AdvancedOrder:
      type: object
      required:
        - parentOrderId
        - accountAddress
        - clOrdId
        - marketId
        - marginMode
        - parentVersion
        - strategy
      additionalProperties: false
      description: |
        One parent: what every strategy shares, and the one strategy it runs in `strategy`, named by `strategy.type`. Its current state, not the receipt of any one request. A client keeps a parent whose `strategy.type` it does not know, with its common fields, rather than failing the read.
      properties:
        parentOrderId:
          $ref: "#/components/schemas/Uint64String"
        accountAddress:
          $ref: "#/components/schemas/AccountAddress"
        clOrdId:
          $ref: "#/components/schemas/ClientOrderId"
          description: The create request's `clOrdId`; an update or cancel never replaces it.
        marketId:
          type: integer
          minimum: 0
          maximum: 8589934591
        marginMode:
          type: string
          enum:
            - cross
            - isolated
        parentVersion:
          $ref: "#/components/schemas/Uint64String"
          description: |
            Counts this parent's reports. Not a command's `version` nor a read's `projectedVersion`, and never a `minVersion`.
        strategy:
          oneOf:
            - $ref: "#/components/schemas/AdvancedOrderTpSl"
            - $ref: "#/components/schemas/AdvancedOrderTwap"
    AdvancedOrderEntry:
      type: object
      required:
        - clOrdId
        - plan
        - state
        - hasFills
      additionalProperties: false
      properties:
        clOrdId:
          $ref: "#/components/schemas/ClientOrderId"
          description: The client id ATLAS gave the entry order.
        plan:
          $ref: "#/components/schemas/EntryPlan"
        state:
          type: string
          enum:
            - offered
            - working
            - done
          description: Sent and not yet answered, working on ATLAS, or no longer working.
        hasFills:
          type: boolean
          description: Whether a fill of the entry was seen; not a size, and not that it filled whole.
    AdvancedOrderSlot:
      type: object
      required:
        - plan
        - state
        - childHasFills
        - childLogged
        - childCancelState
      additionalProperties: false
      description: A side's plan and its own state; cancelling or firing one side leaves the other as it is.
      properties:
        plan:
          $ref: "#/components/schemas/SlotPlan"
        state:
          $ref: "#/components/schemas/SlotState"
        childHasFills:
          type: boolean
          description: Whether a fill of this side's close order was seen; not that it filled whole.
        childLogged:
          type: boolean
          description: Whether this side's close order was submitted to ATLAS.
        childCancelState:
          type: string
          enum:
            - notRequested
            - deciding
            - requested
            - notNeeded
            - done
          description: |
            Where cancelling the close order stands, which only cancelling the parent asks for: not asked for, decided, its cancel submitted to ATLAS, not needed because the order stopped first, or done.
    AdvancedOrderStreamPayload:
      type: object
      required:
        - subscriptionId
        - seq
        - snapshot
        - accountAddress
        - data
      additionalProperties: false
      properties:
        subscriptionId:
          $ref: "#/components/schemas/SubscriptionId"
        seq:
          $ref: "#/components/schemas/SeqString"
        snapshot:
          type: boolean
          description: |
            true on the first event after subscribe, which carries every open parent; false on every later event, which carries one changed parent.
        accountAddress:
          $ref: "#/components/schemas/AccountAddress"
        data:
          type: object
          required:
            - type
          description: |
            Discriminated payload, coupled with `snapshot`: a snapshot (`snapshot = true`) carries `type = "advancedOrders"` with every open parent in `advancedOrders`; an update (`snapshot = false`) carries `type = "advancedOrder"` with one complete parent in `advancedOrder`.
          oneOf:
            - title: StreamAdvancedOrdersSnapshot
              type: object
              required:
                - type
                - advancedOrders
              additionalProperties: false
              properties:
                type:
                  type: string
                  enum:
                    - advancedOrders
                advancedOrders:
                  type: array
                  description: Every open parent of the subscribed strategies.
                  items:
                    $ref: "#/components/schemas/AdvancedOrder"
            - title: StreamAdvancedOrdersUpdate
              type: object
              required:
                - type
                - advancedOrder
              additionalProperties: false
              properties:
                type:
                  type: string
                  enum:
                    - advancedOrder
                advancedOrder:
                  $ref: "#/components/schemas/AdvancedOrder"
      oneOf:
        - title: StreamAdvancedOrdersSnapshotEvent
          required:
            - snapshot
            - data
          properties:
            snapshot:
              type: boolean
              enum:
                - true
            data:
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - advancedOrders
        - title: StreamAdvancedOrdersUpdateEvent
          required:
            - snapshot
            - data
          properties:
            snapshot:
              type: boolean
              enum:
                - false
            data:
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - advancedOrder
    AdvancedOrderTpSl:
      type: object
      required:
        - type
        - status
        - endReason
        - protects
        - entry
        - takeProfit
        - stopLoss
      additionalProperties: false
      description: |
        A `tpSl` parent: at most one take-profit side and one stop-loss side; an entry's fills join the position and never hold the market on their own.
      properties:
        type:
          type: string
          enum:
            - tpSl
        status:
          $ref: "#/components/schemas/TpSlStatus"
        endReason:
          description: Why it was cancelled; null unless `status` is `cancelled`.
          oneOf:
            - $ref: "#/components/schemas/EndReason"
            - type: "null"
        protects:
          description: The side of the position the parent protects; null until it arms.
          oneOf:
            - type: string
              enum:
                - long
                - short
            - type: "null"
        entry:
          oneOf:
            - $ref: "#/components/schemas/AdvancedOrderEntry"
            - type: "null"
        takeProfit:
          oneOf:
            - $ref: "#/components/schemas/AdvancedOrderSlot"
            - type: "null"
        stopLoss:
          oneOf:
            - $ref: "#/components/schemas/AdvancedOrderSlot"
            - type: "null"
    AdvancedOrderTwap:
      type: object
      required:
        - type
        - status
        - endReason
        - side
        - baseQty
        - durationSeconds
        - reduceOnly
        - startedAtMs
        - deadlineMs
        - opportunities
        - filledQty
        - remainingQty
        - averagePrice
        - skip
      additionalProperties: false
      description: |
        A `twap` parent's terms and progress, shown only to the account's authenticated reads. Its children are ordinary Market + IOC orders.
      properties:
        type:
          type: string
          enum:
            - twap
        status:
          $ref: "#/components/schemas/TwapStatus"
        endReason:
          description: Why it stopped; null unless `status` is `stopped`.
          oneOf:
            - $ref: "#/components/schemas/EndReason"
            - type: "null"
        side:
          $ref: "#/components/schemas/Side"
        baseQty:
          $ref: "#/components/schemas/PositiveDecimalString"
        durationSeconds:
          type: integer
          minimum: 300
          maximum: 604800
        reduceOnly:
          type: boolean
        startedAtMs:
          type: integer
          minimum: 0
          description: When ATLAS accepted it, in cluster milliseconds; the first child is due then.
        deadlineMs:
          type: integer
          minimum: 0
          description: After this, in cluster milliseconds, it sends nothing new.
        opportunities:
          type: integer
          minimum: 1
          description: How many scheduled opportunities its plan has.
        filledQty:
          $ref: "#/components/schemas/DecimalString"
          description: Confirmed fills of its children, including a late fill after it ended.
        remainingQty:
          $ref: "#/components/schemas/DecimalString"
        averagePrice:
          description: The volume-weighted average price of its fills; null before the first.
          oneOf:
            - $ref: "#/components/schemas/PositiveDecimalString"
            - type: "null"
        skip:
          description: |
            Why its latest opportunity sent nothing, while that stands: `belowFloor` (the market's maximum order or the shortfall left a child below the starting floor) or `noPrice` (no mark to bind to).
          oneOf:
            - type: string
              enum:
                - belowFloor
                - noPrice
            - type: "null"
    AdvancedOrderType:
      type: string
      enum:
        - limit
        - market
      description: Signs as `uint8` limit 0, market 1.
    AdvancedTimeInForce:
      type: string
      enum:
        - gtc
        - ioc
      description: Signs as `uint8` ioc 0, gtc 1.
    Amount:
      type: string
      pattern: ^-?[0-9]+(\.[0-9]+)?$
      description: Decimal number as a string; parse with a decimal library, never as a float.
    BBO:
      type: object
      description: |
        Best bid and offer snapshot for a symbol, emitted whenever the top-of-book changes. Prices and sizes are decimal strings. `T` is the order book snapshot timestamp in Unix milliseconds (JSON number). Field names are single letters.
      required:
        - marketId
        - s
        - b
        - B
        - a
        - A
        - T
      additionalProperties: false
      properties:
        marketId:
          type: integer
          minimum: 0
          description: Market ID returned by atlas.getSymbols.
        s:
          $ref: "#/components/schemas/Symbol"
          description: Market symbol.
        b:
          $ref: "#/components/schemas/DecimalString"
          description: Best bid price in the order book.
        B:
          $ref: "#/components/schemas/DecimalString"
          description: Quantity available at the best bid price.
        a:
          $ref: "#/components/schemas/DecimalString"
          description: Best ask price in the order book.
        A:
          $ref: "#/components/schemas/DecimalString"
          description: Quantity available at the best ask price.
        T:
          $ref: "#/components/schemas/TimestampMs"
          description: Order book snapshot timestamp, Unix milliseconds.
    Balance:
      type: object
      required:
        - place
        - asset
        - assetId
        - total
        - available
        - held
      additionalProperties: false
      properties:
        place:
          type: string
          enum:
            - staked
            - cross
            - isolated
          description: |
            Where the account holds this cash: `staked` in its staking position and pending unstake of the asset, locked and never collateral; `cross` in the cross unit; `isolated` in the isolated unit of the market `symbol` names.
        symbol:
          $ref: "#/components/schemas/Symbol"
          description: |
            On an `isolated` balance, the market of the isolated unit holding this cash. Absent on a `staked` or `cross` balance.
        asset:
          type: string
          minLength: 1
          description: Asset symbol (e.g. USDT, BTC), the same string as `AssetInfo.symbol`.
        assetId:
          type: integer
          minimum: 0
          maximum: 4294967295
          description: Asset id of `asset`.
        total:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Ledger balance, exact to 12 decimal places whatever the asset's own decimals (a fee can leave digits finer than the asset's minor unit).
        available:
          $ref: "#/components/schemas/DecimalString"
          description: |
            `total` less `held`, exact to 12 decimal places. On a `staked` balance, the staking position an unstake may take.
        held:
          $ref: "#/components/schemas/DecimalString"
          description: |
            What is set aside in this asset: the reserve of resting spot orders plus cash held for pending withdrawals; on a `staked` balance, the pending unstake, which no unstake can take again. `total` − `available`, exact to 12 decimal places. Margin that perp positions and orders use is not held per asset.
        unstakeDueNs:
          $ref: "#/components/schemas/Uint64String"
          description: |
            On a `staked` balance with a pending unstake: when the pending unstake returns whole to the cross unit, Unix nanoseconds. Absent otherwise.
    BuilderId:
      type: string
      pattern: ^0x[0-9a-f]{40}$
      description: |
        Builder (Broker) ID: an opaque 20-byte value issued once, by the first `enableBuilder` of the builder's Main, and kept for every later acceptance. It cannot be derived from the Main or any other account. A `0x`-prefixed, 40-lowercase-hex-char string. It is not the builder's account address. EIP-712 signs it as `address`.
    Candle:
      type: object
      required:
        - marketId
        - t
        - T
        - s
        - i
        - o
        - h
        - l
        - c
        - v
        - n
        - x
      additionalProperties: false
      properties:
        marketId:
          type: integer
          minimum: 0
          description: Market ID returned by atlas.getSymbols.
        t:
          $ref: "#/components/schemas/TimestampMs"
          description: Open time of the candle, Unix milliseconds.
        T:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            Close time of the candle, Unix milliseconds. The next candle's `t` equals this candle's `T`.
        s:
          $ref: "#/components/schemas/Symbol"
        i:
          $ref: "#/components/schemas/Interval"
        o:
          $ref: "#/components/schemas/DecimalString"
          description: Open price.
        h:
          $ref: "#/components/schemas/DecimalString"
          description: High price.
        l:
          $ref: "#/components/schemas/DecimalString"
          description: Low price.
        c:
          $ref: "#/components/schemas/DecimalString"
          description: Close price.
        v:
          $ref: "#/components/schemas/DecimalString"
          description: Total base-asset volume traded in this interval.
        n:
          type: integer
          minimum: 0
          description: Number of individual trades that composed this candle (u32).
        x:
          type: boolean
          description: |
            True when this publication finalizes the candle window; false for an interim update. A late trade can reopen a previously finalized window, producing x=false before the corrected candle is finalized again with x=true.
    ClientOrderId:
      type: string
      pattern: ^0x[0-9a-f]{32}$
      description: |
        Mandatory client-chosen 128-bit order identity, named after the FIX `ClOrdID` (tag 11) / `OrigClOrdID` (tag 41) tags. A `0x`-prefixed, 32-lowercase-hex-char string (`bytes16`). On a `placeOrder` command, `clientOrderId` is placement identity A. On a `cancelOrder`, `cancelAllOrders` or `replaceOrder` command, `clientOrderId` is the request's own identity, and a `target` names the order by `orderId` or by its `clientOrderId`. Only lowercase hex is accepted; uppercase is rejected as invalid params (`-32602`).
    CommandSelector:
      type: string
      pattern: ^0x[0-9a-f]{4}$
      description: |
        A command's 2-byte selector as `0x` and four lowercase hex digits, the form its signed bytes begin with.
    CrossUnit:
      type: object
      required:
        - balances
        - positions
      additionalProperties: false
      description: |
        The account's cross unit, shared by every cross position. Its balances are `place` `cross`; its positions and orders are `marginMode` `cross`.
      properties:
        balances:
          type: array
          description: |
            Cash in every asset, rows as `atlas.getBalances` returns them. For an address that holds no account, what deposits and transfers left there unclaimed: its first account takes it whole as its cross cash.
          items:
            $ref: "#/components/schemas/Balance"
        positions:
          type: array
          description: Cross positions in any number of markets, rows as `atlas.getPositions` returns them.
          items:
            $ref: "#/components/schemas/Position"
    DecimalString:
      type: string
      pattern: ^-?[0-9]+(\.[0-9]+)?$
      description: Decimal number as a string; parse with a decimal library, never as a float.
    EndReason:
      type: string
      enum:
        - client
        - invalid
        - liquidated
        - expired
        - reduceOnlyTrim
        - forceClose
        - childRejected
        - omsKeyRevoked
        - marketClosed
        - positionFlat
      description: |
        Why a strategy or one of its sides was cancelled or stopped; one
        vocabulary for every strategy, each using its own subset.

        - `client`: the user cancelled it, or its close order was cancelled by
          the user, Cancel All or Dead-man.
        - `invalid`: no longer valid (the position went flat or flipped before a
          fire, ATLAS refused the close order or cancelled it for no reason below,
          or the entry ended with no fill).
        - `liquidated`: the position was liquidated.
        - `expired`: the close order's time in force ended it before it filled in
          full.
        - `reduceOnlyTrim`: ATLAS trimmed the close order away to fit what the
          position can still close.
        - `forceClose`: ATLAS force-closed the position.
        - `childRejected`: ATLAS definitively refused a TWAP child.
        - `omsKeyRevoked`: the account's ATLAS key was unbound.
        - `marketClosed`: the market closed for good.
        - `positionFlat`: a reduce-only TWAP's position went flat.
    EntryPlan:
      type: object
      required:
        - side
        - baseQty
        - orderType
        - timeInForce
      additionalProperties: false
      description: |
        The entry order ATLAS places for a parent created with one; its sides wait `pending` until the entry's first fill. The typed encoding signs it as the struct `EntryPlan`.
      properties:
        side:
          $ref: "#/components/schemas/Side"
          description: Signs as `uint8` buy 0, sell 1.
        baseQty:
          $ref: "#/components/schemas/PositiveDecimalString"
          description: Signs as `int64 quantity`, the `Qty` mantissa (scale 8).
        orderType:
          $ref: "#/components/schemas/AdvancedOrderType"
        limitPrice:
          $ref: "#/components/schemas/PositiveDecimalString"
          description: Required on `limit` and absent on `market`. Signs as `hasPrice` and `int64 price`.
        timeInForce:
          $ref: "#/components/schemas/AdvancedTimeInForce"
    ErrorCode:
      type: integer
      description: |
        Stable error code. Protocol rejections use their protocol numbers. Service errors use service-owned ranges; shared errors use the common range. JSON-RPC standard codes retain their protocol meanings.
    EvmAddress:
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
      description: |
        20-byte EVM address, `0x`-prefixed hex. An ATLAS Wallet is authorised by an address, not by a public key: the bridge relay observes the address a deposit came from, and the Main account address follows from it.
    Fill:
      type: object
      required:
        - tradeId
        - accountAddress
        - marketId
        - side
        - price
        - size
        - fee
        - timestamp
      additionalProperties: false
      properties:
        tradeId:
          $ref: "#/components/schemas/TradeId"
          description: |
            The trade's id, shared by its maker and taker fills. On a `kind` row, the `liquidationId` or `adlId` instead: the `causeId` of the `atlas.getLedger` rows of the same cause. The rows of one vault assignment, one per market, share it.
        accountAddress:
          $ref: "#/components/schemas/AccountAddress"
          description: |
            The account this fill side belongs to: the maker's on a maker fill, the taker's on a taker fill.
        orderId:
          type: string
          pattern: ^[0-9]+:[0-9]+$
          description: |
            Opaque composite identifier of the order that this fill belongs
            to. Always `"{marketId}:{seq}"` — the same format for maker fills
            (resting order seq) and taker fills (engine-assigned taker seq).
            Use `liquidity` to distinguish maker
            from taker fills rather than parsing the id string. Absent on a
            `kind` row, which has no order.
        clOrdId:
          $ref: "#/components/schemas/ClientOrderId"
          description: |
            Client-assigned identity of the order at execution. Maker fills use the resting maker order's current identity; taker fills use the accepted taker request's identity. Omitted when the order has no client-assigned identity.
        marketId:
          description: |
            Market id the fill belongs to; `atlas.getSymbols` gives its name.
          type: integer
          minimum: 1
        seq:
          type: integer
          minimum: 0
          description: |
            Order seq, allocated by one counter across every market, as a JSON
            number: the resting order's seq on a
            maker fill and the taker's own order seq on a taker fill. Absent on a
            `kind` row.
          maximum: 9007199254740991
        side:
          $ref: "#/components/schemas/Side"
        price:
          $ref: "#/components/schemas/DecimalString"
          description: |
            The trade price. On a `kind` row, the price the position moved at: the market's mark for a vault assignment, the ADL price for ADL.
        size:
          $ref: "#/components/schemas/DecimalString"
        fee:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Computed fill fee, exact to 12 decimal places as booked (it is not
            rounded to the fee asset's decimals). On every market, spot and perp,
            the fee is denominated in the market's quote (settlement) asset,
            `quoteAsset` in `atlas.getSymbols`, on buys and sells alike, never in
            the asset received, and is booked to the wallet on the fill. A
            negative maker rate gives a negative fee (rebate) in the same asset.
            On a `kind` row, the fee that cause charged on this market, "0" when
            it charged none.
        liquidity:
          $ref: "#/components/schemas/Liquidity"
          description: Absent on a `kind` row.
        timestamp:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            Match time of the fill, or the booking time of a `kind` row.
        kind:
          type: string
          enum:
            - vault_assignment
            - adl
          description: |
            Set on a row that closes or reduces a position without an order: `vault_assignment` when the backstop vault takes the account's positions, one row per market, and `adl` when auto-deleveraging reduces it. Absent on an order-book fill. Cash the cause moved beyond this row's `realizedPnl` and `fee`, such as collateral taken by the vault, is in `atlas.getLedger` under the same cause id.
        signerRole:
          type: string
          enum:
            - owner
            - agent
          description: |
            Who authorized the order behind this fill: `owner` (the account's
            own key) or `agent` (a delegated agent key). Attribution is per
            fill side — a maker fill carries the resting order's signer, a
            taker fill the taker's. Absent when no key signed the order, such as
            an order ATLAS places to liquidate, and on a `kind` row. An order ATLAS placed for a TP/SL parent is
            signed by the ATLAS key bound to the account, so it is `agent`; use
            `origin` to tell it apart.
        agentPubkeyX:
          type: string
          description: |
            Delegated agent public-key x-coordinate as 0x-hex (32 bytes), present only when `signerRole = agent`.
        agentPubkeyY:
          type: string
          description: |
            Delegated agent public-key y-coordinate as 0x-hex (32 bytes), present only when `signerRole = agent`.
        builderId:
          $ref: "#/components/schemas/BuilderId"
          description: The builder this fill's Builder Fee is attributed to. Absent when the order charges none.
        builderFee:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Builder Fee charged on this fill, in the same asset as `fee`, booked to the Builder Fee pile.
        liquidation:
          type: boolean
          description: True when the fill is a liquidation clip. Absent or false otherwise.
        realizedPnl:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Realized PnL this fill booked on the position, in the market's quote (settlement) asset: the price gain or loss of the part that reduced or closed the position, measured against its average entry cost. "0" when the fill only opens or adds. Excludes `fee`. Absent on spot fills.
        direction:
          type: string
          enum:
            - open_long
            - open_short
            - close_long
            - close_short
            - long_to_short
            - short_to_long
          description: |
            What this fill did to the position it booked into: opened or added to it, reduced or closed it, or flipped it through zero to the other side. Absent on spot fills.
        startPosition:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Signed size of the position this fill booked into, before the fill: positive long, negative short, "0" when flat. Absent on spot fills.
        txId:
          $ref: "#/components/schemas/TxId"
          description: |
            Digest of the signed transaction whose processing produced this fill, the same on the maker and taker fills of one trade. Absent when no client-signed transaction produced it, as for a liquidation or an ATLAS-placed child order.
        parentOrderId:
          $ref: "#/components/schemas/Uint64String"
          description: |
            The TP/SL parent of the order behind this fill side, as on `Order.parentOrderId`. Absent when ATLAS did not place that order for a parent.
        origin:
          type: string
          enum:
            - entry
            - take_profit
            - stop_loss
    FundingPayment:
      type: object
      description: |
        One FUNDING cash leg lazy settlement booked for the account. Its coordinates are the booking input's, never the session boundary that fixed the charge: a settlement books a closed session on a later input.
      required:
        - accountAddress
        - marketId
        - symbol
        - sessionId
        - marginMode
        - settlementHeight
        - settlementTsMs
        - positionQuantity
        - fundingRate
        - markPrice
        - payment
      additionalProperties: false
      properties:
        accountAddress:
          $ref: "#/components/schemas/AccountAddress"
        marketId:
          type: integer
          minimum: 0
          maximum: 8589934591
          description: Market kind tag above the 32-bit identifier (spot 0, perpetual 1).
        symbol:
          $ref: "#/components/schemas/Symbol"
        sessionId:
          $ref: "#/components/schemas/Uint64String"
          description: Closed session counter whose charge was booked.
        marginMode:
          type: string
          enum:
            - cross
            - isolated
          description: |
            `isolated` when the charged holding is in the market's isolated unit; `cross` when it is in the cross unit.
        settlementHeight:
          type: integer
          minimum: 0
          maximum: 9007199254740991
          description: |
            Block height of the input that booked the payment. A payment with no booking height makes the read unavailable.
        settlementTsMs:
          $ref: "#/components/schemas/TimestampMs"
          description: Venue time of the input that booked the payment.
        positionQuantity:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Signed size of the holding the session charged, in display units: positive long, negative short. The quantity held at the session boundary.
        fundingRate:
          $ref: "#/components/schemas/DecimalString"
          description: |
            The session's cutoff funding rate as a signed decimal fraction, e.g. "0.0001" is 1 bps. Positive = longs pay shorts; negative = shorts pay longs.
        markPrice:
          $ref: "#/components/schemas/DecimalString"
          description: The cut-off mark the session charged at, in display units.
        payment:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Funding the account received (positive) or paid (negative) at this settlement, in the market's quote (settlement) asset, `quoteAsset` in `atlas.getSymbols`.
    Interval:
      type: string
      enum:
        - 1m
        - 5m
        - 15m
        - 1h
        - 4h
        - 1d
      description: |
        Candle / kline resolution. ATLAS uses a human-readable suffixed format: numeric value + unit (m=minute, h=hour, d=day). TradingView UDF mapping: "1"→1m, "5"→5m, "15"→15m, "60"→1h, "240"→4h, "1D"→1d. Other resolutions are not offered.
    IsolatedUnit:
      type: object
      required:
        - marketId
        - symbol
        - balance
      additionalProperties: false
      description: |
        One isolated unit: one market's isolated margin. Its cash backs only its own position, and its equity is not collateral for the cross unit. It opens with the account's first isolated order on the market and closes once its position is flat and it has no resting orders.
      properties:
        marketId:
          type: integer
          minimum: 0
          maximum: 8589934591
          description: Market kind tag above the 32-bit identifier (spot 0, perpetual 1).
        symbol:
          $ref: "#/components/schemas/Symbol"
          description: The unit's market.
        balance:
          $ref: "#/components/schemas/Balance"
          description: |
            The unit's cash, in the market's settlement asset; its `total` is the unit's funded margin.
        position:
          $ref: "#/components/schemas/Position"
          description: The unit's position; its `size` is 0 until its opening order fills.
    Liquidity:
      type: string
      enum:
        - maker
        - taker
      description: |
        Whether the fill added liquidity (maker, resting order) or removed it (taker, aggressive order).
    LogHeight:
      $ref: "#/components/schemas/Uint64String"
      description: The Log Height of an accepted Log entry, as a decimal string.
    MarkPrice:
      type: object
      description: |
        Committed mark state for a perpetual market, restated periodically for late readers. Spot marks are available through tickers, not this stream.
        `indexPrice` is the last index carried by an applied live mark for this market, in display units. A live mark without an index preserves the previous index.
        Prices and `fundingRate` are decimal strings; both times are `TimestampMs`.
      required:
        - marketId
        - symbol
        - markPrice
        - indexPrice
        - timestamp
      additionalProperties: false
      properties:
        marketId:
          type: integer
          minimum: 0
          description: Market ID returned by atlas.getSymbols.
        symbol:
          $ref: "#/components/schemas/Symbol"
        markPrice:
          $ref: "#/components/schemas/Price"
          description: Mark price in display units (decimal string).
        indexPrice:
          description: |
            Latest index price in display units (decimal string), or null when no index price has been received for this market.
          oneOf:
            - $ref: "#/components/schemas/Price"
            - type: "null"
        fundingRate:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Current periodic funding rate: the average over one settlement session of the clamped, weighted impact premium of the book against the live index, plus a carry leg, capped. A signed decimal fraction at full precision, e.g. "0.0001" is 1 bps. Positive = longs pay shorts; negative = shorts pay longs. Omitted until ATLAS has a funding offer; a committed zero is "0".
        nextFundingTime:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            Due time of ATLAS's committed next session checkpoint. It remains overdue until the checkpoint runs. Omitted when no checkpoint is queued.
        timestamp:
          $ref: "#/components/schemas/TimestampMs"
          description: Committed input time of this state; periodic restatements preserve it.
    Order:
      type: object
      required:
        - accountAddress
        - marketId
        - side
        - type
        - price
        - size
        - reduceOnly
        - status
        - filledSize
        - remainingSize
        - trimmedSize
        - avgFillPrice
        - createdAt
        - updatedAt
      additionalProperties: false
      properties:
        orderId:
          type: string
          pattern: ^[0-9]+:[0-9]+$
          description: Venue order id, `"{marketId}:{seq}"`. Treat it as opaque; read `marketId` and `seq` from the sibling fields when you need them. Absent on a `rejected` placement, which was never given a venue id.
        historyId:
          type: string
          description: |
            Stable record identity present on every history row, including refusals without an order: `history:<stream epoch>:<log position>:<ordinal>`.
        accountAddress:
          $ref: "#/components/schemas/AccountAddress"
          description: The account the order belongs to.
        clOrdId:
          $ref: "#/components/schemas/ClientOrderId"
          description: |
            Current client-assigned identity of the order. Present for client-originated orders and updated after a successful replace.
        txId:
          $ref: "#/components/schemas/TxId"
          description: |
            Digest of the signed transaction that placed this order, the same `txId` its `atlas.sendRawTransaction` result or error carries. Absent when no client-signed transaction placed it, as for an ATLAS-placed child order. A client order ATLAS refused has no `orderId`, so its `txId` identifies it.
        marketId:
          description: |
            Market id from the original request, including refused attempts; `atlas.getSymbols` gives its name. A refused attempt may name a market that is not listed, which has no name to show but this id.
          type: integer
          minimum: 0
        seq:
          type: integer
          minimum: 0
          description: |
            Order seq as a JSON number, the seq part of `orderId`. One counter
            allocates it across every market, so it alone identifies the order.
            Present on resting orders (resting order seq) and terminal
            pure-taker order rows (taker's own order seq); absent on a
            `rejected` order, as `orderId` is.
          maximum: 9007199254740991
        side:
          $ref: "#/components/schemas/Side"
        type:
          $ref: "#/components/schemas/OrderType"
          description: The order type the account placed.
        price:
          description: |
            In history, market and terminal pure-taker orders expose the actual fill VWAP. Null when a market order has no fills. Limit orders otherwise retain their limit price, including the submitted signed price on refusals.
          oneOf:
            - $ref: "#/components/schemas/DecimalString"
            - type: "null"
        size:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Original requested size. Amendments and reduce-only trims do not change it; a replacement starts a new order with its own requested size. A rejected attempt keeps the signed input.
        status:
          $ref: "#/components/schemas/OrderStatus"
        statusReason:
          description: |
            A rejected order carries the error catalog `reason` that its rejection reply carried. An order that the venue cancelled or cut without an instruction carries its cancel cause; a cancel the client signed, including a replace's cancel of its target, carries none.
          anyOf:
            - enum:
                - ACCOUNT_NOT_FOUND
                - BALANCE_EXCEEDED
                - BUILDER_FEE_CAP_EXCEEDED
                - BUILDER_FEE_OUT_OF_RANGE
                - CLIENT_ORDER_ID_ALREADY_SET
                - CLOSE_PRICE_BOUND_EXCEEDED
                - FEE_SCHEDULE_NOT_FOUND
                - FEE_STATE_UNAVAILABLE
                - FX_UNUSABLE
                - INSURANCE_WALLET_POSITION_NOT_PERMITTED
                - ISOLATED_UNIT_LIMIT_EXCEEDED
                - LIQUIDATION_ACTIVE
                - MARGIN_EXCEEDED
                - MARGIN_MODE_MISMATCH
                - MARGIN_MODE_NOT_PERMITTED
                - MARGIN_UNIT_EXIT_ONLY
                - MARKET_NOT_FOUND
                - MATCH_VISIT_CAP_EXCEEDED
                - OPENING_MARGIN_INVALID
                - OPENING_MARGIN_NOT_PERMITTED
                - OPEN_ORDER_LIMIT_EXCEEDED
                - ORDER_MALFORMED
                - ORDER_NOT_FOUND
                - ORDER_SIZE_EXCEEDED
                - ORDER_SIZE_OUT_OF_RANGE
                - ORDER_TYPE_INVALID
                - POSITION_NOTIONAL_CAP_EXCEEDED
                - POSITION_NOT_FOUND
                - POST_ONLY_TAKE_NOT_PERMITTED
                - PRICE_COLLAR_EXCEEDED
                - PRICE_TICK_INVALID
                - REDUCE_ONLY_BUDGET_EXCEEDED
                - REDUCE_ONLY_INVALID
                - RISK_UNAVAILABLE
                - WALLET_EXIT_ONLY
                - WALLET_PENDING
                - WITHDRAWABLE_EXCEEDED
              type: string
            - enum:
                - DEAD_MAN
                - FOK_KILLED
                - FORCE_CLOSE
                - IOC_EXPIRED
                - LIQUIDATION
                - REDUCE_ONLY_TRIM
                - SELF_TRADE
              type: string
        timeInForce:
          type: string
          enum:
            - gtc
            - ioc
            - fok
        postOnly:
          type: boolean
          description: The write's `postOnly` as placed; `false` for a market order.
        reduceOnly:
          type: boolean
          description: |
            The write's `reduceOnly` as placed; `false` on spot, `true` on an order ATLAS placed to close a position for a TP/SL slot.
        filledSize:
          $ref: "#/components/schemas/DecimalString"
          description: Cumulative filled quantity. Always present ("0" before any fill).
        remainingSize:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Executable leaves on this order. While the order is live
            (`open` / `partially_filled`), this equals `size − filledSize − trimmedSize`.
            For every terminal status (`filled` / `cancelled` / `expired` / `rejected`),
            this is `"0"`. For cancelled or expired orders the unfilled terminal
            quantity is therefore `size − filledSize − trimmedSize`, not `remainingSize`.
        trimmedSize:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Quantity reduce-only trims removed from this order's leaves in place,
            neither filled nor cancelled. Always present ("0" when never trimmed).
            A reduce-only trim that cancels the order adds nothing to it.
        avgFillPrice:
          $ref: "#/components/schemas/DecimalString"
          description: Volume-weighted average fill price. Always present ("0" before any fill).
        marginMode:
          type: string
          enum:
            - cross
            - isolated
          description: |
            The margin mode this order was signed with. Absent on spot orders.
        createdAt:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            When ATLAS accepted the order, or refused it for a `rejected` order.
        updatedAt:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            Last change to the order: a fill, an exchange trim, a cancel, an expiry or ATLAS's refusal.
        signerRole:
          type: string
          enum:
            - owner
            - agent
          description: |
            Who authorized this order: `owner` (the account's own key) or
            `agent` (a delegated agent key). Lets a client filter "orders my
            bot/agent placed" vs "orders I placed as owner" — the primary key
            stays `accountAddress` (the economic owner). Absent when no key signed
            the order, such as an order ATLAS places to liquidate. An order ATLAS placed for a TP/SL
            parent is signed by the ATLAS key bound to the account, so it is
            `agent`; use `origin` to tell it apart.
        agentPubkeyX:
          type: string
          description: |
            Delegated agent public-key x-coordinate as 0x-hex (32 bytes), present only when `signerRole = agent`.
        agentPubkeyY:
          type: string
          description: |
            Delegated agent public-key y-coordinate as 0x-hex (32 bytes), present only when `signerRole = agent`.
        builderId:
          $ref: "#/components/schemas/BuilderId"
          description: |
            The `builderFee.builderId` the order was placed with. Absent when it charges no Builder Fee.
        builderFeeRateBps:
          $ref: "#/components/schemas/DecimalString"
          description: The order's Builder Fee rate in bps, fixed at placement.
        stpLevel:
          $ref: "#/components/schemas/StpLevel"
          description: |
            Present only on the row of an order that self-trade prevention cancelled: the level of the taker's wallet when the orders met.
        stpTakerAccount:
          $ref: "#/components/schemas/AccountAddress"
          description: |
            Present only on the row of an order that self-trade prevention cancelled: the account whose order met it.
        parentOrderId:
          $ref: "#/components/schemas/Uint64String"
          description: |
            The TP/SL parent (`AdvancedOrder.parentOrderId`) ATLAS placed this order for. Absent on orders ATLAS did not place for a parent.
        origin:
          type: string
          enum:
            - entry
            - take_profit
            - stop_loss
    OrderBookUpdate:
      type: object
      required:
        - marketId
        - symbol
        - updateId
        - bids
        - asks
        - timestamp
      additionalProperties: false
      properties:
        marketId:
          type: integer
          minimum: 0
          description: Market ID returned by atlas.getSymbols.
        symbol:
          $ref: "#/components/schemas/Symbol"
        updateId:
          description: |
            The book state this frame brings the local book to. Update ids increase but are not contiguous.
          $ref: "#/components/schemas/Uint64String"
        prevUpdateId:
          description: |
            Delta frames only: the updateId of the previous delta for this symbol and interval. Apply the delta when prevUpdateId <= the local book's updateId < updateId.
          $ref: "#/components/schemas/Uint64String"
        bids:
          description: Best bid first.
          type: array
          items:
            $ref: "#/components/schemas/PriceLevel"
        asks:
          description: Best ask first.
          type: array
          items:
            $ref: "#/components/schemas/PriceLevel"
        timestamp:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            When the book reached the state after this update.
    OrderStatus:
      type: string
      enum:
        - accepted
        - open
        - partially_filled
        - filled
        - cancelled
        - rejected
        - expired
      description: |
        Lifecycle state of an order. "accepted"        — acknowledged by the matching engine; not yet open in the book. "open"            — resting in the order book, waiting to be filled. "partially_filled" — partially executed; remainder still open. "filled"          — fully executed; no remainder. "cancelled"       — cancelled before full fill (by client request, self-trade
                            prevention, the dead-man deadline, or a venue-initiated cancel).
        "rejected"        — not accepted by the matching engine (e.g., insufficient margin). "expired"         — timed out by the matching engine; the unfilled remainder of
                            an IOC order.
        Note: a market order that fills immediately will transition directly accepted → filled without resting in the "open" state.
    OrderType:
      type: string
      enum:
        - limit
        - market
      description: |
        Order execution type. "limit"  — rests at the specified price or better. "market" — executes immediately against available liquidity at best price;
                   ignored price field.
        Stop-loss, take-profit and TWAP are advanced orders (`createTpSlOrder`, `createTwapOrder`), not order types.
    OwnerKey:
      type: string
      pattern: ^0x[0-9a-f]{40}$
      description: A wallet owner key, 0x-hex (20 bytes).
    Position:
      type: object
      required:
        - marketId
        - symbol
        - size
        - marginMode
      additionalProperties: false
      properties:
        marketId:
          type: integer
          minimum: 0
          maximum: 8589934591
          description: Market kind tag above the 32-bit identifier (spot 0, perpetual 1).
        symbol:
          $ref: "#/components/schemas/Symbol"
        size:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Signed position size. Positive is long; negative is short.
        entryPrice:
          $ref: "#/components/schemas/DecimalString"
        unrealizedPnl:
          $ref: "#/components/schemas/Amount"
          description: |
            The position's unrealised profit or loss at the mark, in the market's settlement asset. Absent when that service holds no fresh figure for this position: absent means unknown, and a client must not put an estimate in its place.
        realizedPnl:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Cumulative realized PnL of this position: the price gain or loss booked each time it is reduced or closed, measured against its average entry cost. Price PnL excludes trading fees, Builder Fees and funding.
        cumulativeFunding:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Net funding this position has received (positive) or paid (negative) since it opened, in the market's quote (settlement) asset; the sum of its `atlas.getFundingHistory` payments.
        isolatedMargin:
          $ref: "#/components/schemas/Amount"
          description: |
            Isolated margin funding this position: the cash of its isolated unit, quote-denominated decimal string exact to 12 decimal places (absent on cross positions).
        marginMode:
          type: string
          enum:
            - cross
            - isolated
          description: |
            `isolated` when the position is held in its own isolated unit; `cross` when it is in the cross unit.
        liquidationPrice:
          $ref: "#/components/schemas/Price"
          description: |
            The price at which this position would be liquidated, computed from the current marks and rounded onto the price grid against the account: up for a long, down for a short. Absent when that service holds no fresh figure for this position. The authoritative liquidation trigger stays account health.maintenanceBuffer (<= 0 means liquidatable).
    PositiveDecimalString:
      type: string
      pattern: ^[0-9]+(\.[0-9]+)?$
    Price:
      type: string
      pattern: ^[0-9]+(\.[0-9]+)?$
    PriceLevel:
      description: '`[price, size]`, both decimal strings; size "0" removes the level.'
      type: array
      items:
        $ref: "#/components/schemas/DecimalString"
      minItems: 2
      maxItems: 2
    ReportCause:
      type: string
      enum:
        - advanceClock
      description: |
        The system event whose batch produced a report that no transaction produced: `advanceClock` is the clock advance that books funding and expiries.
    ReportNo:
      $ref: "#/components/schemas/Uint64String"
      description: |
        A report number of the account on one stream as a decimal string. The first report of an account on a stream is "1", and each later one is one above the previous; it is never skipped, reused or reset. "0" stands for no report yet.
    ReportPosition:
      type: object
      required:
        - height
        - ordinal
      additionalProperties: false
      description: |
        Where a report sits in the Log: the Log Height of the entry that produced it and its ordinal among every report of that entry on the same stream, every account's, counted from 0. Report positions rise strictly in the order of the stream.
      properties:
        height:
          $ref: "#/components/schemas/LogHeight"
        ordinal:
          $ref: "#/components/schemas/Uint64Number"
    ReportRange:
      type: object
      required:
        - first
        - last
      additionalProperties: false
      description: The report numbers from `first` through `last`, both included.
      properties:
        first:
          $ref: "#/components/schemas/ReportNo"
        last:
          $ref: "#/components/schemas/ReportNo"
    RequestRefV1:
      type: object
      required:
        - txHash
        - requestIndex
      additionalProperties: false
      properties:
        txHash:
          type: string
          pattern: ^0x[0-9a-fA-F]{64}$
          description: |
            The request's transaction (0x-hex, 32 bytes): a native transaction's identifier, the `txId` `atlas.getTransactionReceipt` takes: the digest its credential signs.
        requestIndex:
          type: integer
          minimum: 0
          maximum: 65535
          description: Zero-based slot index within the signed requests[].
    SeqString:
      type: string
      pattern: ^[1-9][0-9]*$
      description: |
        Per-subscription monotonically increasing counter as a decimal string; resets to "1" on each subscribe, no leading zeros.
    Side:
      type: string
      enum:
        - buy
        - sell
      description: |
        Order or trade direction. "buy" = bid; "sell" = ask.
    Size:
      type: string
      pattern: ^[0-9]+(\.[0-9]+)?$
    SlotPlan:
      type: object
      required:
        - triggerRef
        - triggerPrice
        - orderType
        - timeInForce
      additionalProperties: false
      description: |
        One side of a `tpSl` parent: the price it watches and the close order ATLAS places when it fires. A side has no `side`, `baseQty` or `reduceOnly`: the close is a reduce-only order for the whole position at that moment. A take-profit fires when the price reaches `triggerPrice` in the position's favour, a stop-loss when it reaches it against the position. The typed encoding signs it as the struct `SlotPlan`.
      properties:
        triggerRef:
          $ref: "#/components/schemas/TriggerRef"
        triggerPrice:
          $ref: "#/components/schemas/PositiveDecimalString"
          description: Signs as `int64 triggerPrice`, the `Price` mantissa (scale 10).
        orderType:
          $ref: "#/components/schemas/AdvancedOrderType"
          description: The close order's type.
        limitPrice:
          $ref: "#/components/schemas/PositiveDecimalString"
          description: |
            The `limit` close's price, which may differ from `triggerPrice`; required on `limit` and absent on `market`. Signs as `hasPrice` and `int64 price` (scale 10), zero when absent.
        timeInForce:
          $ref: "#/components/schemas/AdvancedTimeInForce"
          description: |
            The close order's time in force: `gtc` for a `limit` close, `ioc` or `gtc` for a `market` close.
    SlotState:
      description: |
        - `pending`: waiting for the entry's first fill.
        - `armed`: watching the trigger.
        - `{"faulted": "positionNotOnQtyGrid"}`: crossed, but the position is
          not on the order quantity grid, so no exact close exists; still watched.
        - `triggered`: ATLAS accepted its close order, which still works. Its
          fills, partial ones included, count for this side.
        - `complete`: the close order filled in full, or filled and the position
          is flat.
        - `{"cancelled": code}`: ended without a close order, ATLAS refused it, or
          the close order was cancelled; a fill before the cancel still counts.

        Once a side fires, its close order is an ordinary reduce-only order placed
        for the position at that moment. The ATLAS does not cancel it when the
        position later goes flat or flips; only cancelling the parent does. So if
        you close the position by other means, a resting close order can still
        fill and open a position the other way: cancel the parent or the close
        order if you do not want that.
      oneOf:
        - type: string
          enum:
            - pending
            - armed
            - triggered
            - complete
        - type: object
          required:
            - faulted
          additionalProperties: false
          properties:
            faulted:
              type: string
              enum:
                - positionNotOnQtyGrid
        - type: object
          required:
            - cancelled
          additionalProperties: false
          properties:
            cancelled:
              $ref: "#/components/schemas/EndReason"
    StpLevel:
      type: string
      enum:
        - account
        - wallet
      description: |-
        Which of a taker's own orders self-trade prevention cancels: `account`
        cancels a crossing maker of the same account; `wallet` cancels a crossing
        maker of any account in the same wallet.
    StreamClosed:
      type: object
      required:
        - subscriptionId
        - seq
        - snapshot
        - reasonCode
        - message
      additionalProperties: false
      properties:
        subscriptionId:
          $ref: "#/components/schemas/SubscriptionId"
        seq:
          $ref: "#/components/schemas/SeqString"
        snapshot:
          type: boolean
          enum:
            - false
        reasonCode:
          $ref: "#/components/schemas/ErrorCode"
        message:
          type: string
    SubscriptionId:
      type: string
      minLength: 1
      description: Opaque id unique within a WebSocket connection; invalidated when it closes.
    Symbol:
      type: string
      pattern: ^[A-Z0-9]+(/[A-Z0-9]+|-[A-Z0-9]+(-(PERP|SPOT))?)$
      examples:
        - BTC-USD-PERP
        - ETH-USD-PERP
        - ETH-USDT
        - BTC-USDT
        - BTC-USD-SPOT
        - ZRO/USDT
        - UST10Y/USDT
    TermsVersion:
      type: object
      required:
        - id
        - version
        - contentHash
      additionalProperties: false
      description: |
        Identifies one exact version of the Atlas Terms of Use, which a wallet accepts by naming it in the terms line of its statements. The server must verify all three values against a published terms record; an unknown ID or version, or a mismatched content hash, must be rejected. Published content and its ID/version/hash binding must be immutable and retained for verification. The content hash covers the exact bytes served at the document's `documentUrl`.
      properties:
        id:
          type: string
          minLength: 1
          description: Stable identifier of the terms document, independent of its version.
        version:
          type: string
          minLength: 1
          description: Published revision of the identified terms document.
        contentHash:
          type: string
          pattern: ^0x[0-9a-f]{64}$
          description: |
            keccak256 of the exact published terms content, as `0x` plus 64 lowercase hex characters.
    Ticker:
      type: object
      required:
        - marketId
        - symbol
        - bestBid
        - bestAsk
        - lastPrice
        - lastSize
        - open24h
        - high24h
        - low24h
        - volume24h
        - volumeQuote24h
        - tradeCount24h
        - priceChange24h
        - priceChangePct24h
        - mode
        - timestamp
      additionalProperties: false
      properties:
        marketId:
          type: integer
          minimum: 0
          description: Market ID returned by atlas.getSymbols.
        symbol:
          type: string
          minLength: 1
          description: Catalogue label shared by markets with the same published symbol.
        bestBid:
          $ref: "#/components/schemas/DecimalString"
          description: Best bid price in the order book.
        bestAsk:
          $ref: "#/components/schemas/DecimalString"
          description: Best ask price in the order book.
        lastPrice:
          $ref: "#/components/schemas/DecimalString"
          description: Price of the most recent trade.
        lastSize:
          $ref: "#/components/schemas/DecimalString"
          description: Size of the most recent trade.
        open24h:
          $ref: "#/components/schemas/DecimalString"
          description: Opening price at the start of the rolling 24-hour window.
        high24h:
          $ref: "#/components/schemas/DecimalString"
          description: Highest traded price in the rolling 24-hour window.
        low24h:
          $ref: "#/components/schemas/DecimalString"
          description: Lowest traded price in the rolling 24-hour window.
        volume24h:
          $ref: "#/components/schemas/DecimalString"
          description: Total base-asset volume in the rolling 24-hour window.
        volumeQuote24h:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Total notional traded in the rolling 24-hour window, in the market's `quoteAsset`.
        tradeCount24h:
          $ref: "#/components/schemas/Uint64Number"
          description: Number of trades in the rolling 24-hour window.
        priceChange24h:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Absolute price change over the rolling 24-hour window. Encoded as a signed DecimalString (may be negative).
        priceChangePct24h:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Percentage price change over the rolling 24-hour window, e.g. "2.53" means +2.53 %.  Signed DecimalString (may be negative).
        mode:
          type: string
          enum:
            - normal
            - reduce_only
            - close_only
          description: |
            Market trading mode. Always present.
        timestamp:
          $ref: "#/components/schemas/TimestampMs"
          description: Time at which this snapshot was taken, Unix milliseconds.
        markPrice:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Live mark price. On a perpetual market it values unrealized PnL and liquidation; on a spot pair it centres the market-order collar.
        fundingRate:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Current periodic funding rate as a signed decimal fraction at full precision, e.g. "0.0001" is 1 bps. Positive = longs pay shorts; negative = shorts pay longs. Present only for perpetual markets with a committed funding offer; omitted when no offer exists. A committed zero is "0".
        nextFundingTime:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            Due time of ATLAS's committed next session checkpoint. Present only for perpetual markets with a queued checkpoint; remains overdue until it runs.
        impactBid:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Impact bid price used as the short-side input to the mark-price calculation. Present only for perpetual markets and only when the book has enough depth on the bid side; otherwise omitted.
        impactAsk:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Impact ask price used as the long-side input to the mark-price calculation. Present only for perpetual markets and only when the book has enough depth on the ask side; otherwise omitted.
        openInterest:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Total outstanding open interest in base units (e.g. "12.5" BTC). The canonical, price-independent value tracked by ATLAS; changes only as positions open/close. Present only for perpetual markets.
        openInterestValue:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Open interest in quote notional, in the market's `quoteAsset` (e.g. "750000" USDT), derived server-side as `openInterest × markPrice` using the same markPrice emitted on this ticker. Present only for perpetual markets.
        indexPrice:
          $ref: "#/components/schemas/DecimalString"
          description: |
            Optional index price in the market's quote asset. Omit when the index source is unavailable; never substitute zero.
    TimestampMs:
      type: integer
      minimum: 0
      description: Unix timestamp in milliseconds as a JSON integer.
    TpSlStatus:
      type: string
      enum:
        - pending
        - armed
        - triggered
        - complete
        - cancelled
      description: |
        A `tpSl` parent's summary of its sides. The most active side wins: `triggered` (a close order works), then `armed`, then `pending` (waiting for the entry's first fill). Once no side is open it is `complete` if one side completed, else `cancelled` with its `endReason`. `complete` and `cancelled` are final. Only a `pending` or `armed` side holds the parent's `(accountAddress, marketId, marginMode)`: once none is left, a new create is taken there even while a close order of this parent still works.
    Trade:
      type: object
      required:
        - marketId
        - symbol
        - price
        - size
        - side
        - timestamp
        - tradeId
      additionalProperties: false
      properties:
        marketId:
          type: integer
          minimum: 0
          description: Market ID returned by atlas.getSymbols.
        symbol:
          $ref: "#/components/schemas/Symbol"
        price:
          $ref: "#/components/schemas/Price"
        size:
          $ref: "#/components/schemas/Size"
        side:
          $ref: "#/components/schemas/Side"
          description: |
            Aggressor side: the side of the order that crossed the spread and triggered the match.
        timestamp:
          $ref: "#/components/schemas/TimestampMs"
          description: |
            Match time of the trade.
        tradeId:
          $ref: "#/components/schemas/TradeId"
        liquidation:
          type: boolean
          description: |
            True when this trade is a liquidation clip, the same flag as `Fill.liquidation` on the fills it produced. Absent or false otherwise. Filtering `stream.trades` on it gives an exchange-wide liquidation feed.
    TradeId:
      type: string
      minLength: 1
    TriggerRef:
      type: string
      enum:
        - mark
        - index
        - last
      description: The price a side watches. Signs as `uint8` mark 0, index 1, last 2.
    TwapStatus:
      type: string
      enum:
        - running
        - filled
        - ended
        - stopped
      description: |
        `running` while it may send; `filled` once the whole total is confirmed filled; `ended` when the deadline arrived first; `stopped`, with its `endReason`, when something ended it early. Only `running` changes.
    TxId:
      type: string
      pattern: ^0x[0-9a-f]{64}$
      description: |
        Transaction identifier as `0x` plus 64 lowercase hex characters: the digest the transaction's credential signs, its Opaque or Typed digest (not a hash of the signature). It is the submission identity and the result and dedup key of the signed transaction. It is not the per-key timestamp nonce and not a clOrdId. A changed command with an already-consumed timestamp has a new identifier but must still fail nonce replay.
    Uint64Number:
      type: integer
      minimum: 0
      description: Bounded unsigned integer as a JSON number (e.g. resting-order seq, block height).
    Uint64String:
      type: string
      pattern: ^[0-9]+$
      description: Unsigned 64-bit integer as a decimal string; allows "0".
    WalletState:
      type: string
      enum:
        - pending
        - active
        - exit_only
      description: |-
        The state of the account's wallet. It is one setting of the wallet, so
        every account of the wallet reads the same value.
        `pending`: the default, until the wallet completes `enableTrading`. The
        wallet cannot add risk or transfer to another wallet.
        `active`: the wallet may trade.
        `exit_only`: set by the Atlas operator. The whole wallet can reduce,
        exit, withdraw and transfer between its own accounts, and cannot add
        risk or transfer to another wallet. Its resting orders stay.
