> 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/futures-websocket/private-stream.md).

# Private Stream

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

## Order Stream

> \*\*Topic\*\*: \`ORDER\`\
> \
> Real-time futures order updates. Pushes when order state changes.\
> \
> \*\*Subscribe\*\* (after authentication):\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "ORDER", "symbol": "BTC\_USDT\_PERP"}\
> \`\`\`\
> \
> Or subscribe to all symbols:\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "ORDER", "symbol": "ALL"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "ORDER", "symbol": "BTC\_USDT\_PERP"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex Futures WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/wsUA` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex Futures WebSocket Server"}],"paths":{"/wsUA (order)":{"get":{"tags":["Private Stream"],"summary":"Order Stream","operationId":"subscribeOrder","description":"**Topic**: `ORDER`\n\nReal-time futures order updates. Pushes when order state changes.\n\n**Subscribe** (after authentication):\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"ORDER\", \"symbol\": \"BTC_USDT_PERP\"}\n```\n\nOr subscribe to all symbols:\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"ORDER\", \"symbol\": \"ALL\"}\n```\n\n**Unsubscribe**:\n```json\n{\"op\": \"UNSUBSCRIBE\", \"topic\": \"ORDER\", \"symbol\": \"BTC_USDT_PERP\"}\n```\n","parameters":[{"name":"symbol","in":"query","required":true,"description":"Futures trading pair symbol, or 'ALL' for all symbols","schema":{"type":"string"}}],"responses":{"200":{"description":"Order update message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FuturesOrderMessage"}}}}}}}},"components":{"schemas":{"FuturesOrderMessage":{"type":"object","description":"Futures order stream message","properties":{"topic":{"type":"string"},"symbol":{"type":"string","description":"Futures trading pair symbol"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"$ref":"#/components/schemas/FuturesOrderRecord"}}},"FuturesOrderRecord":{"type":"object","properties":{"orderId":{"type":"integer","format":"int64","description":"Order ID"},"symbol":{"type":"string","description":"Futures trading pair symbol"},"type":{"type":"string","enum":["LIMIT","MARKET_QTY","IOC","FOK","POSTONLY"],"description":"Order type"},"positionMode":{"type":"string","enum":["BUYSELL","OPENCLOSE"],"description":"Position mode (one-way or hedge mode)"},"isolatedMode":{"type":"string","enum":["CROSS","ISOLATED_BOTH","ISOLATED_LONG","ISOLATED_SHORT"],"description":"Margin mode"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order side"},"positionSide":{"type":"string","enum":["BOTH","LONG","SHORT"],"description":"Position side (BOTH for one-way mode, LONG/SHORT for hedge mode)"},"price":{"type":"string","description":"Order price"},"origSize":{"type":"string","description":"Original order quantity as submitted by user"},"size":{"type":"string","description":"Actual order quantity (may be trimmed for reduce-only orders)"},"amount":{"type":"string","description":"Market buy order amount (for MARKET_AMT orders)"},"filledSize":{"type":"string","description":"Filled quantity"},"filledAmount":{"type":"string","description":"Filled amount (quote currency)"},"status":{"type":"string","enum":["OPEN","CLOSED"],"description":"Order status (OPEN includes SUBMITTED/CONFIRMED/PARTIAL_FILLED, CLOSED includes FILLED/CANCELED/REJECTED)"},"reduceOnly":{"type":"boolean","description":"Whether this order only reduces position (does not increase)"},"clientOrderId":{"type":"string","description":"Client order ID for deduplication"},"source":{"type":"string","enum":["MANUAL","API","SYSTEM","TRIGGER"],"description":"Order source"},"createTime":{"type":"integer","format":"int64","description":"Order creation time in milliseconds"},"updateTime":{"type":"integer","format":"int64","description":"Last update time in milliseconds"}}}}}}
````

## Fill Stream

> \*\*Topic\*\*: \`FILL\`\
> \
> Real-time fill (trade execution) updates for futures orders.\
> \
> \*\*Subscribe\*\* (after authentication):\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "FILL", "symbol": "BTC\_USDT\_PERP"}\
> \`\`\`\
> \
> Or subscribe to all symbols:\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "FILL", "symbol": "ALL"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "FILL", "symbol": "BTC\_USDT\_PERP"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex Futures WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/wsUA` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex Futures WebSocket Server"}],"paths":{"/wsUA (fill)":{"get":{"tags":["Private Stream"],"summary":"Fill Stream","operationId":"subscribeFill","description":"**Topic**: `FILL`\n\nReal-time fill (trade execution) updates for futures orders.\n\n**Subscribe** (after authentication):\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"FILL\", \"symbol\": \"BTC_USDT_PERP\"}\n```\n\nOr subscribe to all symbols:\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"FILL\", \"symbol\": \"ALL\"}\n```\n\n**Unsubscribe**:\n```json\n{\"op\": \"UNSUBSCRIBE\", \"topic\": \"FILL\", \"symbol\": \"BTC_USDT_PERP\"}\n```\n","parameters":[{"name":"symbol","in":"query","required":true,"description":"Futures trading pair symbol, or 'ALL' for all symbols","schema":{"type":"string"}}],"responses":{"200":{"description":"Fill update message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FuturesFillMessage"}}}}}}}},"components":{"schemas":{"FuturesFillMessage":{"type":"object","description":"Futures fill stream message","properties":{"topic":{"type":"string"},"symbol":{"type":"string","description":"Futures trading pair symbol"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"$ref":"#/components/schemas/FuturesFillRecord"}}},"FuturesFillRecord":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Fill record ID"},"orderId":{"type":"integer","format":"int64","description":"Associated order ID"},"symbol":{"type":"string","description":"Futures trading pair symbol"},"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"},"feeType":{"type":"string","enum":["TRADING","LIQUIDATION"],"description":"Fee type (TRADING for normal trade fee, LIQUIDATION for liquidation fee)"},"timestamp":{"type":"integer","format":"int64","description":"Fill timestamp in milliseconds"}}}}}}
````

## Balance Stream

> \*\*Topic\*\*: \`BALANCE\`\
> \
> Real-time account balance updates for futures account. Pushes when balance changes (order, fill, funding, transfer, etc.).\
> \
> Updates are aggregated within 100ms and only push when actual changes occur.\
> \
> \*\*Two message types\*\* (discriminated by \`type\` field):\
> \- \*\*CROSS\*\*: Cross margin account balance\
> \- \*\*ISOLATE\_LONG / ISOLATE\_SHORT / ISOLATE\_BOTH\*\*: Isolated margin position balance\
> \
> \*\*Subscribe\*\* (after authentication):\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "BALANCE"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "BALANCE"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex Futures WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/wsUA` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex Futures WebSocket Server"}],"paths":{"/wsUA (balance)":{"get":{"tags":["Private Stream"],"summary":"Balance Stream","operationId":"subscribeBalance","description":"**Topic**: `BALANCE`\n\nReal-time account balance updates for futures account. Pushes when balance changes (order, fill, funding, transfer, etc.).\n\nUpdates are aggregated within 100ms and only push when actual changes occur.\n\n**Two message types** (discriminated by `type` field):\n- **CROSS**: Cross margin account balance\n- **ISOLATE_LONG / ISOLATE_SHORT / ISOLATE_BOTH**: Isolated margin position balance\n\n**Subscribe** (after authentication):\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/FuturesBalanceMessage"}}}}}}}},"components":{"schemas":{"FuturesBalanceMessage":{"type":"object","description":"Futures balance stream message","properties":{"topic":{"type":"string"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"oneOf":[{"$ref":"#/components/schemas/CrossBalanceData"},{"$ref":"#/components/schemas/IsolateBalanceData"}],"discriminator":{"propertyName":"type","mapping":{"CROSS":"#/components/schemas/CrossBalanceData","ISOLATE_LONG":"#/components/schemas/IsolateBalanceData","ISOLATE_SHORT":"#/components/schemas/IsolateBalanceData","ISOLATE_BOTH":"#/components/schemas/IsolateBalanceData"}}}}},"CrossBalanceData":{"type":"object","description":"Cross margin account balance data","properties":{"type":{"type":"string","enum":["CROSS"],"description":"Balance type indicator"},"balances":{"type":"array","description":"Balance list for all currencies","items":{"type":"object","properties":{"coin":{"type":"string","description":"Currency code"},"free":{"type":"string","description":"Available balance"},"frozen":{"type":"string","description":"Frozen balance"},"debts":{"type":"string","description":"Debt amount"}}}},"timestamp":{"type":"integer","format":"int64","description":"Balance update timestamp in milliseconds"}}},"IsolateBalanceData":{"type":"object","description":"Isolated margin position balance data","properties":{"type":{"type":"string","enum":["ISOLATE_LONG","ISOLATE_SHORT","ISOLATE_BOTH"],"description":"Isolated margin type"},"symbol":{"type":"string","description":"Futures trading pair symbol for the isolated position"},"balances":{"type":"array","description":"Balance list for this isolated position","items":{"type":"object","properties":{"coin":{"type":"string","description":"Currency code"},"free":{"type":"string","description":"Available balance"},"frozen":{"type":"string","description":"Frozen balance"},"debts":{"type":"string","description":"Debt amount"}}}},"timestamp":{"type":"integer","format":"int64","description":"Balance update timestamp in milliseconds"}}}}}}
````

## Risk State Stream

> \*\*Topic\*\*: \`RISK\`\
> \
> Real-time risk state monitoring for futures account and positions.\
> \
> \*\*Two message types\*\* (discriminated by \`type\` field):\
> \- \*\*CROSS\*\*: Cross margin account risk state\
> \- \*\*ISOLATE\_LONG / ISOLATE\_SHORT / ISOLATE\_BOTH\*\*: Isolated margin position risk state\
> \
> \*\*Push frequency\*\*:\
> \- Non-TRADING state: every 10 seconds\
> \- TRADING state: every 15 minutes\
> \- State changes: immediate push\
> \
> \*\*Subscribe\*\* (after authentication):\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "RISK"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "RISK"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex Futures WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/wsUA` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex Futures WebSocket Server"}],"paths":{"/wsUA (risk)":{"get":{"tags":["Private Stream"],"summary":"Risk State Stream","operationId":"subscribeRisk","description":"**Topic**: `RISK`\n\nReal-time risk state monitoring for futures account and positions.\n\n**Two message types** (discriminated by `type` field):\n- **CROSS**: Cross margin account risk state\n- **ISOLATE_LONG / ISOLATE_SHORT / ISOLATE_BOTH**: Isolated margin position risk state\n\n**Push frequency**:\n- Non-TRADING state: every 10 seconds\n- TRADING state: every 15 minutes\n- State changes: immediate push\n\n**Subscribe** (after authentication):\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"RISK\"}\n```\n\n**Unsubscribe**:\n```json\n{\"op\": \"UNSUBSCRIBE\", \"topic\": \"RISK\"}\n```\n","responses":{"200":{"description":"Risk state update message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FuturesRiskMessage"}}}}}}}},"components":{"schemas":{"FuturesRiskMessage":{"type":"object","description":"Futures risk state stream message","properties":{"topic":{"type":"string"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"oneOf":[{"$ref":"#/components/schemas/CrossRiskData"},{"$ref":"#/components/schemas/IsolateRiskData"}],"discriminator":{"propertyName":"type","mapping":{"CROSS":"#/components/schemas/CrossRiskData","ISOLATE_LONG":"#/components/schemas/IsolateRiskData","ISOLATE_SHORT":"#/components/schemas/IsolateRiskData","ISOLATE_BOTH":"#/components/schemas/IsolateRiskData"}}}}},"CrossRiskData":{"type":"object","description":"Cross margin account risk data","properties":{"type":{"type":"string","enum":["CROSS"],"description":"Risk type indicator"},"riskState":{"type":"string","description":"Risk state: TRADING, HOLDING, MERGING, LIQUIDATING, TAKEOVER"},"quote":{"type":"string","description":"Quote currency"},"updatedTime":{"type":"integer","format":"int64","description":"Risk state update time in milliseconds"},"extraInfo":{"type":"object","description":"Additional risk information","properties":{"accountEquity":{"type":"string","description":"Account equity"},"totalMaintMargin":{"type":"string","description":"Total maintenance margin requirement"}}}}},"IsolateRiskData":{"type":"object","description":"Isolated margin position risk data","properties":{"type":{"type":"string","enum":["ISOLATE_LONG","ISOLATE_SHORT","ISOLATE_BOTH"],"description":"Isolated margin type"},"symbol":{"type":"string","description":"Futures trading pair symbol for the isolated position"},"riskState":{"type":"string","description":"Risk state: TRADING, HOLDING, MERGING, LIQUIDATING, TAKEOVER"},"quote":{"type":"string","description":"Quote currency"},"updatedTime":{"type":"integer","format":"int64","description":"Risk state update time in milliseconds"},"extraInfo":{"type":"object","description":"Additional risk information","properties":{"accountEquity":{"type":"string","description":"Position equity"},"totalMaintMargin":{"type":"string","description":"Maintenance margin requirement"}}}}}}}}
````

## Position Stream

> \*\*Topic\*\*: \`POSITION\`\
> \
> Real-time position updates for futures trading. Pushes when position changes.\
> \
> \*\*Subscribe\*\* (after authentication):\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "POSITION", "symbol": "BTC\_USDT\_PERP"}\
> \`\`\`\
> \
> Or subscribe to all symbols:\
> \`\`\`json\
> {"op": "SUBSCRIBE", "topic": "POSITION", "symbol": "ALL"}\
> \`\`\`\
> \
> \*\*Unsubscribe\*\*:\
> \`\`\`json\
> {"op": "UNSUBSCRIBE", "topic": "POSITION", "symbol": "BTC\_USDT\_PERP"}\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"Pionex Futures WebSocket API","version":"1.0.0"},"tags":[{"name":"Private Stream","description":"Private channels via `wss://ws.pionex.com/wsUA` (auth required)"}],"servers":[{"url":"wss://ws.pionex.com","description":"Pionex Futures WebSocket Server"}],"paths":{"/wsUA (position)":{"get":{"tags":["Private Stream"],"summary":"Position Stream","operationId":"subscribePosition","description":"**Topic**: `POSITION`\n\nReal-time position updates for futures trading. Pushes when position changes.\n\n**Subscribe** (after authentication):\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"POSITION\", \"symbol\": \"BTC_USDT_PERP\"}\n```\n\nOr subscribe to all symbols:\n```json\n{\"op\": \"SUBSCRIBE\", \"topic\": \"POSITION\", \"symbol\": \"ALL\"}\n```\n\n**Unsubscribe**:\n```json\n{\"op\": \"UNSUBSCRIBE\", \"topic\": \"POSITION\", \"symbol\": \"BTC_USDT_PERP\"}\n```\n","parameters":[{"name":"symbol","in":"query","required":true,"description":"Futures trading pair symbol, or 'ALL' for all symbols","schema":{"type":"string"}}],"responses":{"200":{"description":"Position update message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FuturesPositionMessage"}}}}}}}},"components":{"schemas":{"FuturesPositionMessage":{"type":"object","description":"Futures position stream message","properties":{"topic":{"type":"string"},"symbol":{"type":"string","description":"Futures trading pair symbol"},"timestamp":{"type":"integer","format":"int64","description":"Message timestamp in milliseconds"},"data":{"$ref":"#/components/schemas/FuturesPositionRecord"}}},"FuturesPositionRecord":{"type":"object","properties":{"positionId":{"type":"string","description":"Position unique identifier"},"symbol":{"type":"string","description":"Futures trading pair symbol"},"isolatedMode":{"type":"string","enum":["CROSS","ISOLATED_BOTH","ISOLATED_LONG","ISOLATED_SHORT"],"description":"Margin mode"},"positionSide":{"type":"string","enum":["LONG","SHORT"],"description":"Position direction"},"netSize":{"type":"string","description":"Net position size = sizeLong + sizeShort"},"avgPrice":{"type":"string","description":"Average entry price = abs((amountLong + amountShort + amountSettled) / (sizeLong + sizeShort))"},"sizeLong":{"type":"string","description":"Cumulative long size (positive)"},"sizeShort":{"type":"string","description":"Cumulative short size (negative)"},"amountLong":{"type":"string","description":"Cumulative long cost (negative)"},"amountShort":{"type":"string","description":"Cumulative short proceeds (positive)"},"amountSettled":{"type":"string","description":"Cumulative settled amount"},"sizeLiquidated":{"type":"string","description":"Cumulative liquidated size (negative for long, positive for short)"},"amountLiquidated":{"type":"string","description":"Cumulative liquidated amount (positive for long, negative for short)"},"sizeTakeover":{"type":"string","description":"Takeover size (in cases where position was taken over by system)"},"createTime":{"type":"integer","format":"int64","description":"Position creation time in milliseconds"},"updateTime":{"type":"integer","format":"int64","description":"Last update time in milliseconds"}}}}}}
````
