> For the complete documentation index, see [llms.txt](https://www.pionex.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pionex.com/docs/api-docs/trade-websocket/private-stream.md).

# Private Stream

Private channels via `wss://ws.pionex.com/ws` (auth required)

## Order Stream

> \*\*Topic\*\*: \`ORDER\`\
> \
> Real-time order updates. Updates every 250ms when there are changes, every 5000ms when idle.\
> \
> \*\*Subscribe\*\*:\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "ORDER", "symbol": "BTC\_USDT"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "ORDER", "symbol": "BTC\_USDT"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/ws` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex WebSocket Server"}],"paths":{"/ws (order)":{"get":{"tags":["Private Stream"],"summary":"Order Stream","operationId":"subscribeOrder","description":"**Topic**: `ORDER`\n\nReal-time order updates. Updates every 250ms when there are changes, every 5000ms when idle.\n\n**Subscribe**:\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"ORDER\", \"symbol\": \"BTC_USDT\"}\n```\n\n**Unsubscribe**:\n```json\n{\"op\": \"UNSUBSCRIBE\", \"topic\": \"ORDER\", \"symbol\": \"BTC_USDT\"}\n```\n","parameters":[{"name":"symbol","in":"query","required":true,"description":"Trading pair symbol","schema":{"type":"string"}}],"responses":{"200":{"description":"Order update message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderMessage"}}}}}}}},"components":{"schemas":{"OrderMessage":{"type":"object","description":"Order stream message","properties":{"topic":{"type":"string"},"symbol":{"type":"string","description":"Trading pair symbol"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"$ref":"#/components/schemas/OrderRecord"}}},"OrderRecord":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Trading pair symbol"},"type":{"type":"string","enum":["LIMIT","MARKET"],"description":"Order type"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order direction"},"price":{"type":"string","description":"Order price"},"size":{"type":"string","description":"Order quantity"},"filledSize":{"type":"string","description":"Filled quantity"},"filledAmount":{"type":"string","description":"Filled amount"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"IOC":{"type":"boolean","description":"Immediate-or-cancel flag"},"status":{"type":"string","enum":["OPEN","CLOSED"],"description":"Order status"},"clientOrderId":{"type":"string","description":"Client order ID"},"createTime":{"type":"integer","format":"int64","description":"Create timestamp in milliseconds"},"updateTime":{"type":"integer","format":"int64","description":"Update timestamp in milliseconds"}}}}}}
````

## Fill Stream

> \*\*Topic\*\*: \`FILL\`\
> \
> Real-time fill (trade execution) updates across all markets.\
> \
> \*\*Subscribe\*\*:\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "FILL", "symbol": "BTC\_USDT"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "FILL", "symbol": "BTC\_USDT"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/ws` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex WebSocket Server"}],"paths":{"/ws (fill)":{"get":{"tags":["Private Stream"],"summary":"Fill Stream","operationId":"subscribeFill","description":"**Topic**: `FILL`\n\nReal-time fill (trade execution) updates across all markets.\n\n**Subscribe**:\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"FILL\", \"symbol\": \"BTC_USDT\"}\n```\n\n**Unsubscribe**:\n```json\n{\"op\": \"UNSUBSCRIBE\", \"topic\": \"FILL\", \"symbol\": \"BTC_USDT\"}\n```\n","parameters":[{"name":"symbol","in":"query","required":true,"description":"Trading pair symbol","schema":{"type":"string"}}],"responses":{"200":{"description":"Fill update message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FillMessage"}}}}}}}},"components":{"schemas":{"FillMessage":{"type":"object","description":"Fill stream message","properties":{"topic":{"type":"string"},"symbol":{"type":"string","description":"Trading pair symbol"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"$ref":"#/components/schemas/FillRecord"}}},"FillRecord":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Fill record ID"},"orderId":{"type":"integer","format":"int64","description":"Associated order ID"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Trade direction"},"role":{"type":"string","enum":["TAKER","MAKER"],"description":"Participant role"},"price":{"type":"string","description":"Execution price"},"size":{"type":"string","description":"Fill quantity"},"fee":{"type":"string","description":"Transaction fee"},"feeCoin":{"type":"string","description":"Fee currency"},"timestamp":{"type":"integer","format":"int64","description":"Fill timestamp in milliseconds"}}}}}}
````

## Balance Stream

> \*\*Topic\*\*: \`BALANCE\`\
> \
> Real-time account balance updates. No symbol required.\
> \
> \*\*Subscribe\*\*:\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "BALANCE"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "BALANCE"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/ws` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex WebSocket Server"}],"paths":{"/ws (balance)":{"get":{"tags":["Private Stream"],"summary":"Balance Stream","operationId":"subscribeBalance","description":"**Topic**: `BALANCE`\n\nReal-time account balance updates. No symbol required.\n\n**Subscribe**:\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"BALANCE\"}\n```\n\n**Unsubscribe**:\n```json\n{\"op\": \"UNSUBSCRIBE\", \"topic\": \"BALANCE\"}\n```\n","responses":{"200":{"description":"Balance update message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceMessage"}}}}}}}},"components":{"schemas":{"BalanceMessage":{"type":"object","description":"Balance stream message","properties":{"topic":{"type":"string"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"type":"object","properties":{"balances":{"type":"array","items":{"$ref":"#/components/schemas/BalanceRecord"}},"timestamp":{"type":"integer","format":"int64","description":"Data timestamp in milliseconds"}}}}},"BalanceRecord":{"type":"object","properties":{"coin":{"type":"string","description":"Currency code"},"free":{"type":"string","description":"Available balance"},"frozen":{"type":"string","description":"Frozen balance"}}}}}}
````
