Documentation Index
Fetch the complete documentation index at: https://docs.qfex.com/llms.txt
Use this file to discover all available pages before exploring further.
Subscribe to the fills channel to receive real-time fill updates for executed trades.
Messages are pushed in realtime.
1) Authenticate
Send this immediately after connecting to wss://trade.qfex.com?api_key=YOUR_API_KEY:
{ "type": "auth", "params": { "hmac": { "public_key": "qfex_pub_xxxxx", "nonce": "c0ffee...", "unix_ts": 1760545414, "signature": "5f2e..." } } }
2) Subscribe
{ "type": "subscribe", "params": { "channels": ["fills"] } }
Sample Code
# Python (websocket-client)
# pip install websocket-client
import json, websocket
API_KEY = "YOUR_API_KEY"
def send(ws, obj): ws.send(json.dumps(obj))
def on_open(ws):
# 1) Authenticate
# https://docs.qfex.com/websocket/channels/trade/authenticate#how-it-works
send(ws, {"type": "auth", "params": { "hmac": { "public_key": "qfex_pub_xxxxx", "nonce": "c0ffee...", "unix_ts": 1760545414, "signature": "5f2e..." }}})
# 2) Subscribe to fills
send(ws, {"type": "subscribe", "params": {"channels": ["fills"]}})
ws = websocket.WebSocketApp(
"wss://trade.qfex.com?api_key=YOUR_API_KEY",
on_open=on_open,
on_message=lambda _, m: print("Message:", m),
on_error=lambda _, e: print("Error:", e),
on_close=lambda *_: print("Closed"),
)
ws.run_forever()
Example Responses
{ "subscribed": "fills" }
{
"fill_response": {
"trade_id": "REDACTED",
"user_id": "REDACTED",
"symbol": "US100-USD",
"price": 25242.0,
"quantity": 0.004,
"side": "SELL",
"aggressor_side": "SELL",
"order_id": "0aeae7d0-4a6e-4672-ad69-82b8811d4e0b",
"fee": 0.00045,
"order_type": "MARKET",
"tif": "IOC",
"order_price": 25547.0,
"client_order_id": "REDACTED",
"remaining_quantity": 0.0,
"take_profit": 0.0,
"stop_loss": 0.0,
"execution_type": "NEW",
"timestamp": 1769439642.8484282,
"realised_pnl": 0.0
}
}