Orders¶
The order APIs let you place orders of different varities, modify and cancel pending orders, retrieve the daily order and more.
| type | endpoint | |
|---|---|---|
| POST | /orders/:variety | Place an order of a particular variety |
| PUT | /orders/:variety/:order_id | Modify an open or pending order |
| DELETE | /orders/:variety/:order_id | Cancel an open or pending order |
| GET | /orders | Retrieve the list of all orders (open and executed) for the day |
| GET | /orders/:order_id | Retrieve the history of a given order |
| GET | /trades | Retrieve the list of all executed trades for the day |
| GET | /orders/:order_id/trades | Retrieve the trades generated by an order |
Glossary of constants¶
Here are several of the constant enum values used for placing orders.
| param | values | |
|---|---|---|
variety |
regular |
Regular order |
amo |
After Market Order | |
co |
Cover Order ? | |
iceberg |
Iceberg Order ? | |
auction |
Auction Order ? | |
order_type |
MARKET |
Market order |
LIMIT |
Limit order | |
SL |
Stoploss order ? | |
SL-M |
Stoploss-market order ? | |
product |
CNC |
Cash & Carry for equity ? |
NRML |
Normal for futures and options ? | |
MIS |
Margin Intraday Squareoff for futures and options ? | |
MTF |
Margin Trading Facility ? | |
validity |
DAY |
Regular order |
IOC |
Immediate or Cancel | |
TTL |
Order validity in minutes | |
market_protection |
0 |
No market protection (default) |
0 - 100 |
Custom market protection percentage (e.g., 2 for 2% protection, 10 for 10% protection) | |
-1 |
Automatic market protection applied by the system as per market protection guidelines | |
autoslice |
true |
Enable automatic order slicing for quantities above freeze limits ? |
false |
Disable automatic order slicing (default) |
Placing orders¶
Placing an order implies registering it with the OMS via the API. This does not guarantee the order's receipt at the exchange. The fate of an order is dependent on several factors including market hours, availability of funds, risk checks and so on. Under normal circumstances, order placement, receipt by the OMS, transport to the exchange, execution, and the confirmation roundtrip happen instantly.
When an order is successfully placed, the API returns an order_id. The status of the order is not known at the moment of placing because of the aforementioned reasons.
In case of non-MARKET orders that may be open indefinitely during the course of a trading day, it is not practical to poll the order APIs continuously to know the status. For this, postbacks are ideal as they sent order updates asynchronously as they happen.
Note
Successful placement of an order via the API does not imply its successful execution. To know the true status of a placed order, you should scan the order history or retrieve the particular order's current details using its order_id.
Order varieties¶
You can place orders of different varieties—regular orders, after market orders, cover orders, iceberg orders etc. See the list of varieties here.
curl https://api.kite.trade/orders/regular \
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token" \
-d "tradingsymbol=ACC" \
-d "exchange=NSE" \
-d "transaction_type=BUY" \
-d "order_type=MARKET" \
-d "quantity=1" \
-d "product=MIS" \
-d "validity=DAY"
{
"status": "success",
"data": {
"order_id": "151220000000000"
}
}
Regular order parameters¶
These parameters are common across different order varieties.
| parameter | |
|---|---|
tradingsymbol |
Tradingsymbol of the instrument ? |
exchange |
Name of the exchange (NSE, BSE, NFO, CDS, BCD, MCX) |
transaction_type |
BUY or SELL |
order_type |
Order type (MARKET, LIMIT etc.) |
quantity |
Quantity to transact |
product |
Margin product to use for the order (margins are blocked based on this) ? |
price |
The price to execute the order at (for LIMIT orders) |
trigger_price |
The price at which an order should be triggered (SL, SL-M) |
disclosed_quantity |
Quantity to disclose publicly (for equity trades) |
validity |
Order validity (DAY, IOC and TTL) |
validity_ttl |
Order life span in minutes for TTL validity orders |
iceberg_legs |
Total number of legs for iceberg order type (number of legs per Iceberg should be between 2 and 10) |
iceberg_quantity |
Split quantity for each iceberg leg order (quantity/iceberg_legs) |
auction_number string |
A unique identifier for a particular auction |
market_protection |
Market protection percentage for MARKET and SL-M orders. Values: 0 (no protection), 0-100 (custom %), -1 (auto protection) |
autoslice |
Enable automatic slicing for orders exceeding freeze quantity limits. Values: true (enable), false (disable, default) ? |
tag |
An optional tag to apply to an order to identify it (alphanumeric, max 20 chars) |
Modifying orders¶
As long as on order is open or pending in the system, certain attributes of it may be modified. It is important to sent the right value for :variety in the URL.
curl --request PUT https://api.kite.trade/orders/regular/151220000000000 \
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token" \
-d "order_type=MARKET" \
-d "quantity=3" \
-d "validity=DAY"
{
"status": "success",
"data": {
"order_id": "151220000000000"
}
}
Regular order parameters¶
| parameter | |
|---|---|
order_type |
|
quantity |
|
price |
|
trigger_price |
|
disclosed_quantity |
|
validity |
Cover order (CO) parameters¶
| parameter | |
|---|---|
order_id |
Unique order ID |
price |
The price to execute the order at |
trigger_price |
For LIMIT Cover orders |
Cancelling orders¶
As long as on order is open or pending in the system, it can be cancelled.
curl --request DELETE \
"https://api.kite.trade/orders/regular/151220000000000" \
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token" \
{
"status": "success",
"data": {
"order_id": "151220000000000"
}
}
Retrieving orders¶
The order history or the order book is transient as it only lives for a day in the system. When you retrieve orders, you get all the orders for the day including open, pending, and executed ones.
curl "https://api.kite.trade/orders" \
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token"
{
"status": "success",
"data": [
{
"placed_by": "XXXXXX",
"order_id": "100000000000000",
"exchange_order_id": "200000000000000",
"parent_order_id": null,
"status": "CANCELLED",
"status_message": null,
"status_message_raw": null,
"order_timestamp": "2021-05-31 09:18:57",
"exchange_update_timestamp": "2021-05-31 09:18:58",
"exchange_timestamp": "2021-05-31 09:15:38",
"variety": "regular",
"modified": false,
"exchange": "CDS",
"tradingsymbol": "USDINR21JUNFUT",
"instrument_token": 412675,
"order_type": "LIMIT",
"transaction_type": "BUY",
"validity": "DAY",
"product": "NRML",
"quantity": 1,
"disclosed_quantity": 0,
"price": 72,
"trigger_price": 0,
"average_price": 0,
"filled_quantity": 0,
"pending_quantity": 1,
"cancelled_quantity": 1,
"market_protection": 0,
"meta": {},
"tag": null,
"guid": "XXXXX"
},
{
"placed_by": "XXXXXX",
"order_id": "300000000000000",
"exchange_order_id": "400000000000000",
"parent_order_id": null,
"status": "COMPLETE",
"status_message": null,
"status_message_raw": null,
"order_timestamp": "2021-05-31 15:20:28",
"exchange_update_timestamp": "2021-05-31 15:20:28",
"exchange_timestamp": "2021-05-31 15:20:28",
"variety": "regular",
"modified": false,
"exchange": "NSE",
"tradingsymbol": "IOC",
"instrument_token": 415745,
"order_type": "LIMIT",
"transaction_type": "BUY",
"validity": "DAY",
"product": "CNC",
"quantity": 1,
"disclosed_quantity": 0,
"price": 109.4,
"trigger_price": 0,
"average_price": 109.4,
"filled_quantity": 1,
"pending_quantity": 0,
"cancelled_quantity": 0,
"market_protection": 0,
"meta": {},
"tag": null,
"guid": "XXXXXX"
},
{
"placed_by": "XXXXXX",
"order_id": "500000000000000",
"exchange_order_id": "600000000000000",
"parent_order_id": null,
"status": "COMPLETE",
"status_message": null,
"status_message_raw": null,
"order_timestamp": "2021-05-31 15:20:51",
"exchange_update_timestamp": "2021-05-31 15:20:52",
"exchange_timestamp": "2021-05-31 15:20:52",
"variety": "regular",
"modified": false,
"exchange": "NSE",
"tradingsymbol": "IOC",
"instrument_token": 415745,
"order_type": "MARKET",
"transaction_type": "SELL",
"validity": "DAY",
"product": "CNC",
"quantity": 1,
"disclosed_quantity": 0,
"price": 0,
"trigger_price": 0,
"average_price": 109.35,
"filled_quantity": 1,
"pending_quantity": 0,
"cancelled_quantity": 0,
"market_protection": 0,
"meta": {},
"tag": null,
"guid": "XXXX"
},
{
"placed_by": "XXXXXX",
"order_id": "220524001859672",
"exchange_order_id": null,
"parent_order_id": null,
"status": "REJECTED",
"status_message": "Insufficient funds. Required margin is 95417.84 but available margin is 74251.80. Check the orderbook for open orders.",
"status_message_raw": "RMS:Margin Exceeds,Required:95417.84, Available:74251.80 for entity account-XXXXX across exchange across segment across product ",
"order_timestamp": "2022-05-24 12:26:52",
"exchange_update_timestamp": null,
"exchange_timestamp": null,
"variety": "iceberg",
"modified": false,
"exchange": "NSE",
"tradingsymbol": "SBIN",
"instrument_token": 779521,
"order_type": "LIMIT",
"transaction_type": "BUY",
"validity": "TTL",
"validity_ttl": 2,
"product": "CNC",
"quantity": 200,
"disclosed_quantity": 0,
"price": 463,
"trigger_price": 0,
"average_price": 0,
"filled_quantity": 0,
"pending_quantity": 0,
"cancelled_quantity": 0,
"market_protection": 0,
"meta": {
"iceberg": {
"leg": 1,
"legs": 5,
"leg_quantity": 200,
"total_quantity": 1000,
"remaining_quantity": 800
}
},
"tag": "icebergord",
"tags": [
"icebergord"
],
"guid": "XXXXXX"
},
{
"placed_by": "XXXXXX",
"order_id": "700000000000000",
"exchange_order_id": "800000000000000",
"parent_order_id": null,
"status": "COMPLETE",
"status_message": null,
"status_message_raw": null,
"order_timestamp": "2021-05-31 16:00:36",
"exchange_update_timestamp": "2021-05-31 16:00:36",
"exchange_timestamp": "2021-05-31 16:00:36",
"variety": "regular",
"modified": false,
"exchange": "MCX",
"tradingsymbol": "GOLDPETAL21JUNFUT",
"instrument_token": 58424839,
"order_type": "LIMIT",
"transaction_type": "BUY",
"validity": "DAY",
"product": "NRML",
"quantity": 1,
"disclosed_quantity": 0,
"price": 4854,
"trigger_price": 0,
"average_price": 4852,
"filled_quantity": 1,
"pending_quantity": 0,
"cancelled_quantity": 0,
"market_protection": 0,
"meta": {},
"tag": "connect test order1",
"tags": [
"connect test order1"
],
"guid": "XXXXXXX"
},
{
"placed_by": "XXXXXX",
"order_id": "9000000000000000",
"exchange_order_id": "1000000000000000",
"parent_order_id": null,
"status": "COMPLETE",
"status_message": null,
"status_message_raw": null,
"order_timestamp": "2021-05-31 16:08:40",
"exchange_update_timestamp": "2021-05-31 16:08:41",
"exchange_timestamp": "2021-05-31 16:08:41",
"variety": "regular",
"modified": false,
"exchange": "MCX",
"tradingsymbol": "GOLDPETAL21JUNFUT",
"instrument_token": 58424839,
"order_type": "LIMIT",
"transaction_type": "BUY",
"validity": "DAY",
"product": "NRML",
"quantity": 1,
"disclosed_quantity": 0,
"price": 4854,
"trigger_price": 0,
"average_price": 4852,
"filled_quantity": 1,
"pending_quantity": 0,
"cancelled_quantity": 0,
"market_protection": 0,
"meta": {},
"tag": "connect test order2",
"tags": [
"connect test order2",
"XXXXX"
],
"guid": "XXXXXX"
},
{
"placed_by": "XXXXXX",
"order_id": "98000000000000000",
"exchange_order_id": "67000000000000000",
"parent_order_id": null,
"status": "CANCELLED",
"status_message": null,
"status_message_raw": null,
"order_timestamp": "2023-06-12 14:00:58",
"exchange_update_timestamp": "2023-06-12 14:00:58",
"exchange_timestamp": "2023-06-12 14:00:58",
"variety": "auction",
"modified": false,
"exchange": "NSE",
"tradingsymbol": "BHEL",
"instrument_token": 112129,
"order_type": "LIMIT",
"transaction_type": "SELL",
"validity": "DAY",
"validity_ttl": 0,
"product": "CNC",
"quantity": 60,
"disclosed_quantity": 0,
"price": 85,
"trigger_price": 0,
"auction_number": "22",
"average_price": 0,
"filled_quantity": 0,
"pending_quantity": 60,
"cancelled_quantity": 0,
"market_protection": 0,
"meta": {},
"tag": null,
"guid": null
},
{
"account_id": "XXXXXX",
"placed_by": "XXXXXX",
"order_id": "250117800776785",
"exchange_order_id": "1300000029561105",
"parent_order_id": null,
"status": "CANCELLED",
"status_message": null,
"status_message_raw": null,
"order_timestamp": "2025-01-17 11:49:45",
"exchange_update_timestamp": "2025-01-17 11:49:45",
"exchange_timestamp": "2025-01-17 11:49:45",
"variety": "regular",
"modified": false,
"exchange": "NSE",
"tradingsymbol": "SBIN",
"instrument_token": 779521,
"order_type": "LIMIT",
"transaction_type": "BUY",
"validity": "DAY",
"validity_ttl": 0,
"product": "MTF",
"quantity": 1,
"disclosed_quantity": 0,
"price": 702,
"trigger_price": 0,
"average_price": 0,
"filled_quantity": 0,
"pending_quantity": 1,
"cancelled_quantity": 1,
"market_protection": 0,
"meta": {},
"tag": null,
"guid": null
}
]
}
Response attributes¶
| attribute | |
|---|---|
order_idstring |
Unique order ID |
parent_order_idstring |
Order ID of the parent order (only applicable in case of multi-legged orders like CO) |
exchange_order_idnull, string |
Exchange generated order ID. Orders that don't reach the exchange have null IDs |
modifiedbool |
Indicate that the order has been modified since placement by the user |
placed_bystring |
ID of the user that placed the order. This may different from the user's ID for orders placed outside of Kite, for instance, by dealers at the brokerage using dealer terminals |
varietystring |
Order variety (regular, amo, co etc.) |
statusstring |
Current status of the order. Most common values or COMPLETE, REJECTED, CANCELLED, and OPEN. There may be other values as well. |
tradingsymbolstring |
Exchange tradingsymbol of the instrument |
exchangestring |
Exchange |
instrument_tokenstring |
The numerical identifier issued by the exchange representing the instrument. Used for subscribing to live market data over WebSocket |
transaction_typestring |
BUY or SELL |
order_typestring |
Order type (MARKET, LIMIT etc.) |
productstring> |
Margin product to use for the order (margins are blocked based on this) ? |
validitystring |
Order validity |
pricefloat64 |
Price at which the order was placed (LIMIT orders) |
quantityint64 |
Quantity ordered |
trigger_pricefloat64 |
Trigger price (for SL, SL-M, CO orders) |
average_pricefloat64 |
Average price at which the order was executed (only for COMPLETE orders) |
pending_quantityint64 |
Pending quantity to be filled |
filled_quantityint64 |
Quantity that's been filled |
disclosed_quantityint64 |
Quantity to be disclosed (may be different from actual quantity) to the public exchange orderbook. Only for equities |
order_timestampstring |
Timestamp at which the order was registered by the API |
exchange_timestampstring |
Timestamp at which the order was registered by the exchange. Orders that don't reach the exchange have null timestamps |
exchange_update_timestampstring |
Timestamp at which an order's state changed at the exchange |
status_messagenull, string |
Textual description of the order's status. Failed orders come with human readable explanation |
status_message_rawnull, string |
Raw textual description of the failed order's status, as received from the OMS |
cancelled_quantityint64 |
Quantity that's cancelled |
auction_number string |
A unique identifier for a particular auction |
meta{}, string |
Map of arbitrary fields that the system may attach to an order. |
tagnull, string |
An optional tag to apply to an order to identify it (alphanumeric, max 20 chars) |
guidstring |
Unusable request id to avoid order duplication |
Order statuses¶
The status field in the order response shows the current state of the order. The status values are largely self explanatory. The most common statuses are OPEN, COMPLETE, CANCELLED, and REJECTED.
An order can traverse through several interim and temporary statuses during its lifetime. For example, when an order is first placed or modified, it instantly passes through several stages before reaching its end state. Some of these are highlighted below.
| status | |
|---|---|
PUT ORDER REQ RECEIVED |
Order request has been received by the backend |
VALIDATION PENDING |
Order pending validation by the RMS (Risk Management System) |
OPEN PENDING |
Order is pending registration at the exchange |
MODIFY VALIDATION PENDING |
Order's modification values are pending validation by the RMS |
MODIFY PENDING |
Order's modification values are pending registration at the exchange |
TRIGGER PENDING |
Order's placed but the fill is pending based on a trigger price. |
CANCEL PENDING |
Order's cancellation request is pending registration at the exchange |
AMO REQ RECEIVED |
Same as PUT ORDER REQ RECEIVED, but for AMOs |
Tagging orders¶
Often, it may be necessary to tag and filter orders based on various criteria, for instance, to filter out all orders that came from a particular application or an api_key of yours. The tag field comes in handy here. It let's you send an arbitrary string while placing an order. This can be a unique ID, or something that indicates a particular type or context, for example. When the orderbook is retrieved, this value will be present in the tag field in the response.
Market protection¶
Market protection is a feature that helps protect against extreme price movements when placing MARKET and SL-M (stoploss-market) orders. This feature allows you to set a percentage threshold to limit how much the order price can deviate from the current market price.
The market_protection parameter accepts the following values:
0: No market protection (default behavior)0to100: Custom market protection percentage (e.g., 2 means 2% protection, 10 means 10% protection)-1: Automatic market protection applied by the system as per market protection guidelines
The protection percentage should be within the circuit limit's.
Note
Market protection is only applicable for MARKET and SL-M order types. It has no effect on LIMIT and SL orders as they already have built-in price protection.
Auto slice orders¶
When placing orders with autoslice=true for quantities exceeding freeze limits, the API response remains the same format (single order object), but the order gets automatically split into multiple smaller orders internally. Each slice appears as a separate order in your orderbook with its own order_id. Auto sliced orders can be identified by the "autoslice" tag in the tags array, and child slices will have an additional tag like "autoslice:parent_order_id" to show the relationship.
Multi-legged orders (CO)¶
Cover orders are "multi-legged" orders, where, a single order you place (first-leg) may spawn new orders (second-leg) based on the conditions you set on the first-leg order. These orders have special properties, where the first-leg order creates a position. The position is exited when the second-leg order is executed or cancelled.
These second-leg orders will have a parent_order_id field indicating the order_id of its parent order, that is, the first-leg order. This field may be required while modifying or cancelling an open second-leg order.
Retrieving an order's history¶
curl "https://api.kite.trade/orders/171229000724687" \
-H "Authorization: token api_key:access_token"
{
"status": "success",
"data": [
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": null,
"exchange_timestamp": null,
"filled_quantity": 0,
"instrument_token": 1,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:06:52",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300,
"product": "CNC",
"quantity": 1,
"status": "PUT ORDER REQ RECEIVED",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
},
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": null,
"exchange_timestamp": null,
"filled_quantity": 0,
"instrument_token": 779521,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:06:52",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300,
"product": "CNC",
"quantity": 1,
"status": "VALIDATION PENDING",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
},
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": null,
"exchange_timestamp": null,
"filled_quantity": 0,
"instrument_token": 779521,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:06:52",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300,
"product": "CNC",
"quantity": 1,
"status": "OPEN PENDING",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
},
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": "1300000001887410",
"exchange_timestamp": "2017-12-29 11:06:52",
"filled_quantity": 0,
"instrument_token": 779521,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:06:52",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300,
"product": "CNC",
"quantity": 1,
"status": "OPEN",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
},
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": "1300000001887410",
"exchange_timestamp": "2017-12-29 11:06:52",
"filled_quantity": 0,
"instrument_token": 779521,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:08:16",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300,
"product": "CNC",
"quantity": 1,
"status": "MODIFY VALIDATION PENDING",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
},
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": "1300000001887410",
"exchange_timestamp": "2017-12-29 11:06:52",
"filled_quantity": 0,
"instrument_token": 779521,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:08:16",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300,
"product": "CNC",
"quantity": 1,
"status": "MODIFY PENDING",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
},
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": "1300000001887410",
"exchange_timestamp": "2017-12-29 11:08:16",
"filled_quantity": 0,
"instrument_token": 779521,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:08:16",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300,
"product": "CNC",
"quantity": 1,
"status": "MODIFIED",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
},
{
"average_price": 0,
"cancelled_quantity": 0,
"disclosed_quantity": 0,
"exchange": "NSE",
"exchange_order_id": "1300000001887410",
"exchange_timestamp": "2017-12-29 11:08:16",
"filled_quantity": 0,
"instrument_token": 779521,
"order_id": "171229000724687",
"order_timestamp": "2017-12-29 11:08:16",
"order_type": "LIMIT",
"parent_order_id": null,
"pending_quantity": 1,
"placed_by": "DA0017",
"price": 300.1,
"product": "CNC",
"quantity": 1,
"status": "OPEN",
"status_message": null,
"tag": null,
"tradingsymbol": "SBIN",
"transaction_type": "BUY",
"trigger_price": 0,
"validity": "DAY",
"variety": "regular",
"modified": false
}
]
}
Every order, right after being placed, goes through multiple stages internally in the OMS. Initial validation, RMS (Risk Management System) checks and so on before it goes to the exchange. In addition, an open order, when modified, again goes through these stages.
Retrieving all trades¶
While an orders is sent as a single entity, it may be executed in arbitrary chunks at the exchange depending on market conditions. For instance, an order for 10 quantity of an instrument can be executed in chunks of 5, 1, 1, 3 or any such combination. Each individual execution that fills an order partially is a trade. An order may have one or more trades.
This API returns a list of all trades generated by all executed orders for the day.
curl "https://api.kite.trade/trades" \
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token"
{
"status": "success",
"data": [
{
"trade_id": "10000000",
"order_id": "200000000000000",
"exchange": "NSE",
"tradingsymbol": "SBIN",
"instrument_token": 779521,
"product": "CNC",
"average_price": 420.65,
"quantity": 1,
"exchange_order_id": "300000000000000",
"transaction_type": "BUY",
"fill_timestamp": "2021-05-31 09:16:39",
"order_timestamp": "09:16:39",
"exchange_timestamp": "2021-05-31 09:16:39"
},
{
"trade_id": "40000000",
"order_id": "500000000000000",
"exchange": "CDS",
"tradingsymbol": "USDINR21JUNFUT",
"instrument_token": 412675,
"product": "MIS",
"average_price": 72.755,
"quantity": 1,
"exchange_order_id": "600000000000000",
"transaction_type": "BUY",
"fill_timestamp": "2021-05-31 11:18:27",
"order_timestamp": "11:18:27",
"exchange_timestamp": "2021-05-31 11:18:27"
},
{
"trade_id": "70000000",
"order_id": "800000000000000",
"exchange": "MCX",
"tradingsymbol": "GOLDPETAL21JUNFUT",
"instrument_token": 58424839,
"product": "NRML",
"average_price": 4852,
"quantity": 1,
"exchange_order_id": "312115100078593",
"transaction_type": "BUY",
"fill_timestamp": "2021-05-31 16:00:36",
"order_timestamp": "16:00:36",
"exchange_timestamp": "2021-05-31 16:00:36"
},
{
"trade_id": "90000000",
"order_id": "1100000000000000",
"exchange": "MCX",
"tradingsymbol": "GOLDPETAL21JUNFUT",
"instrument_token": 58424839,
"product": "NRML",
"average_price": 4852,
"quantity": 1,
"exchange_order_id": "1200000000000000",
"transaction_type": "BUY",
"fill_timestamp": "2021-05-31 16:08:41",
"order_timestamp": "16:08:41",
"exchange_timestamp": "2021-05-31 16:08:41"
}
]
}
Response attributes¶
| attribute | |
|---|---|
trade_idstring |
Exchange generated trade ID |
order_idstring |
Unique order ID |
exchange_order_idnull, string |
Exchange generated order ID |
tradingsymbolstring |
Exchange tradingsymbol of the instrument |
exchangestring |
Exchange |
instrument_tokenstring |
The numerical identifier issued by the exchange representing the instrument. Used for subscribing to live market data over WebSocket |
transaction_typestring |
BUY or SELL |
productstring |
Margin product to use for the order (margins are blocked based on this) ? |
average_pricefloat64 |
Price at which the quantity was filled |
filledint64 |
Filled quantity |
fill_timestampstring |
Timestamp at which the trade was filled at the exchange |
order_timestampstring |
Timestamp at which the order was registered by the API |
exchange_timestampstring |
Timestamp at which the order was registered by the exchange |
Retrieving an order's trades¶
This API returns the trades spawned and executed by a particular order.
curl "https://api.kite.trade/orders/200000000000000/trades" \
-H "X-Kite-Version: 3" \
-H "Authorization: token api_key:access_token"
{
"status": "success",
"data": [
{
"trade_id": "10000000",
"order_id": "200000000000000",
"exchange": "MCX",
"tradingsymbol": "GOLDPETAL21JUNFUT",
"instrument_token": 58424839,
"product": "NRML",
"average_price": 4852,
"quantity": 1,
"exchange_order_id": "300000000000000",
"transaction_type": "BUY",
"fill_timestamp": "2021-05-31 16:00:36",
"order_timestamp": "16:00:36",
"exchange_timestamp": "2021-05-31 16:00:36"
}
]
}