Back to home
Doc Fundamentals
API Reference
Funds Management
Order Management
Portfolio Management
User Authentication
Trade Book
POSTJSONRest API
169349
Daily API Calls
99.98%
Success Rate
100.59ms
Avg. Response Time
This API helps clients to track the trades executed for the day. It fetches trade book of the user which will contain cash, derivatives, currency and commodity trades for all exchanges (NSE, BSE, MCX)
API Provides trade book detail list which includes various parameters such as order rate, order quantity, traded quantity etc.
One order can be executed in multiple trades, you can map an the same with help of ExchangeOrderId and ExchangeTradeID.
REQUEST URL
https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V1/TradeBook
Request headers
KEY | VALUE |
---|---|
Content-Type | application/json |
Authorization | bearer{Your Access Token} |
Request body
FIELD NAME | MANDATORY | DESCRIPTION | |
---|---|---|---|
head | keySTRING | Yes | User Key of the partner received along with API |
body | ClientCodeSTRING | Yes | 5paisa demat account client code of the user in plain text. |
SAMPLE REQUEST BODY :
{
"head": {
"key": "{{Your App Key}}"
},
"body": {
"ClientCode": "{{clientcode}}"
}
}
Response body
FIELD NAME | VALUES | DESCRIPTION | |
---|---|---|---|
head | responseCodeSTRING | 5PTrdBkV1 | 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 | TradeBookDetailARRAY | It provides the list of all the trade details for the day. | |
StatusINTEGER | 0: Success1: No Trade found for this Client.9: Invalid Session | This is the numeric code | |
MessageSTRING | SuccessNo Trade found for this Client.Invalid Session | This is the description of the status of API request. |
TradeBookDetail
FIELD NAME | VALUES | DESCRIPTION |
---|---|---|
BuySellSTRING | B: Buy | This specifies whether the trade is of buy type or sell type. |
DelvIntraSTRING | D: Delivery | This specifies the type of the trade. |
ExchSTRING | N: NSE | This is the exchange in which order is placed. |
ExchOrderIDSTRING | - | This is the order ID generated by the exchange. |
ExchangeTradeTimeDATETIME | - | Timestamp at which trade is placed in the exchange. |
ExchTypeSTRING | C: Cash | This is exchange type in which the order is placed. |
ExchangeTradeIDSTRING | - | This is the trade ID generated by the exchange. |
OrgQtyINTEGER | - | This is the original order quantity in case any modification is done to the order. |
PendingQtyINTEGER | - | This is the quantity pending to be executed. |
QtyINTEGER | - | This is the total quantity of the order. |
RateDOUBLE | - | This is the price rate at which trade is executed. |
RemoteOrderIDSTRING | - | This is the remote order ID passed by the user while placing the order. |
ScripCodeINTEGER | - | This is the unique code for instrument in which order is placed. |
ScripNameSTRING | - | This is the name of the instrument for which order is placed. |
TradeTypeSTRING | ON | This is the type of the trade executed at exchange. |
SAMPLE SUCCESS RESPONSE
{
"body": {
"Message": "",
"Status": 0,
"TradeBookDetail": [
{
"BuySell": "S",
"DelvIntra": "D",
"Exch": "N",
"ExchOrderID": "1000000021496830",
"ExchType": "D",
"ExchangeTradeID": "2114466",
"ExchangeTradeTime": "/Date(1707364850000+0530)/",
"Multiplier": 1,
"OrgQty": 550,
"PendingQty": 0,
"Qty": 50,
"Rate": 2.55,
"ScripCode": 45502,
"ScripName": "NIFTY 08 Feb 2024 CE 22300.00",
"TradeType": "ON"
}
]
},
"head": {
"responseCode": "5PTrdBkV1",
"status": "0",
"statusDescription": "Success"
}
}
SAMPLE FAILURE RESPONSE Failure due to missing or wrong IIFLMarcookie
{
"body": {
"Message": "Invalid Session",
"Status": 9,
"TradeBookDetail": []
},
"head": {
"responseCode": "5PTrdBkV1",
"status": "0",
"statusDescription": "Invalid Session"
}
}
Failure when user has not placed any order today
{
"head": {
"responseCode": "5PTrdBkV1",
"status": "0",
"statusDescription": "Success"
},
"body": {
"Message": "No Trade found for this Client.",
"OrderBookDetail": [],
"Status": 1
}
}
On this Page