Market Depth
POST /marketDepth
The Market Depth API provides real-time data on the market depth for a given trading symbol on a specific exchange. This includes details about the current bid and ask prices, their quantities, and other relevant market data. It is useful for traders and investors to understand the supply and demand dynamics of a stock and make informed trading decisions.
Parameter
| Name | Type | Required | Description |
|---|---|---|---|
exchange | string | false | Name of the exchange. Valid values: BSE, NSE, NFO, BFO, MCX, CDS, MFO. Default is NSE if not provided. For BSE, NFO, CDS, and MCX, the exchange is mandatory. |
symbolName | string | true | Symbol name of the scrip. For Equity, enter the SymbolName of the scrip. For Derivatives, enter the TradingSymbol of the scrip. |
Sample Request Body
json
requestBody={
"exchange" : "BFO",
"symbolName" : "BANKEX2450656000CE"
}Sample Code
bash
curl -X POST 'https://tradeapi.samco.in/marketDepth' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-session-token: <SESSION_TOKEN>' \
-d '{"exchange":"BFO","symbolName":"BANKEX2450656000CE"}'java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Sample {
public static void main(String[] args) throws Exception {
String requestBody = """
{
"exchange": "BFO",
"symbolName": "BANKEX2450656000CE"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/marketDepth"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("x-session-token", "<SESSION_TOKEN>")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}js
(async () => {
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
};
const requestBody = {
exchange: "BFO",
symbolName: "BANKEX2450656000CE"
};
const response = await fetch('https://tradeapi.samco.in/marketDepth', {
method: 'POST',
headers,
body: JSON.stringify(requestBody),
});
const data = await response.json();
console.log(data);
})();py
import requests
import json
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
}
requestBody = {
"exchange": "BFO",
"symbolName": "BANKEX2450656000CE"
}
r = requests.post('https://tradeapi.samco.in/marketDepth',
data=json.dumps(requestBody),
headers=headers)
print(r.json())Sample Response
json
{
"serverTime": "20/08/24 13:41:54",
"msgId": "f494c1cb-ba67-4591-b29e-9a27f92e5204",
"status": "Success",
"statusMessage": "Market depth data retrieved successfully",
"MarketDepthDetails": {
"marketDepth": {
"tradingSymbol": "NIFTY2482224500PE",
"vega": "5.05",
"theta": "-15.53",
"gamma": "0.0010",
"symbol": "36759_NFO",
"tBuyQty": "774925",
"iv": "13.80",
"tSellQty": "985500",
"bestFiveAsk": [
{
"askNumber": "8",
"askSize": "1775",
"askPrice": "27.05"
},
{
"askNumber": "19",
"askSize": "4350",
"askPrice": "27.10"
},
{
"askNumber": "19",
"askSize": "3650",
"askPrice": "27.15"
},
{
"askNumber": "20",
"askSize": "5025",
"askPrice": "27.20"
},
{
"askNumber": "11",
"askSize": "1950",
"askPrice": "27.25"
}
],
"bestFiveBid": [
{
"bidSize": "1400",
"bidNumber": "4",
"bidPrice": "27.00"
},
{
"bidSize": "3850",
"bidNumber": "13",
"bidPrice": "26.95"
},
{
"bidSize": "8975",
"bidNumber": "22",
"bidPrice": "26.90"
},
{
"bidSize": "5450",
"bidNumber": "18",
"bidPrice": "26.85"
},
{
"bidSize": "2800",
"bidNumber": "9",
"bidPrice": "26.80"
}
],
"atmIV": "11.70",
"delta": "-0.19",
"exc": "NFO"
}
}
}json
{
"serverTime": "14/05/24 13:49:07",
"status": "Failure",
"statusMessage": "No Symbol found for the provided symbol name and exchange."
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | The timestamp of when the response was generated, indicating the server's current time. |
msgId | string | A unique identifier for the request, useful for tracking and debugging. |
status | string | The status of the API response. Possible values: 'Success', 'Error', or 'Failure'. |
statusMessage | string | A message providing additional details about the status of the request. |
MarketDepthDetails | Object | Contains the market depth information. |
tradingSymbol | string | The identifier for the financial instrument or contract. |
vega | string | Measures the sensitivity of the F&O’s price to changes in the volatility of the underlying asset. |
theta | string | Measures the rate at which the F&O’s price decreases as it approaches expiration. |
gamma | string | Measures the rate of change of delta with respect to changes in the underlying asset's price. |
symbol | string | A unique code for the instrument on the exchange. |
tBuyQty | string | The total quantity available for buying. |
iv | string | Implied volatility of the F&O. |
tSellQty | string | The total quantity available for selling. |
bestFiveAsk | Object | An array listing the top five ask prices (prices at which sellers are willing to sell). |
askNumber | string | The order number for the ask price. |
askSize | string | The quantity available at the ask price. |
askPrice | string | The price at which sellers are willing to sell. |
bestFiveBid | Object | An array listing the top five bid prices (prices at which buyers are willing to buy). |
bidSize | string | The quantity available at the bid price. |
bidNumber | string | The order number for the bid price. |
bidPrice | string | The price at which buyers are willing to buy. |
atmIV | Object | The implied volatility of the at-the-money F&O. |
delta | string | Measures the sensitivity of the F&O’s price to changes in the price of the underlying asset. |
exc | string | The exchange code where the instrument is traded. |