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

# CE Refund Events

> Subscribe to real-time capital efficiency refund events

Subscribe to capital-efficiency refund events for a particular user. You receive updates when refunds are generated from reductions in maximum loss (MXL) for the user's market groups.

For field definitions, see [Get portfolio refunds](/api-reference/get-trades-refunds). For a high-level overview, see [Capital Efficiency](/developers/capital-efficiency).

**CHANNEL NAME FORMAT**

`ce_refunds:{bettor}`

| Name   | Type   | Description                      |
| ------ | ------ | -------------------------------- |
| bettor | string | The user address to subscribe to |

**MESSAGE PAYLOAD FORMAT**

The message payload matches a single element within the `GET /trades/portfolio/refunds` JSON results. See [Get portfolio refunds](/api-reference/get-trades-refunds) for schema details.

***

<CodeGroup>
  ```javascript JavaScript theme={null}
  // To subscribe
  const bettor = "0xaD6A65315Cb20dD0b9D0Af56213516727a20C66F";
  const sub = client.newSubscription(`ce_refunds:${bettor}`, { 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():
      bettor = "0xaD6A65315Cb20dD0b9D0Af56213516727a20C66F"
      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"ce_refunds:{bettor}", handler)
      await sub.subscribe()
      await asyncio.Future()  # keep running

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

The above returns JSON structured like this:

```json theme={null}
[
  {
    "marketHash": "0x3e012cc2842849b96768547d4c92720d7ee8946e7706323f5114b6451708cf5e",
    "baseToken": "0x1BC6326EA6aF2aB8E4b68c83418044B1923b2956",
    "totalRefunded": 2.346033,
    "events": [
      {
        "maker": false,
        "amount": "2.346033",
        "bettor": "0xaD6A65315Cb20dD0b9D0Af56213516727a20C66F",
        "baseToken": "0x1BC6326EA6aF2aB8E4b68c83418044B1923b2956",
        "createdAt": "2025-10-21T14:29:26.805266+00:00",
        "marketHash": "0x3e012cc2842849b96768547d4c92720d7ee8946e7706323f5114b6451708cf5e",
        "fillOrderHash": "0x7efa8ee211c5cbccebda722318252ee09cfadaa9c910bf4c433086d853784b02"
      }
    ]
  }
]
```
