{
"type": "auth",
"params": {
"hmac": {
"public_key": "qfex_pub_xxxxx",
"nonce": "c0ffee...",
"unix_ts": 1760545414,
"signature": "5f2e..."
}
}
}{
"type": "subscribe",
"params": {
"channels": [
"positions"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"positions"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"balances"
]
}
}{
"type": "get_user_leverage",
"params": {
"limit": 10,
"offset": 0
}
}{
"type": "set_user_leverage",
"params": {
"symbol": "AAPL-USD",
"leverage": 10
}
}{
"type": "get_available_leverage_levels",
"params": {
"limit": 10,
"offset": 0
}
}{
"type": "add_order",
"params": {
"symbol": "AAPL-USD",
"side": "BUY",
"order_type": "LIMIT",
"order_time_in_force": "GTC",
"quantity": 10,
"price": 150.5,
"client_order_id": "my-order-123"
}
}{
"type": "cancel_order",
"params": {
"symbol": "AAPL-USD",
"order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
"cancel_order_id_type": "order_id"
}
}{
"type": "modify_order",
"params": {
"symbol": "AAPL-USD",
"order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
"price": 152,
"quantity": 15,
"side": "BUY",
"order_type": "LIMIT"
}
}{
"type": "get_order",
"params": {
"order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
"symbol": "AAPL-USD"
}
}{
"type": "get_user_orders",
"params": {
"limit": 10,
"offset": 0,
"symbol": "AAPL-USD"
}
}{
"type": "cancel_on_disconnect",
"params": {
"cancel_on_disconnect": true
}
}{
"type": "close_position",
"params": {
"symbol": "AAPL-USD",
"client_order_id": "my-close-order-1"
}
}{
"type": "get_user_trades",
"params": {
"limit": 20,
"start_ts": 1760545414
}
}{
"type": "cancel_stop_order",
"params": {
"stop_order_id": "stop-order-uuid"
}
}{
"type": "modify_stop_order",
"params": {
"stop_order_id": "stop-order-uuid",
"symbol": "AAPL-USD",
"price": 160,
"quantity": 5
}
}{
"type": "unsubscribe",
"params": {
"channels": [
"order_responses",
"positions"
]
}
}{
"type": "subscribed",
"connection_id": "ee987ddf-822c-4356-b0d1-012314859b00",
"message_id": 1,
"id": "3ab267fd-7c83-49c6-b42e-65bb94682b41",
"channel": "v4_balances",
"contents": [
{
"id": "2cb208e3-6e54-48c4-82e9-641e64bf185d",
"user_id": "0f5208e3-6e54-48c4-82e9-641e64bf185d",
"deposit": 1000,
"realised_pnl": -898.65735,
"unrealised_pnl": 0,
"order_margin": 0,
"position_margin": 0,
"net_funding": -1.5354636,
"available_balance": 99.80721
}
]
}{
"type": "subscribed",
"connection_id": "ee987ddf-822c-4356-b0d1-012314859b00",
"message_id": 1,
"id": "3ab267fd-7c83-49c6-b42e-65bb94682b41",
"channel": "v4_positions",
"contents": [
{
"id": "PLTR-USD",
"symbol": "PLTR-USD",
"user_id": "0f5208e3-6e54-48c4-82e9-641e64bf185d",
"position": 0,
"margin_alloc": 0,
"realised_pnl": 1.327875,
"unrealised_pnl": 0,
"net_funding": 0.00000482,
"open_orders": 1,
"open_quantity": 10,
"leverage": 20,
"initial_margin": 0,
"maintenance_margin": 0,
"average_price": 0,
"timestamp": "2025-05-09T03:47:20.505934+00:00"
}
]
}{
"order_response": {
"order_id": "<string>",
"symbol": "<string>",
"status": "<string>",
"quantity": 123,
"price": 123,
"take_profit": 123,
"stop_loss": 123,
"side": "<string>",
"type": "<string>",
"time_in_force": "<string>",
"user_id": "<string>",
"client_order_id": "<string>",
"quantity_remaining": 123,
"update_time": 123,
"trade_id": "<string>"
}
}No examples found{
"authenticated": true
}No examples foundNo examples foundNo examples found{
"subscribed": "<string>"
}{
"unsubscribed": "<string>"
}{
"stop_order_response": {
"stop_order_id": "<string>",
"user_id": "<string>",
"symbol": "<string>",
"price": 123,
"quantity": 123,
"direction": "<string>",
"stop_order_type": "<string>",
"client_order_id": "<string>",
"update_time": "<string>"
}
}{
"position_response": {
"id": "<string>",
"symbol": "<string>",
"position": 123,
"margin_alloc": 123,
"realised_pnl": 123,
"unrealised_pnl": 123,
"net_funding": 123,
"open_orders": 123,
"open_quantity": 123,
"leverage": 123,
"initial_margin": 123,
"maintenance_margin": 123,
"average_price": 123
}
}{
"balance_response": {
"id": "<string>",
"user_id": "<string>",
"deposit": 123,
"realised_pnl": 123,
"order_margin": 123,
"position_margin": 123,
"unrealised_pnl": 123,
"net_funding": 123,
"available_balance": 123,
"referral_rewards": 123,
"fees": 123
}
}No examples found{
"err": {
"error_code": "<string>",
"message": "<string>"
}
}{
"type": "auth",
"params": {
"hmac": {
"public_key": "qfex_pub_xxxxx",
"nonce": "c0ffee...",
"unix_ts": 1760545414,
"signature": "5f2e..."
}
}
}{
"type": "subscribe",
"params": {
"channels": [
"positions"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"positions"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"balances"
]
}
}{
"type": "get_user_leverage",
"params": {
"limit": 10,
"offset": 0
}
}{
"type": "set_user_leverage",
"params": {
"symbol": "AAPL-USD",
"leverage": 10
}
}{
"type": "get_available_leverage_levels",
"params": {
"limit": 10,
"offset": 0
}
}{
"type": "add_order",
"params": {
"symbol": "AAPL-USD",
"side": "BUY",
"order_type": "LIMIT",
"order_time_in_force": "GTC",
"quantity": 10,
"price": 150.5,
"client_order_id": "my-order-123"
}
}{
"type": "cancel_order",
"params": {
"symbol": "AAPL-USD",
"order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
"cancel_order_id_type": "order_id"
}
}{
"type": "modify_order",
"params": {
"symbol": "AAPL-USD",
"order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
"price": 152,
"quantity": 15,
"side": "BUY",
"order_type": "LIMIT"
}
}{
"type": "get_order",
"params": {
"order_id": "5b309929-206f-40ec-804d-cbe46e81afc1",
"symbol": "AAPL-USD"
}
}{
"type": "get_user_orders",
"params": {
"limit": 10,
"offset": 0,
"symbol": "AAPL-USD"
}
}{
"type": "cancel_on_disconnect",
"params": {
"cancel_on_disconnect": true
}
}{
"type": "close_position",
"params": {
"symbol": "AAPL-USD",
"client_order_id": "my-close-order-1"
}
}{
"type": "get_user_trades",
"params": {
"limit": 20,
"start_ts": 1760545414
}
}{
"type": "cancel_stop_order",
"params": {
"stop_order_id": "stop-order-uuid"
}
}{
"type": "modify_stop_order",
"params": {
"stop_order_id": "stop-order-uuid",
"symbol": "AAPL-USD",
"price": 160,
"quantity": 5
}
}{
"type": "unsubscribe",
"params": {
"channels": [
"order_responses",
"positions"
]
}
}{
"type": "subscribed",
"connection_id": "ee987ddf-822c-4356-b0d1-012314859b00",
"message_id": 1,
"id": "3ab267fd-7c83-49c6-b42e-65bb94682b41",
"channel": "v4_balances",
"contents": [
{
"id": "2cb208e3-6e54-48c4-82e9-641e64bf185d",
"user_id": "0f5208e3-6e54-48c4-82e9-641e64bf185d",
"deposit": 1000,
"realised_pnl": -898.65735,
"unrealised_pnl": 0,
"order_margin": 0,
"position_margin": 0,
"net_funding": -1.5354636,
"available_balance": 99.80721
}
]
}{
"type": "subscribed",
"connection_id": "ee987ddf-822c-4356-b0d1-012314859b00",
"message_id": 1,
"id": "3ab267fd-7c83-49c6-b42e-65bb94682b41",
"channel": "v4_positions",
"contents": [
{
"id": "PLTR-USD",
"symbol": "PLTR-USD",
"user_id": "0f5208e3-6e54-48c4-82e9-641e64bf185d",
"position": 0,
"margin_alloc": 0,
"realised_pnl": 1.327875,
"unrealised_pnl": 0,
"net_funding": 0.00000482,
"open_orders": 1,
"open_quantity": 10,
"leverage": 20,
"initial_margin": 0,
"maintenance_margin": 0,
"average_price": 0,
"timestamp": "2025-05-09T03:47:20.505934+00:00"
}
]
}{
"order_response": {
"order_id": "<string>",
"symbol": "<string>",
"status": "<string>",
"quantity": 123,
"price": 123,
"take_profit": 123,
"stop_loss": 123,
"side": "<string>",
"type": "<string>",
"time_in_force": "<string>",
"user_id": "<string>",
"client_order_id": "<string>",
"quantity_remaining": 123,
"update_time": 123,
"trade_id": "<string>"
}
}No examples found{
"authenticated": true
}No examples foundNo examples foundNo examples found{
"subscribed": "<string>"
}{
"unsubscribed": "<string>"
}{
"stop_order_response": {
"stop_order_id": "<string>",
"user_id": "<string>",
"symbol": "<string>",
"price": 123,
"quantity": 123,
"direction": "<string>",
"stop_order_type": "<string>",
"client_order_id": "<string>",
"update_time": "<string>"
}
}{
"position_response": {
"id": "<string>",
"symbol": "<string>",
"position": 123,
"margin_alloc": 123,
"realised_pnl": 123,
"unrealised_pnl": 123,
"net_funding": 123,
"open_orders": 123,
"open_quantity": 123,
"leverage": 123,
"initial_margin": 123,
"maintenance_margin": 123,
"average_price": 123
}
}{
"balance_response": {
"id": "<string>",
"user_id": "<string>",
"deposit": 123,
"realised_pnl": 123,
"order_margin": 123,
"position_margin": 123,
"unrealised_pnl": 123,
"net_funding": 123,
"available_balance": 123,
"referral_rewards": 123,
"fees": 123
}
}No examples found{
"err": {
"error_code": "<string>",
"message": "<string>"
}
}Provide your public key as a query parameter (?api_key=...).
Provide your JWT as a query parameter (?jwt=...).
Authenticate to the WebSocket gateway. Required before any other commands.
Subscribe to user orders. Receive live updates on current orders.
Subscribe to user positions. Receive 1s pulsed updates on current positions.
Subscribe to user balance. Receive 1s pulsed updates on current balance.
Get current leverage levels per symbol
Set leverage level for a symbol
Get available leverage levels per symbol
Add order.
Cancel order.
Modify order.
Get order details by order_id or client_order_id.
Get active orders for the user.
Enable or disable cancel-on-disconnect feature for this connection.
Close an open position.
Get user trade history.
Cancel a stop order.
Modify a stop order.
Unsubscribe from channels.
User balance updates
User position updates
Response containing a single order.
Response containing a list of orders.
Response indicating authentication success.
Response containing user trades.
Response containing user leverage settings.
Response containing available leverage levels.
Confirmation of subscription.
Confirmation of unsubscription.
Response containing a stop order.
Response containing a position.
Response containing a balance.
General acknowledgment.
Error response.