Viewing: Depth

Depth

Get order book depth snapshots for a symbol with selectable level controls. See Real-time WebSocket for streaming updates.

GET /market/depth/{symbol}/

Pro+

Fetch depth snapshots for a symbol with requested level depth.

Access requirement

A Pro or higher plan is required, and REST depth access must also be enabled for your account. Plan eligibility alone does not activate this market-data entitlement.

Endpoint

https://api.sahmk.sa/api/v1/market/depth/2222/?levels=5

Parameters

(*) Required

ParameterTypeAllowed
symbol *string

stock ticker

levelsinteger

1-20

Returned levels can be lower than requested when entitlement or available market data is smaller.

Data availability by plan:

200 OKapplication/json
{
  "symbol": "2222",
  "updated_at": "2026-08-12T12:19:54.982770+00:00",
  "session": "atc",
  "book_state": "normal",
  "levels": 5,
  "best_bid": 26.6,
  "best_ask": 26.62,
  "spread": 0.02,
  "spread_bps": 7.52,
  "total_bid_quantity_top5": 241514,
  "total_ask_quantity_top5": 491802,
  "total_bid_quantity": 241514,
  "total_ask_quantity": 491802,
  "level_imbalance": -0.3413,
  "level_imbalance_top5": -0.3413,
  "bids": [
    { "level": 0, "price": 26.6, "quantity": 9181, "order_count": 18 },
    { "level": 1, "price": 26.58, "quantity": 228, "order_count": 3 },
    { "level": 2, "price": 26.56, "quantity": 13363, "order_count": 34 },
    { "level": 3, "price": 26.54, "quantity": 4133, "order_count": 21 },
    { "level": 4, "price": 26.52, "quantity": 214609, "order_count": 120 }
  ],
  "asks": [
    { "level": 0, "price": 26.62, "quantity": 38155, "order_count": 17 },
    { "level": 1, "price": 26.64, "quantity": 25208, "order_count": 12 },
    { "level": 2, "price": 26.66, "quantity": 17877, "order_count": 36 },
    { "level": 3, "price": 26.68, "quantity": 203743, "order_count": 53 },
    { "level": 4, "price": 26.7, "quantity": 206819, "order_count": 72 }
  ],
  "market_order": {
    "bid_quantity": 79938,
    "bid_order_count": 22,
    "bid_updated_at": "2026-10-06T06:31:50+00:00",
    "ask_quantity": 87743,
    "ask_order_count": 11,
    "ask_updated_at": "2026-10-06T06:31:35+00:00"
  },
  "entitled_levels": 5
}

Returned depth

  • The response is the best snapshot available at the time of the request.
  • You may receive fewer levels than requested, depending on your plan and what the market is publishing.

Market orders

  • market_order sits beside the priced ladder and is null when neither side has a positive quantity.
  • Price 0 is not a priced level and is not included in the best bid, best ask, spread, or quantity totals.
  • A book that contains only market orders is still delivered.
View Endpoint-Specific Errors
json
{
  "error": {
    "code": "DEPTH_NOT_AVAILABLE",
    "message": "No usable depth snapshot found for '2222'."
  }
}

{
  "error": {
    "code": "MARKET_DATA_ENTITLEMENT_REQUIRED",
    "message": "Market-depth access requires an approved entitlement."
  }
}

Last updated on