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.
You can request the leverage levels applied for each symbol for your account.
You cannot change the leverage level if you have any open orders or a non zero
position.
Leverage management is performed over WebSocket.
- Endpoint:
wss://trade.qfex.com?api_key=YOUR_API_KEY
- Authenticate within 1 minute of connecting.
Example Request
{
"type": "get_user_leverage",
"params": {
"limit": 10, // Optional
"offset": 0 // Optional
}
}
limit (optional) — maximum number of trades to return (default 1000)
offset (optional) — pagination offset (default 0)
Sample Code
# Python (websocket-client)
import json, websocket
API_KEY = "YOUR_API_KEY"
def send(ws, obj): ws.send(json.dumps(obj))
def on_open(ws):
# 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..." }}})
# Request user trades
send(ws, {"type": "get_user_leverage", "params": {"limit": 10, "offset": 0}})
ws = websocket.WebSocketApp(
"wss://trade.qfex.com?api_key=YOUR_API_KEY",
on_open=on_open,
on_message=lambda _, m: print("Message:", m)
)
ws.run_forever()
Example Response
{
"user_leverage_response": [
{
"id": "96eedb94-bf74-4efe-bd64-82e7a541c7f4",
"symbol": "META-USD",
"initial_margin": 0.05,
"maintenance_margin": 0.03333333333333333,
"max_notional": 100000.0,
"leverage": "20"
}
]
}