Order Book

POSTJSONRest API
176632

Daily API Calls

99.97%

Success Rate

97.72ms

Avg. Response Time


With the variety of orders available, tracking of the order is crucial after placing an order. This API helps partners and clients to track the order placed for the day. It fetches order book of the user which will contain cash, derivatives, currency and commodity orders.

API provides order book detail list which includes various parameters such as average Price , trigger rate, quantity traded and pending etc. The method responds with status of execution of API along with the remote order ID, broker order ID and exchange order ID to map the orders.

Common Usage

API can be used to map order ID, broker order ID and exchange order, which further can be used for modifying the order.

To check order status it is recommended to use Websocket or OrderStatusAPI. 

REQUEST URL

https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V3/OrderBook

Request 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 in plain text.

SAMPLE REQUEST BODY  :

{
    "head": {
        "key": "{{YOur APp Key}}"
    },
    "body": {
        "ClientCode": "{{clientcode}}"  
    }
}

Response body

FIELD NAMEVALUESDESCRIPTION

head

responseCode

STRING

5POrdBkV3

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

OrderBookDetail

ARRAY

 

 

 

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

Status

INTEGER

0: Success

1: No orders found for this Client.

9: Invalid Session

This is the numeric code
for the status of API 
request

 

Message

STRING

Success

No orders found for this Client.

Invalid Session

This is the description of the status of API request.

OrderBookDetail

FIELD NAMEVALUESDESCRIPTION

AveragePrice

STRING

-This specifies Average Price at which all trades are processed. For Partially filled order this will reflect price for filled trades.   

AHProcess

STRING

Y: After-market order
N: Not after-market order

This specifies if the order is after market order or not.

AfterHours

STRING

Y
N

This specifies if the order is placed after closing of the market.

AtMarket

STRING

Y: Market order
N: Limit order

This specifies if the order is placed at the market rate or not.

BrokerOrderId

INTEGER

-

It provides the ID generated by 5paisa for the order.

BrokerOrderTime

DATETIME

-

Timestamp in epoch format when the order is placed on 5paisa system.

BuySell

STRING

B: Buy
S: Sell

This specifies whether the order 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 order.

DisClosedQty

INTEGER

-

This is quantity of the order which is disclosed to the market while placing the order.

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.

ExchOrderTime

DATETIME

-

Timestamp at which order 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.

OldorderQty

INTEGER

-

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

OrderRequesterCode

STRING

-

This is 5paisa Securities client code of the user for which order is placed.

OrderStatus

STRING

Mentioned in the table below

This is current status of the order.

OrderValidUpto

DATE

-

This is the date upto which the order is valid.

OrderValidity

INTEGER

0: Day
1: GTD
2: GTC
3: IOC
4: EOS
5: VTD
6: FOK

This is order type based on the order validity.

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 order is placed.

Reason

STRING

-

This is the rejection reason for the order.

RemoteOrderID

STRING

-

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

RequestType

STRING

P: Place
M: Modify
C: Cancel

This is the type of request for the order.

SLTriggerRate

DOUBLE

-

This is the trigger rate in case of stop loss order.

SLTriggered

STRING

Y: Stop loss triggered
N: Stop loss not triggered

This specifies if the stop loss has been triggered or not.

SMOProfitRate

DOUBLE

-

This is profit order rate in case of bracket order.

SMOSLLimitRate

DOUBLE

-

This is the limit rate of stop loss leg for bracket/cover order. It's value is 0 since this leg is always placed at market rate.

SMOSLTriggerRate

DOUBLE

-

This is price rate for the stop loss leg of the bracket/cover order.

SMOTrailingSL

DOUBLE

-

This is the trailing stop Ioss for the bracket/cover 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.

TerminalId

INTEGER

-

This is the terminal ID through which order is placed.

TradedQty

INTEGER

-

This is the quantity which has been executed.

WithSL

STRING

Y: Stop loss order
N: Not a stop loss order

This specifies if the order is a stop loss order or not.

Order Status

STATUSDESCRIPTION

Fully Executed

Order has been fully exceuted.

Modified

Order has been modified from its original execution state.

Xmitted

Order has been prepared by 5paisa system, but exchange rejected it or hasn't reached exchange.

Rejected By 5P

5paisa Securities system rejected the order.

AH Cancelled

After market hours order is cancelled.

AH Modified

After market hours order is modified from its previous state.

Rejected by Exch

Order has been rejected by exchange.

AH Placed

After market hours order has been placed.

Cancelled

Order has been cancelled.

Pending

Order has been placed and is pending.

 SAMPLE SUCCESS RESPONSE  
{
    "body": {
        "Message": "Success",
        "OrderBookDetail": [
            {
                "AHProcess": "N",
                "AfterHours": "N",
                "AtMarket": "N",
                "AveragePrice": 5.2,
                "BrokerOrderId": 182747604,
                "BrokerOrderTime": "/Date(1707279047230+0530)/",
                "BuySell": "S",
                "DelvIntra": "D",
                "DisClosedQty": 0,
                "Exch": "N",
                "ExchOrderID": "1500000035029169",
                "ExchOrderTime": "/Date(1707279047000+0530)/",
                "ExchType": "D",
                "MarketLot": 165,
                "OldorderQty": 0,
                "OrderRequesterCode": "client_code",
                "OrderStatus": "Fully Executed",
                "OrderValidUpto": "07 Feb 2024",
                "OrderValidity": 0,
                "PendingQty": 0,
                "Qty": 165,
                "Rate": 4.55,
                "Reason": "",
                "RemoteOrderID": "MAE",
                "RequestType": "P",
                "SLTriggerRate": 0,
                "SLTriggered": "N",
                "SMOProfitRate": 0,
                "SMOSLLimitRate": 0,
                "SMOSLTriggerRate": 0,
                "SMOTrailingSL": 0,
                "ScripCode": 43899,
                "ScripName": "BANKNIFTY 07 Feb 2024 CE 47000.00",
                "TerminalId": 46188,
                "TradedQty": 165,
                "WithSL": "N"
            }
        ],
        "Status": 0
    },
    "head": {
        "responseCode": "5POrdBkV3",
        "status": "0",
        "statusDescription": "Success"
    }
}
 SAMPLE FAILURE RESPONSE  Failure due to missing or wrong IIFLMarcookie
{
    "body": {
        "Message": "Invalid Session",
        "OrderBookDetail": [],
        "Status": 9
    },
    "head": {
        "responseCode": "IIFLMarRQOrdBkV3",
        "status": "0",
        "statusDescription": "Success"
    }
}
Failure when user has not placed any order today
{
  "head": {
    "responseCode": "5POrdBkV3",
    "status": "0",
    "statusDescription": "Success"
  },
  "body": {
    "Message": "No Order found for this Client.",
    "OrderBookDetail": [],
    "Status": 1
  }
}
On this Page

Knowledge base

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