Order Book
PURPOSE
This API is used to Fetch Order Book of a particular Client which will contain both Equity and Commodity Orders with additional field as MarketLot, which would be helpful in case of F&O to give the lot size from the market side. This API can only be used in an active session when a client is logged in with valid credentials. The only parameter passed on the request is the client’s ID which is passed to the system and is responded with Order Book Detail list which includes various parameters such as order rate, trigger rate, quantity traded and pending, Stop loss margin etc. The method responds with status of execution of API and a message along with the requisite type of status.
Request Method: POST
Request format: JSON
Request Header:
Content-Type: application/json
Ocp-Apim-Subscription-Key:
to be provided after registration
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. | IIFLMarDEMO |
appVer | Developer App Version | String | Cannot be empty. | 1.0 |
key | UserKey generated at the time of registration | String | Cannot be empty. | ABpyyGUh1nsbesSlup3VKURkI4tQDe8y |
osName | Channel of order | String | Cannot be empty. | WEB, Android, iOS |
requestCode | Request Code of the API called | String | Cannot be empty. | IIFLMarRQOrdBkV2 |
userId | User ID generated at the time of registration | String | Cannot be empty. | ZkhghN5uKj |
password | Password generated at the time of registration | String | Cannot be empty. | lfjnfS7rHGj |
BODY
Field Name | Description | Data Type (max length) |
Validation | Sample Value |
---|---|---|---|---|
ClientCode | Pass the Clientcode for whom we want to check margin. | String(15) | Cannot be empty. | Dummy123 |
REQUEST:
{
"head": {
"appName": "IIFLMarDEMO",
"appVer": "1.0",
"key": "ABpyyGUh1nsbesSlup3VKURkI4tQDe8y",
"osName": "Android",
"requestCode": "IIFLMarRQOrdBkV2",
"userId": "mocZueK622W",
"password": "UjR1ElLwSzr"
},
"body": {
"ClientCode": "Dummy123"
}
}
RESPONSE BODY
HEADER
Field Name | Description | Data Type (max length) |
List of Values | Sample Value |
---|---|---|---|---|
responseCode | This is the response code of API | String | - | IIFLMarRQLoginForVendor |
status | This is the response code of API | String | 0 2 |
0 |
statusDescription | This is the response code of API | String | 0 - Success 2 - Invalid head parameters |
Success |
responseCode | This is the response code of API | String | - | IIFLMarRQLoginForVendor |
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 9 |
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 OrderBookV2 | Array Of OrderBookV2 | - |
OrderBook
FieldName | Type | Description |
---|---|---|
RequestType | Char(1) | Order request type P- Placed, M- Modified, C- Cancelled |
BrokerOrderId | Int32(10) | Order ID set by IIFL for a particular Order |
BrokerOrderTime | DateTime | Time at which order received by IIFL |
Exch | Char(1) | Exchange in which order has been Placed. N- NSE, B-BSE |
ExchType | Char(1) | Exchange segment C-Cash, D-Derivatives |
ScripCode | Int32(4) | Scrip Code of the particular stock |
ScripName | String(100) | Scrip Name of the scrip |
BuySell | Char(1) | B- Buy S- Sell |
Qty | Int32(4) | Order Qunatity |
Rate | Double(10) | Rate at which order has been placed |
AtMarket | Char(1) | Order Placed is limit order or Market Order. Y-At Market, N- Limit Order |
WithSL | Char(1) | Is stop loss order. |
SLTriggerRate | Double(8) | Stop lass rate |
SLTriggered | Char(1) | Is stop loss triggered |
ExchOrderID | String(20) | Order ID given by Exchange to an order. |
ExchOrderTime | DateTime | Time at which order has received by Exchange |
OrderStatus | String(50) | Status of an Order.) |
AfterHours | Char(1) | Is Order Placed After Market order. |
AHProcess | Char(1) | Is AH Order is Processed by IIFL or not |
OldorderQty | Int32(4) | Order quantity before modified quantity |
TradedQty | Int32(4) | Number of Quantity which are traded. |
PendingQty | Int32(4) | Remaining quantity after trade happened |
OrderRequesterCode | String | Id of the user who had placed the order. |
DisClosedQty | DisClosedQty | Quantity which is exposed in Exchange by Client. |
TerminalId | Int32(10) | Terminal number on which order has been sent. |
DelvIntra | Char(1) | I-Intraday, D-Delivery |
OrderValidity | Int32(4) | Validity of an order. Day = 0 GTD = 1 GTC = 2 IOC = 3 EOS = 4 VTD = 5 FOK = 6 |
OrderValidUpto | String(20) | Order Validity Date |
MarketLot | Int32(4) | Fetch scrip lot for placed order (in case of F&O) |
Reason | String | Order rejection reason. |
SMOSLLimitRate | Double(8) | SMO Stop Loss Limit Rate |
SMOSLTriggerRate | Double(8) | SMO Stop Loss Trigger Rate |
SMOProfitRate | Double(8) | SMO Profit Rate |
SMOTrailingSL | Double(8) | Double |
Success Response
{
"head": {
"responseCode": "IIFLMarRQOrdBkV2",
"status": "0",
"statusDescription": "Success"
},
"body": {
"Message": "",
"OrderBookDetail": [
{
"AHProcess": "N",
"AfterHours": "\u0000",
"AtMarket": "Y",
"BrokerOrderId": 15941,
"BrokerOrderTime": "/Date(1557382909280+0530)/",
"BuySell": "B",
"DelvIntra": "D",
"DisClosedQty": 0,
"Exch": "N",
"ExchOrderID": "0",
"ExchOrderTime": "/Date(315513000000+0530)/",
"ExchType": "Y",
"MarketLot": 0,
"OldorderQty": 0,
"OrderRequesterCode": "Dummy123",
"OrderStatus": "Rejected By IIFL",
"OrderValidUpto": "09-05-2019 11:51:49",
"OrderValidity": 0,
"PendingQty": 1,
"Qty": 1,
"Rate": 39000,
"Reason": "Order rejected by RMS as margin required is Rs84135.24, while available margin is Rs80927",
"RequestType": "P",
"SLTriggerRate": 0,
"SLTriggered": "N",
"SMOProfitRate": 0,
"SMOSLLimitRate": 0,
"SMOSLTriggerRate": 0,
"SMOTrailingSL": 0,
"ScripCode": 1014,
"ScripName": "SILVER 05 Sep 2019",
"TerminalId": 0,
"TradedQty": 0,
"WithSL": "N"
}
],
"Status": 0
}
}
Success Response
{
"head": {
"responseCode": "IIFLMarRQOrdBkV2",
"status": "0",
"statusDescription": "Success"
},
"body": {
"Message": "No Order found for this Client.",
"OrderBookDetail": [],
"Status": 1
}
}