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 consolidated market statistics for one symbol or all symbols.
The market_stats stream combines the latest BBO, mark price, open interest, and current daily volume into one message. On subscribe, MDS sends the latest snapshot when data is available, then pushes refreshed stats once per second.
How it works
Connect to the public websocket:
Then send a subscribe message:
{
"type": "subscribe",
"channels": ["market_stats"],
"symbols": ["AAPL-USD"]
}
Or subscribe to all symbols with a wildcard:
{ "type": "subscribe", "channels": ["market_stats"], "symbols": ["*"] }
Sample Code
# Python (websocket-client)
import json
import websocket
def on_open(ws):
sub = {
"type": "subscribe",
"channels": ["market_stats"],
"symbols": ["*"]
}
ws.send(json.dumps(sub))
def on_message(ws, message):
print("Market stats:", message)
if __name__ == "__main__":
ws = websocket.WebSocketApp(
"wss://mds.qfex.com",
on_open=on_open,
on_message=on_message
)
ws.run_forever()
Example Response
{
"type": "market_stats",
"sequence": 30272540,
"time": "2025-09-04T09:26:40Z",
"symbol": "*",
"bbos": [
{
"time": "2025-09-04T09:26:39.545268322Z",
"symbol": "AAPL-USD",
"bid": [["10101.1", "0.4505414"]],
"ask": [["10102.55", "0.57753524"]]
}
],
"mark_prices": [
{
"time": "2025-09-04T09:26:39.545268322Z",
"symbol": "AAPL-USD",
"price": "10102"
}
],
"open_interests": [
{
"time": "2025-09-04T09:26:39.545268322Z",
"symbol": "AAPL-USD",
"open_interest": "12.5"
}
],
"daily_volumes": [
{
"symbol": "AAPL-USD",
"volume": "12.5"
}
]
}
Unsubscribe (optional)
{ "type": "unsubscribe", "channels": ["market_stats"], "symbols": ["*"] }
Notes
symbols supports a single symbol, multiple symbols, or wildcard *.
bbos, mark_prices, open_interests, and daily_volumes are arrays. Arrays can be empty when no latest value is available for that component.
- Daily volume is counted from the daily reset at 20:00 America/Chicago.
market_stats ignores intervals and sig_figs; it always uses the default subscription filter.