> ## 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.

# Best Odds

> Subscribe to real-time best odds changes

<Warning>
  This WebSocket API will be deprecated on July 1, 2026. See the [Migration Guide](/api-reference/centrifugo-migration) to move to the Centrifuge-based API.
</Warning>

Subscribe to best odds changes in a particular order book for the given base token. 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**

`best_odds:{baseToken}`

| Name      | Type   | Description                                               |
| --------- | ------ | --------------------------------------------------------- |
| baseToken | string | Restrict updates to only orders denominated in this token |

**MESSAGE PAYLOAD FORMAT**

The message payload is an array of JSON objects representing each object with the fields below.

| Name                     | Type    | Description                                                                                                                                                                                                                                                                                                                                                   |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| baseToken                | string  | The token for the best odds result order                                                                                                                                                                                                                                                                                                                      |
| marketHash               | string  | The market for the best odds result                                                                                                                                                                                                                                                                                                                           |
| isMakerBettingOutcomeOne | boolean | Whether or not the maker is betting outcome one. If false, maker is betting outcome two.                                                                                                                                                                                                                                                                      |
| percentageOdds           | string  | The odds that the `maker` receives in the sportx protocol format. To convert to an implied odds divide by 10^20. To convert to the odds that the taker would receive if this order would be filled in implied format, use the formula `takerOdds=1-percentageOdds/10^20`. See [the unit conversion section](/api-reference/unit-conversion) for more details. |
| updatedAt                | number  | The timestamp in milliseconds for when the odds became the best                                                                                                                                                                                                                                                                                               |

Note that the messages are sent in batches in an array. If you receive two updates for the same `orderHash` within an update, you can order them by `updateTime` after converting the `updateTime` to a BigInt or BigNumber.

***

```javascript theme={null}
const baseToken = "0xa25dA0331C0853FD17C47c8c34BCCBAaF516C438";
const channel = realtime.channels.get(`best_odds:${baseToken}`);
channel.subscribe((message) => {
  console.log(message.data);
});
```

The above command returns JSON structured like this

```json theme={null}
[
  {
    "baseToken": "0x1BC6326EA6aF2aB8E4b68c83418044B1923b2956",
    "marketHash": "0xddaf2ef56d0db2317cf9a1e1dde3de2f2158e28bee55fe35a684389f4dce0cf6",
    "isMakerBettingOutcomeOne": true,
    "percentageOdds": "750000000000000000000",
    "updatedAt": 1747500000000
  }
]
```
