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

# Trading Actions

> Order, cancel, modify, fill, and rejection event formats

Trading actions come from two layers. Pre-consensus events arrive before the block is committed. Confirmed events are the validator output after matching.

## Confirmed: order

A new limit order resting on the book.

```json theme={null}
{
  "type": "order",
  "consensus": "confirmed",
  "timestamp": 1776147483883,
  "user": "0xfc667adba8d4e79a22cac8e8f6d2a5b5c17cfa94",
  "asset": "BTC",
  "asset_id": 0,
  "data": {
    "status": "open",
    "coin": "BTC",
    "side": "B",
    "px": "74400.0",
    "sz": "0.04158",
    "oid": 380721383669,
    "orderType": "Limit",
    "tif": "Alo",
    "reduceOnly": false,
    "cloid": "0x000000334e47524d534c363834483736",
    "hash": "0x9d660b786cd389ac...",
    "builder": null,
    "origSz": "0.04158",
    "isTrigger": false,
    "triggerPx": "0.0",
    "isPositionTpsl": false
  },
  "network": "mainnet"
}
```

**Key fields:** `side` (B=buy, A=sell), `px` (price), `sz` (size), `oid` (order ID), `tif` (time in force: Alo/Gtc/Ioc).

## Confirmed: order\_filled

An order that was filled immediately (IOC or market order that matched).

Same format as `order` but with `"status": "filled"` and `sz` may be `"0.0"` (fully consumed).

## Confirmed: order\_canceled

An order that was canceled. Same format with `"status": "canceled"`.

## Confirmed: order\_rejected

An order that was rejected by the matching engine.

```json theme={null}
{
  "type": "order_rejected",
  "consensus": "confirmed",
  "asset": "ETH",
  "data": {
    "status": "badAloPxRejected",
    "coin": "ETH",
    "side": "B",
    "px": "2359.7",
    "sz": "2.731",
    "reject_reason": "badAloPxRejected"
  }
}
```

Rejection reasons: `badAloPxRejected` (ALO crosses spread), `perpMarginRejected`, `insufficientSpotBalanceRejected`, `iocCancelRejected`, `reduceOnlyCanceled`, `reduceOnlyRejected`, `minTradeNtlRejected`, `selfTradeCanceled`.

## Confirmed: fill

A trade was executed. Includes PnL, fees, and direction.

```json theme={null}
{
  "type": "fill",
  "consensus": "confirmed",
  "user": "0x9690bcfc16394e2bd25b00e83d6b06c9ab3f5de5",
  "asset": "HYPE",
  "data": {
    "coin": "HYPE",
    "side": "B",
    "px": "22.608",
    "sz": "442.0",
    "dir": "Close Short",
    "closedPnl": "0.920686",
    "fee": "0.035973",
    "feeToken": "USDC",
    "oid": 380721384070,
    "tid": 910601406,
    "hash": "0xa9a32c7c2b7fb452...",
    "crossed": true,
    "builder": null,
    "builderFee": null,
    "startPosition": "5476379.0",
    "cloid": "0x000000000000000018a5ddb495c4e76c",
    "twapId": null
  }
}
```

**Key fields:** `dir` (Open Long/Close Short/etc.), `closedPnl`, `fee`, `feeToken`, `crossed` (taker vs maker), `startPosition`, `twapId`.

## Pre-consensus: cancel

Cancel submitted before block commit. Arrives \~1 second before confirmed cancellation.

```json theme={null}
{
  "type": "cancel",
  "consensus": "pre",
  "asset": "ALGO",
  "asset_id": 158,
  "data": {
    "cancels": [
      {"asset": 158, "oid": 380721371885},
      {"asset": 158, "oid": 380721371886}
    ]
  }
}
```

## Pre-consensus: cancelByCloid

Same as cancel but uses client order IDs instead of order IDs.

```json theme={null}
{
  "type": "cancelByCloid",
  "consensus": "pre",
  "asset": "HYPE",
  "data": {
    "cancels": [
      {"asset": 159, "cloid": "0xfc4e1afffc66a533..."}
    ]
  }
}
```

## Pre-consensus: batchModify

Order modification with new price and/or size. Shows what market makers are doing before the change is committed.

```json theme={null}
{
  "type": "batchModify",
  "consensus": "pre",
  "asset": "LDO",
  "data": {
    "modifies": [
      {
        "oid": 380709763838,
        "order": {
          "asset": 17,
          "side": "sell",
          "price": "0.35988",
          "size": "11130",
          "orderType": {"limit": ["Alo"]},
          "reduceOnly": false
        }
      }
    ]
  }
}
```

## Pre-consensus: scheduleCancel

Dead man's switch — cancels all orders if no heartbeat by the specified timestamp.

```json theme={null}
{
  "type": "scheduleCancel",
  "consensus": "pre",
  "data": 1776146486453
}
```

The `data` field is the Unix millisecond timestamp when the cancel triggers.
