KiteConnect exposes a complete order management surface: you can place every order variety (regular, AMO, CO, BO, iceberg, and auction), modify open orders, cancel or exit them, and pull the full audit trail of executions. Two margin calculation methods let you pre-check buying power before committing a trade.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/anurag-roy/kiteconnect-ts/llms.txt
Use this file to discover all available pages before exploring further.
placeOrder
Place a new order for an equity or derivative instrument.placeOrder(variety: Variety, params: PlaceOrderParams): Promise<{ order_id: string }>
Order variety. One of
regular, amo, bo, co, iceberg, auction.Exchange where the instrument is listed. One of
NSE, BSE, NFO, BFO, CDS, BCD, MCX.Exchange trading symbol of the instrument (e.g.,
RELIANCE, INFY).BUY or SELL.Number of units to trade.
Margin product code. One of
CNC, NRML, MIS, CO, BO.MARKET, LIMIT, SL, or SL-M.Order validity:
DAY, IOC, or TTL.Limit price. Required for
LIMIT and SL orders.Trigger price. Required for
SL and SL-M orders, and for CO orders.Quantity visible in the public order book (equity only).
Square-off value for bracket orders (
bo variety).Stop-loss value for bracket orders.
Trailing stop-loss value for bracket orders.
Validity in minutes when
validity is TTL.Total number of legs for an iceberg order (variety
iceberg).Quantity per iceberg leg.
Unique auction identifier for auction variety orders.
Optional alphanumeric tag (max 20 chars) to identify the order.
modifyOrder
Modify an open order’s price, quantity, validity, or trigger.modifyOrder(variety: Variety, order_id: string, params): Promise<{ order_id: string }>
The variety of the original order (
regular, amo, bo, co, etc.).The unique ID of the order to modify.
New order quantity.
New limit price.
New order type:
MARKET, LIMIT, SL, or SL-M.New validity:
DAY or IOC.New disclosed quantity.
New trigger price.
Parent order ID for multi-leg orders such as CO.
cancelOrder
Cancel an open order.cancelOrder(variety: Variety, order_id: string, params?): Promise<{ order_id: string }>
Variety of the order being cancelled.
ID of the order to cancel.
Parent order ID for multi-leg orders.
exitOrder
exitOrder is an alias for cancelOrder. Both accept the same parameters and return the same result. Use exitOrder when the intent is to exit a CO or BO leg.
getOrders
Retrieve all orders placed for the current trading day.Promise<Order[]>. Key fields on each Order:
| Field | Type | Description |
|---|---|---|
order_id | string | Unique order ID |
exchange_order_id | string | null | Exchange-assigned ID (null if order didn’t reach exchange) |
status | string | COMPLETE, OPEN, CANCELLED, REJECTED, etc. |
tradingsymbol | string | Instrument symbol |
transaction_type | string | BUY or SELL |
quantity | number | Total ordered quantity |
filled_quantity | number | Quantity filled so far |
pending_quantity | number | Remaining quantity |
average_price | number | Average fill price |
order_timestamp | Date | When the API registered the order |
status_message | string | null | Human-readable status (e.g., rejection reason) |
getOrderHistory
Retrieve the state transitions for a single order.Promise<Order[]> — an array of Order snapshots, one per state change.
getTrades
Retrieve all trades executed during the current trading day.Promise<Trade[]>. Key fields on each Trade:
| Field | Type | Description |
|---|---|---|
trade_id | string | Exchange-assigned trade ID |
order_id | string | Associated order ID |
tradingsymbol | string | Instrument symbol |
transaction_type | string | BUY or SELL |
average_price | number | Price at which the lot was filled |
filled | number | Filled quantity in this trade |
fill_timestamp | Date | When the trade was filled at the exchange |
getOrderTrades
Retrieve trades associated with a specific order. A single order can be filled across multiple tranches.Promise<Trade[]>.
orderMargins
Calculate the margin required for a list of orders before placing them. Pass'compact' as the second argument to get a leaner response containing only the total margin.
- Full response
- Compact response
orderMargins(orders: MarginOrder[]): Promise<Margin[]>orderMargins(orders: MarginOrder[], mode: 'compact'): Promise<CompactMargin[]>
Margin includes: total, span, exposure, option_premium, additional, bo, cash, var, pnl, leverage, and a detailed charges breakdown. CompactMargin contains only type, tradingsymbol, exchange, and total.
orderBasketMargins
Calculate combined margin for a basket of orders, optionally accounting for your existing positions. Three overloads are available.- Basket only
- With positions
- Compact mode
orderBasketMargins(orders): Promise<{ initial: Margin; final: Margin; orders: Margin[] }>orderBasketMargins(orders, consider_positions): Promise<{ initial: Margin; final: Margin; orders: Margin[] }>orderBasketMargins(orders, consider_positions, mode: 'compact'): Promise<{ initial: CompactMargin; final: CompactMargin; orders: CompactMargin[] }>
consider_positions defaults to true.