{
"type": "auth",
"params": {
"hmac": {
"public_key": "qfex_pub_xxxxx",
"nonce": "c0ffee...",
"unix_ts": 1760545414,
"signature": "5f2e..."
}
}
}{
"type": "subscribe",
"params": {
"channels": [
"order_responses"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"positions"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"balances"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"fills"
]
}
}{
"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": "add_twap",
"params": {
"symbol": "AAPL-USD",
"side": "BUY",
"total_quantity": 10,
"num_orders": 5,
"order_interval_secs": 30,
"reduce_only": false,
"client_twap_id": "rebalance-aapl-001",
"start_time": 1785499200.25,
"worst_price": 250
}
}{
"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"
]
}
}{
"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>"
}
}{
"fill_response": {
"trade_id": "<string>",
"user_id": "<string>",
"symbol": "<string>",
"price": 123,
"quantity": 123,
"side": "<string>",
"aggressor_side": "<string>",
"order_id": "<string>",
"fee": 123,
"order_type": "<string>",
"tif": "<string>",
"order_price": 123,
"client_order_id": "<string>",
"remaining_quantity": 123,
"take_profit": 123,
"stop_loss": 123,
"execution_type": "<string>",
"timestamp": 123,
"realised_pnl": 123
}
}No examples found{
"authenticated": true
}{
"user_trades_response": {
"trade_id": "<string>",
"symbol": "<string>",
"price": 123,
"quantity": 123,
"side": "<string>",
"order_id": "<string>",
"fee": 123,
"order_type": "<string>",
"tif": "<string>"
}
}{
"user_leverage_response": {
"id": "<string>",
"symbol": "<string>",
"initial_margin": 123,
"maintenance_margin": 123,
"max_notional": 123,
"leverage": "<string>"
}
}{
"available_leverage_levels_response": {
"id": "<string>",
"symbol": "<string>",
"initial_margin": 123,
"maintenance_margin": 123,
"max_notional": 123,
"leverage": "<string>"
}
}{
"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,
"builder_rewards": 123,
"fees": 123
}
}No examples found{
"err": {
"error_code": "<string>",
"message": "<string>"
}
}交易 Playground
Single channel for order commands, positions, balances, fills
{
"type": "auth",
"params": {
"hmac": {
"public_key": "qfex_pub_xxxxx",
"nonce": "c0ffee...",
"unix_ts": 1760545414,
"signature": "5f2e..."
}
}
}{
"type": "subscribe",
"params": {
"channels": [
"order_responses"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"positions"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"balances"
]
}
}{
"type": "subscribe",
"params": {
"channels": [
"fills"
]
}
}{
"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": "add_twap",
"params": {
"symbol": "AAPL-USD",
"side": "BUY",
"total_quantity": 10,
"num_orders": 5,
"order_interval_secs": 30,
"reduce_only": false,
"client_twap_id": "rebalance-aapl-001",
"start_time": 1785499200.25,
"worst_price": 250
}
}{
"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"
]
}
}{
"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>"
}
}{
"fill_response": {
"trade_id": "<string>",
"user_id": "<string>",
"symbol": "<string>",
"price": 123,
"quantity": 123,
"side": "<string>",
"aggressor_side": "<string>",
"order_id": "<string>",
"fee": 123,
"order_type": "<string>",
"tif": "<string>",
"order_price": 123,
"client_order_id": "<string>",
"remaining_quantity": 123,
"take_profit": 123,
"stop_loss": 123,
"execution_type": "<string>",
"timestamp": 123,
"realised_pnl": 123
}
}No examples found{
"authenticated": true
}{
"user_trades_response": {
"trade_id": "<string>",
"symbol": "<string>",
"price": 123,
"quantity": 123,
"side": "<string>",
"order_id": "<string>",
"fee": 123,
"order_type": "<string>",
"tif": "<string>"
}
}{
"user_leverage_response": {
"id": "<string>",
"symbol": "<string>",
"initial_margin": 123,
"maintenance_margin": 123,
"max_notional": 123,
"leverage": "<string>"
}
}{
"available_leverage_levels_response": {
"id": "<string>",
"symbol": "<string>",
"initial_margin": 123,
"maintenance_margin": 123,
"max_notional": 123,
"leverage": "<string>"
}
}{
"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,
"builder_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. Optional params.builder_code attributes trading fees on this connection.
Subscribe to user orders. Receive live updates on current orders.
Subscribe to position snapshots with a 60-second periodic refresh and event-driven updates.
Subscribe to balance snapshots with a 60-second periodic refresh and event-driven updates.
Subscribe to user fills. Receive live updates for executed trades.
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.
Create a TWAP order.
Get user trade history.
Cancel a stop order.
Modify a stop order.
Unsubscribe from channels.
Response containing a single order.
Response containing a single fill.
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.
Initial, periodic, or event-driven position snapshot for one symbol.
Initial, periodic, or event-driven account balance snapshot.
General acknowledgment.
Error response.