Order Request


PURPOSE


This API is the backbone of all the trade dependent APIs and is the key method that you would need to place your order in the market. Like other APIs this work only with active session and you need to be successfully logged in to consume this API. This API has been designed keeping in mind the requirements of both individual and institutional traders, where you can either place the order for yourself or any of your clients who trade through you. The input parameters include exchange, segment of exchange, price, quantity, before or after market trade, order validity etc. and takes implicit parameters such as Ordering date and time, reference IDs. It returns various codes and order deployment details on successful execution and status of API execution and message along with it.

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. IIFLMarRQOrdReq
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 Client code for whom order is being placed. String Cannot be empty. Dummy123
OrderRequesterCode Clientcode of customer String Cannot be empty. Dummy123
OrderFor P- Place (Fresh ), M-Modify, C- Cancel Order String Cannot be empty. P M C
Exchange Exchange in which order has been placed. N- NSE, B- BSE, M-MCX Char Cannot be empty. N B M
ExchangeType Exchange segment. C-Cash, D-Derivative, U - Currency Char Cannot be empty. C D U
Price Rate at which client wants to Buy / Sell the stock.(Price=0 for at market order) Double Cannot be empty. 10200.00
OrderID It is an incremental number for each order after login. Long Cannot be empty. -
OrderType Client want to buy or sell the String Cannot be empty. Buy MSell
Qty Total quantity client want to buy or sell (In Case Of Derivative Send Market Lot in Qty) Long Cannot be empty. 2
OrderDateTime Local date at which order has been placed. Date Cannot be empty. /Date(1522923287588)/
TradedQty Pass the traded qty. For placing fresh order, value should be 0. For modification/cancellation, send the actual traded qty. Incorrect value would lead to order rejection. Long Cannot be empty. 0
ScripCode Scrip Code of the requested order. Long Cannot be empty. 22
AtMarket Specifies where the order placed is at market or Limit Order. Send False for Limit Order and True for At Market Order. Boolean Cannot be empty. true false
RemoteOrderID This will be unique ID for each order created by you. String Cannot be empty. 123456789123456789
ExchOrderID This is order reference number generated by exchange for an order. Send 0 for fresh order and for modify cancel send the exchange order id received from exchange. String Cannot be empty. 5
DisQty Quantity exposed in the exchange. Disclosed quantity is never larger than order quantity. Long Cannot be empty. 0
StopLossPrice This will be the trigger price. This will be set when user want to place stop loss order. (For Buy Stop loss, Trigger price should not be greater than Limit Price. And for Sell Stop Loss Order Trigger Price should not be less than Limit Price) Double Cannot be empty. -
IsStopLossOrder This will indicate where client has placed stop loss order. Send True if order placed is stop loss and send False if it is regular order Boolean Cannot be empty. true false
IOCOrder TSend False in case order is not IOC Boolean Cannot be empty. true false
IsIntraday For Intraday order send this flag as True and for Delivery order send it as False Boolean Cannot be empty. true false
ValidTillDate Order Validity Date For VTD (GTD in Case of Commodity) Order should not be today’s or earlier date. Date should be in Range of 45 days from next Day Date Cannot be empty. /Date(1522923270611)/
PublicIP Local IP address of the Device used by client to place an order String Cannot be empty. 10.0.2.15
iOrderValidity Enum of OrderValidity OrderValidity Cannot be empty. 0 - Day
4 - EOS
2 - GTC
1- GTD
3 - IOC
6 - FOK
AppSource App source generated at the time of registration Integer Cannot be empty. 5

REQUEST:

{
  "_ReqData": {
    "head": {
      "requestCode": "IIFLMarRQOrdReq",
      "key": "lpB6VGirPra8bIMeKAGJGUfAjhqVcRhx",
      "appVer": "5.6.0.0",
      "appName": "TEST123",
      "osName": "Android",
      "userId": "OPvTpKu8EzD",
      "password": "qHLmTRrs5La"
    },
    "body": {
      "ClientCode": "Dummy123",
      "OrderFor": "P",
      "Exchange": "N",
      "ExchangeType": "C",
      "Price": 1164,
      "OrderID": 2,
      "OrderType": "BUY",
      "Qty": 1,
      "OrderDateTime": "/Date(1563857357612)/",
      "ScripCode": 2885,
      "AtMarket": false,
      "RemoteOrderID": "s0002201907231019172",
      "ExchOrderID": "0",
      "DisQty": 0,
      "IsStopLossOrder": false,
      "StopLossPrice": 1170,
      "IsVTD": false,
      "IOCOrder": false,
      "IsIntraday": false,
      "PublicIP": "192.168.84.215",
      "AHPlaced": "N",
      "ValidTillDate": "/Date(1563857357611)/",
      "iOrderValidity": 0,
      "OrderRequesterCode": "Dummy123",
      "TradedQty": 0
    }
  },
  "AppSource": 58
}	

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. Int -1 = Exception
0 = success
1=No Record Found
2- Invalid Input/ head parameters
9-“Invalid Session”
0
Message Returns the status of the response. String A. String “Success” B. “No record found.” C. “Invalid input parameters.” D. “Invalid head parameters.” E. “Error while processing your request.” F. “Invalid Session” G. "No Order found for this Client." 0
BrokerOrderID Order ID generated by IIFL UInt32 123456
ClientCode Client code who had placed the order String dummy123
Exch Exchange in which order has been placed (N-NSE, B-BSE, M- MCX) Char N
ExchOrderID Order id received from exchange. In case of rejections, these would be null String 0
ExchType Exchange segment. C-Cash, D-Derivative, U- Currency, X - Char C
RMSResponseCode Repsonse code send by RMS (0- Success) Integer 0
LocalOrderID This is the local order id used while placing order Long 124
ScripCode Returns Scrip Code Integer 2885
Time Exchange Order time received from exchange. Empty in case of rejected orders DateTime /Date(1594924200000+0530)/

Success Response

{
  "head": {
    "responseCode": "IIFLMarRPOrdRes",
    "status": "0",
    "statusDescription": "Success"
  },
  "body": {
    "BrokerOrderID": 603977,
    "ClientCode": "Dummy123",
    "Exch": "N",
    "ExchOrderID": "0",
    "ExchType": "C",
    "LocalOrderID": 2,
    "Message": "Success",
    "RMSResponseCode": 0,
    "ScripCode": 2885,
    "Status": 0,
    "Time": "/Date(1594924200000+0530)/"
  }
}

Failure Response

{
  "head": {
    "responseCode": "IIFLMarRPOrdRes",
    "status": "0",
    "statusDescription": "Success"
  },
  "body": {
    "BrokerOrderID": 603999,
    "ClientCode": "Dummy123",
    "Exch": "N",
    "ExchOrderID": "0",
    "ExchType": "C",
    "LocalOrderID": 2,
    "Message": "Order rejected by RMS. Limit price should be within circuit limit(1143.9 - 1398.1)",
    "RMSResponseCode": -64,
    "ScripCode": 2885,
    "Status": 1,
    "Time": "/Date(1594924200000+0530)/"
  }
}