Skip to main content

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.

KiteConnect gives you full read access to your portfolio: long-term holdings held in your DEMAT account, intraday and overnight positions, and instruments available for auction. You can also convert an open position from one margin product to another without squaring it off.

getHoldings

Retrieve all equity holdings in your DEMAT account.
const holdings = await kc.getHoldings();
holdings.forEach((h) => {
  console.log(h.tradingsymbol, h.quantity, h.pnl);
});
Returns Promise<PortfolioHolding[]>.
tradingsymbol
string
Exchange trading symbol of the instrument (e.g., RELIANCE).
exchange
string
Exchange where the instrument is listed (NSE or BSE).
instrument_token
number
Numerical identifier used to subscribe to live market data via WebSocket.
isin
string
Standard ISIN representing the stock across exchanges.
product
string
Margin product applied to the holding (e.g., CNC).
quantity
number
Net quantity held (T+1 quantity plus realised delivery).
t1_quantity
number
Quantity on T+1 day. Stocks purchased today appear here until they are delivered on T+2.
realised_quantity
number
Quantity already delivered to your DEMAT account.
used_quantity
number
Quantity sold from the net holding quantity.
authorised_quantity
number
Quantity authorised at the depository for sale.
authorised_date
string
Date from which you can sell the authorised holding stock.
opening_quantity
number
Quantity carried forward overnight.
collateral_quantity
number
Quantity pledged as collateral.
collateral_type
string
Type of collateral pledge.
discrepancy
boolean
true if there is a price discrepancy detected in the holding.
average_price
number
Average price at which the net holding quantity was acquired.
last_price
number
Last traded market price of the instrument.
close_price
number
Previous trading day’s closing price.
pnl
number
Net profit and loss on the holding based on the current market price.
day_change
number
Absolute price change from yesterday’s close to the current last price.
day_change_percentage
number
Percentage change from yesterday’s close to the current last price.

getPositions

Retrieve open intraday and overnight positions.
const { net, day } = await kc.getPositions();

console.log('Net positions:', net.length);
net.forEach((p) => console.log(p.tradingsymbol, p.quantity, p.pnl));

console.log('Day positions:', day.length);
Returns Promise<{ net: Position[]; day: Position[] }>. The net array contains the combined overnight-plus-intraday view; the day array contains only intraday positions.
tradingsymbol
string
Exchange trading symbol.
exchange
string
Exchange where the instrument is listed.
instrument_token
number
Numerical instrument identifier.
product
string
Margin product applied to this position (MIS, CNC, NRML, etc.).
quantity
number
Current net quantity held. Negative values indicate a short position.
overnight_quantity
number
Quantity held before the trading day started (carried forward).
multiplier
number
Lot-size multiplier used when calculating P&L for F&O instruments.
average_price
number
Average price at which the net quantity was acquired.
last_price
number
Last traded market price.
close_price
number
Previous day’s closing price.
pnl
number
Net profit and loss on the position.
m2m
number
Mark-to-market returns based on the last close and last traded price.
unrealised
number
Unrealised intraday returns.
realised
number
Realised intraday returns.
value
number
Net monetary value of the position.
buy_quantity
number
Total quantity bought and added to the position.
buy_price
number
Average price of bought quantities.
sell_quantity
number
Total quantity sold from the position.
sell_price
number
Average price of sold quantities.

convertPosition

Convert an open position from one margin product to another (for example, from MIS to NRML before the intraday auto-square-off cutoff).
const success = await kc.convertPosition({
  exchange: 'NSE',
  tradingsymbol: 'INFY',
  transaction_type: 'BUY',
  position_type: 'day',
  quantity: '1',
  old_product: 'MIS',
  new_product: 'CNC',
});
console.log('Converted:', success); // true
Returns Promise<boolean>.
exchange
string
required
Exchange where the instrument is listed (NSE, BSE, NFO, BFO, CDS, MCX).
tradingsymbol
string
required
Trading symbol of the instrument.
transaction_type
string
required
BUY or SELL — the side of the original position.
position_type
string
required
day for intraday positions or overnight for carry-forward positions.
quantity
string
required
Quantity to convert. Passed as a string.
old_product
string
required
The current product code of the position (NRML, MIS, or CNC).
new_product
string
required
The target product code to convert to (NRML, MIS, or CNC).

getAuctionInstruments

Retrieve instruments available for the current auction session.
const auctionInstruments = await kc.getAuctionInstruments();
console.log(auctionInstruments);
Auction instruments are only available during exchange-designated auction windows. Outside those windows the list is empty.

Build docs developers (and LLMs) love