Market and instruments¶
Between multiple exchanges and segments, there are tens of thousands of different kinds of instruments that trade. Any application that facilitates trading needs to have a master list of these instruments.
The market API calls provide a consolidated, import-ready list of instruments available for trading.
type | endpoint | |
---|---|---|
GET | /instruments | Retrieve the CSV dump of all tradable instruments |
GET | /instruments/:exchange | Retrieve the CSV dump of instruments in the particular exchange |
Retrieving full instrument list¶
Unlike the rest of the calls that return JSON, the instrument list API returns a gzipped CSV dump of instruments across all exchanges that can be imported into a database. The dump is generated once everyday and hence last_price is not real time.
curl "https://api.kite.trade/instruments"
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token" \
instrument_token, exchange_token, tradingsymbol, name, last_price, expiry, strike, tick_size, lot_size, instrument_type, segment, exchange
408065,1594,INFY,INFOSYS,0,,,0.05,1,EQ,NSE,NSE
5720322,22345,NIFTY15DECFUT,,78.0,2015-12-31,,0.05,75,FUT,NFO-FUT,NFO
5720578,22346,NIFTY159500CE,,23.0,2015-12-31,9500,0.05,75,CE,NFO-OPT,NFO
645639,SILVER15DECFUT,,7800.0,2015-12-31,,1,1,FUT,MCX,MCX
Response columns¶
column | |
---|---|
instrument_token string |
Numerical identifier used for subscribing to live market quotes with the WebSocket API. |
exchange_token string |
The numerical identifier issued by the exchange representing the instrument. |
tradingsymbol string |
Exchange tradingsymbol of the instrument |
name string |
Name of the company (for equity instruments) |
last_price float |
Last traded market price |
expiry string |
Expiry date (for derivatives) |
strike float |
Strike (for options) |
tick_size float |
Value of a single price tick |
lot_size int |
Quantity of a single lot |
instrument_type string |
EQ, FUT, CE, PE |
segment string |
Segment the instrument belongs to |
exchange string |
Exchange |
Warning
The instrument list API returns large amounts of data. It's best to request it once a day (ideally at around 08:30 AM) and store in a database at your end.
Retrieving full market quotes¶
type | endpoint | |
---|---|---|
GET | /quote | Retrieve the CSV dump of all tradable instruments |
GET | /quote/ohlc | Retrieve the CSV dump of instruments in the particular exchange |
GET | /quote/ltp | Retrieve the CSV dump of instruments in the particular exchange |
This API returns the complete market data snapshot of up to 250 instruments in one go. It includes the quantity, OHLC, and Open Interest fields, and the complete bid/ask market depth amongst others.
Instruments are identified by the exchange:tradingsymbol
combination and are passed as values to the query parameter i
which is repeated for every instrument. If there is no data available for a given key, the key will be absent from the response. The existence of all the instrument keys in the response map should be checked before to accessing them.
curl "https://api.kite.trade/quote?i=41729&i=NSE:INFY" \
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token"
{
"status": "success",
"data": {
"41729": {
"instrument_token": 41729,
"timestamp": "2018-01-12 10:31:54",
"last_price": 278.75,
"last_quantity": 8,
"last_trade_time": "2018-01-12 10:31:54",
"average_price": 279.04,
"volume": 559981,
"buy_quantity": 703982,
"sell_quantity": 424423,
"ohlc": {
"open": 279.45,
"high": 280.55,
"low": 277.4,
"close": 279.05
},
"net_change": 0,
"open_interest": 0,
"day_high_oi": 0,
"day_low_oi": 0,
"depth": {
"buy": [
{
"price": 278.7,
"quantity": 750,
"orders": 1
},
{
"price": 278.6,
"quantity": 340,
"orders": 3
},
{
"price": 278.55,
"quantity": 1880,
"orders": 5
},
{
"price": 278.5,
"quantity": 2259,
"orders": 10
},
{
"price": 278.45,
"quantity": 1456,
"orders": 4
}
],
"sell": [
{
"price": 278.75,
"quantity": 117,
"orders": 5
},
{
"price": 278.8,
"quantity": 382,
"orders": 2
},
{
"price": 278.85,
"quantity": 5,
"orders": 1
},
{
"price": 278.9,
"quantity": 518,
"orders": 2
},
{
"price": 278.95,
"quantity": 2663,
"orders": 7
}
]
}
},
"NSE:INFY": {
"instrument_token": 408065,
"timestamp": "2018-01-12 10:31:54",
"last_price": 1075.1,
"last_quantity": 14,
"last_trade_time": "2018-01-12 10:31:53",
"average_price": 1077.13,
"volume": 1311662,
"buy_quantity": 235801,
"sell_quantity": 496803,
...
}
}
}
Response attributes¶
attribute | |
---|---|
last_price float |
Last traded market price |
volume int |
Volume traded today |
buy_quantity int |
Total quantity of buy orders |
sell_quantity int |
Total quantity of sell orders |
open_interest float |
Total number of outstanding contracts held by market participants exchange-wide (only F&O) |
last_quantity int |
Last traded quantity |
last_time null, string |
Time of last trade |
ohlc.open float |
Price at market opening |
ohlc.high float |
Highest price today |
ohlc.low float |
Lowest price today |
ohlc.close float |
Closing price of the instrument from the last trading day |
depth.buy[].price float |
Price at which the depth stands |
depth.buy[].orders int |
Number of open BUY (bid) orders at the price |
depth.buy[].quantity int |
Net quantity from the pending orders |
depth.sell[].price float |
Price at which the depth stands |
depth.sell[].orders int |
Number of open SELL (ask) orders at the price |
depth.sell[].quantity int |
Net quantity from the pending orders |
Retrieving OHLC quotes¶
This API returns the OHLC + LTP snapshots of up to 250 instruments in one go.
Instruments are identified by the exchange:tradingsymbol
combination and are passed as values to the query parameter i
which is repeated for every instrument. If there is no data available for a given key, the key will be absent from the response. The existence of all the instrument keys in the response map should be checked before to accessing them.
curl "https://api.kite.trade/quote/ohlc?i=NSE:INFY&i=BSE:SENSEX&i=NSE:NIFTY+50"
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token"
{
"status": "success",
"data": {
"BSE:SENSEX": {
"instrument_token": 265,
"last_price": 31606.48,
"ohlc": {
"open": 31713.5,
"high": 31713.5,
"low": 31586.53,
"close": 31809.55
}
},
"NSE:INFY": {
"instrument_token": 408065,
"last_price": 890.9,
"ohlc": {
"open": 900,
"high": 900.3,
"low": 890,
"close": 901.9
}
},
"NSE:NIFTY 50": {
"instrument_token": 256265,
"last_price": 9893.4,
"ohlc": {
"open": 9899.25,
"high": 9911.9,
"low": 9882.55,
"close": 9952.2
}
}
}
}
Response attributes¶
attribute | |
---|---|
instrument_token uint32 |
The numerical identifier issued by the exchange representing the instrument. |
last_price float |
Last traded market price |
ohlc.open float |
Price at market opening |
ohlc.high float |
Highest price today |
ohlc.low float |
Lowest price today |
ohlc.close float |
Closing price of the instrument from the last trading day |
Note
Always check for the existence of a particular key you've requested (eg: NSE:INFY) in the response. If there's no data for the particular instrument or if it has expired, the key will be missing from the response.
Retrieving LTPs quotes¶
This API returns the LTPs of up to 250 instruments in one go.
Instruments are identified by the exchange:tradingsymbol
combination and are passed as values to the query parameter i
which is repeated for every instrument. If there is no data available for a given key, the key will be absent from the response. The existence of all the instrument keys in the response map should be checked before to accessing them.
curl "https://api.kite.trade/quote/ltp?i=NSE:INFY&i=BSE:SENSEX&i=NSE:NIFTY+50"
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token"
{
"status": "success",
"data": {
"BSE:SENSEX": {
"instrument_token": 265,
"last_price": 31606.48
},
"NSE:INFY": {
"instrument_token": 408065,
"last_price": 890.9
},
"NSE:NIFTY 50": {
"instrument_token": 256265,
"last_price": 9893.4
}
}
}
Response attributes¶
attribute | |
---|---|
instrument_token uint32 |
The numerical identifier issued by the exchange representing the instrument. |
last_price float |
Last traded market price |
Note
Always check for the existence of a particular key you've requested (eg: NSE:INFY) in the response. If there's no data for the particular instrument or if it has expired, the key will be absent from the response.