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

KEYVALUE

Content-Type

application/json

Authorization

bearer{Your Access Token}

Request body

FIELD NAMEMANDATORYDESCRIPTION

head

key

STRING

Yes

User Key of the partner received along with API 
credentials

body

ClientCode

STRING

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 NAMEVALUESDESCRIPTION

head

responseCode

STRING

5PTrdBkV1

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

TradeBookDetail

ARRAY

 

It provides the list of all the trade details for the day.

Status

INTEGER

0: Success

1: No Trade found for this Client.

9: Invalid Session

This is the numeric code
for the status of API 
request

 

Message

STRING

Success

No Trade found for this Client.

Invalid Session

This is the description of the status of API request.

TradeBookDetail

FIELD NAMEVALUESDESCRIPTION

BuySell

STRING

B: Buy
S: Sell

This specifies whether the trade is of buy type or sell type.

DelvIntra

STRING

D: Delivery
I: Intraday
S: Bracket Order
C: Cover Order

This specifies the type of the trade.

Exch

STRING

N: NSE
B: BSE
M: MCX

This is the exchange in which order is placed.

ExchOrderID

STRING

-

This is the order ID generated by the exchange.

ExchangeTradeTime

DATETIME

-

Timestamp at which trade is placed in the exchange.

ExchType

STRING

C: Cash
D: Derivatives (NSE, BSE & MCX F&O)
U: Currency
 

This is exchange type in which the order is placed.

ExchangeTradeID

STRING

-

This is the trade ID generated by the exchange.

OrgQty

INTEGER

-

This is the original order quantity in case any modification is done to the order.

PendingQty

INTEGER

-

This is the quantity pending to be executed.

Qty

INTEGER

-

This is the total quantity of the order.

Rate

DOUBLE

-

This is the price rate at which trade is executed.

RemoteOrderID

STRING

-

This is the remote order ID passed by the user while placing the order.

ScripCode

INTEGER

-

This is the unique code for instrument in which order is placed.

ScripName

STRING

-

This is the name of the instrument for which order is placed.

TradeType

STRING

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

Knowledge base

Portfolio API docs is the next thing to checkout
Holdings 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