Skip to content

Depth

Get market depth (Level 2 data) for a symbol showing top 5 bid and ask prices with quantities.

Endpoint URL

http
Local Host   :  POST http://127.0.0.1:5000/api/v1/depth
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/depth
Custom Domain:  POST https://<your-custom-domain>/api/v1/depth

Sample API Request

json
{
  "apikey": "<your_app_apikey>",
  "symbol": "SBIN",
  "exchange": "NSE"
}

Sample cURL Request

bash
curl -X POST http://127.0.0.1:5000/api/v1/depth \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "symbol": "SBIN",
  "exchange": "NSE"
}'

Sample API Response

json
{
  "status": "success",
  "data": {
    "open": 760.0,
    "high": 774.0,
    "low": 758.15,
    "ltp": 769.6,
    "ltq": 205,
    "prev_close": 746.9,
    "volume": 9362799,
    "oi": 161265750,
    "totalbuyqty": 591351,
    "totalsellqty": 835701,
    "asks": [
      {"price": 769.6, "quantity": 767},
      {"price": 769.65, "quantity": 115},
      {"price": 769.7, "quantity": 162},
      {"price": 769.75, "quantity": 1121},
      {"price": 769.8, "quantity": 430}
    ],
    "bids": [
      {"price": 769.4, "quantity": 886},
      {"price": 769.35, "quantity": 212},
      {"price": 769.3, "quantity": 351},
      {"price": 769.25, "quantity": 343},
      {"price": 769.2, "quantity": 399}
    ]
  }
}

Request Body

ParameterDescriptionMandatory/OptionalDefault Value
apikeyYour Tradeboard API keyMandatory-
symbolTrading symbolMandatory-
exchangeAny value in the shared VALID_EXCHANGES listMandatory-

These three fields are the complete DepthSchema. Any other field, including a depth-level count, returns HTTP 400. The number of levels returned is whatever the broker supplies.

Response Fields

FieldTypeDescription
statusstring"success" or "error"
dataobjectMarket depth data object

Data Object Fields

FieldTypeDescription
opennumberDay's open price
highnumberDay's high price
lownumberDay's low price
ltpnumberLast traded price
ltqnumberLast traded quantity
prev_closenumberPrevious day's close
volumenumberTotal traded volume
oinumberOpen interest (for F&O)
totalbuyqtynumberTotal buy quantity in order book
totalsellqtynumberTotal sell quantity in order book
asksarrayTop 5 ask (sell) prices
bidsarrayTop 5 bid (buy) prices

Ask/Bid Array Fields

FieldTypeDescription
pricenumberPrice level
quantitynumberQuantity at this price

Understanding Market Depth

text
     BIDS (Buyers)             ASKS (Sellers)
-----------------------   ------------------------
Qty  Price                              Price  Qty
886 769.40 <-- Best Bid   Best Ask --> 769.60  767
212 769.35                             769.65  115
351 769.30                             769.70  162
343 769.25                             769.75 1121
399 769.20                             769.80  430

Notes

  • Depth shows the order book structure for a symbol
  • Bid-Ask spread indicates liquidity (tighter = more liquid)
  • totalbuyqty vs totalsellqty shows demand-supply balance
  • For F&O, oi (open interest) is available
  • The REST call returns one broker snapshot. Use WebSocket Depth for continuous updates.

Use Cases

  • Scalping strategies: Identify immediate support/resistance
  • Order placement: Decide limit price based on depth
  • Liquidity analysis: Assess ease of entry/exit

Back to: API Documentation