Trading APIs

Order Book

Purpose

This API is used to Fetch OrderBook of a particular Client which will contain both Equity and Commodity Orders.

Request URL https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V2/OrderBook

Request Method POST
Request format: JSON

Request Header Content-Type:application/json

Request Body

Header

Field Name Description Data Type (max length) Validation Sample Value
appName App Name provided at the time of registration String Cannot be empty. APPTRIAL
appVer Developer App Version String Cannot be empty. 1.0
key UserKey generated at the time of registration String Cannot be empty. ue73jHVeEzBswG5ss9ugyrAasdasdyKYxg
osName Channel of order String Cannot be Empty WEB, Android, iOS
requestCode Request Code of the API called String Cannot be Empty 5PMarginV3
userId User ID generated at the time of registration String Cannot be empty. asdue73jHVeE
password Password generated at the time of registration String Cannot be empty. 9ugyrAasdasdy

Body

Field Name Description Data Type (max length) Validation Sample Value
ClientCode Pass the registered client code of the user. String(10) Cannot be empty. 12345678

Response Body

Field Name Description Data Type (max length) List Values Sample Value
Status Returns the status of the response. Integer A. -1
0
1
2
Message Returns the message of the reponse. String - “Success”
“No record found.”
“Invalid input parameters.”
“Invalid head parameters.”
“Error while processing your request.”
“Invalid Session”
"No Order found for this Client."
OrderBookDetail Order Details of that particular client for the day. Array Of Orders Array Of Orders -

OrderBookDetail

Field Name Type Description
RequestType Char Order request type
P- Placed, M- Modified, C- Cancelled
BrokerOrderId Int32 Order ID set by 5paisa for a particular Order
BrokerOrderTime DateTime Time at which order received by 5paisa
Exch Char Exchange in which order has been Placed. N- NSE, B-BSE, M- MCX
ExchType Char Exchange segment C-Cash, D-Derivatives, U-Currency
ScripCode Int32 Scrip Code of the particular stock
ScripName String Scrip Name of the scrip.
BuySell Char B- Buy
S- Sell
Qty Int32 Order Qunatity
Rate Double Rate at which order has been placed
AtMarket Char Order Placed is limit order or Market Order. Y-At Market, N- Limit Order
WithSL Char Is stop loss order.
SLTriggerRate Double Stop lass rate
SLTriggered Char Is stop loss triggered
ExchOrderID String Order ID given by Exchange to an order.
ExchOrderTime DateTime Time at which order has received by Exchange
OrderStatus String Status of an Order.
AfterHours Char Is Order Placed After Market order.
AHProcess Char Is AH Order is Processed by 5paisa or not
OldorderQty Int32 Order quantity before modified quantity
TradedQty Int32 Number of Quantity which are traded.
PendingQty Int32 Remaining quantity after trade happened
OrderRequesterCode String Id of the user who had placed the order.
DisClosedQty Int32 Quantity which is exposed in Exchange by Client.
TerminalId Int32 Terminal number on which order has been sent.
DelvIntra Char I-Intraday, D-Delivery
OrderValidity Int32 Validity of an order.
Day = 0
GTD = 1
GTC = 2
IOC = 3
EOS = 4
VTD = 5
FOK = 6
OrderValidUpto String Order Validity Date
Reason String Order rejection reason.
SMOSLLimitRate Double SMO Stop Loss Limit Rate
SMOSLTriggerRate Double SMO Stop Loss Trigger Rate
SMOProfitRate Double SMO Profit Rate
SMOTrailingSL Double SMO Trailing Stop Loss
MarketLot Double Shows MarketLot

Sample Request

        {
            "head": {
            "appName": "APPTRIAL",
            "appVer": "1.0",
            "key": "ue73jH6AKVXeESDFSGzBswG5ss9ugyrAyKYxg",
            "osName": "Android",
            "requestCode": "5POrdBkV2",
            "userId": "s9RzKCjdL9SDAN",
            "password":  "nznS4f34zASDAXw" 
            },
            "body": {
            "ClientCode": "12345678"
            }
        }
    

Sample Response

    {
        "body": {
        "Message": "",
        "OrderBookDetail": [
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 90974611,
        "BrokerOrderTime": "/Date(1556174280727+0530)/",
        "BuySell": "S",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "1100000003274860",
        "ExchOrderTime": "/Date(1556174280000+0530)/",
        "ExchType": "C",
        "MarketLot": 1,
        "OldorderQty": 1,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Fully Executed",
        "OrderValidUpto": "25 Apr 2019",
        "OrderValidity": 0,
        "PendingQty": 0,
        "Qty": 1,
        "Rate": 52.9,
        "Reason": "",
        "RequestType": "M",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 11184,
        "ScripName": "IDFCFIRSTB",
        "TerminalId": 42583,
        "TradedQty": 1,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 90975529,
        "BrokerOrderTime": "/Date(1556174345727+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "1400000006836412",
        "ExchOrderTime": "/Date(1556166711000+0530)/",
        "ExchType": "D",
        "MarketLot": 1,
        "OldorderQty": 20,
        "OrderRequesterCode": "C142243",
        "OrderStatus": "Cancelled",
        "OrderValidUpto": "30 Dec 1899",
        "OrderValidity": 0,
        "PendingQty": 20,
        "Qty": 20,
        "Rate": 26,
        "Reason": "",
        "RequestType": "C",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 40124,
        "ScripName": "BANKNIFTY 02 May 2019 PE 29500.00",
        "TerminalId": 34450,
        "TradedQty": 0,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 90979426,
        "BrokerOrderTime": "/Date(1556174647640+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "0",
        "ExchOrderTime": "/Date(315513000000+0530)/",
        "ExchType": "D",
        "MarketLot": 2,
        "OldorderQty": 0,
        "OrderRequesterCode": "123456789",
        "OrderStatus": "Rejected By 5P",
        "OrderValidUpto": "30 Dec 1899",
        "OrderValidity": 0,
        "PendingQty": 40,
        "Qty": 40,
        "Rate": 26,
        "Reason": "Order rejected by RMS as margin required is Rs1040, while available margin is Rs526.53",
        "RequestType": "P",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 40124,
        "ScripName": "BANKNIFTY 02 May 2019 PE 29500.00",
        "TerminalId": 0,
        "TradedQty": 0,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 90980441,
        "BrokerOrderTime": "/Date(1556174735707+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "0",
        "ExchOrderTime": "/Date(315513000000+0530)/",
        "ExchType": "D",
        "MarketLot": 1,
        "OldorderQty": 0,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Rejected By 5P",
        "OrderValidUpto": "30 Dec 1899",
        "OrderValidity": 0,
        "PendingQty": 20,
        "Qty": 20,
        "Rate": 30,
        "Reason": "Order rejected by RMS as margin required is Rs600, while available margin is Rs526.53",
        "RequestType": "P",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 40124,
        "ScripName": "BANKNIFTY 02 May 2019 PE 29500.00",
        "TerminalId": 0,
        "TradedQty": 0,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 90980925,
        "BrokerOrderTime": "/Date(1556174776827+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "1400000024187237",
        "ExchOrderTime": "/Date(1556174752000+0530)/",
        "ExchType": "D",
        "MarketLot": 1,
        "OldorderQty": 20,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Cancelled",
        "OrderValidUpto": "30 Dec 1899",
        "OrderValidity": 0,
        "PendingQty": 20,
        "Qty": 20,
        "Rate": 26,
        "Reason": "",
        "RequestType": "C",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 40124,
        "ScripName": "BANKNIFTY 02 May 2019 PE 29500.00",
        "TerminalId": 34450,
        "TradedQty": 0,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 91028378,
        "BrokerOrderTime": "/Date(1556177965000+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "0",
        "ExchOrderTime": "/Date(315513000000+0530)/",
        "ExchType": "C",
        "MarketLot": 1,
        "OldorderQty": 0,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Rejected By 5P",
        "OrderValidUpto": "25 Apr 2019",
        "OrderValidity": 0,
        "PendingQty": 1,
        "Qty": 1,
        "Rate": 1400,
        "Reason": "Order rejected by RMS as margin required is Rs399.98, while available margin is Rs17.75",
        "RequestType": "P",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 2885,
        "ScripName": "RELIANCE",
        "TerminalId": 0,
        "TradedQty": 0,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 91028710,
        "BrokerOrderTime": "/Date(1556177985650+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "0",
        "ExchOrderTime": "/Date(315513000000+0530)/",
        "ExchType": "U",
        "MarketLot": 1,
        "OldorderQty": 0,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Rejected By 5P",
        "OrderValidUpto": "30 Dec 1899",
        "OrderValidity": 0,
        "PendingQty": 1,
        "Qty": 1,
        "Rate": 69,
        "Reason": "Order rejected by RMS as margin required is Rs1610.13, while available margin is Rs6.52999999999997",
        "RequestType": "P",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 2794,
        "ScripName": "USDINR 25 Apr 2019",
        "TerminalId": 0,
        "TradedQty": 0,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 91029117,
        "BrokerOrderTime": "/Date(1556178010583+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "1400000030807362",
        "ExchOrderTime": "/Date(1556177515000+0530)/",
        "ExchType": "D",
        "MarketLot": 1,
        "OldorderQty": 20,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Cancelled",
        "OrderValidUpto": "30 Dec 1899",
        "OrderValidity": 0,
        "PendingQty": 20,
        "Qty": 20,
        "Rate": 26,
        "Reason": "",
        "RequestType": "C",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 40124,
        "ScripName": "BANKNIFTY 02 May 2019 PE 29500.00",
        "TerminalId": 34450,
        "TradedQty": 0,
        "WithSL": "N"
        }, 
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 91049315,
        "BrokerOrderTime": "/Date(1556179132500+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "0",
        "ExchOrderTime": "/Date(315513000000+0530)/",
        "ExchType": "C",
        "MarketLot": 2,
        "OldorderQty": 0,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Rejected By 5P",
        "OrderValidUpto": "24 Apr 2019",
        "OrderValidity": 0,
        "PendingQty": 2,
        "Qty": 2,
        "Rate": 717.65,
        "Reason": "Order rejected by RMS. Limit price should be within circuit limit(358.7 - 538)",
        "RequestType": "P",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 11809,
        "ScripName": "IIFL",
        "TerminalId": 0,
        "TradedQty": 0,
        "WithSL": "N"
        },
        {
        "AHProcess": "N",
        "AfterHours": "N",
        "AtMarket": "N",
        "BrokerOrderId": 91049576,
        "BrokerOrderTime": "/Date(1556179147060+0530)/",
        "BuySell": "B",
        "DelvIntra": "D",
        "DisClosedQty": 0,
        "Exch": "N",
        "ExchOrderID": "0",
        "ExchOrderTime": "/Date(315513000000+0530)/",
        "ExchType": "C",
        "MarketLot": 2,
        "OldorderQty": 0,
        "OrderRequesterCode": "12345678",
        "OrderStatus": "Rejected By 5P",
        "OrderValidUpto": "24 Apr 2019",
        "OrderValidity": 0,
        "PendingQty": 2,
        "Qty": 2,
        "Rate": 366,
        "Reason": "Order rejected by RMS as margin required is Rs732, while available margin is Rs547.75",
        "RequestType": "P",
        "SLTriggerRate": 0,
        "SLTriggered": "N",
        "SMOProfitRate": 0,
        "SMOSLLimitRate": 0,
        "SMOSLTriggerRate": 0,
        "SMOTrailingSL": 0,
        "ScripCode": 11809,
        "ScripName": "IIFL",
        "TerminalId": 0,
        "TradedQty": 0,
        "WithSL": "N"
        }
    ],
        "Status": 0
    },
        "head": {
        "responseCode": "5POrdBkV2",
        "status": "0",
        "statusDescription": "Success"
        }
    }