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

# Active Order Updates

> Subscribe to real-time changes in a user's orders

Subscribe to changes in a particular user's orders. You will receive updates when orders are filled, cancelled, or posted. Note that for performance reasons, updates are delayed by at most 100ms.

**CHANNEL NAME FORMAT**

`active_orders:{maker}`

| Name  | Type   | Description                       |
| ----- | ------ | --------------------------------- |
| maker | string | The maker address to subscribe to |

<Info>
  The channel no longer includes a `baseToken` parameter. Updates for all tokens are now broadcast on a single channel per maker address.
</Info>

**MESSAGE PAYLOAD FORMAT**

The message payload is an array of JSON objects. These are the same fields as in [the orders section](/api-reference/get-orders), with additional `status` and `updateTime` fields.

| Name                     | Type    | Description                                                                                                                                                                                                                          |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| orderHash                | string  | A unique identifier for this order                                                                                                                                                                                                   |
| marketHash               | string  | The market for this order                                                                                                                                                                                                            |
| status                   | string  | `"ACTIVE"` if still valid, `"INACTIVE"` if cancelled                                                                                                                                                                                 |
| fillAmount               | string  | How much this order has been filled in Ethereum units. See [unit conversion](/api-reference/unit-conversion).                                                                                                                        |
| pendingFillAmount        | string  | Amount pending fill in Ethereum units. See [unit conversion](/api-reference/unit-conversion).                                                                                                                                        |
| totalBetSize             | string  | Total size of this order in Ethereum units. See [unit conversion](/api-reference/unit-conversion).                                                                                                                                   |
| percentageOdds           | string  | The odds the `maker` receives in the sportx protocol format. To convert to implied odds divide by 10^20. To get taker implied odds: `takerOdds = 1 - percentageOdds / 10^20`. See [unit conversion](/api-reference/unit-conversion). |
| expiry                   | number  | Deprecated. Always `2209006800`.                                                                                                                                                                                                     |
| apiExpiry                | number  | The time in unix seconds after which this order is no longer valid                                                                                                                                                                   |
| salt                     | string  | A random number to differentiate identical orders                                                                                                                                                                                    |
| isMakerBettingOutcomeOne | boolean | `true` if the maker is betting outcome one                                                                                                                                                                                           |
| signature                | string  | Signature of the maker on this order                                                                                                                                                                                                 |
| updateTime               | string  | Server-side clock time for the last modification of this order                                                                                                                                                                       |
| sportXeventId            | string  | The event related to this order                                                                                                                                                                                                      |

Messages are sent in batches as an array. If you receive two updates for the same `orderHash`, order them by `updateTime` after converting to a BigInt.

***

<CodeGroup>
  ```javascript JavaScript theme={null}
  // To subscribe
  const maker = "0x082605F78dD03A8423113ecbEB794Fb3FFE478a2";
  const sub = client.newSubscription(`active_orders:${maker}`, { positioned: true, recoverable: true });

  sub.on("publication", (ctx) => {
    const data = ctx.data;
    // message handler logic
  });

  sub.subscribe();
  ```

  ```python Python theme={null}
  import asyncio
  from centrifuge import Client, PublicationContext, SubscriptionEventHandler

  async def on_publication(ctx: PublicationContext) -> None:
      print(ctx.data)

  async def main():
      maker = "0x082605F78dD03A8423113ecbEB794Fb3FFE478a2"
      client = Client(
          "wss://realtime.sx.bet/connection/websocket",
          token="YOUR_TOKEN",  # from /user/realtime-token/api-key
      )
      await client.connect()
      handler = SubscriptionEventHandler(on_publication=on_publication)
      sub = client.new_subscription(f"active_orders:{maker}", handler)
      await sub.subscribe()
      await asyncio.Future()  # keep running

  asyncio.run(main())
  ```
</CodeGroup>

The above returns JSON structured like this:

```json theme={null}
[
  {
    "orderHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890",
    "marketHash": "0x1234567890abcdef1234567890abcdef1234567890abcd",
    "status": "INACTIVE",
    "fillAmount": "100000000000000000",
    "pendingFillAmount": "500000000000000000",
    "totalBetSize": "2000000000000000000",
    "percentageOdds": "750000000000000000000",
    "expiry": 1747500000000,
    "apiExpiry": 1747500000000,
    "salt": "12345678901234567890123456789012345678901",
    "isMakerBettingOutcomeOne": false,
    "signature": "0xbf099ab02255d5e2a9e063dc43a7afe96e65f5e8fc2ed3d2ba60b0a3fcadb3441bf32271293e85b7a795c9d86a2384035a0da3285113e746547e236bc58885e0",
    "updateTime": 1747490000000,
    "sportXeventId": "L13772588"
  }
]
```
