trade.qfex.com require authentication. You must authenticate within 1 minute of connecting or the server will close the connection. Authentication uses an HMAC-SHA256 signature that proves you control the API secret.
How it works
- Connect to wss://trade.qfex.com?api_key=YOUR_PUBLIC_KEY.
- Generate a cryptographically secure random nonce (hex encoded, max 100 characters) and capture the current Unix timestamp.
- Build the string
${nonce}:${unix_ts}and compute an HMAC-SHA256 using your secret key. Hex-encode the result to get the signature. - Send the auth payload with the
hmacblock shown below. The nonce must be unique within a 15 minute window.
Sample Code
Example Response
After the client successfully authenticates, the server keeps the connection alive by periodically sending heartbeat messages in the form of WebSocket ping frames.