Doc Fundamentals
Funds Management
Order Management
Portfolio Management
User Authentication
Market Depth
Daily API Calls
Success Rate
Avg. Response Time
This API is used to fetch the level 5 market Depth of a particular scrip.
The response of the API consists of details like Price , Quantity, No of Orders of the requested scrip.
https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V2/MarketDepth
Note
Either ScripCode or ScripData can be used to fetch market depth, with priority given to ScripCode. If the ScripCode value is present, the API response will be for the specified ScripCode
Headers
KEY | VALUE |
---|---|
Content-Type | application/json |
Authorization | bearer {Your Access Token} |
Request body
FIELD NAME | MANDATORY | DESCRIPTION | |
---|---|---|---|
head | keySTRING | Yes | AppKey of User or Partner |
body | ClientCodeSTRING | Yes | 5paisa demat account client code of the user. |
ExchSTRING | Yes | This is the exchange of the instrument.N: NSE | |
ExchTypeSTRING | Yes | It specifies the exchange segment of the instrument.C: Cash | |
ScripCodeSTRING | Optional | This is the unique code for the instrument. Can be skipped or passed as 0 if ScripData is to be used. | |
ScripDataSTRING | Optional | This is the unique Scrip Data for the instrument. Can be skipped or passed as Blank("") if ScripCode is to be used. |
{
"head": {
"key": "{{vendor_key}}"
},
"body": {
"ClientCode": "{{clientcode}}",
"Exchange":"N",
"ExchangeType":"C",
"ScripCode":2885,
"ScripData":""
}
}
Response body
FIELD NAME | VALUES | DESCRIPTION | |
---|---|---|---|
head | responseCodeSTRING | 5PMDV2 | This is the unique response code for the API. |
statusSTRING | 0: Success2: Invalid head parameters.
| This is the status code which depicts the status of API request to the server. | |
statusDescriptionSTRING | SuccessInvalid head parameters. | This is the description of the status received from the server for the API request. | |
body | CacheTimeINTEGER | - | It provides total cache time for the tick data. |
ExchSTRING | N: NSE | This is the exchange of the instrument. | |
ExchTypeSTRING | C: Cash | This specifies the exchange segment of the instrument. | |
MarketDepthDataARRAY | - | It provides level 5 bid/ask market depth. | |
ScripCodeSTRING | - | ScripCode code of the request scrip. | |
MessageSTRING | - | This is the description of | |
StatusINTEGER | - | This is the numeric code | |
TimeStampDATETIME | - | This is the time stamp of the tick data. |
Data
FIELD NAME | VALUES | DESCRIPTION |
---|---|---|
BbBuySellFlagDOUBLE | 66/83 | This is buy or sell Flag. 66 stands for Buy and 83 for sell. |
NumberOfOrdersDOUBLE | - | Total orders available for buy/sell at above price level. |
PriceDOUBLE | - | The price at each depth level. |
QuantityDOUBLE | - | Total quantity available for buy/sell at above price level. |
{
"body": {
"CacheTime": 5,
"Exch": "N",
"ExchType": "C",
"MarketDepthData": [
{
"BbBuySellFlag": 66,
"NumberOfOrders": 1,
"Price": 2802.05,
"Quantity": 212
},
{
"BbBuySellFlag": 66,
"NumberOfOrders": 1,
"Price": 2802,
"Quantity": 4
},
{
"BbBuySellFlag": 66,
"NumberOfOrders": 1,
"Price": 2801.95,
"Quantity": 1
},
{
"BbBuySellFlag": 66,
"NumberOfOrders": 1,
"Price": 2801.85,
"Quantity": 1
},
{
"BbBuySellFlag": 66,
"NumberOfOrders": 3,
"Price": 2801.75,
"Quantity": 9
},
{
"BbBuySellFlag": 83,
"NumberOfOrders": 2,
"Price": 2803.65,
"Quantity": 55
},
{
"BbBuySellFlag": 83,
"NumberOfOrders": 2,
"Price": 2803.85,
"Quantity": 54
},
{
"BbBuySellFlag": 83,
"NumberOfOrders": 2,
"Price": 2803.9,
"Quantity": 55
},
{
"BbBuySellFlag": 83,
"NumberOfOrders": 3,
"Price": 2804,
"Quantity": 147
},
{
"BbBuySellFlag": 83,
"NumberOfOrders": 1,
"Price": 2804.6,
"Quantity": 35
}
],
"Message": "Success",
"ScripCode": 2885,
"Status": 0,
"TimeStamp": "/Date(1715594363000+0530)/"
},
"head": {
"responseCode": "5PMDV2",
"status": "0",
"statusDescription": "Success"
}
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Request Error</title>
<style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px;
} #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em;
} A:link { color: #336699; font-weight: bold; text-decoration: underline;
} A:visited { color: #6699cc; font-weight: bold; text-decoration: underline;
} A:active { color: #336699; font-weight: bold; text-decoration: underline;
} .heading1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;
} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word;
} table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana;
} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;
} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;
}</style>
</head>
<body>
<div id="content">
<p class="heading1">Request Error</p>
<p>The server encountered an error processing the request. See server logs for more details.</p>
</div>
</body>
</html>