> ## 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.

# Minmax Price

Subscribe to real-time minimum and maximum price updates for symbols.

## How it works

Connect to the public websocket:

* URL: **wss\://mds.qfex.com**

Then send a subscribe message:

```json theme={null}
{
  "type": "subscribe",
  "channels": ["minmax_price"],
  "symbols": ["AAPL-USD"]
}
```

## Sample Code

<CodeGroup>
  ```python python theme={null}
  # Python (websocket-client)
  import json
  import websocket

  def on_open(ws):
      sub = {
          "type": "subscribe",
          "channels": ["minmax_price"],
          "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()
  ```

  ```javascript node theme={null}
  // Node.js (ws)
  import WebSocket from "ws";

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

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

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

## Example Response

```json theme={null}
{
  "type": "minmax_price",
  "symbol": "AAPL-USD",
  "min_price": "400.00",
  "max_price": "450.00",
  "time": "2025-05-08T20:52:48.000Z"
}
```
