API Documentation

Introduction

The Definedge Securities trading API INTEGRATE allows you to build trading and investment services platforms, execute strategies, and much more.

You can execute & modify orders in real time in equities, derivatives, currencies and commodities. You can also manage user portfolios, access live market data and much more with a lightning fast API.

We offer resource-based URLs that accept JSON or form-encoded requests. The response is returned as JSON-encoded responses using Standard HTTP response codes, verbs, and authentication.

Below is complete documentation of the Integrate trading API.

Base URL: https://integrate.definedgesecurities.com/dart/v1 ( This is the base url for all trading related API’s. For Ex. buy, sell, order book, trade book etc. )

Note: Data from Integrate API and Websocket is intended for personal use only. Distribution of this data is strictly prohibited.

Integrate Python Library

Python Client Library for INTEGRATE API along with working examples is now available.

Project Description & Documentation

Master File

Particular

Details

API Name

Download link for Master file of Symbols

URL

NSE Cash: https://app.definedgesecurities.com/public/nsecash.zip

NSE FNO: https://app.definedgesecurities.com/public/nsefno.zip

NSE CDS: https://app.definedgesecurities.com/public/cdsfno.zip

BSE Cash: https://app.definedgesecurities.com/public/bsecash.zip

BSE FNO: https://app.definedgesecurities.com/public/bsefno.zip

MCX FNO: https://app.definedgesecurities.com/public/mcxfno.zip

All Segments: https://app.definedgesecurities.com/public/allmaster.zip

Method

GET

Produces

application/zip

Description

This link downloads master file consisting all the symbols of all segments, in zip format.

You should download this file every morning after 7.30am for latest trading symbols.

These trading symbols are arranged as per different exchanges and segments. Application that consumes trading API needs to update master file on daily basis. Extracted zip file produces csv file which can be imported in your trading software.

 

Response message format

Fields in downloaded CSV file appears in following sequence

SEGMENT – STRING NSE/BSE/NFO/CDS/MCX

TOKEN - INT

SYMBOL - STRING

TRADINGSYM - STRING

INSTRUMENT TYPE- STRING

EXPIRY – DDMMYYYY only for derivatives

TICKSIZE - INT

LOTSIZE - INT

OPTIONTYPE - STRING

STRIKE - INT ( Actual Strike price = STRIKE/( MULTIPLIER * 10 ^ PRICEPREC) )

PRICEPREC – INT. Use this for calculating strike price.

MULTIPLIER – INT. Use this for calculating strike price.

ISIN - STRING, EMPTY WHEN NOT APPLICABLE

PRICEMULT = FLOAT

Historical Data

Particular

Details

API Name

Historical Data API

URL

https://data.definedgesecurities.com/sds/history/{segment}/{token}/{timeframe}/{from}/{to}

Method

GET

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Produces

text/csv

Description

Data for various timeframes is available as follows:
Daily: Last 20 years
Intraday: Last 6 months
Tick: Last 2 trading sessions

Request URL format

segment: NSE/BSE/NFO/CDS/MCX

token (from Master file)

timeframe: day/minute/tick

from: ddMMyyyyHHmm format

to: ddMMyyyyHHmm format

For example: https://data.definedgesecurities.com/sds/history/NSE/22/day/010620230000/010620231530

Response message format

Fields in response appear in following format (csv without headers)
for day and minute timeframe: Dateandtime, Open Price, High Price, Low Price, Close, Volume, Open Interest (OI only for derivatives segments)

for tick timeframe: UTC(in seconds), LTP(Last Traded Price), LTQ(Last Traded Quantity), Open Interest (OI will be 0 for Equity segments)

Error Codes

Particular

Details

API Name

Various Error codes

Description

API returns different errors depending on nature of data submitted and server processing.

Some of the errors are technical while some errors are business validations.

 

400 - Server returns this error if some of the request parameters are incorrect or required headers are missing.

404 - Server returns this error when requested URL is invalid

500 - This is general error if there are any technical issues on API server

 

Rest of the errors are returned in API response with JSON structure.

 

Authentication

USER LOGIN STEP 1 :

Particular

Details

API Name

User login - Step one

URL

https://signin.definedgesecurities.com/auth/realms/debroking/dsbpkc/login/{{api_token}}

Method

GET

Produces

application/json

Description

To get values for api_token and api_secret, Go to Account section of MyAccount (myaccount.definedgesecurities.com) and click on "SHOW MY API SECRET" button at top.

Your API credentials get reset when you change/reset your login password.

Request Header

api_secret: Actual value of api_secret key


Curl

https://signin.definedgesecurities.com/auth/realms/debroking/protocol/openid-connect/token

-H "Accept: application/json"

-H "Content-type: application/x-www-form-urlencoded"

-d "client_id=TRTP"

-d "grant_type=password"

-d "client_secret=f5c00...-.....-....e09a54da3"

(Your client secrete is available at MyAccount->Account page)

-d "username=UCC"

-d "password=YOUR PASSWORD"

Response Message Format

{ "otp_token": "...", "message": "OTP is sent to mobile XXXX and registered email id." }

USER LOGIN STEP 2 :

Particular

Details

API Name

User login - Step two

URL

https://signin.definedgesecurities.com/auth/realms/debroking/dsbpkc/token

Method

POST

Produces

application/json

Description

This API performs second step of login for 2 Factor Authentication and it returns API key

You need to retain API key received in response to use it for all API calls.

Also retain susertoken for websocket connection.

Request Header

NA

API Key

Extract "api_session_key" and use this in all subsequent API calls by passing in request header

Websocket Key

Extract "susertoken" from response and use it while making Websocket connection.

Request Message Format

{ "otp_token": "{{otp_token}}", "otp": "{{otp_code}}" }

Curl

curl https://signin.definedgesecurities.com/auth/realms/debroking/dsbpkc/token

-H "Content-type: application/json"

-d "client_id=TRTP"

-d "grant_type=password"

-d "client_secret=f5c00...-.....-....e09a54da3"

(Your client secret is available at MyAccount->Account page)

-d "otp_token=OTP TOKEN RECEIVED FROM STEP 1"

-d "otp=OTP RECEIVED "

Response Message Format

{ "request_time": "13:26:42 03-02-2023", "actid": "YOUR UCC", "uname": "test user10", "prarr": [ ...], "stat": "Ok", "susertoken": "YOUR WEBSOCKET KEY", "email": "YOUR EMAIL", "uid": "YOUR UCC", "brnchid": "HO", "orarr": [...], "exarr": [], "brkname": "DEFINEDGE", "lastaccesstime": "1675411002", "api_session_key": "YOUR API KEY" }

API Token

USER LOGIN STEP 3 GET OMS TOKEN :

Particular

Details

API Name

User login - Step Three (Get Order Management System [OMS] token)

Relative URL

/token

Method

POST

Content-Type

application/json

Produces

application/json

Description

After user authentication, you will receive JWT from authentication server which needs to be passed to this API.

Invoke this for getting OMS token.

You need to retain API key received in response and use it for all API calls

Request message format

JWT Received from Login API. JWT is in JSON format. Pass it to this API as POST request.

API Key

Extract "api_session_key" and Use this in all subsequent API calls by passing in request header


Request Message Format

{ "access_token": "...", "expires_in": 28800, "refresh_expires_in": 900, "refresh_token": "...", "token_type": "Bearer", "id_token": "...", "not-before-policy": 1640845104, "session_state": "...", "scope": "..." } // Post response from STEP 2 to API server URL

Response Message Format

{ "request_time": "13:26:42 03-02-2023", "actid": "YOUR UCC", "uname": "test user10", "prarr": [ ...], "stat": "Ok", "susertoken": "YOUR WEBSOCKET KEY", "email": "YOUR EMAIL", "uid": "YOUR UCC", "brnchid": "HO", "orarr": [...], "exarr": [], "brkname": "DEFINEDGE", "lastaccesstime": "1675411002", "api_session_key": "YOUR API KEY" }

Place Order

Particular

Details

API Name

Place BUY/SELL order

Relative URL

/placeorder

Method

POST

Content-Type

application/json

Produces

application/json

Description

This API places BUY/SELL order in different segments entitled to user.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Place Order Request :

Json Fields Possible value Description
exchange* - Exchange to which order will be placed
order_type* BUY
SELL
Order type BUY/SELL
price* - Price to place the order (Should be 0 in case of price_type = Market)
price_type* LIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_type* CNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity* - Order quantity for this order (In multiple of lots for derivatives)
tradingsymbol* - Trading symbol as per master file
amo - If AMO order, input value as "Yes", otherwise optional
book_loss_price - Shows Stoploss price. Applicable only for Bracket orders
book_profit_price - Shows target price. Applicable only for Bracket orders
disclosed_quantity - Quantity to be disclosed (Only for Equity and MCX)
market_protection - Market order protection percentage (only for BSE and MCX)
remarks - Any tag by user to mark order.
trailing_price - Trailing Price applicable only if product is selected as H andB (High Leverage and Bracket order )
trigger_price - Price at which the order should be triggered (only for price_type = SL_LIMIT or SL-MARKET)
validity DAY
EOS
IOC
Order Validity(default value = DAY)

Place Order Response :

Json Fields Possible value Description
message - Shows the status message
status - Shows the status for the request
order_id - Shows Order ID

Request Message Format

{ "price_type": "MARKET", "tradingsymbol": "NIFTY23FEB23F", "quantity": "50", "price":"0", "product_type": "NORMAL", "order_type": "SELL", "exchange": "NFO" }

Response Message Format

{ "status": "SUCCESS", "order_id": "123456789000" }

Order Book

Particular

Details

API Name

Get Order book

Relative URL

/orders

Method

GET

Content-Type

NA

Produces

application/json

Description

This API returns order book data which represents all the orders placed on that day along with their respective status.

Request message format

NA

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Order Book Response :

Json Fields Possible value Description
message - Shows the status message
status - Shows the status for the request
orders - Refer below table Order Book Response Item

Order Book Response Item :

Json Fields Possible value Description
amo - After Market Order, if Yes. Will take Regular as default
average_traded_price - Average trade price of total traded quantity
book_loss_price - Shows Stoploss price. Applicable only for Bracket orders
book_profit_price - Shows target price. Applicable only for Bracket orders
cancel_qty - Canceled quantity for order which is in status cancelled
disclosed_quantity - Quantity to be disclosed (Only for Equity and MCX)
exchange - Exchange to which order will be placed
exchange_orderid - Order id generated by exchange
exchange_time - Exchange update time
expiry - For derivatives, specifies expiry of the contract
filled_qty - Total Traded Quantity of this order
instrument_type - Instrument type
last_fill_qty - quantity of last executed trade
lotsize - For Derivatives symbols, specifies its lot size
market_protection - Market order protection percentage (only for BSE and MCX)
message - Shows the status message
multiplier - Contract price multiplier, (used for order value calculation)
order_entry_time - Indicates Order entry time
order_id - Shows Order ID
order_status CANCELED
COMPLETE
NEW
OPEN
REJECTED
REPLACED
Shows the status for the request
order_type BUY
SELL
Order type BUY/SELL
pending_qty - Specifies quantity which is open and yet to be executed
price - Price to place the order (Should be 0 in case of price_type = Market)
price_factor - Contract price factor, (used for order value calculation)
price_precision - Indicates the price precision
price_type LIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_type CNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity - Order quantity for this order (In multiple of lots for derivatives)
remarks - -
required_price -
ticksize - Tick size for the mentioned symbol
token - Unique token ID for each symbol
tradingsymbol - Trading symbol as per master file
trailing_price - Shows Stoploss price. Applicable only for Bracket orders
trigger_price - Price at which the order should be triggered (only for price_type = SL_LIMIT or SL_MARKET)
validity - Order Validity DAY/EOS/IOC,(default value = DAY)
variety AMO
REGULAR
SQUAREOFF
Specifies whether it a Regular, AMO or Squareoff order

Response Message Format

{ "status": "SUCCESS", "orders": [ { "order_id": "1234567890", "tradingsymbol": "NIFTY23FEB23F", "token": "48757", "quantity": "50", "price_type": "MARKET", "product_type": "NORMAL", "order_entry_time": "1675257585", "order_status": "COMPLETE", "order_type": "SELL", "variety": "REGULAR", "lotsize": "50", "exchange_orderid": "1001234567890", "pending_qty": "0", "price": "0.00", "exchange_time": "01-02-2023 18:49:48", "average_traded_price": "17665.00", "exchange": "NFO", "filled_qty": "50", "disclosed_quantity": "0", "validity": "DAY", "price_precision": "2", "ticksize": "0.05", "price_factor": "1.000000", "multiplier": "1", "rqty": "50", "required_price": "17665.00" } ] }

Single Order Status

Particular

Details

API Name

Get Single Order Status

Relative URL

/order/{orderid}

Method

GET

Content-Type

NA

Produces

application/json

Description

This API returns order status for that specific order along with its details.

Request message format

NA

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Single Order Status Response :

Json Fields Possible value Description
amo - After Market Order, if Yes. Will take Regular as default
book_loss_price - Shows Stoploss price. Applicable only for Bracket orders
book_profit_price - Shows target price. Applicable only for Bracket orders
cancel_qty - Canceled quantity for order which is in status cancelled
disclosed_quantity - Quantity to be disclosed (Only for Equity and MCX)
exchange - Exchange to which order will be placed
exchange_orderid - Order id generated by exchange
exchange_time - Exchange update time
expiry - For derivatives, specifies expiry of the contract
filled_qty - Total Traded Quantity of this order
instrument_type - Instrument type
last_fill_qty - quantity of last executed trade
market_protection - Market order protection percentage (only for BSE and MCX)
message - Shows the status message
order_entry_time - Indicates Order entry time
order_id - Shows Order ID
order_status CANCELED
COMPLETE
NEW
OPEN
REJECTED
REPLACED
Shows the status for the request
order_type BUY
SELL
Order type BUY/SELL
pending_qty - Specifies quantity which is open and yet to be executed
price - Price to place the order (Should be 0 in case of price_type = Market)
price_type LIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_type CNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity - Order quantity for this order (In multiple of lots for derivatives)
remarks - -
token - Unique token ID for each symbol
tradingsymbol - Trading symbol as per master file
trailing_price - Shows Stoploss price. Applicable only for Bracket orders
trigger_price - Price at which the order should be triggered (only for price_type = SL_LIMIT or SL_MARKET)
validity - Order Validity DAY/EOS/IOC,(default value = DAY)

Response Message Format

{ "order_id": "1234567890", "tradingsymbol": "NIFTY23FEB23F", "token": "48757", "quantity": "50", "price_type": "MARKET", "product_type": "NORMAL", "order_entry_time": "1675257585", "order_status": "COMPLETE", "order_type": "SELL", "exchange_orderid": "1001234567890", "pending_qty": "0", "price": "0.00", "exchange_time": "01-02-2023 18:49:48", "exchange": "NFO", "filled_qty": "50", "disclosed_quantity": "0", "validity": "DAY" }

Trade Book

Particular

Details

API Name

Get Trade book

Relative URL

/trades

Method

GET

Content-Type

NA

Produces

application/json

Description

This API returns trade book data which represents trades along with their respective status.

Request message format

NA

Request Header

Authorization: Actual value of api_session_key

This key is received from token response in Login Step 3

Trade Book Response :

Json Fields Possible value Description
message - Shows the status message
status - Shows the status for the request
trades - Refer below table Trade Book Response Item

Trade Book Response Item

Json Fields Possible value Description
average_traded_price - Average price of the traded quantity
exchange - Exchange to which order will be placed
exchange_orderid - Order id generated by exchange
exchange_time - Time at which order reached at exchange
fill_id - Specifies the system generated fill id 
fill_price - Price at which the trade was filled
fill_time - Time at which the trade was filled
filled_qty - Total Traded / filled quantity
last_fill_qty - quantity of last executed trade
lotsize - For Derivatives symbols, specifies its lot size
order_id - Shows Order ID
order_type BUY
SELL
Order type BUY/SELL
price - Price to place the order
price_precision - Price Precision
price_type LIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_type CNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity - Order quantity for this order (In multiple of lots for derivatives)
remarks - Any tag by user to mark order.
status - Shows the status for the request
ticksize - Tick size for the mentioned symbol
token - Unique token ID for each symbol
tradingsymbol - Trading symbol as per master file
validity Enum:
DAY
EOS
IOC
Order Validity DAY/EOS/IOC,(default value = DAY)

Response Message Format

{ "status": "SUCCESS", "trades": [ { "order_id": "1234567890", "exchange": "NFO", "price_type": "MARKET", "validity": "DAY", "product_type": "NORMAL", "fill_id": "4627", "fill_time": "01-02-2023 18:49:48", "order_type": "SELL", "tradingsymbol": "NIFTY23FEB23F", "quantity": "50", "token": "48757", "filled_qty": "50", "last_fill_qty": "50", "price_precision": "2", "lotsize": "50", "ticksize": "0.05", "price": "0.00", "fill_price": "17665.00", "exchange_time": "01-02-2023 18:49:48", "exchange_orderid": "1001234567890 " } ] }

Position Book

Particular

Details

API Name

Get Position book

Relative URL

/positions

Method

GET

Content-Type

NA

Produces

application/json

Description

This API returns all Positions of the current day.

Request message format

NA

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Position Book Response :

Json Fields Possible value Description
message - Shows the status message
status - Shows the status for the request
positions - Refer below table Position Book Response Item

Position Book Response Item :

Json Fields Possible value Description
break_even_point--
broker_name- Broker specific contract display name, present only if applicable.
carry_buy_amt- Amount for carry forward Buy amount
carry_buy_avg- Buy average for carry forward quantity
carry_buy_qty- Total Carry forward Buy quantity
carry_sell_amt- Amount for carry forward Sell amount
carry_sell_avg- Sell average for carry forward quantity
carry_sell_qty- Total Carry forward Sell quantity
cf_sell_quantity--
day_averageprice--
day_buy_amt- Amount for quantity bought today
day_buy_avg- Average for quantity bought today
day_buy_qty- Quantity bought today
day_sell_amt- Amount for quantity sold today
day_sell_avg- Average for quantity bought today
day_sell_qty- Quantity sold today
exchange- Exchange to which order will be placed
lastPrice--
lotsize- For Derivatives symbols, specifies its lot size
multiplier- Contract price multiplier, (used for order value calculation)
net_averageprice--
net_quantity--
net_uploadprice--
open_buy_amount- Indicates the Open Buy Amount
open_buy_averageprice- Indicates the Open Buy Average Price
open_buy_quantity- Indicates the Open Buy Quantity
open_sell_amount- Indicates the Open Sell Amount
open_sell_averageprice- Indicates the Open Sell Average Price
open_sell_quantity- Indicates the Open Sell Quantity
order_id- Shows Order ID
original_average_price--
price_factor- Contract price factor (GNPN)/(GDPD)
price_precision- Indicates the price precision
product_typeCNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
realized_pnl- Realised Returns
request_time --
status- Shows the status for the request
ticksize- Tick size for the mentioned symbol
token- Unique token ID for each symbol
total_buy_amt- Amount for total Buy amount
total_buy_avg- Average for total Buy quantity
total_sell_amt- Amount for total Sell amount
total_sell_avg- Average for total Sell quantity
tradingsymbol- Trading symbol as per master file
unrealized_pnl- Unrealised Returns
upload_price--

Response Message Format

{ "status": "SUCCESS", "positions": [ { "exchange": "NFO", "tradingsymbol": "NIFTY23FEB23F", "product_type": "NORMAL", "token": "48757", "price_precision": "2", "lotsize": "50", "ticksize": "0.05", "multiplier": "1", "price_factor": "1.000000", "day_buy_qty": "0", "day_sell_qty": "50", "day_buy_amt": "0.00", "day_buy_avg": "0.00", "day_sell_amt": "883250.00", "day_sell_avg": "17665.00", "carry_buy_qty": "0", "carry_sell_qty": "0", "open_buy_quantity": "0", "open_sell_quantity": "0", "open_buy_amount": "0.00", "open_buy_averageprice": "0.00", "open_sell_amount": "0.00", "open_sell_averageprice": "0.00", "day_averageprice": "17665.00", "net_quantity": "-50", "net_averageprice": "17665.00", "upload_price": "0.00", "net_uploadprice": "17665.00", "lastPrice": "17665.00", "unrealized_pnl": "-0.00", "break_even_point": "17665.00", "realized_pnl": "0.00", "total_buy_amt": "0.00", "total_sell_amt": "883250.00", "total_sell_avg": "17665.00" } ] }

Holdings

Particular

Details

API Name

Get Holdings

Relative URL

/holdings

Method

GET

Content-Type

NA

Produces

application/json

Description

This API provides holdings along with their details.

Request message format

NA

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Holding Response :

Json Fields Possible value Description
avg_buy_price- Average Buy price
broker_collateral_qty- Non-POA Pledged Quantity
collateral_qty- POA pledged Collateral Quantity
cusa_qty- CUSA qty
dp_qty- DP Holding Quantity
haircut- Haircut for that symbol
holding_used- Quantity placed to sell today
message- Error message
non_poa_qty- Non POA Quantity
sell_amt- Amount for quantity sold today
status- Holding request success or failure indication
t1_qty- T1 Quantity
trade_qty- Quantity Sold today
tradingsymbol-Refer below table Holdings Response Item
unpledged_qty- Unpledged quantity

Holdings Response Item :

Json Fields Possible value Description
exchange- Exchange to which order will be placed
isin- Specifies ISIN code for the given scrip, in case of Equity Scrips
lotsize- For Derivatives symbols, specifies its lot size
message- Shows the status message
price_precisionObjectPrice Precision
requestTime --
ticksize- Tick size for the mentioned symbol
token-Unique token ID for each symbol
tradingsymbol- Trading symbol as per master file

Response Message Format

{ "status": "SUCCESS", "data": [ { "dp_qty": "0", "t1_qty": "25", "holding_used": "0", "avg_buy_price": "197.30", "sell_amt": "0.000000", "trade_qty": "0", "tradingsymbol": [ { "exchange": "NSE", "tradingsymbol": "CUB-EQ", "token": "5701", "price_precision": "2", "ticksize": "0.05", "lotsize": "1", "isin": "INE491A01021" }, { "exchange": "BSE", "tradingsymbol": "CUB", "token": "532210", "price_precision": "2", "ticksize": "0.05", "lotsize": "1", "isin": "INE491A01021" } ] }, { "dp_qty": "0", "t1_qty": "300", "holding_used": "0", "avg_buy_price": "21.80", "sell_amt": "0.000000", "trade_qty": "0", "tradingsymbol": [ { "exchange": "NSE", "tradingsymbol": "IOB-EQ", "token": "9348", "price_precision": "2", "ticksize": "0.05", "lotsize": "1", "isin": "INE565A01014" }, { "exchange": "BSE", "tradingsymbol": "IOB", "token": "532388", "price_precision": "2", "ticksize": "0.05", "lotsize": "1", "isin": "INE565A01014" } ] }, { "dp_qty": "0", "t1_qty": "200", "holding_used": "0", "avg_buy_price": "23.55", "sell_amt": "0.000000", "trade_qty": "0", "tradingsymbol": [ { "exchange": "NSE", "tradingsymbol": "MAHABANK-EQ", "token": "11377", "price_precision": "2", "ticksize": "0.05", "lotsize": "1", "isin": "INE457A01014" }, { "exchange": "BSE", "tradingsymbol": "MAHABANK", "token": "532525", "price_precision": "2", "ticksize": "0.05", "lotsize": "1", "isin": "INE457A01014" } ] } ] }

Modify Order

Particular

Details

API Name

Modify individual order

Relative URL

/modify

Method

POST

Content-Type

application/json

Produces

application/json

Description

This API modifies existing order, if it is OPEN or Partially fulfilled

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Modify Order Request :

Json Fields Possible value Description
exchange* - Exchange to which order will be placed
order_id* - Shows Order ID
order_type* BUY
SELL
Order type BUY/SELL
price* - Price to place the order (Should be 0 in case of price_type = Market)
price_type* LIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_type* CNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity* - Order quantity for this order (In multiple of lots for derivatives)
tradingsymbol* - Trading symbol as per master file
book_loss_price - Shows Stoploss price. Applicable only for Bracket orders
book_profit_price - Shows target price. Applicable only for Bracket orders
disclosed_quantity - Quantity to be disclosed (Only for Equity and MCX)
market_protection - Market order protection percentage (only for BSE and MCX)
remarks - Any tag by user to mark order.
source - Specifies Order source
trailing_price - Trailing Price applicable only if product is selected as H andB (High Leverage and Bracket order )
trigger_price - Price at which the order should be triggered (only for price_type = SL_LIMIT or SL-MARKET)
validity DAY
EOS
IOC
Order Validity DAY/EOS/IOC,(default value = DAY)

Modify Order Response :

Json Fields Possible value Description
message - Shows the status message
status - Shows the status for the request
order_id - Shows Order ID

Request Message Format

{ "exchange": "NFO", "order_id": "1234567890012", "tradingsymbol": "NIFTY23FEB23C17800", "quantity": "100", "price":"220", "product": "INTRADAY", "order_type": "BUY", "price_type": "LIMIT" }

Response Message Format

{ "status": "SUCCESS", "order_id": "1234567890012" }

Cancel Order

Particular

Details

API Name

Cancel Open order

Relative URL

/cancel/{orderid}

Method

GET

Content-Type

NA

Produces

application/json

Description

This API cancels existing order if it is OPEN or Partially fulfilled

Request message format

This is get request and order id needs to be put in request URL.

e.g. /cancel/1234567890012

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Cancel Order Response :

Json Fields Possible value Description
message Shows the status message
order_id Shows Order ID
request_time Request time
status Shows the status for the request

Response Message Format

{ "status": "SUCCESS", "order_id": "1234567890012", "request_time": "19:05:27 01-02-2023" }

Place Slice Order

Particular

Details

API Name

Place BUY/SELL order with slicing

Relative URL

/sliceorder

Method

POST

Content-Type

application/json

Produces

application/json

Description

This API places BUY/SELL order in different segments entitled to user with default slicing.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Place Slice Order Request :

Json Fields Possible value Description
exchange*   Exchange to which order will be placed
order_type* BUY
SELL
Order type BUY/SELL
price*   Price to place the order (Should be 0 in case of price_type = Market)
price_type* LIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_type* CNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity*   Order quantity per slice(In multiple of lots for derivatives). This will be used for one single slice order
slices*   Provide how many slices to be created for given order.
tradingsymbol*   Trading symbol as per master file
amo   If AMO order, input value as "Yes", otherwise optional
book_loss_price   Shows Stoploss price. Applicable only for Bracket orders
book_profit_price   Shows target price. Applicable only for Bracket orders
disclosed_quantity   Quantity to be disclosed (Only for Equity and MCX)
market_protection   Market order protection percentage (only for BSE and MCX)
remarks   Any tag by user to mark order.
trailing_price   Trailing Price applicable only if product is selected as H andB (High Leverage and Bracket order )
trigger_price   Price at which the order should be triggered (only for price_type = SL_LIMIT or SL-MARKET)
validity DAY
EOS
IOC
Order Validity DAY/EOS/IOC,(default value = DAY)

Place Slice Order Response :

Json Fields Possible value Description
message - Shows the status message
status - Shows the status for the request
order_id - Shows Order ID

Request Message Format

{ "price_type": "LIMIT", "tradingsymbol": "NIFTY23FEB23F", "quantity": "1000", "product_type": "NORMAL", "price": "17600", "order_type": "BUY", "exchange": "NFO", "validity": "DAY", "slices":"2" }

Response Message Format

{ "status": "SUCCESS", "message": "Orders submitted", "orders": [ { "status": "SUCCESS", "order_id": "123456789000" }, { "status": "SUCCESS", "order_id": "1234567890001" } ] }

Product Conversion

Particular

Details

API Name

Product conversion

Relative URL

/productconversion

Method

POST

Content-Type

application/json

Produces

application/json

Description

This API provides product conversion feature of open positions

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Product Conversion Request :

Json Fields Possible value Description
exchange*- Specifies the Exchange for your trading symbol
order_type*BUY
SELL
Order type BUY/SELL
position_type*--
previous_product*CNC
INTRADAY
NORMAL
Previous product type to be converted
product_type*CNC
INTRADAY
NORMAL
New Product type to be after conversion, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both).
quantity*- Order Quantity (In multiple of lots for derivatives)
tradingsymbol*- Specifies the trading symbol

Product Conversion Response :

Json Fields Possible value Description
message- Shows the status message
status - Shows the status for the request

Request Message Format

{ "exchange": "NFO", "tradingsymbol": "NIFTY23FEB23F", "quantity": 50, "previous_product": "NORMAL", "order_type": "SELL", "product_type": "INTRADAY", "position_type": "DAY" }

Response Message Format

{ "status": "SUCCESS" }

GTT Order book

Particular

Details

API Name

Get GTT Order book

Relative URL

/gttorders

Method

GET

Content-Type

NA

Produces

Application/json

Description

This API returns order book data which represents all the open GTT orders.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

GTT Order book Response :

Json Fields Possible value Description
alert_id - Alert ID
tradingsymbol - Trading symbol as per master file
exchange - Specifies the Exchange for your trading symbol
token - Unique token ID for each symbol
remarks - Any tag by user to mark order.
order_time - Order Time
order_type BUY
SELL
Order type BUY/SELL
price_type LIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_type CNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
lotsize - For Derivatives symbols, specifies its lot size
trigger_price - Price at which the order should be triggered
quantity - Order quantity for this order (In multiple of lots for derivatives)
condition - Condition for the placed GTT / OCO order

Response Message Format

{ "status": "SUCCESS", "pendingGTTOrderBook": [ { "alert_id": "1234001", "tradingsymbol": "TCS-EQ", "exchange": "NSE", "token": "11536", "remarks": "", "order_time": "16:23:36 27-03-2023", "order_type": "BUY", "price_type": "LIMIT", "product_type": "CNC", "lotsize": "1", "trigger_price": "3385.00", "price": "3390.00", "quantity": "3", "condition": "LTP_ABOVE" }, { "alert_id": "1234002", "tradingsymbol": "RELIANCE-EQ", "exchange": "NSE", "token": "2885", "remarks": "", "order_time": "16:24:44 27-03-2023", "order_type": "BUY", "price_type": "LIMIT", "product_type": "CNC", "lotsize": "1", "trigger_price": "2195.00", "price": "2200.00", "quantity": "1", "condition": "LTP_BELOW" }, { "alert_id": "1234003", "tradingsymbol": "NIFTY29MAR23F", "exchange": "NFO", "token": "37834", "remarks": "admin", "order_time": "16:31:10 27-03-2023", "order_type": "SELL", "price_type": "LIMIT", "product_type": "NORMAL", "lotsize": "50", "stoploss_quantity": "50", "target_quantity": "50", "stoploss_price": "17700.00", "target_price": "17400.00", "stoploss_trigger": "17700.00", "target_trigger": "17400.00", "condition": "LMT_OCO" } ] }

Place GTT order

Particular

Details

API Name

Place GTT order

Relative URL

/gttplaceorder

Method

POST

Content-Type

Application/json

Produces

Application/json

Description

This API places GTT(Good Till Triggered) BUY/SELL orders.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Place GTT order Request :

Json Fields Possible value Description
exchange - Specifies the Exchange for your trading symbol
tradingsymbol - Trading symbol as per master file
condition LTP_ABOVE
LTP_BELOW
Condition for the placed GTT / OCO order
alert_price - Order Price
order_type BUY
SELL
Order type BUY/SELL
price - Order Price
quantity - Order quantity for this order (In multiple of lots for derivatives)

Place GTT order Response :

Json Fields Possible value Description
status - Shows the status for the request
alert_id - Alert ID
message - Shows the status message
request_time - Request time

Request Message Format

{ "exchange": "NSE", "tradingsymbol": "TCS-EQ", "condition": "LTP_BELOW", "alert_price": "3100", "order_type": "BUY", "quantity": "1", "price": "3100" }

Response Message Format

{ "status": "SUCCESS", "alert_id": "1234001", "message": "Order Submitted Successfully", "request_time": "11:31:32 27-03-2023" }

Modify GTT order

Particular

Details

API Name

Modify GTT order

Relative URL

/gttmodify

Method

POST

Content-Type

Application/json

Produces

Application/json

Description

This API modifies existing GTT order, if it is OPEN.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Modify GTT order Request :

Json Fields Possible value Description
exchange - Specifies the Exchange for your trading symbol
alert_id - Alert ID
tradingsymbol - Trading symbol as per master file
condition - Condition for the placed GTT / OCO order
alert_price - Order Price
order_type BUY
SELL
Order type BUY/SELL
price - Order Price
quantity - Order quantity for this order (In multiple of lots for derivatives)

Modify GTT order Response :

Json Fields Possible value Description
status - Shows the status for the request
alert_id - Alert ID
message - Shows the status message
request_time - Request time

Request Message Format

{ "exchange": "NSE", "alert_id": "1234001", "tradingsymbol": "TCS-EQ", "condition": "LTP_ABOVE", "alert_price": "3390", "order_type": "BUY", "quantity": "3", "price": "3390" }

Response Message Format

{ "status": "SUCCESS", "alert_id": "1234001", "message": "Order Modified Successfully", "request_time": "12:51:10 27-03-2023" }

Cancel GTT order

Particular

Details

API Name

Cancel GTT order

Relative URL

/gttcancel/{alert_id}

Method

GET

Content-Type

NA

Produces

Application/json

Description

This API cancels existing GTT order if it is OPEN.

Request message format

This is get request and order id needs to be put in request URL.

e.g. /gttcancel/1234001

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Cancel GTT order Response :

Json Fields Possible value Description
status - Shows the status for the request
alert_id - Alert ID
message - Shows the status message
request_time - Request time

Response Message Format

{ "status": "SUCCESS", "request_time": "12:52:00 27-03-2023", "alert_id": "1234001", "message": "Order cancelled Successfully" }

Place OCO Order

Particular

Details

API Name

Place OCO order

Relative URL

/ocoplaceorder

Method

POST

Content-Type

Application/json

Produces

Application/json

Description

This API places OCO(One Cancels Other) order.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Place OCO Order Request :

Json Fields Possible value Description
remarks - Any tag by user to mark order.
tradingsymbol - Trading symbol as per master file
exchange - Specifies the Exchange for your trading symbol
order_type BUY
SELL
Order type BUY/SELL
target_quantity - Target Quantity
stoploss_quantity - Stoploss Quantity
target_price - Target Price
stoploss_price - Stoploss Price

Place OCO Order Response :

Json Fields Possible value Description
status - Shows the status for the request
alert_id - Alert ID
message - Shows the status message
request_time - Request time

Request Message Format

{ "remarks": "admin", "tradingsymbol": "NIFTY29MAR23F", "exchange": "NFO", "order_type": "SELL", "target_quantity": "50", "stoploss_quantity": "50", "target_price": "17000", "stoploss_price": "17300" }

Response Message Format

{ "status": "SUCCESS", "request_time": "12:53:08 27-03-2023", "alert_id": "1234002", "message": "Order Submitted Successfully" }

Modify OCO Order

Particular

Details

API Name

Modify OCO order

Relative URL

/ocomodify

Method

POST

Content-Type

Application/json

Produces

Application/json

Description

This API modifies existing OCO order, if it is OPEN.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Modify OCO Order Request :

Json Fields Possible value Description
remarks - Any tag by user to mark order.
tradingsymbol - Trading symbol as per master file
exchange - Specifies the Exchange for your trading symbol
order_type BUY
SELL
Order type BUY/SELL
target_quantity - Target Quantity
stoploss_quantity - Stoploss Quantity
target_price - Target Price
stoploss_price - Stoploss Price
alert_id - Alert ID

Modify OCO Order Response :

Json Fields Possible value Description
status - Shows the status for the request
alert_id - Alert ID
message - Shows the status message
request_time - Request time

Request Message Format

{ "remarks": "admin", "tradingsymbol": "NIFTY29MAR23F", "exchange": "NFO", "order_type": "SELL", "target_quantity": "100", "stoploss_quantity": "100", "target_price": "17050", "stoploss_price": "17250", "alert_id": "1234002" }

Response Message Format

{ "status": "SUCCESS", "request_time": "12:54:06 27-03-2023", "alert_id": "1234002", "message": "Order Modified Successfully" }

Cancel OCO Order

Particular

Details

API Name

Cancel OCO order

Relative URL

/ococancel/{alert_id}

Method

GET

Content-Type

NA

Produces

Application/json

Description

This API cancels existing OCO order if it is OPEN.

Request message format

This is get request and order id needs to be put in request URL.

e.g. /ococancel/1234002

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Cancel OCO Order Response :

Json Fields Possible value Description
status - Shows the status for the request
alert_id - Alert ID
message - Shows the status message
request_time - Request time

Response Message Format

{ "status": "SUCCESS", "request_time": "12:54:41 27-03-2023", "alert_id": "1234002", "message": "Order cancelled Successfully" }

Limits

Particular

Details

API Name

Get Limits

Relative URL

/limits

Method

GET

Content-Type

NA

Produces

application/json

Description

This API provides limit across the segments

Request message format

NA

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Limit Response :

Json Fields Possible value Description
CACBuyUsed--
CACSellCredits--
additionalScripBasketMargin--
additionalScripBasketMarginCommodityIntraday--
additionalScripBasketMarginCommodityMargin--
additionalScripBasketMarginDerivativeIntraday--
additionalScripBasketMarginDerivativeMargin--
additionalScripBasketMarginFXIntraday--
additionalScripBasketMarginFXMargin--
brokerCollateralAmount--
brokerage--
brokerageCommodityBracketOrder--
brokerageCommodityHighLeverage--
brokerageCommodityIntraday--
brokerageCommodityMargin--
brokerageDerivativeBracketOrder--
brokerageDerivativeHighLeverage--
brokerageDerivativeIntraday--
brokerageDerivativeMargin--
brokerageEquityBracketOrder--
brokerageEquityCAC--
brokerageEquityHighLeverage--
brokerageEquityIntraday--
brokerageEquityMargin--
brokerageFXBracketOrder--
brokerageFXHighLeverage--
brokerageFXIntraday--
brokerageFXMargin--
cash--
collateral--
currentRealizedPNL--
currentRealizedPNLCommodityIntraday--
currentRealizedPNLCommodityMargin--
currentRealizedPNLDerivativeIntraday--
currentRealizedPNLDerivativeMargin--
currentRealizedPNLEquityCashNCarry--
currentRealizedPNLEquityIntraday--
currentRealizedPNLEquityMargin--
currentRealizedPNLFXIntraday--
currentRealizedPNLFXMargin--
currentUnrealizedMTOMCommodityIntraday--
currentUnrealizedMTOMCommodityMargin--
currentUnrealizedMTOMDerivativeIntraday--
currentUnrealizedMTOMDerivativeMargin--
currentUnrealizedMTOMEquityCashNCarry--
currentUnrealizedMTOMEquityIntraday--
currentUnrealizedMTOMEquityMargin--
currentUnrealizedMTOMFXIntraday--
currentUnrealizedMTOMFXMargin--
currentUnrealizedMtom--
dayCash--
exchange--
exposureMargin--
exposureMarginCommodityIntraday--
exposureMarginCommodityMargin--
exposureMarginDerivativeIntraday--
exposureMarginDerivativeMargin--
exposureMarginFXIntraday--
exposureMarginFXMargin--
grcoll--
grossExposure--
grossExposureDerivative--
marginProduct--
marginProductCommodityBracketOrder--
marginProductCommodityHighLeverage--
marginProductDerivativeBracketOrder--
marginProductDerivativeHighLeverage--
marginProductEquityBracketOrder--
marginProductEquityHighLeverage--
marginProductFXBracketOrder--
marginProductFXHighLeverage--
marginUsed--
message--
mtomCurrentPercentage--
optionPremiumCommodityIntraday--
optionPremiumCommodityMargin--
optionPremiumDerivativeIntraday--
optionPremiumDerivativeMargin--
optionPremiumFXIntraday--
optionPremiumFXMargin--
payin--
payout--
peakMarginUsedByClient--
pendordval--
pendordvallmt--
premium--
product--
requestTime --
scripBasketMargin--
scripBasketMarginEquityCashNCarry--
scripBasketMarginEquityIntraday--
scripBasketMarginEquityMargin--
segment--
span--
spanMarginCommodityIntraday--
spanMarginCommodityMargin--
spanMarginDerivativeIntraday--
spanMarginDerivativeMargin--
spanMarginFXIntraday--
spanMarginFXMargin--
status --
turnOverLimit--
turnover--
unClearedCash--
varElmEquityCashNCarry--
varElmEquityIntraday--
varElmEquityMargin--
varElmMargin--

Response Message Format

{ "status": "SUCCESS", "cash": "2500000.00", "payin": "0.00", "payout": "0.0", "brokerCollateralAmount": "0.00", "unClearedCash": "0.00", "dayCash": "0.00", "turnOverLimit": "750000000.00", "pendordvallmt": "450000000.00" }

Get Margin

Particular

Details

API Name

Get Order Margin

Relative URL

/margin

Method

POST

Content-Type

application/json

Produces

application/json

Description

This API provides margin required for multiple order. If multiple orders are required to be placed this use this API and pass information about trading symbols for which order is to be placed.

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Basket Margin Request :

Json Fields Possible value Description
basketlistsRefer below table Basket Margin Item Request
exchange- Exchange to which order will be placed
order_typeBUY
SELL
Order type BUY/SELL
price- Price to place the order (Should be 0 in case of price_type = Market)
price_typeLIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_typeCNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity- Order quantity for this order (In multiple of lots for derivatives)
tradingsymbol- Trading symbol as per master file
trigger_price- Price at which the order should be triggered (only for price_type = SL_LIMIT or SL-MARKET)

Basket Margin Item Request :

Json Fields Possible value Description
book_loss_price- Shows Stoploss price. Applicable only for Bracket orders
exchange- Exchange to which order will be placed
filled_qty- Total Traded / filled quantity
order_id- Shows Order ID
order_typeBUY
SELL
Order type BUY/SELL
price- Price to place the order (Should be 0 in case of price_type = Market)
price_typeLIMIT
MARKET
SL-LIMIT
SL-MARKET
Price type for order. Supported values are from LIMIT/MARKET/SL-LIMIT/SL-MARKET
product_typeCNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
quantity- Order quantity for this order (In multiple of lots for derivatives)
tradingsymbol- Trading symbol as per master file
trigger_price- Price at which the order should be triggered (only for price_type = SL_LIMIT or SL-MARKET)

Basket Margin Response :

Json Fields Possible value Description
status - Place order success or failure indication.
requestTime - Response received time.
remarks - This field will contain rejection reason.
newTotalMarginUsed - Total margin used.
newMarginUsedAfterTrade - Margin used after trade.
errorMessage - This will be present only if Order placement fails
marginUsed - -

Request Message Format

{ "basketlists": [ { "exchange": "NFO", "tradingsymbol": "NIFTY23FEB23F", "quantity": "50", "price": "18000", "product_type": "INTRADAY", "order_type": "BUY", "price_type": "LIMIT" } ] }

Response Message Format

{ "status": "SUCCESS", "remarks": "", "newTotalMarginUsed": "109263.47", "newMarginUsedAfterTrade": "113898.47", "marginUsed": "9056.27" }

Span Calculator

Particular

Details

API Name

Span calculator

Relative URL

/spancalculator

Method

POST

Content-Type

application/json

Produces

application/json

Description

This API provides span information for supplied trading symbols

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Span Calculator Request Item :

Json Fields Possible value Description
exchange- Specifies the Exchange for your tradingsymbol
expiry- For derivatives, specifies expiry of the contract
net_qty- Net Traded quantity
open_buy_qty- Open buy quantity
open_sell_qty- Open sell quantity
option_strike- Option Strike price
option_type- Option type, whether CE or PE
product_typeCNC
INTRADAY
NORMAL
Indicates product type, whether Normal(Derivatives only), CNC(Equity only) or Intraday(both)
symbol_name- symbol_name
tradingsymbol- Specifies the trading symbol

Span Calculator Response :

Json Fields Possible value Description
exposure- Exposure Margin
exposureTrade --
message- Shows the status message
request_time --
span - Span Margin
spanTrade --
status - Shows the status for the request

Request Message Format

{ "positions": [ { "product_type": "NORMAL", "exchange": "NFO", "symbol_name": "NIFTY", "tradingsymbol": "NIFTY23FEB2317700C", "expiry": "23-FEB-2023", "open_sell_qty": 100, "open_buy_qty": 0, "option_strike": "17700", "option_type": "CE" }, { "product_type": "NORMAL", "exchange": "NFO", "symbol_name": "NIFTY", "tradingsymbol": "NIFTY23FEB2317700P", "expiry": "23-FEB-2023", "open_sell_qty": 100, "open_buy_qty": 0, "option_strike": "17700", "option_type": "PE" } ] }

Response Message Format

{ "status": "SUCCESS", "span": "328482.00", "exposure": "70660.00", "spanTrade": "328482.00", "exposureTrade": "70660.00", "request_time": "19:08:56 01-02-2023" }

Get Quotes

Particular

Details

API Name

Get Quotes

Relative URL

/quotes/{exchange}/{token}

Method

GET

Content-Type

NA

Produces

application/json

Description

This API provides quotes information for supplied trading symbols

Request message format

Create a GET request and put exchange and token in request URL.

e.g. /quotes/NSE/22

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Get Quotes Response :

Json Fields Possible value Description
average_traded_price - Average price of the traded quantity
best_ask_orders1- Orders for Best Ask 1
best_ask_orders2- Orders for Best Ask 2
best_ask_orders3- Orders for Best Ask 3
best_ask_orders4- Orders for Best Ask 4
best_ask_orders5- Orders for Best Bid 5
best_ask_price1- Best Ask Price 1
best_ask_price2- Best Ask Price 2
best_ask_price3 - Best Ask Price 3
best_ask_price4 - Best Ask Price 4
best_ask_price5- Best Ask Price 5
best_ask_qty1- Quantity for Best Ask 1
best_ask_qty2- Quantity for Best Ask 2
best_ask_qty3- Quantity for Best Ask 3
best_ask_qty4- Quantity for Best Ask 4
best_ask_qty5- Quantity for Best Ask 5
best_bid_orders1- Orders for Best Bid 1
best_bid_orders2- Orders for Best Bid 2
best_bid_orders3- Orders for Best Bid 3
best_bid_orders4- Orders for Best Bid 4
best_bid_orders5- Orders for Best Bid 5
best_bid_price1- Best Bid Price 1
best_bid_price2- Best Bid Price 2
best_bid_price3- Best Bid Price 3
best_bid_price4- Best Bid Price 4
best_bid_price5- Best Bid Price 5
best_bid_qty1- Quantity for Best Bid 1
best_bid_qty2- Quantity for Best Bid 2
best_bid_qty3- Quantity for Best Bid 3
best_bid_qty4- Quantity for Best Bid 4
best_bid_qty5- Quantity for Best Bid 5
company_name- Specifies Company name in case of NSE Equity Symbol
day_high- Day High Price
day_low- Day Low Price
day_open- Day Open Price
exchange- Exchange to which order will be placed
instrument_name- Specifies name of the instrument
isin- Specifies ISIN code for the given scrip, in case of Equity Scrips
last_trade_time- Time for the last executed trade
last_traded_qty- Quantity for the last executed trade
lotsize - For Derivatives symbols, specifies its lot size
lower_circuit - Current Lower Circuit limit for the symbol
ltp- Specifies the Last Traded Price for that scrip
message- Shows the status message
multiplier- Contract price multiplier, (used for order value calculation)
price_factor- Price factor ((GN / GD) * (PN/PD))
price_precision- Price Precision
segment- Specifies Segment, whether equity or derivatives
status- Shows the status for the request
symbol_name -
ticksize- Tick size for the mentioned symbol
token- Unique token ID for each symbol
tradingsymbol- Trading symbol as per master file
upper_circuit- Current Upper Circuit limit for the symbol
volume- Total Volume for the day

Response Message Format

{ "status": "SUCCESS", "lotsize": "1", "exchange": "NSE", "tradingsymbol": "ACC-EQ", "company_name": "ACC LIMITED", "symbol_name": "ACC", "segment": "EQT", "instrument_name": "EQ", "isin": "INE012A01025", "ticksize": "0.05", "price_precision": "2", "multiplier": "1", "upper_circuit": "2165.10", "lower_circuit": "1673.05", "price_factor": "(1 / 1 ) * (1 / 1)", "ltp": "1858.00", "day_high": "2008.50", "day_low": "1750.00", "volume": "4839643", "last_traded_qty": "2", "last_trade_time": "15:29:59", "best_bid_price1": "1858.00", "best_ask_price1": "1859.00", "best_bid_price2": "1855.00", "best_ask_price2": "1859.90", "best_bid_price3": "1854.00", "best_ask_price3": "1860.00", "best_bid_price4": "1853.00", "best_ask_price4": "1860.85", "best_bid_price5": "1852.60", "best_ask_price5": "1862.00", "best_bid_qty1": "8", "best_ask_qty1": "94", "best_bid_qty2": "1", "best_ask_qty2": "242", "best_bid_qty3": "10", "best_ask_qty3": "292", "best_bid_qty4": "20", "best_ask_qty4": "34", "best_bid_qty5": "100", "best_ask_qty5": "10", "best_bid_orders1": "1", "best_ask_orders1": "4", "best_bid_orders2": "1", "best_ask_orders2": "7", "best_bid_orders3": "1", "best_ask_orders3": "14", "best_bid_orders4": "1", "best_ask_orders4": "1", "best_bid_orders5": "1", "best_ask_orders5": "1", "day_open": "1999.50", "average_traded_price": "1858.91" }

Security Information

Particular

Details

API Name

Security information

Relative URL

/securityinfo/{exchange}/{token}

Method

GET

Content-Type

NA

Produces

application/json

Description

This API provides details about the mentioned security for that token.

Request message format

Create a GET request and put exchange and token in request URL.

e.g. /quotes/NSE/22

Request Header

Authorization: Actual value of api_session_key

This key is received from token response

Get Security Info Response :

Json Fields Possible value Description
additional_buy_margin- Additional margin for Buy order
additional_sell_margin- Additional margin for Sell order
company_name- Specifies Company name in case of NSE Equity Symbol
deliveryMargin- -
deliveryUnits- -
elmMargin- -
elm_buy_margin- Extreme Loss margin for Buy order
elm_sell_margin- Extreme Loss margin for Sell order
exchange- Exchange to which order will be placed
exerciseEndDate--
exerciseStartDate- -
expiry- For derivatives, specifies expiry of the contract
exposureMargin--
freeze_qty- Freeze Quantity
instrument_name--
isin- Specifies ISIN code for the given scrip, in case of Equity Scrips
issueDate- -
last_trade_date- Date for the last executed trade
listingDate- -
lotsize- For Derivatives symbols, specifies its lot size
marketType- -
message- -
multiplier- Contract price multiplier, (used for order value calculation)
nonTradableInstruments- -
option_strike- Option Strike price
option_type- Option type, whether CE or PE
prcftr_d- -
priceQuoteQuantity- -
priceUnit- -
price_precision- Price Precision
requestTime- -
segment- Specifies Segment, whether equity or derivatives
special_buy_margin- Special margin for Buy order
special_sell_margin- Special margin for Sell order
status- Shows the status for the request
symbol_name- Specifies Symbol name
tenderEndDate--
tenderMargin- -
tenderStartDate--
ticksize- Tick size for the mentioned symbol
token-Unique token ID for each symbol
tradeUnits- -
tradingsymbol- Trading symbol as per master file
varMargin- -
weeklyOption- -

Response Message Format

{ "requestTime": "16:33:33 03-02-2023", "status": "SUCCESS", "exchange": "NSE", "tradingsymbol": "ACC-EQ", "company_name": "ACC LIMITED", "segment": "EQT", "instrument_name": "EQ", "ticksize": "0.05", "lotsize": "1", "price_precision": "2", "multiplier": "1", "isin": "INE012A01025", "freeze_qty": "54270", "deliveryMargin": "0.00", "varMargin": "20.00", "token": "22", "prcftr_d": "(1/1)*(1/1)", "issueDate": "24-10-1994", "listingDate": "01-01-1980" }

Web Socket API

CONNECT

WebSocket connection URL: wss://trade.definedgesecurities.com/NorenWSTRTP/

Note: One connection can be made at a time and 500 tokens per connection are allowed.

Request :

Json Fields Possible value Description
t c ‘c’ represents connect task
uid - User ID
actid - Account id
source TRTP Source should be TRTP
susertoken - User Session Token 

Response :

Json Fields Possible value Description
t ck ‘ck’ represents connect acknowledgement
uid - User ID 
s - Ok or Not_Ok(in case of invalid user id or session id)

HEARTBEAT

Heartbeat message must be sent every 50 secs in order to keep the connection alive.
It will be a json object, as mentioned besides.
Note: There will be no response for the sent heartbeat message


Heartbeat Message

{ "t": "h" }

SUBSCRIBE TOUCHLINE

Request :

Json Fields Possible value Description
t t ‘t’ represents touchline task 
k - One or more scriplist for subscription. Example NSE|22#BSE|508123#NSE|NIFTY

Subscription Acknowledgement :

Number of Acknowledgements for a single subscription will be the same as the number of scrips mentioned in the key (k) field.

Json Fields Possible value Description
t tk ‘tk’ represents connect acknowledgement
e NSE, BSE, NFO .. Exchange name 
tk 22 Scrip Token
pp 2 for NSE, BSE
4 for CDS USDINR
Price precision
ts - Trading Symbol
ti - Tick size
ls - Lot size
lp - LTP
pc - Percentage change
v - volume
o - Open price
h - High price
I - Low price
c - Close price
ap - Average trade price
oi - Open interest
poi - Previous day closing Open Interest
toi - Total open interest for underlying
bq1 - Best Buy Quantity 1
bp1 - Best Buy Price 1
sq1 - Best Sell Quantity 1
sp1 - Best Sell Price 1

 

TouchLine subscription Updates :

Accept for t, e, and tk other fields may / may not be present.

Json Fields Possible value Description
t tf ‘tf’ represents touchline feed
e NSE, BSE, NFO .. Exchange name 
tk 22 Scrip Token
ft - Feed time
lp - LTP
pc - Percentage change
v - volume
o - Open price
h - High price
l - Low price
c - Close price
ap - Average trade price
oi - Open interest
poi - Previous day closing Open Interest
toi - Total open interest for underlying
bq1 - Best Buy Quantity 1
bp1 - Best Buy Price 1
sq1 - Best Sell Quantity 1
sp1 - Best Sell Price 1

UNSUBSCRIBE TOUCHLINE

Request :

Json Fields Possible value Description
t u ‘u’ represents Unsubscribe Touchline 
k - One or more scriplist for unsubscription. Example NSE|22#BSE|508123

Response :

Json Fields Possible value Description
t uk ‘uk’ represents Unsubscribe Touchline acknowledgement 
k - One or more scriplist for unsubscription. Example NSE|22#BSE|508123

SUBSCRIBE DEPTH

Request :

Json Fields Possible value Description
t d ‘d’ represents depth subscription
k - One or more scriplist for subscription. Example NSE|22#BSE|508123 

Subscription Depth Acknowledgement :

Number of Acknowledgements for a single subscription will be the same as the number of scrips mentioned in the key (k) field.

Json Fields Possible value Description
t dk ‘dk’ represents depth acknowledgement
e NSE, BSE, NFO .. Exchange name
tk 22 Scrip Token 
lp - LTP
pc - Percentage change
v - volume
o - Open price
h - High price
l - Low price
c - Close price
ap - Average trade price
ltt - Last trade time
ltq - Last trade quantity
tbq - Total Buy Quantity
tsq - Total Sell Quantity
bq1 - Best Buy Quantity 1
bq2 - Best Buy Quantity 2
bq3 - Best Buy Quantity 3
bq4 - Best Buy Quantity 4
bq5 - Best Buy Quantity 5
bp1 - Best Buy Price 1
bp2 - Best Buy Price 2
bp3 - Best Buy Price 3
bp4 - Best Buy Price 4
bp5 - Best Buy Price 5
bo1 - Best Buy Orders 1
bo2 - Best Buy Orders 2
bo3 - Best Buy Orders 3
bo4 - Best Buy Orders 4
bo5 - Best Buy Orders 5
sq1 - Best Sell Quantity 1
sq2 - Best Sell Quantity 2
sq3 - Best Sell Quantity 3
sq4 - Best Sell Quantity 4
sq5 - Best Sell Quantity 5
sp1 - Best Sell Price 1
sp2 - Best Sell Price 2
sp3 - Best Sell Price 3
sp4 - Best Sell Price 4
sp5 - Best Sell Price 5
so1 - Best Sell Orders 1
so2 - so3
so4 - Best Sell Orders 4
so5 - Best Sell Orders 5
lc - Lower Circuit Limit
uc - Upper Circuit Limit
52h - 52 week high low in other exchanges, Life time high low in mcx
52l - 52 week high low in other exchanges, Life time high low in mcx
oi - Open interest
poi - Previous day closing Open Interest
toi - Total open interest for underlying

 

Depth subscription Updates :

Json Fields Possible value Description
t df ‘df’ represents depth feed
e NSE, BSE, NFO .. Exchange name
tk 22 Scrip Token
lp - LTP
pc - Percentage change
v - volume
o - Open price
h - High price
l - Low price 
c - Close price
ap - Average trade price
ltt - Last trade time
ltq - Last trade quantity
tbq - Total Buy Quantity
tsq - Total Sell Quantity
bq1 - Best Buy Quantity 1
bq2 - Best Buy Quantity 2
bq3 - Best Buy Quantity 3
bq4 - Best Buy Quantity 4
bq5 - Best Buy Quantity 5
bp1 - Best Buy Price 1
bp2 - Best Buy Price 2
bp3 - Best Buy Price 3
bp4 - Best Buy Price 4
bp5 - Best Buy Price 5
bo1 - Best Buy Orders 1
bo2 - Best Buy Orders 2
bo3 - Best Buy Orders 3
bo4 - Best Buy Orders 4
bo5 - Best Buy Orders 5
sq1 - Best Sell Quantity 1
sq2 - Best Sell Quantity 2
sq3 - Best Sell Quantity 3
sq4 - Best Sell Quantity 4
sq5 - Best Sell Quantity 5
sp1 - Best Sell Price 1
sp2 - Best Sell Price 2
sp3 - Best Sell Price 3
sp4 - Best Sell Price 4
sp5 - Best Sell Price 5
so1 - Best Sell Orders 1
so2 - so3
so4 - Best Sell Orders 4
so5 - Best Sell Orders 5
lc - Lower Circuit Limit
uc - Upper Circuit Limit
52h - 52 week high low in other exchanges, Life time high low in mcx
52l - 52 week high low in other exchanges, Life time high low in mcx
oi - Open interest
poi - Previous day closing Open Interest
toi - Total open interest for underlying

Sample Message

{ "t": "df", "e": "NSE", "tk": "22", "o": "1166.00", "h": "1179.00", "l": "1145.35", "c": "1152.65", "ap": "1159.74", "v": "819881", "tbq": "120952", "tsq": "131730", "bp1": "1156.00", "sp1": "1156.50", "bp2": "1155.80", "sp2": "1156.55", "bp3": "1155.75", "sp3": "1156.65", "bp4": "1155.70", "sp4": "1156.70", "bp5": "1155.65", "sp5": "1156.75", "bq1": "4", "sq1": "10", "bq2": "67", "sq2": "63", "bq3": "83", "sq3": "1", "bq4": "139", "sq4": "53", "bq5": "393", "sq5": "94" }

UNSUBSCRIBE DEPTH

Request :

Json Fields Possible value Description
t ud ‘ud’ represents Unsubscribe depth
k - One or more scriplist for unsubscription. Example NSE|22#BSE|508123 

 

Response :

Json Fields Possible value Description
t udk ‘udk’ represents unsubscribe depth acknowledgement
k - One or more scriplist for unsubscription. Example NSE|22#BSE|508123 

Order Update Web Socket

SUBSCRIBE ORDER UPDATE

Request :

Json Fields Possible value Description
t o ‘o’ represents order update subscription task 
actid - Account id based on which order updated to be sent.

 

Subscription Acknowledgement :

Json Fields Possible value Description
t ok ‘ok’ represents order update subscription acknowledgement
t om ‘om’ represents touchline feed 
norenordno - Noren Order Number
uid - User Id
actid - Account ID
exch - Exchange
tsym - Trading symbol
qty - Order quantity
prc - Order Price
prd - Product
status - Order status (New, Replaced, Complete, Rejected etc)
reporttype - Order event for which this message is sent out. (Fill, Rejected, Canceled)
trantype - Order transaction type, buy or sell
prctyp - Order price type (LMT, MKT, SL-LMT, SL-MKT)
ret - Order retention type (DAY, EOS, IOC,...)
fillshares - Total Filled shares for this order
avgprc - Average fill price
fltm - Fill Time(present only when reporttype is Fill)
flid - Fill ID (present only when reporttype is Fill)
flqty - Fill Qty(present only when reporttype is Fill)
flprc - Fill Price(present only when reporttype is Fill)
rejreason - Order rejection reason, if rejected
exchordid - Exchange Order ID
cancelqty - Canceled quantity, in case of canceled order
remarks - User added tag, while placing order
dscqty - Disclosed quantity
trgprc - Trigger price for SL orders
snonum - This will be present for child orders in case of cover and bracket orders, if present needs to be sent during exit
snoordt - This will be present for child orders in case of cover and bracket orders, it will indicate whether the order is profit or stoploss
blprc - This will be present for cover and bracket parent order. This is the differential stop loss trigger price to be entered.
bpprc - This will be present for bracket parent order. This is the differential profit price to be entered.
trailprc - This will be present for cover and bracket parent order. This is required if trailing ticks is to be enabled.
exch_tm - This will have the exchange update time

UNSUBSCRIBE ORDER UPDATE

Request :

Json Fields Possible value Description
t uo ‘uo’ represents Unsubscribe Order update 
t uok ‘uok’ represents Unsubscribe Order update acknowledgement
Open Demat Account