Viewing: Stocks

Real-time WebSocket - Stocks

Stream real-time quote updates through the stocks channel.

WS /ws/v1/stocks/

Pro+

Real-time quotes channel for live stock updates.

Endpoint

wss://api.sahmk.sa/ws/v1/stocks/?api_key=YOUR_API_KEY

Connected message

json
{
  "type": "connected",
  "plan": "business",
  "delivery_profile": "business_standard",
  "limits": {
    "max_symbols_per_connection": 120,
    "max_symbols_per_call": 40,
    "stream_modes": ["standard"]
  },
  "message": "Connected to SAHMK real-time stock stream",
  "timestamp": "2026-07-09T15:05:37.749535+00:00"
}

Client actions

json
{"action":"subscribe","symbols":["2222","1120"]}
{"action":"unsubscribe","symbols":["1120"]}
{"action":"ping"}
{"action":"subscribe","symbols":["*"]} // Enterprise only

Quote message

200 OKapplication/json
{
  "type": "quote",
  "symbol": "2222",
  "mode": "standard",
  "data": {
    "price": 25.86,
    "open": 25.4,
    "high": 25.9,
    "low": 25.2,
    "close": 25.86,
    "change": 0.86,
    "change_percent": 3.44,
    "previous_close": 25.0,
    "volume": 9803705,
    "value": 252308343.0,
    "trade_count": 12289,
    "bid": 25.84,
    "ask": 25.88,
    "bid_size": 79,
    "ask_size": 188,
    "liquidity": {
      "inflow_value": 154800000.0,
      "inflow_volume": 6000000,
      "outflow_value": 97508343.0,
      "outflow_volume": 3803705,
      "net_value": 57291657.0
    },
    "trade_time": "2026-07-09T09:30:40+00:00",
    "market_session": "REGULAR",
    "auction": {
      "phase": "opening",
      "price": 25.9,
      "price_updated_at": "2026-10-07T06:31:01+00:00",
      "volume": 11646,
      "volume_updated_at": "2026-10-07T06:31:01+00:00",
      "symbol_state": null,
      "symbol_session": "pre-open"
    }
  },
  "timestamp": "2026-07-09T09:30:41.114000+00:00",
  "latency_ms": 14
}

Indicative auction

  • data.auction uses the same object as the REST quote.
  • It is null outside a live opening or closing auction, and always null on a delayed plan.
  • data.price stays the last official trade.

Last updated on