Skip to main content
Subscribe to real-time open interest updates for symbols.

How it works

Connect to the public websocket:
  • URL: wss://mds.qfex.com
Then send a subscribe message:
{
  "type": "subscribe",
  "channels": ["open_interest"],
  "symbols": ["AAPL-USD"]
}

Sample Code

# Python (websocket-client)
import json
import websocket

def on_open(ws):
    sub = {
        "type": "subscribe",
        "channels": ["open_interest"],
        "symbols": ["AAPL-USD"]
    }
    ws.send(json.dumps(sub))

def on_message(ws, message):
    print("Update:", message)

if __name__ == "__main__":
    ws = websocket.WebSocketApp(
        "wss://mds.qfex.com",
        on_open=on_open,
        on_message=on_message
    )
    ws.run_forever()
// Node.js (ws)
import WebSocket from "ws";

const ws = new WebSocket("wss://mds.qfex.com");

ws.on("open", () => {
  const sub = {
    type: "subscribe",
    channels: ["open_interest"],
    symbols: ["AAPL-USD"]
  };
  ws.send(JSON.stringify(sub));
});

ws.on("message", (msg) => {
  console.log("Update:", msg.toString());
});

Example Response

{
  "type": "open_interest",
  "symbol": "AAPL-USD",
  "open_interest": "1000000",
  "time": "2025-05-08T20:52:48.000Z"
}