Market Depth

POSTJSONRest API
21340

Daily API Calls

100%

Success Rate

96.26ms

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. 

REQUEST URL

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

KEYVALUE

Content-Type

application/json

Authorization

bearer {Your Access Token}

Request body

FIELD NAMEMANDATORYDESCRIPTION

head

key

STRING

Yes

AppKey of User or Partner

body

ClientCode

STRING

Yes

5paisa demat account client code of the user.

Exch

STRING

Yes

This is the exchange of the instrument.

N: NSE
B: BSE
M: MCX

 

ExchType

STRING

Yes

It specifies the exchange segment of the instrument.

C: Cash
D: Derivatives (FnO for NSE, BSE & MCX)
U: Currency Derivatives

 

ScripCode

STRING

Optional

This is the unique code for the instrument. Can be skipped or passed as 0 if ScripData is to be used.

 

ScripData

STRING

OptionalThis is the unique Scrip Data for the instrument. Can be skipped or passed as Blank("") if ScripCode is to be used.
SAMPLE REQUEST BODY  :

{
    "head": {
        "key": "{{vendor_key}}"
    },
    "body": {
        "ClientCode": "{{clientcode}}",
         "Exchange":"N",
         "ExchangeType":"C",
         "ScripCode":2885,
         "ScripData":""
    }
}

Response body

FIELD NAMEVALUESDESCRIPTION

head

responseCode

STRING

5PMDV2

This is the unique response code for the API.

status

STRING

0: Success

2: Invalid head parameters.

 

This is the status code which depicts the status of API request to the server.

statusDescription

STRING

Success

Invalid head parameters.

This is the description of the status received from the server for the API request.

body

CacheTime

INTEGER

-

It provides total cache time for the tick data.

Exch

STRING

N: NSE
B: BSE
M:MCX

This is the exchange of the instrument.

ExchType

STRING

C: Cash
D: Derivatives (FnO for NSE, BSE & MCX)
U: Currency

 

This specifies the exchange segment of the instrument.

MarketDepthData

ARRAY

-

It provides level 5 bid/ask market depth. 

ScripCode

STRING

-

ScripCode code of the request scrip. 

Message

STRING

-

This is the description of 
the status of API request

Status

INTEGER

-

This is the numeric code
for the status of API 
request

TimeStamp

DATETIME

-

This is the time stamp of the tick data.

Data

FIELD NAMEVALUESDESCRIPTION

BbBuySellFlag

DOUBLE

66/83This is buy or sell Flag. 66 stands for Buy and 83 for sell. 

NumberOfOrders

DOUBLE

-Total orders available for buy/sell at above price level. 

Price

DOUBLE

-

The price at each depth level.

Quantity

DOUBLE

-

Total quantity available for buy/sell at above price level. 

 SAMPLE SUCCESS RESPONSE  SAMPLE SUCCESS RESPONSE

{
   "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"
   }
}

 SAMPLE FAILURE RESPONSE:  Failure when scripCode is passed as blank

<?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>

On this Page

Knowledge base

Historical candles docs is the next thing to checkout
Historical Candles API
How to use this API that suits your work flow best
Start using our APIs

Contribute and get rewarded

Help make these Dev Docs great, contribute to the APIs and get rewarded for your contribution

Need Help

Ask Developer Community

Contact Support

 

Changelog

Changes made to our APIs - Changelog

AVENUES