Release v1 IIFL Markets' API Documentation
Release v1 IIFL Markets' API Documentation
Introduction
Getting Started
Video Tutorials
Instrument Details
Postman Collection and SDKs
Developer’s Community
Base URL
Request and Response Structure
User
Login Flow
Get User Session
Profile
Limits
Logout
Margin
Pre-order Margin
SPAN and Exposure
Order Management
Place
Modify
Cancel
Order Book
Order History
Trade Book
Order and Trade Updates
Order Update
Trade Update
Portfolio
Holdings
Positions
Market Data Stream
Steps to receive the Market Data events with Python example
Market Feed
Open Interest Stream
Market Status
Upper Circuit Change
Lower Circuit Change
Limit Price Protection(LPP) Change
52 Week High Change
52 Week Low Change
Market Data APIs
Historical Candlestick Chart Data
Market Quotes
Market Depth
Open Interest
1
Annexure
Instrument Details
Postman Collection
SDKs
Video Tutorials
Sample conversion of a binary event to decimal format
Developer’s Community
Trading API Error Codes
Python SDK errors and packets
RMS Order Rejections
Rate Limits
FAQs
Introduction
Getting Started
IIFL Markets’ APIs provide fast, efficient, and easy-to-use trading solutions for retail traders and fintech
platforms. These APIs enable trading, investment, wealth generation, automation, and algorithmic
strategy execution with low complexity.
As REST-like APIs, they integrate seamlessly with our trading ecosystem, allowing real-time order
execution, modification, and cancellation. Users can manage portfolios, access live market data, and
monitor order status. The APIs use resource-based URLs, accept JSON or form-encoded requests, and
return JSON responses using standard HTTP codes. Toolkits are available in multiple programming
languages for quick integration.
Video Tutorials
1. Trading API Document overview: A quick walkthrough of the key sections and API details in our
documentation.
https://youtu.be/t7TMp4SldJ4
2. Daily client login flow: Step-by-step guide for clients to perform daily logins on the trading applications.
https://youtu.be/DMvSVncJOZA
Instrument Details
Get comprehensive exchange and segment-wise data of all active market instruments in CSV and JSON
formats.
CSV Links:
Exchange & Segment Instrument Details CSV File Link
NSEEQ https://api.iiflcapital.com/v1/contractfiles/NSEEQ.csv
2
NSEFO https://api.iiflcapital.com/v1/contractfiles/NSEFO.csv
NSECOMM https://api.iiflcapital.com/v1/contractfiles/NSECOMM.csv
MCXCOMM https://api.iiflcapital.com/v1/contractfiles/MCXCOMM.csv
INDICES https://api.iiflcapital.com/v1/contractfiles/INDICES.csv
NSECURR https://api.iiflcapital.com/v1/contractfiles/NSECURR.csv
BSEEQ https://api.iiflcapital.com/v1/contractfiles/BSEEQ.csv
BSEFO https://api.iiflcapital.com/v1/contractfiles/BSEFO.csv
BSECURR https://api.iiflcapital.com/v1/contractfiles/BSECURR.csv
JSON Links:
Exchange & Segment Instrument Details JSON Link
NSEEQ https://api.iiflcapital.com/v1/contractfiles/NSEEQ.json
NSEFO https://api.iiflcapital.com/v1/contractfiles/NSEFO.json
NSECOMM https://api.iiflcapital.com/v1/contractfiles/NSECOMM.json
MCXCOMM https://api.iiflcapital.com/v1/contractfiles/MCXCOMM.json
INDICES https://api.iiflcapital.com/v1/contractfiles/INDICES.json
NSECURR https://api.iiflcapital.com/v1/contractfiles/NSECURR.json
BSEEQ https://api.iiflcapital.com/v1/contractfiles/BSEEQ.json
BSEFO https://api.iiflcapital.com/v1/contractfiles/BSEFO.json
BSECURR https://api.iiflcapital.com/v1/contractfiles/BSECURR.json
Note: These JSON links can also serve as APIs, allowing you to retrieve instrument details using the
GET method. No authorization is required to make these API calls.
Developer’s Community
🐞 Found a bug or facing an issue? Raise it on our GitHub Issues page!
Base URL
The base URL is the common URL used as a prefix for all the API calls.
https://api.iiflcapital.com/v1
Request Structure
● Users need to pass the generated access token as a Bearer token to authorise the request.
● All parameters for GET and DELETE requests are passed as query parameters.
Example:
DELETE
https://api.iiflcapital.com/v1/orders/{brokerOrderId}
● All POST and PUT requests are sent in raw JSON format in the request body.
Example:
POST
https://api.iiflcapital.com/v1/orders
Body:
[
{
"instrumentId": "1594",
"exchange": "NSEEQ",
"transactionType": "BUY",
"quantity": "1",
"orderComplexity": "REGULAR",
"product": "INTRADAY",
"orderType": "MARKET",
"validity": "DAY"
}
]
Response Structure
● status: Indicates the success, failure or error of the overall API call.
● message: Provides additional explanation or error description for the status.
● result: A list of individual results, each containing specific details about a single operation (e.g.,
order details). The sequence of the responses in the result array matches the sequence of the
requests. For example, if leg A was sent first and leg B was sent second, the result array will list
the response for leg A first, followed by the response for leg B inside the result array.
● result[].status: Provides the status or error of the individual operation within the response
● result[].message: Provides additional details or error description about the status of the
individual operation
Example:
{
"status": "Ok", // Overall status of the Place Order API Call
"message": "Success", // Provides additional explanation for the status
"result": [ // List of individual results, each containing specific details about placing that particular order.
{
4
"status": "Success", // Shows the status of 1st leg, shows that it has passed all the validations
"message": "Success", // provides additional information on the 1st leg status
"brokerOrderId": "240919000000041", // response data, brokerOrderId in this case
"requestTime": "19-Sep-2024 18:48:46", // response data, requestTime in this case
},
{
"status": "EC901", // Code for the occurred error while validating 2nd leg’s parameters
"message": "Invalid parameter: 'exchange' Accepts only
{'NSEEQ','NSEFO','BSEEQ','BSEFO','NSECURR','BSECURR','MCXCOMM','NCDEXCOMM','NSECOMM','
BSECOMM'}” // Error Description for the above error code
}
]
}
User
There are 4 user APIs which enable login, logout, provide access to the client’s account details, and
display their trading margins and available limits.
Login Flow
To log in, a client requires the following:
1. Trading Account Credentials: Email/Phone/ClientId/PAN and password. The client can reset
their password directly on the web login page if they have forgotten it.
2. OTP or TOTP: For two-factor authentication.
3. App Key and App Secret: Specific to the application the client is logging into (contact your
Relationship Manager or Point of Contact to obtain these).
If you have a use case to redirect the user dynamically to different URLs after login, you can pass
an optional redirecturl parameter in the OAuth URL. If this parameter is provided, users will
be redirected to that specific URL post-login; otherwise, they will be redirected to the default URL
registered with your trading application.
If no redirect URL was specified during the app creation, they will be redirected to an IIFL
webpage displaying an authCode.
Request Structure
{
"checkSum":"bec46c08a04f7c8f1ea355b85d0f32e9250d83ffe42a147400fc4d0bdb9aee2b"
}
Request Parameters
Data
Parameter Type Description Approved/Example Values
SHA256(CONCATENATION(TEST101,IUBTQFR
GKC0NV9EHKCPT,LY47CQpl9N1T4NLBEYiwd0
F5tdI9B0f7xNM18rfjSTELztsSfvfK3lNZQU
SHA-256 encrypted value of 7b3MQbCwclFd4EUw0pO9ufWv3aOFdw6jgW9W
checkSum concatenation of 4Jck8E)) →
Required varchar (clientId,authCode,apiSecret) 92568ec06bbdc2c549c394c277c81319e35d
6
5d57b88db1cba6469f492818f1e3
Response Structure
{
"status": "Ok",
"userSession": "eyJhbGciOi*******bx844uFwWA"
}
Response Parameters
Profile
Method Endpoint Processing Mode Action
GET /profile Single Retrieves client's account details and personal information
Headers
Authorization: Bearer <userSession>
Request Structure
No Body
Response Structure
{
"status": "Ok",
"message": "Success",
"result": {
"clientId": "3******4",
"clientName": "Ishan Arora",
"isTotpEnabled": "Y",
"isPoaProvided": "Y",
"accountStatus": "Na",
"exchanges": [
"BSECURR",
"BSEEQ",
7
"BSEFO",
"NSECURR",
"NSEEQ",
"NSEFO"
],
"products": [
"NORMAL",
"INTRADAY",
"DELIVERY",
"BNPL"
],
"orderComplexity": [
"REGULAR",
"AMO",
"BO",
"CO"
],
"email": "is**********@gmail.com",
"phoneNumber": "8********4"
}
}
Response Parameters
Limits
Method Endpoint Processing Mode Action
GET /limits Single Provides the user's available trading limits and margins
Headers
8
Request Structure
No Body
Response Structure
{
"status": "Ok",
"message": "Success",
"result": {
"tradingLimit": 19990000.00,
"openingCashLimit": 0.0,
"intradayPayin": 20000000.00,
"collateralMargin": 0.0,
"creditForSell": 0.0,
"adhocMargin": 0.0,
"utilizedMargin": 0.00,
"blockedForPayout": 10000.0,
"utilizedSpanMargin": 0.0,
"utilizedExposureMargin": 0.0
}
}
Response Parameters
Logout
Method Endpoint Processing Mode Action
POST /profile/logout Single Terminates the user's active session
Headers
Authorization: Bearer <userSession>
Request Structure
No Body
Response Structure
{
"status": "Ok",
"message": "Success",
"result": {
"status": "Success",
"message": "Success"
}
}
Response Parameters
Param Data Type Description Example Values
status varchar Overall status of the Place Order API Call Ok
message varchar Provides additional explanation for the status Success
result[].status varchar Provides the status or error of the logout operation Success
Provides additional details or error description
result[].message varchar about the status of the logout operation Success
Margin
There are 2 margin APIs that calculate the required margin for an individual order or a basket of orders.
Pre-order Margin
Method Endpoint Processing Mode Action
Calculate the required margin for an order
POST /preordermargin Single considering the existing positions
Headers
Authorization: Bearer <userSession>
Request Structure
Note: Parameters marked in red are required in the request payload whereas parameters marked in grey
are either conditionally required or optional.
{
"instrumentId": "54786",
"exchange": "NSEFO",
"transactionType": "SELL",
"quantity": "25",
"orderComplexity": "REGULAR",
"product": "NORMAL",
"orderType": "MARKET",
"validity": "DAY",
"price": "1501.55",
"slTriggerPrice": "1505.2",
"slLegPrice": "1500",
“targetLegPrice”: “1600”
}
Request Parameters
Data Approved/Example
Parameter Type Description Values
instrumentId
Required varchar Unique identifier for the financial instrument 1594
NSEEQ,NSEFO,BSEEQ,B
SEFO,NSECURR,BSECUR
exchange R,MCXCOMM,NSECOMM,B
Required varchar Exchange & segment of the instrument to be traded SECOMM,NCDEXCOMM
transactionType
Required varchar Defines whether the order is a buy or sell BUY,SELL
quantity
Required int Number of units to be traded 100
orderComplexity
Required varchar Specifies the complexity of the order REGULAR,AMO,BO,CO
11
product NORMAL,INTRADAY,DEL
Required varchar Product type for the order IVERY,BNPL
orderType
Required varchar Order type LIMIT,MARKET,SL,SLM
price
Conditionally The specified price for limit orders
Required double Req. if orderType=LIMIT,SL 1501.55
slTriggerPrice
Conditionally Trigger price for stop-loss orders
Required double Req. if orderType=SL,SLM 1505.2
slLegPrice
Conditionally The exit price forBracket/Cover orders
Required double Req. if orderComplexity=BO,CO 1500
targetLegPrice
Conditionally The book profit price for Bracket orders
Required double Req. if orderComplexity=BO,CO 1600
Response Structure
{
"totalCashAvailable": "10006024.00",
"preOrderMargin": "76624.00",
"postOrderMargin": "88710.73",
"currentOrderMargin": "12086.73",
"rmsvalidationMessage": "OK",
"fundShort": "0.00"
}
Response Parameters
Headers
Authorization: Bearer <userSession>
Request Structure
[
{
"instrumentId": "35089",
"exchange": "NSEFO",
"transactionType": "BUY",
"quantity": 25
},
{
"instrumentId": "35005",
"exchange": "NSEFO",
"transactionType": "SELL",
"quantity": 25
}
]
Request Parameters
Data Approved/Example
Parameter Type Description Values
instrumentId
Required varchar Unique identifier for the financial instrument 1594
NSEEQ,NSEFO,BSEEQ,B
SEFO,NSECURR,BSECUR
exchange R,MCXCOMM,NSECOMM,B
Required varchar Exchange & segment of the instrument to be traded SECOMM,NCDEXCOMM
transactionType
Required varchar Defines whether the order is a buy or sell BUY,SELL
quantity
Required int Number of units to be traded 100
Response Structure
{
"span": "11090.00",
"exposureMargin": "4122.17",
"totalMargin": "15212.17"
}
13
Response Parameters
Param Data Type Description Example Values
The minimum required margin based on worst-case
span double risk scenarios for derivative positions 11090.00
An additional cushion margin for unexpected market
exposureMargin double fluctuations 4122.17
The combined margin requirement, totaling SPAN
totalMargin double and exposure margins for full risk coverage 15212.17
Order Management
There are 6 Order Management APIs that let you place, modify, and cancel orders. They also
provide access to the order book, trade book, order history, and pre-order margin.
Processing
Method Endpoint Mode Action
POST /orders Single/Bulk Place new orders
PUT /orders/{brokerOrderId} Single Modify pending orders
DELETE /orders/{brokerOrderId} Single Cancel a Pending order
GET /orders Single Fetch details of all orders placed today
GET /orders/{brokerOrderId} Single Fetch the history of a specific order
GET /trades Single Fetch details of all executed trades for today
Place Order
Processing
Method Endpoint Mode Action
POST /orders Single/Bulk Place new orders
Headers
Authorization: Bearer <userSession>
Request Structure
Note: Parameters marked in red are required in the request payload whereas parameters marked in grey
are either conditionally required or optional.
[
{
14
"instrumentId": "1594",
"exchange": "NSEEQ",
"transactionType": "BUY",
"quantity": "1",
"orderComplexity": "REGULAR",
"product": "INTRADAY",
"orderType": "MARKET",
"validity": "DAY",
"price": "1501.55",
"slTriggerPrice": "1505.2",
"slLegPrice": "1500",
"targetLegPrice ": "1600",
"disclosedQuantity": "500",
"marketProtectionPercent ": "1400",
"apiOrderSource": "InstaOptions",
"algoId": "ALGO1234",
"orderTag": "Stangle Leg 1"
}
]
Request Parameters
Data Approved/Example
Parameter Type Description Values
instrumentId
Required varchar Unique identifier for the financial instrument 1594
NSEEQ,NSEFO,BSEEQ,B
SEFO,NSECURR,BSECUR
exchange R,MCXCOMM,NSECOMM,B
Required varchar Exchange & segment of the instrument to be traded SECOMM,NCDEXCOMM
transactionType
Required varchar Defines whether the order is a buy or sell BUY,SELL
quantity
Required int Number of units to be traded 100
orderComplexity
Required varchar Specifies the complexity of the order REGULAR,AMO,BO,CO
product NORMAL,INTRADAY,DEL
Required varchar Product type for the order IVERY,BNPL
orderType
Required varchar Order type LIMIT,MARKET,SL,SLM
15
price
Conditionally The specified price for limit orders
Required double Req. if orderType=LIMIT,SL 1501.55
slTriggerPrice
Conditionally Trigger price for stop-loss orders
Required double Req. if orderType=SL,SLM 1505.2
slLegPrice
Conditionally The exit price for stop-loss orders
Required double Req. if orderComplexity=BO,CO 1500
targetLegPrice
Conditionally Price at which to exit the position for profit
Required double Req. if orderComplexity=BO 1600
validity
Required varchar The time duration the order should remain active DAY,IOC
disclosedQuantity
Optional int The partial quantity disclosed to the market 500
Market protection ensures that this sell order is not
marketProtectionP executed below (or buy order above) the specified
ercent price, safeguarding against unfavourable price
Optional double movements. 1400
The source from which the API order is placed.
apiOrderSource Fintech partners should specify their name in this
Optional varchar parameter. PlatformName1
algoId
Optional varchar The identifier for the algorithm placing the order ALGO1234
orderTag
Optional varchar A custom label or tag assigned to the order Stangle Leg 1
Response Structure
{
"status": "Ok",
"message": "Success",
"result":
[
{
"status": "Success",
"message": "Success",
"brokerOrderId": "240919000000041",
"requestTime": "19-Sep-2024 18:48:46"
}
]
}
16
Response Parameters
Modify Order
Processing
Method Endpoint Mode Action
PUT /orders/{brokerOrderId} Single Modify pending orders
Headers
Authorization: Bearer <userSession>
Request Structure
Note: Parameters marked in red are required in the request payload whereas parameters marked in grey
are either conditionally required or optional.
[
{
"quantity": "1",
"orderType": "MARKET",
"validity": "DAY",
"price": "1501.55",
"slTriggerPrice": "1505.2",
"disclosedQuantity": "500",
"marketProtectionPercent ": "1400"
}
]
Request Parameters
Data Approved/Example
Parameter Type Description Values
quantity
Optional int Number of units to be traded 100
orderType
Optional varchar Order type LIMIT,MARKET,SL,SLM
17
price
Conditionally The specified price for limit orders
Required double Req. if orderType=LIMIT,SL 1501.55
slTriggerPrice
Conditionally Trigger price for stop-loss orders
Required double Req. if orderType=SL,SLM 1505.2
validity
Optional varchar The time duration the order should remain active DAY,IOC
disclosedQuantity
Optional int The partial quantity disclosed to the market 500
Market protection ensures that this sell order is not
marketProtectionP executed below (or buy order above) the specified
ercent price, safeguarding against unfavourable price
Optional double movements. 1400
*Note: You only need to pass the parameters which you want to modify or any additional related
parameter which is required for the modification.
Use Case I: If you want to change the quantity of an order to 15, you only need to pass the below request
payload.
{
"quantity": "15"
}
Use Case II: If you want to change the orderType from MARKET to LIMIT and set the limit price as 100,
you need to pass orderType and price.
{
"orderType": "LIMIT",
"price": "100"
}
Use Case III: If you want to change the orderType from LIMIT to SL and set the stop loss trigger price at
99 keeping price the same, you need to pass orderType and slTriggerPrice.
{
"orderType": "SL",
"slTriggerPrice": "99"
}
Response Structure
{
"status": "Ok",
"message": "Success",
"result":
18
{
"status": "Success",
"message": "Success",
"brokerOrderId": "240919000000041",
"requestTime": "19-Sep-2024 18:48:46"
}
}
Response Parameters
Cancel Order
Processing
Method Endpoint Mode Action
DELETE /orders/{brokerOrderId} Single Cancel a Pending order
Headers
Authorization: Bearer <userSession>
Request Structure
No Body
Response Structure
{
"status": "Ok",
"message": "Success",
"result":
{
"status": "Success",
"message": "Success",
"brokerOrderId": "240919000000041",
"requestTime": "19-Sep-2024 18:48:46"
}
}
19
Response Parameters
Order Book
Processing
Method Endpoint Mode Action
GET /orders Single Fetch details of all orders placed today
Headers
Authorization: Bearer <userSession>
Request Structure
No Body
Response Structure
[
{
"clientId": "TEST102",
"placedBy": "TEST102",
"brokerOrderId": "240920000000124",
"exchangeOrderId": "1100000000089930",
"orderStatus": "cancelled",
"formattedInstrumentName": "INFOSYS LIMITED",
"tradingSymbol": "INFY-EQ",
"instrumentId": "1594",
"exchange": "NSEEQ",
"transactionType": "BUY",
"quantity": "1",
"product": "INTRADAY",
"orderComplexity": "REGULAR",
"orderType": "LIMIT",
"price": "180000.0",
"averageTradedPrice": "0.0",
20
"slTriggerPrice": "0.0",
"validity": "DAY",
"disclosedQty": "0",
"marketProtectionPercent ": "0.0",
"exchangeTimestamp": "20-Sep-2024 16:05:33",
"exchangeUpdateTime": "20-Sep-2024 16:05:32",
"rejectionReason": "",
"mainLegOrderId ": "NA",
"pendingQuantity": "1",
"filledQuantity": "0",
"appKey": "NA",
"apiOrderSource": "API",
"algoId": "",
"source": "API",
"orderTag": "NA",
"brokerUpdateTime": "17-Feb-2025 06:48:39"
}
]
Response Parameters
Data
Parameter Type Description Example Values
clientId varchar Unique identifier of the client 31625881
placedBy varchar User(client or dealer) who placed the order 31625881
brokerOrderId varchar Unique order ID assigned by IIFL Capital 240807000000068
exchangeOrderId varchar Unique order ID assigned by the exchange 900000000000000000
Current status of the order (e.g., Open, Complete,
orderStatus varchar Rejected, Canceled) rejected
formattedInstrumen IDEA VODAFONE
tName varchar Display name of the financial instrument LIMITED
tradingSymbol varchar Trading symbol of the instrument IDEA-EQ
InstrumentId varchar Unique identifier for the financial instrument 14366
exchange varchar The exchange where the order is placed NSEEQ
transactionType varchar Specifies whether the order is a buy or sell BUY
quantity int Number of shares or contracts in the order 1
Type of product used for the order (e.g., intraday or
product varchar delivery) NORMAL
Complexity of order, such as Regular, AMO, BO, or
orderComplexity varchar CO REGULAR
Specifies the execution type of the order (e.g., Market
orderType varchar or Limit) MARKET
21
price double Price at which the order is placed for limit orders 1500
averageTradedPrice double Average price at which the order was executed 1510
slTriggerPrice double Stop-loss trigger price for the order 1600
validity varchar Duration for which the order is valid (e.g., DAY, IOC) DAY
disclosedQuantity int Partial quantity disclosed to the market 10
Market protection ensures that this sell order is not
executed below (or buy order above) the specified
marketProtectionPe price, safeguarding against unfavourable price
rcent double movements. 1300
07-Aug-2024
exchangeTimestamp varchar Timestamp when the order was placed 16:14:17
Timestamp when the exchange updated the order 07-Aug-2024
exchangeUpdateTime varchar status 16:14:17
RMS:Margin
rejectionReason varchar Reason for order rejection, if applicable Exceeds,****duct
ID of the parent order, if this order is part of a Bracket
mainLegOrderId varchar Order or Cover Order 240807000000068
pendingQuantity int Quantity of the order that remains unfilled 25
filledQuantity int Quantity of the order that has been filled 50
appKey varchar Key identifying the application that placed the order UXjPaQVPYyeVDEZ
The source from which the API order is placed.
Fintech partners may specify their name in this
apiOrderSource varchar parameter. Trade Tron
Unique identifier for the algorithm that placed the
algoId varchar order algo123
The platform or system from which the order was
source varchar placed(e.g., Web, App, API) API
orderTag varchar Custom tag or label assigned to the order 123abc
17-Feb-2025
brokerUpdateTime varchar Timestamp of the broker's last update on the order 06:48:39
Order History
Processing
Method Endpoint Mode Action
GET /orders/{brokerOrderId} Single Fetch the history of a specific order
Headers
Authorization: Bearer <userSession>
Request Structure
22
No Body
Response Structure
[
{
"clientId": "TEST102",
"placedBy": "TEST102",
"brokerOrderId": "240920000000124",
"exchangeOrderId": "1100000000089930",
"orderStatus": "cancelled",
"formattedInstrumentName": "INFOSYS LIMITED",
"tradingSymbol": "INFY-EQ",
"instrumentId": "1594",
"exchange": "NSEEQ",
"transactionType": "BUY",
"quantity": "1",
"product": "INTRADAY",
"orderComplexity": "REGULAR",
"orderType": "LIMIT",
"price": "180000.0",
"averageTradedPrice": "0.0",
"slTriggerPrice": "0.0",
"validity": "DAY",
"disclosedQty": "0",
"marketProtectionPercent ": "0.0",
"exchangeTimestamp": "20-Sep-2024 16:05:33",
"exchangeUpdateTime": "20-Sep-2024 16:05:32",
"rejectionReason": "",
"mainLegOrderId ": "NA",
"cancelledQuantity": "1",
"pendingQuantity": "1",
"filledQuantity": "0",
"appKey": "NA",
"apiOrderSource": "API",
"algoId": "",
"source": "API",
"orderTag": "NA",
"brokerUpdateTime": "17-Feb-2025 06:48:39"
}
]
Response Parameters
23
Data
Parameter Type Description Example Values
clientId varchar Unique identifier of the client 31625881
placedBy varchar User(client or dealer) who placed the order 31625881
brokerOrderId varchar Unique order ID assigned by IIFL Capital 240807000000068
exchangeOrderId varchar Unique order ID assigned by the exchange 900000000000000000
Current status of the order (e.g., Open, Complete,
orderStatus varchar Rejected, Canceled) rejected
formattedInstrumen IDEA VODAFONE
tName varchar Display name of the financial instrument LIMITED
tradingSymbol varchar Trading symbol of the instrument IDEA-EQ
InstrumentId varchar Unique identifier for the financial instrument 14366
exchange varchar The exchange where the order is placed NSEEQ
transactionType varchar Specifies whether the order is a buy or sell BUY
quantity int Number of shares or contracts in the order 1
Type of product used for the order (e.g., intraday or
product varchar delivery) NORMAL
Complexity of order, such as Regular, AMO, BO, or
orderComplexity varchar CO REGULAR
Specifies the execution type of the order (e.g., Market
orderType varchar or Limit) MARKET
price double Price at which the order is placed for limit orders 1500
averageTradedPrice double Average price at which the order was executed 1510
slTriggerPrice double Stop-loss trigger price for the order 1600
validity varchar Duration for which the order is valid (e.g., DAY, IOC) DAY
disclosedQuantity int Partial quantity disclosed to the market 10
Market protection ensures that this sell order is not
executed below (or buy order above) the specified
marketProtectionPe price, safeguarding against unfavourable price
rcent double movements. 1300
07-Aug-2024
exchangeTimestamp varchar Timestamp when the order was placed 16:14:17
Timestamp when the exchange updated the order 07-Aug-2024
exchangeUpdateTime varchar status 16:14:17
RMS:Margin
rejectionReason varchar Reason for order rejection, if applicable Exceeds,****duct
ID of the bracket order, if this order is part of a
mainLegOrderId varchar Bracket Order 240807000000068
cancelledQuantity int Quantity of the order that was cancelled 30
pendingQuantity int Quantity of the order that remains unfilled 25
24
Trade Book
Processing
Method Endpoint Mode Action
GET /trades Single Fetch details of all executed trades for today
Headers
Authorization: Bearer <userSession>
Request Structure
No Body
Response Structure
[
{
“clientId”: "31625881",
“placedBy”: "31625881",
“brokerOrderId”: "240807000000068",
“exchangeOrderId”: "900000000000000",
“exchangeTradeId”: "893487609000000",
“formattedInstrumentName”: "IDEA VODAFONE,
“tradingSymbol”: "IDEA-EQ",
“instrumentId”: "14366",
“exchange”: "NSEEQ",
“transactionType”: "BUY",
“product”: "NORMAL",
“orderComplexity”: "REGULAR",
“orderType”: "MARKET",
25
“validity: "DAY",
“tradedPrice”: "1560",
“filledQuantity”: "50",
“fillTimestamp: "07-Aug-2024 16:14:17",
“algoId”: "algo123",
“orderTag”: "123abc"
}
]
Response Parameters
Data
Param Type Description Example Values
clientId varchar Unique identifier of the client 31625881
placedBy varchar User(client or dealer) who placed the order 31625881
brokerOrderId varchar Unique order ID assigned by IIFL Capital 240807000000068
exchangeOrderId varchar Unique order ID assigned by the exchange 900000000000000
exchangeTradeId varchar Unique trade ID assigned by the exchange 893487609000000
IDEA VODAFONE
formattedInstrumentName varchar Display name of the financial instrument LIMITED
tradingSymbol varchar Trading symbol of the instrument IDEA-EQ
instrumentId varchar Unique identifier for the financial instrument 14366
exchange varchar The exchange where the order is placed NSEEQ
transactionType varchar Specifies whether the order is a buy or sell BUY
Type of product used for the order (e.g., intraday
product varchar or delivery) NORMAL
Complexity of order, such as Regular, AMO, BO,
orderComplexity varchar or CO REGULAR
Specifies the execution type of the order (e.g.,
orderType varchar Market or Limit) MARKET
Duration for which the order is valid (e.g., DAY,
validity varchar IOC) DAY
The price at which the order was filled in the
tradedPrice double market 1560
filledQuantity int Quantity of the order that has been filled 50
07-Aug-2024
fillTimestamp varchar Timestamp when the order was filled 16:14:17
Unique identifier for the algorithm that placed
algoId varchar the order algo123
orderTag varchar Custom tag or label assigned to the order 123abc
26
To receive these events, you must register their designated callback functions.
Setter Property
Event to register Request Respons
Type callbacks Param e Format Description
Provides real-time updates on the status of placed
Order on_order_update orders, including modifications, cancellations, and
Updates s_received Client Id JSON execution progress
Trades on_trade_update Delivers instant notifications of executed trades with
Updates s_received Client Id JSON details such as price, quantity, and trade time
Follow the below steps to receive order and trade update events:
connection_object = connector.Connect()
4. Before establishing a connection, complete the below steps to receive and handle
acknowledgments and error messages effectively. These acknowledgements and error messages
are for connection, subscription, unsubscription and disconnection requests.
b. A setter property is responsible for registering a callback function. When you pass a
function to it, the setter will save the function so that it can be used later when the event
arrives.
connection_object.on_acknowledge_response =acknowledgment_handler
c. When the actual acknowledgment is received, the bridge package will call the
acknowledgment_handler function.
e. Use the setter property on_error to register the error_handler function created in the
previous step as the callback function for the error event.
connection_object.on_error = error_handler
f. When the actual error is received, the bridge package will call the error_handler
function.
connection_object.subscribe_order_updates(req)
connection_object.subscribe_trade_updates(req)
28
Pass your client Id in req. For example, if your client ID is CLIENT101, pass
connection_object.on_order_updates_received=order_updates_handler
connection_object.on_trade_updates_received=trade_updates_handler
d. When the actual order updates and trade updates events are received, the bridge
package will call the order_updates_handler and trade_updates_handler functions
respectively.
8. Unsubscribe from the events when they are no longer required
connection_object.unsubscribe_order_updates(req)
connection_object.unsubscribe_trade_updates(req)
Pass your client Id in req. For example, if your client ID is CLIENT101, pass
connection_object.disconnect_host()
The packet structure for both the Order Updates and Trade Updates events are detailed below.
Order Updates
29
Packet JSON
{
"clientId: "31625881",
"validity: "DAY",
"orderComplexity: "REGULAR",
"product: "NORMAL",
"orderType: "MARKET",
"tradingSymbol: "IDEA-EQ",
"transactionType: "BUY",
"instrumentId: "14366",
"price: "1500",
"slTriggerPrice: "1600",
"quantity: "1",
"disclosedQuantity: "10",
"cancelledQuantity: "30",
"algoId: "algo123",
"marketProtectionPercent : "1300",
"placedBy: "31625881",
"averageTradedPrice: "1510",
"filledQuantity: "50",
"pendingQuantity: "25",
"brokerOrderId: "240807000000068",
"exchangeOrderId: "900000000000000001",
"rejectionReason: "RMS:Margin Exceeds,****duct",
"orderStatus: "rejected",
"exchangeTimestamp: "07-Aug-2024 16:14:17",
"exchangeUpdateTime: "07-Aug-2024 16:14:17",
"mainLegOrderId : "240807000000068",
"validityDate: "45511",
"source: "API",
"comments: "Strangle~dQcOimFMAvsXlum~SELF",
"brokerUpdateTime": "17-Feb-2025 06:48:39"
}
Packet Parameters
30
Data
Parameter Type Description Example Values
clientId varchar Unique identifier of the client 31625881
validity varchar Duration for which the order is valid (e.g., DAY, IOC) DAY
Complexity of order, such as Regular, AMO, BO, or
orderComplexity varchar CO REGULAR
Type of product used for the order (e.g., intraday or
product varchar delivery) NORMAL
Specifies the execution type of the order (e.g., Market
orderType varchar or Limit) MARKET
tradingSymbol varchar Trading symbol of the instrument IDEA-EQ
transactionType varchar Specifies whether the order is a buy or sell BUY
instrumentId varchar Unique identifier for the financial instrument 14366
price double Price at which the order is placed for limit orders 1500
slTriggerPrice double Stop-loss trigger price for the order 1600
quantity int Number of shares or contracts in the order 1
disclosedQuantity int Partial quantity disclosed to the market 10
cancelledQuantity int Quantity of the order that was cancelled 30
Unique identifier for the algorithm that placed the
algoId varchar order algo123
Market protection ensures that this sell order is not
executed below (or buy order above) the specified
marketProtectionPe price, safeguarding against unfavourable price
rcent double movements. 1300
placedBy varchar User(client or dealer) who placed the order 31625881
averageTradedPrice double Average price at which the order was executed 1510
filledQuantity int Quantity of the order that has been filled 50
pendingQuantity int Quantity of the order that remains unfilled 25
brokerOrderId varchar Unique order ID assigned by IIFL Capital 240807000000068
exchangeOrderId varchar Unique order ID assigned by the exchange 900000000000000001
RMS:Margin
rejectionReason varchar Reason for order rejection, if applicable Exceeds,****duct
Current status of the order (e.g., Open, Complete,
orderStatus varchar Rejected, Canceled) rejected
The timestamp indicating when the order was 07-Aug-2024
exchangeTimestamp varchar received by the exchange 16:14:17
Timestamp when the exchange updated the order 07-Aug-2024
exchangeUpdateTime varchar status 16:14:17
ID of the bracket order, if this order is part of a
mainLegOrderId varchar Bracket Order 240807000000068
validityDate varchar The date until which the order remains valid, based 8/7/2024
31
Trade Updates
Callback Request Response
Event Type Function Param Format Description
Trades on_trade_updat Delivers instant notifications of executed trades
Updates es_received Client Id JSON with details such as price, quantity, and trade time
Packet JSON
{
"tradedPrice: "1560",
"filledQuantity: "50",
"exchangeTradeId: "893487609000000",
"instrumentId: "14366",
"exchange: "NSEEQ",
"clientId: "31625881",
"orderComplexity: "REGULAR",
"product: "NORMAL",
"tradingSymbol: "IDEA-EQ",
"fillDate: "45511",
"fillTime: "0.676585648148148",
"brokerOrderId: "240807000000068",
"exchangeOrderId: "900000000000000",
"transactionType: "BUY",
"orderType: "MARKET",
"placedBy: "31625881",
"algoId: "algo123"
}
Packet Parameters
Data
Parameter Type Description Example Values
tradedPrice double The price at which the order was filled in the market 1560
32
Portfolio
The portfolio APIs let you fetch holdings and positions in your portfolio.
Processing
Method Endpoint Mode Action
The Holdings API returns long-term equity holdings of a client. All the
financial instruments in the holdings reside in the customer's DEMAT
account indefinitely until they are sold or delisted or altered by the
GET /holdings Single exchanges. Changes to the DEMAT account are settled in T+1 days.
The Positions API contains all the open positions of the client for the
GET /positions Single day. This includes all F&O carryforward positions as well.
Holdings
Processing
Method Endpoint Mode Action
The Holdings API returns long-term equity holdings of a client. All the
financial instruments in the holdings reside in the customer's DEMAT
GET /holdings Single account indefinitely until they are sold or delisted or altered by the
33
Headers
Authorization: Bearer <userSession>
Request Structure
No Body
Response Structure
{
"isin": "INE002A01018",
"nseInstrumentId": "2885",
"bseInstrumentId": "500325",
"nseTradingSymbol": "RELIANCE-EQ",
"bseTradingSymbol": "RELIANCE",
"formattedInstrumentName": "RELIANCE INDUSTRIES LTD.",
"product": "DELIVERY",
"totalQuantity": 300,
"dpQuantity": 300,
"collateralQuantity": 0,
"t1Quantity": 0,
"authorizedQuantity": "0",
"averageTradedPrice": "280000.00",
"previousDayClose": null
}
Response Parameters
Data
Param Type Description Example Values
The unique International Securities Identification Number
isin varchar for the financial instrument INE257A01026
nseInstrumentId varchar The instrument identifier for the security on NSE 438
bseInstrumentId varchar The instrument identifier for the security on BSE 500183
nseTradingSymbol varchar The trading symbol for the security on NSE IDEA-EQ
bseTradingSymbol varchar The trading symbol for the security on BSE IDEA
formattedInstrumen IDEA VODAFONE
tName varchar The formatted name of the financial instrument LIMITED
product varchar Type of product used for the order (BNPL or delivery) DELIVERY/BNPL
The total number of shares held in the account
totalQuantity int (totalQuantity = dpQuantity + t1Quantity) 50
34
Positions
Processing
Method Endpoint Mode Action
The Positions API contains all the open positions of the client for the
GET /positions Single day. This includes all F&O carryforward positions as well.
Headers
Authorization: Bearer <userSession>
Request Structure
No Body
Response Structure
{
"instrumentId": "35382",
"tradingSymbol": "NIFTY24OCTFUT",
"formattedInstrumentName": "NIFTY 31 Oct 2024",
"exchange": "NSEFO",
"product": "NORMAL",
"netQuantity": 26.0,
"netAveragePrice": "0",
"overnightQuantity": 1.0,
"overnightPrice": "0",
"buyQuantity": 25.0,
"buyPrice": 652000.0,
"sellQuantity": 0.0,
"sellPrice": 0.0,
"dayBuyQuantity": "25",
"dayBuyPrice": 652000.0,
"dayBuyValue": "627961.54",
"daySellQuantity": "0",
35
"daySellPrice": "0.00",
"daySellValue": "0.00",
"multiplier": "1",
"lotSize": "25",
"tickSize": "0.05",
"previousDayClose": "26308.85"
}
Response Parameters
Data Example
Param Type Description Values
instrumentId varchar Unique identifier for the financial instrument 35382
NIFTY24OCT
NIFTY 31
formattedInstrume
ntName varchar Display name of the financial instrument Oct 2024
product varchar Type of product used for the order (e.g., intraday or delivery) NORMAL
The profit or loss booked from completed trades by closing
realizedPnl double positions 1000
The total number of shares or contracts held after netting off buy
and sell quantities (netQuantity = overnightQuantity +
netQuantity int dayBuyQuantity - daySellQuantity) 3
Average price at which the net quantity was acquired
(netAveragePrice =
(overnightQuantity*overnightPrice + dayBuyValue -
netAveragePrice double daySellValue)/ netQuantity) 1
The net quantity of shares or contracts carried forward from the
overnightQuantity int previous trading day 3
The net average price at which the overnight positions were
overnightPrice double carried forward 1
The total number of shares or contracts purchased
(buyQuantity = max(overnightQuantity,0) +
buyQuantity int dayBuyQuantity) 3
The weighted average price at which the buy transactions were
executed (buyPrice = (overnightPrice *
max(overnightQuantity,0) + dayBuyPrice *
buyPrice double dayBuyQuantity)/buyQuantity) 8
The total number of shares or contracts sold (buyQuantity =
sellQuantity int max(-1*overnightQuantity,0) + daySellQuantity) 8
The weighted average price at which the sell transactions were
sellPrice double executed (sellPrice = (overnightPrice * 0
36
max(-1*overnightQuantity,0) + daySellPrice *
daySellQuantity)/SellQuantity)
dayBuyQuantity int The total number of shares or contracts bought today 25
dayBuyPrice double The weighted average price of shares or contracts bought today 652000.00
The total value of buy transactions executed today (
dayBuyValue double dayBuyQuantity * dayBuyPrice) 627961.54
Maximum of 1024 event subscription requests can be sent at once and there can be a maximum of 2000
events subscriptions per client.
The Bridge Package is available in multiple programming languages. Below, we provide an example
implementation in Python.
connection_object = connector.Connect()
4. Before establishing a connection, complete the below steps to receive and handle
acknowledgments and error messages effectively:
b. A setter property is responsible for registering a callback function. When you pass a
function to it, the setter will save the function so that it can be used later when the event
arrives.
connection_object.on_acknowledge_response =acknowledgment_handler
c. When the actual acknowledgment status is received, the bridge package will call the
acknowledgment_handler function.
38
e. Use the setter property on_error to register the error_handler function created in the
previous step as the callback function for the error event.
connection_object.on_error =error_handler
f. When the actual error is received, the bridge package will call the error_handler
function.
connection_object.subscribe_feed(req)
Market Feed example: if you wish to receive updates on prices, trading volumes, and market
depth for the RELIANCE INDUSTRIES LTD stock and NIFTY 26th DEC FUT future, pass
d. Create a market data stream handler callback function. For the Market Feed example
given above, create a market_feed_handler function
Refer to the annexure sample conversion of a binary event to decimal format, which
demonstrates the conversion of a market feed event in binary format to a readable
decimal format.
The same steps apply to any type of market data event. Include the code for each
step outlined in the example within all your market data handler functions.
e. Use the setter property of the event to register the function created in the previous step
as the callback function for the event.
Continuing with the Market Feed example: Use the setter property
on_feed_data_received to register the market_feed_handler function created in the
previous step as the callback function for the market feed event.
connection_object.on_feed_data_received =market_feed_handler
f. When the actual market data event is received, the bridge package will call the market
data handler function.
In the above Market Feed example, when the actual market feed event is received, the
bridge package will call the market_feed_handler function.
connection_object.unsubscribe_feed(req)
Continuing our Market Feed example, if you wish to stop receiving updates on prices, trading
volumes, and market depth for the RELIANCE INDUSTRIES LTD stock and NIFTY 26th DEC
FUT future, pass
connection_object.disconnect_host()
The packet structure for each market data event is detailed below, along with a few examples for
clarification.
40
Market Feed
Callback Response Length
Event Type Function Format (bytes) Description
on_feed_data_re Provides updates on prices, trading volumes, and
Market Feed ceived binary 188 market depth for equities, FnO and indices
nseeq/2885 Provides updates on prices, trading volumes, and market depth for the RELIANCE
INDUSTRIES LTD stock
nsefo/35005 Provides updates on prices, trading volumes, and market depth for NIFTY 26th DEC
FUT future
nsefo/35217 Provides updates on prices, trading volumes, and market depth for NIFTY 26th DEC
30000 CE option
bseeq/999901 Provides updates on prices for the SENSEX index(market depth and volume entries
will be 0 for indices)
*Note: All event names are case-sensitive and must be provided in lowercase.
Packet Structure
Data
Param Type Size Bytes Description
ltp Int32 4 0-3 Last traded price of the instrument
lastTradedQuantity UInt32 4 4-7 Quantity of the last trade executed
tradedVolume UInt32 4 8-11 Total volume of trades for the instrument
high Int32 4 12-15 Highest price reached during the session
low Int32 4 16-19 Lowest price reached during the session
open Int32 4 20-23 Opening price of the trading session
close Int32 4 24-27 Closing price of the previous trading session
averageTradedPrice Int32 4 28-31 Average price of all trades during the session
bytes reserved for future usage, can be safely
reserved UInt16 2 32-33 ignored
bestBidQuantity UInt32 4 34-37 Quantity available at the best buy price
bestBidPrice Int32 4 38-41 Highest price available for buying
bestAskQuantity UInt32 4 42-45 Quantity available at the best sell price
bestAskPrice Int32 4 46-49 Lowest price available for selling
totalBidQuantity UInt32 4 50-53 Total quantity available for buying
totalAskQuantity UInt32 4 54-57 Total quantity available for selling
priceDivisor Int32 4 58-61 The integer by which all the prices should be
41
nsefo/35005 Provides updates on open interest for NIFTY 26th DEC FUT future
nsefo/35217 Provides updates on open interest for NIFTY 26th DEC 30000 CE option
*Note: All event names are case-sensitive and must be provided in lowercase.
Packet Structure
Data
Param Type Size Bytes Description
openInterest Int32 4 0-3 Total number of outstanding derivative contracts
dayHighOi Int32 4 4-7 Highest open interest recorded during the day
dayLowOi Int32 4 8-11 Lowest open interest recorded during the day
previousOi Int32 4 12-15 Open interest from the previous trading session
Market Status
Callback Response Length
Event Type Function Format (bytes) Description
on_market_statu Provides opening and closing events of the
Market Status s_data_received binary 2 multiple sessions of the normal market
nseeq Provides the opening and closing events of the NSE equity segment's normal
market
*Note: All event names are case-sensitive and must be provided in lowercase.
Packet Structure
Data
Param Type Size Bytes Description
MarketStatusCode Int16 2 0-1 A code for the exchange status
nseeq Provides events when a security reaches the upper limit of its daily
price range (DPR) in the equity segment of NSE
*Note: All event names are case-sensitive and must be provided in lowercase.
Packet Structure
Param Data Type Size Bytes Description
44
nseeq Provides events when a security reaches the lower limit of its daily
price range (DPR) in the equity segment of NSE
*Note: All event names are case-sensitive and must be provided in lowercase.
Packet Structure
Param Data Type Size Bytes Description
instrumentId UInt32 4 0-3 Unique identifier for the financial instrument
lowerCircuit UInt32 4 4-7 the lower limit of the daily price range (DPR) reached by the security
The integer by which the lowerCircuit price should be divided to
priceDivisor Int32 4 8-11 obtain the actual price in decimals
All Limit Price Protection(LPP) Change events adhere to the template: <exchange>/<instrumentId>
nsefo/35005 Provides updates on limit order price range for the future contract NIFTY 26th
DEC FUT
nsefo/35217 Provides updates on limit order price range for the Options contract NIFTY
26th DEC 30000 CE
*Note: All event names are case-sensitive and must be provided in lowercase.
45
Packet Structure
Packet Structure
*Note: All event names are case-sensitive and must be provided in lowercase.
Packet Structure
Param Data Type Size Bytes Description
instrumentId UInt32 4 0-3 Unique identifier for the financial instrument
52WeekLow UInt32 4 4-7 updated 52 week low price for the stock
The integer by which the 52WeekLow should be divided to obtain the
priceDivisor Int32 4 8-11 actual price in decimals
Processing
Method Endpoint Mode Action
/marketdata/ Provides historical candlestick data (open, high, low, close and
POST historicaldata Single volume) for the specified instrument over a chosen time frame
/marketdata/ Delivers real-time market data, including price and volume, for
POST marketquotes Single/Bulk selected instruments
/marketdata/ Returns market depth details, showing the best buy/sell prices
POST marketdepth Single and order quantities at different price levels
Provides open interest data for futures and options, indicating
/marketdata/ total number of outstanding futures or options contracts that have
POST openinterest Single not been settled or closed
Headers
Authorization: Bearer <userSession>
Request Structure
{
“exchange”: “NSEEQ”,
“InstrumentId”: “1594”,
“interval”: “1 minute”,
47
“fromDate”: “19-Sep-2024”,
“toDate”: “20-Sep-2024”
}
Request Parameters
fromDate 19-Sep-2024
Required varchar from date
toDate 20-Sep-2024
Required varchar to date
Response Structure
Note: The Historical Candlestick Chart Data API response is returned in string format(& not in JSON format).
{
"status": "Ok",
"message": "Success",
"result":
[
{
“2024-11-11T09:15:00”, //initial timestamp
292.0, //open
294.0, //high
289.5, //low
293.55, //close
11025420 //volume
},
{
"2024-11-11T09:16:00", //initial timestamp
295.0, //open
296.3, //high
293.75, //low
295.3, //close
48
11315876 //volume
},
{
"2024-11-11T09:17:00", //initial timestamp
295.2, //open
295.6, //high
292.7, //low
294.45, //close
9149737 //volume
}
]
}
Response Parameters
Param Data Type Description Example Values
19-Sep-2024
initialTimestamp varchar Starting time of the candlestick period 09:17:00
high double Highest price reached during the candlestick period 295.6
low double Lowest price reached during the candlestick period 292.7
Market Quotes
Processing
Method Endpoint Mode Action
/marketdata/ Delivers real-time market data, including price and volume, for
POST marketquotes Single/Bulk selected instruments
Headers
Authorization: Bearer <userSession>
Request Structure
[
{
“exchange”: “NSEEQ”,
“InstrumentId”: “1594”
},
49
{
“exchange”: “NSEEQ”,
“InstrumentId”: “2885”
}
]
Request Parameters
Response Structure
{
"status": "Ok",
"message": "Success",
"result":
[
{
“exchange”: "NSEEQ",
“instrumentId”: 1594,
“ltp”: 1412.95,
“lastTradedQuantity”: 5,
“averageTradedPrice”: 1412.47,
“tradedVolume”: 7360198,
“open”: 1396,
“high”: 1421.75,
“low”: 1395.55,
“close”: 1389.65,
"bestBidPrice": 2994.25,
"bestBidQuantity": 4,
"besAskPrice": 2994.75,
"bestAskQuantity": 13,
"totalBidQuantity": 404715,
"totalAskQuantity": 216809,
"tickTimestamp": "19-Sep-2024 09:15:00"
},
{
“exchange”: "NSEEQ",
50
“instrumentId”: 2885,
“ltp”: 1412.95,
“lastTradedQuantity”: 5,
“averageTradedPrice”: 1412.47,
“tradedVolume”: 7360198,
“open”: 1396,
“high”: 1421.75,
“low”: 1395.55,
“close”: 1389.65,
"bestBidPrice": 2994.25,
"bestBidQuantity": 4,
"bestAskPrice": 2994.75,
"bestAskQuantity": 13,
"totalBidQuantity": 404715,
"totalAskQuantity": 216809,
"tickTimestamp": "19-Sep-2024 09:15:00"
}
]
Response Parameters
Param Data Type Description Example Values
exchange varchar The exchange where the order is placed NSEEQ
instrumentId varchar Unique identifier for the financial instrument 1594
ltp double Last traded price of the instrument 1412.95
lastTradedQuantity int Quantity of the last trade executed 5
averageTradedPrice double Average price of all trades during the session 1412.47
tradedVolume int Total volume of trades for the instrument 7360198
open double Opening price of the trading session 1396
high double Highest price reached during the session 1421.75
low double Lowest price reached during the session 1395.55
close double Closing price of the previous trading session 1389.65
bestBidPrice double Highest price available for buying 2994.25
bestBidQuantity int Quantity available at the best buy price 4
bestAskPrice double Lowest price available for selling 2994.75
bestAskQuantity int Quantity available at the best sell price 13
totalBidQuantity int Total quantity available for buying 404715
totalAskQuantity int Total quantity available for selling 216809
tickTimestamp varchar Timestamp of the latest price update 19-Sep-2024 9:15:00
51
Market Depth
Processing
Method Endpoint Mode Action
/marketdata/ Returns market depth details, showing the best buy/sell prices
POST marketdepth Single and order quantities at different price levels
Headers
Authorization: Bearer <userSession>
Request Structure
{
“exchange”: “NSEEQ”,
“InstrumentId”: “1594”
}
Request Parameters
Response Structure
{
"status": "Ok",
"message": "Success",
"result":
{
“exchange”: "NSEFO",
“instrumentId”: 408065,
"totalBidQuantity": 404715,
"totalAskQuantity": 216809,
"marketDepth":
{
“bids”: [
{
“price”: 110,
“quantity”: 10,
“orders”: 30
52
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
}
],
asks: [
{
“price”: 14311,
“quantity”: 100,
“orders”: 4
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
53
},
{
“price”: 110,
“quantity”: 10,
“orders”: 30
}
]
}
}
}
Response Parameters
Param Data Type Description Example Values
exchange varchar The exchange where the order is placed NSEFO
instrumentId varchar Unique identifier for the financial instrument 408065
totalBidQuantity int Total quantity available for buying 404715
totalAskQuantity int Total quantity available for selling 216809
price double Price at a specific bid or ask level 0
quantity int Total quantity available at the given price level 0
orders int Number of orders at the specified price level 0
Open Interest
Processing
Method Endpoint Mode Action
Provides open interest data for futures and options, indicating
/marketdata/ total number of outstanding futures or options contracts that have
POST openinterest Single not been settled or closed
Headers
Authorization: Bearer <userSession>
Request Structure
{
“exchange”: “NSEEQ”,
“InstrumentId”: “1594”
}
Request Parameters
NSEEQ,NSEFO,BSEEQ,BSEFO,NSECU
exchange Exchange & segment of the instrument RR,BSECURR,MCXCOMM,NCDEXCOMM,
Required varchar to be traded NSECOMM,BSECOMM
instrumentId Unique identifier for the financial
Required varchar instrument 1594
Response Structure
{
"exchange": "NSEFO",
"instrumentId": 408065,
"openInterest": 7239000,
"dayHighOi": 87863000,
"dayLowOi": 69892000
}
Response Parameters
Param Data Type Description Example Values
exchange varchar The exchange where the order is placed NSEFO
instrumentId varchar Unique identifier for the financial instrument 408065
openInterest int Total number of outstanding derivative contracts 7239000
dayHighOi int Highest open interest recorded during the day 87863000
dayLowOi int Lowest open interest recorded during the day 69892000
Annexure
Instrument Details
Get comprehensive exchange and segment-wise data of all active market instruments in CSV and JSON
formats.
CSV Links:
Exchange & Segment Instrument Details CSV File Link
NSEEQ https://api.iiflcapital.com/v1/contractfiles/NSEEQ.csv
NSEFO https://api.iiflcapital.com/v1/contractfiles/NSEFO.csv
NSECOMM https://api.iiflcapital.com/v1/contractfiles/NSECOMM.csv
MCXCOMM https://api.iiflcapital.com/v1/contractfiles/MCXCOMM.csv
INDICES https://api.iiflcapital.com/v1/contractfiles/INDICES.csv
NSECURR https://api.iiflcapital.com/v1/contractfiles/NSECURR.csv
BSEEQ https://api.iiflcapital.com/v1/contractfiles/BSEEQ.csv
BSEFO https://api.iiflcapital.com/v1/contractfiles/BSEFO.csv
BSECURR https://api.iiflcapital.com/v1/contractfiles/BSECURR.csv
JSON Links:
55
Postman Collection
You can download the official Postman API Collection here.
SDKs
Below is a list of pre-built official libraries for IIFL Markets’ APIs developed in popularly used programming
languages that can be used to interact with the APIs without having to make raw HTTP calls.
● Python library
● .Net Framework 4.6 library
● .Net Core 8 library
● Golang library
● Java library
● Node JS library
Video Tutorials
1. Trading API Document overview: A quick walkthrough of the key sections and API details in our
documentation.
https://youtu.be/t7TMp4SldJ4
2. Daily client login flow: Step-by-step guide for clients to perform daily logins on the trading applications.
https://youtu.be/DMvSVncJOZA
Binary (Base-2):
Uses two digits, 0 and 1. Commonly used in computing as it represents machine-level data.
3 2 1 0
Example: 𝐵𝑖𝑛𝑎𝑟𝑦 1011 = 1 × 2 + 0 ×2 + 1 ×2 + 1 ×2 = 11
Decimal (Base-10):
The standard number system used in daily life, consisting of digits 0-9.
2 1 0
Example: 𝐷𝑒𝑐𝑖𝑚𝑎𝑙 155 = 1 × 10 + 5 × 10 + 5 × 10 = 155
Hexadecimal (Base-16):
Uses digits 0-9 and letters A-F to represent values 10-15. Commonly used in programming to represent
large binary values compactly.
1 0
Example: 𝐻𝑒𝑥𝑎𝑑𝑒𝑐𝑖𝑚𝑎𝑙 9𝐵 = 9 × 16 + 11 × 16 = 155
*Each binary digit is 1 bit, and each hexadecimal digit is 𝑙𝑜𝑔2(16) = 4 bits. Hence, 1 byte(8 bits) is
represented by 2 two hexadecimal characters (e.g., 10, F3, etc.)
Follow the below steps to convert a binary event into a readable decimal format:
1. Read and Parse the Hex Data: Begin with the raw hex dump and read each byte in sequence. A byte
is represented by two hexadecimal characters (e.g., 10, F3, etc.).
Example: Let’s assume we receive a hexadecimal Market Quotes and Depth Feed like this
00000000: 10 F3 01 00 74 00 00 00 E4 54 75 00 58 F6 01 00 ....t....Tu.X...
00000010: EC EE 01 00 97 F3 01 00 77 F5 01 00 63 F2 01 00 ........w...c...
00000020: 4F 7D ED 02 00 00 06 F3 01 00 84 00 00 00 24 F3 O}............$.
00000030: 01 00 EA 8A 0B 00 1B AD 09 00 64 00 00 00 56 CD ..........d...V.
00000040: 31 67 ED 02 00 00 06 F3 01 00 06 00 00 00 AE 01 1g..............
00000050: 00 00 FC F2 01 00 09 00 00 00 04 00 00 00 F7 F2 ................
00000060: 01 00 01 00 00 00 53 01 00 00 F2 F2 01 00 09 00 ......S.........
00000070: 00 00 51 01 00 00 ED F2 01 00 0B 00 00 00 84 00 ..Q.............
00000080: 00 00 24 F3 01 00 04 00 00 00 15 00 00 00 29 F3 ..$...........).
00000090: 01 00 03 00 00 00 46 05 00 00 2E F3 01 00 0A 00 ......F.........
000000a0: 00 00 C3 02 00 00 33 F3 01 00 06 00 00 00 48 03 ......3.......H.
000000b0: 00 00 38 F3 01 00 0A 00 00 00 00 00
2. Remove Address Offsets and ASCII interpretations: Remove any address offsets (like 00000000,
00000010, etc.) at the start of each line. Ignore any ASCII interpretations (like ....t....Tu.X..., etc.) at the
end of each line. You only need the hex values.
Example: Remove address offsets and ASCII interpretations from each row
10 F3 01 00 74 00 00 00 E4 54 75 00 58 F6 01 00
EC EE 01 00 97 F3 01 00 77 F5 01 00 63 F2 01 00
57
4F 7D ED 02 00 00 06 F3 01 00 84 00 00 00 24 F3
01 00 EA 8A 0B 00 1B AD 09 00 64 00 00 00 56 CD
31 67 ED 02 00 00 06 F3 01 00 06 00 00 00 AE 01
00 00 FC F2 01 00 09 00 00 00 04 00 00 00 F7 F2
01 00 01 00 00 00 53 01 00 00 F2 F2 01 00 09 00
00 00 51 01 00 00 ED F2 01 00 0B 00 00 00 84 00
00 00 24 F3 01 00 04 00 00 00 15 00 00 00 29 F3
01 00 03 00 00 00 46 05 00 00 2E F3 01 00 0A 00
00 00 C3 02 00 00 33 F3 01 00 06 00 00 00 48 03
00 00 38 F3 01 00 0A 00 00 00 00 00
3. Remove Whitespace and Format as Continuous Hex String: Concatenate all the hex bytes into a
single continuous string without spaces (e.g., 10F3010074000000E454750058F6...).
4. Split into 4 or 2 Byte Groups: Divide the continuous hex string into groups of 4 or 2 bytes each as per
the packet structure provided here. Since each byte is represented by 2 hexadecimal characters, a 4-byte
group will consist of 8 hexadecimal characters, while a 2-byte group will contain 4 hexadecimal
characters.
5. Reverse bytes: byte values are represented in little-endian format, so you need to reverse the
bytes(set of 2 hex characters) within each byte group to get the correct value.(e.g., the 4 byte group
10F30100 should get reversed to 0001F310)
0001F658
...
6. Convert Each Group to Decimal Number: Convert each 8 or 4-character (4 or 2-byte) group to its
decimal number.
4 3 2 1 0
ltp 127760 0001𝐹310 = 1 × 16 + 15 × 16 + 3 × 16 + 1 × 16 + 0 × 16
1 0
lastTradedQuantity 116 00000074 = 7 × 16 + 4 × 16
5 4 3 2 1 0
tradedVolume 7689444 07554𝐸4 = 7 × 16 + 5 × 16 + 5 × 16 + 4 × 16 + 14 × 16 + 4 × 16
4 3 2 1 0
high 128600 0001𝐹658 = 1 × 16 + 15 × 16 + 6 × 16 + 5 × 16 + 8 × 16
... ... …
7. Divide by price divisor: Divide the converted decimal number by the price divisor if the byte group
represents a price
Example: The price divisor value is located in bytes 58-61 of the Market Quotes and Depth Feed. For this
example, the price divisor is 100. Divide the ltp and high prices, 127760 and 128600 respectively, by the
price divisor to get their final values.
ltp 1277.6
lastTradedQuantity 116
tradedVolume 7689444
high 1286
... ...
8. Convert into human timestamp: Timestamps are sent in Unix epoch time format, convert the decimal
number into human readable format if the byte group represents a timestamp.
Example: None of the 4 byte groups in this example represent timestamps. So, this step should be
skipped for these 4 byte groups.
9. Get additional information from the topic name: The topic name for this message is nseeq/2885.
Extract exchange and instrumentId from the topic name following the topic structure given here.
exchange NSEEQ
instrumentId 2885
10. Output the Results: Store each byte group final values into appropriate variables along with the topic
details. Repeat until all data is processed.
59
exchange NSEEQ
instrumentId 2885
ltp 1277.6
lastTradedQuantity 116
tradedVolume 7689444
high 1286
... ...
Developer’s Community
🐞 Found a bug or facing an issue? Raise it on our GitHub Issues page!
Trading API Error Codes
All the errors that the trading APIs can throw are mentioned below along with their error message. Note
that Order Rejection reasons are not errors from APIs and have not been included in the below list.
EC804 Invalid fromDate format. Please enter the fromDate in DD-MMM-YYYY format (e.g., 20-Sep-2020).
EC805 Invalid parameter: 'toDate' cannot be empty or null.
EC806 Invalid toDate format. Please enter the toDate in DD-MMM-YYYY format (e.g., 20-Sep-2020).
EC807 Invalid date range. The 'fromDate' cannot be greater than the 'toDate'.
EC808 Error : Invalid : 'instrumentId' must be greater than 0.
EC809 Maximum permissible date range limit reached
EC810 From date has to be less than end date
EC001 Invalid parameter : 'UserIdentity' cannot be empty or null.
EC002 Client does not exist.
EC004 User blocked.
EC005 Invalid parameter : Request is null or empty.
EC006 Invalid parameter : 'IsPANEntered' cannot be empty or null.
EC007 Invalid parameter : 'IsPANEntered', IsPANEntered will consists only Y and N.
EC008 Invalid parameter : 'UserId' cannot be empty or null.
EC009 Invalid parameter : 'Password' cannot be empty or null.
EC010 Invalid parameter : 'appName' cannot be empty or null.
EC011 Multiple client IDs associated with the provided details. Please specify a client code to proceed further.
EC012 Multiple client IDs associated with the provided details. Please specify a client code to proceed further.
EC013 Multiple client IDs associated with the provided details. Please specify a client code to proceed further.
EC014 Your account has been blocked by adminstrator. Please contact admin(Unblock accout option wont work).
EC015 Not able to send OTP for the registered mobile and email.
EC016 Invalid userId or password.
EC017 Invalid parameter : 'osName' cannot be empty or null.
EC018 Your OTP has been initiated. Please try again after 60 seconds.
EC019 You have exceeded the maximum limit for OTP requests. Please try again later.
EC020 We are currently unable to send OTP. Please contact the administrator for assistance.
EC021 Invalid parameter : 'ClientCode' cannot be empty or null.
EC022 Invalid parameter : 'ReceivedOTP' cannot be empty or null.
EC023 Invalid parameter : 'IsPANEntered' cannot be empty or null.
EC024 Your OTP is expired.
EC025 Invalid OTP.
EC026 Invalid parameter : 'userId' cannot be empty or null.
EC027 Invalid parameter : 'pan' cannot be empty or null.
EC028 Invalid parameter : 'osName' cannot be empty or null.
EC029 Invalid parameter : 'dob' cannot be empty or null.
64
EC065 Multiple client IDs associated with the provided mobile. Please specify a client code to proceed further.
EC066 Multiple client IDs associated with the provided details. Please specify a client code to proceed further.
EC067 Error : Provide pan is not mapped with any client Id.
EC068 Error : Provide userId is not mapped with given pan.
EC069 Error : Your password has expired. Please change your password to continue.
EC070 Invalid parameter : 'version' cannot be empty or null.
EC071 Invalid parameter : 'os' cannot be empty or null.
Mobile Number and email ID are invalid, please write to [email protected] to update your Mobile Number &
EC072 email ID.
EC073 Error: Please enter the date of birth (DOB) in MMDDYYYY format.
EC074 Error: Invalid 'osName'.
EC075 Error: Unauthorized access.
EC076 Error: This service is not available for your account type.
EC077 Error : Provide PAN is not mapped with given user Id.
EC078 Error : Provide PAN is not mapped with given user Id.
EC079 Error: Password must have one allowed special character out of @ # $ % & * / \\
EC080 Error : Too many incorrect OTP attempts. Request a new OTP after 15 minutes.
Error : Your account is in a voluntary freeze state, and login is not permitted. Please contact the
EC081 administrator for assistance.
Below are the result codes sent by the Python SDK and their corresponding messages:
result Codes Message
0 Topic granted
104 Invalid topic
66
Below are the Acknowledgement packetTypes sent by the Python SDK and their corresponding names:
packetType PacketName
2 Connection acknowledgement
9 Subscription acknowledgement
11 Unsubscription acknowledgement
14 Disconnect acknowledgement
Rate Limits
67
FAQs
● What are IIFL Markets Trading APIs?
IIFL Markets Trading APIs allow individual traders and fintech platforms to connect directly to
IIFL’s broker systems for order placements, market data retrieval, and portfolio management.
● Do I need to log in daily, and will a new session token be generated each time?
Yes, you need to log in every day. A new, unique session token is generated with each login.
● What do the two status and message parameters in API responses mean?
The two status and message parameters are explained in this section.
● Can I convert MIS (intraday) trades to CNC (delivery) or vice versa using the API?
No, order conversions between MIS and CNC/NRML are not supported through the API. These
conversions can be done via the IIFL Markets Mobile Application.
● Where can I access real-time market data, and can I use third-party data sources?
Market data is available through the APIs and bridge package. You can also use authorized
third-party vendors for market data.
● Is the use of the bridge package mandatory for accessing the Market Data stream?
Yes, the bridge package is mandatory for accessing the Market Data stream. It contains
pre-built functions and sample implementations, simplifying the integration process.
Find the list of Bridge Packages available in multiple programming languages here. If your
preferred programming language package is not available, you can request it through your
RM/POC.