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.

Every type exported from kiteconnect-ts is derived directly from the source — no types are invented or inferred. Import any type you need alongside the class:
import {
  KiteConnect,
  Exchange,
  Order,
  Quote,
  PlaceOrderParams,
  // ... any exported type
} from 'kiteconnect-ts';

Enums

All enums are implemented as const objects with a matching type alias, so you get both runtime values and compile-time type checking.

Exchange

const Exchange = {
  NSE: 'NSE',
  BSE: 'BSE',
  NFO: 'NFO',
  CDS: 'CDS',
  BCD: 'BCD',
  BFO: 'BFO',
  MCX: 'MCX',
} as const;
type Exchange = keyof typeof Exchange;
ValueDescription
NSENational Stock Exchange — equities
BSEBombay Stock Exchange — equities
NFONSE Futures & Options
CDSNSE Currency Derivatives
BCDBSE Currency Derivatives
BFOBSE Futures & Options
MCXMulti Commodity Exchange

TransactionType

const TransactionType = { BUY: 'BUY', SELL: 'SELL' } as const;
type TransactionType = keyof typeof TransactionType;

ProductType

const ProductType = {
  NRML: 'NRML',
  MIS:  'MIS',
  CNC:  'CNC',
  CO:   'CO',
  BO:   'BO',
} as const;
type ProductType = keyof typeof ProductType;
ValueDescription
NRMLNormal — overnight F&O positions
MISMargin Intraday Square-off
CNCCash and Carry — delivery equity
COCover Order
BOBracket Order

OrderType

const OrderType = {
  LIMIT:  'LIMIT',
  MARKET: 'MARKET',
  SL:     'SL',
  'SL-M': 'SL-M',
} as const;
type OrderType = keyof typeof OrderType;

Variety

const Variety = {
  amo:     'amo',
  auction: 'auction',
  bo:      'bo',
  co:      'co',
  iceberg: 'iceberg',
  regular: 'regular',
} as const;
type Variety = keyof typeof Variety;
ValueDescription
regularStandard order during market hours
amoAfter Market Order
coCover Order
boBracket Order
icebergIceberg (disclosed quantity) order
auctionAuction order

Validity

const Validity = { DAY: 'DAY', IOC: 'IOC', TTL: 'TTL' } as const;
type Validity = keyof typeof Validity;
ValueDescription
DAYValid for the current trading day
IOCImmediate or Cancel
TTLValid for a specified number of minutes (validity_ttl)

TriggerType

const TriggerType = {
  'two-leg': 'two-leg',
  single:    'single',
} as const;
type TriggerType = keyof typeof TriggerType;
ValueDescription
singleSingle trigger price, one order
two-legTwo trigger prices (OCO — one cancels other)

Parameter interfaces

KiteConnectParams

Constructor parameters for KiteConnect. See the KiteConnectParams reference for full details.
api_key
string
required
API key issued by Zerodha.
access_token
string
Pre-set access token. Default: null.
root
string
API root URL. Default: "https://api.kite.trade".
login_uri
string
Login redirect URL. Default: "https://kite.trade/connect/login".
debug
boolean
Log requests and responses. Default: false.
timeout
number
Request timeout in milliseconds. Default: 7000.

PlaceOrderParams

interface PlaceOrderParams {
  exchange: Exchange;
  tradingsymbol: string;
  transaction_type: TransactionType;
  quantity: number;
  product: ProductType;
  order_type: OrderType;
  validity?: Validity;
  price?: number;
  disclosed_quantity?: number;
  trigger_price?: number;
  squareoff?: number;
  stoploss?: number;
  trailing_stoploss?: number;
  validity_ttl?: number;
  iceberg_legs?: number;
  iceberg_quantity?: number;
  auction_number?: number;
  tag?: string;
}
exchange
Exchange
required
Exchange to route the order through.
tradingsymbol
string
required
Trading symbol of the instrument (e.g., RELIANCE, INFY).
transaction_type
TransactionType
required
BUY or SELL.
quantity
number
required
Order quantity.
product
ProductType
required
Margin product code.
order_type
OrderType
required
Order type.
validity
Validity
Order validity. Defaults to DAY.
price
number
Limit price (required for LIMIT and SL orders).
trigger_price
number
Stop trigger price (required for SL, SL-M, CO orders).
disclosed_quantity
number
Quantity to show in the public order book (equities only).
squareoff
number
Square-off target for bracket orders.
stoploss
number
Stop-loss for bracket orders.
trailing_stoploss
number
Trailing stop-loss for bracket orders.
validity_ttl
number
Validity in minutes for TTL orders.
iceberg_legs
number
Total legs for iceberg order variety.
iceberg_quantity
number
Disclosed quantity per iceberg leg.
auction_number
number
Auction identifier for auction variety.
tag
string
Optional label (alphanumeric, max 20 chars).

ConvertPositionParams

interface ConvertPositionParams {
  exchange: Exchange;
  tradingsymbol: string;
  transaction_type: TransactionType;
  position_type: 'overnight' | 'day';
  quantity: string;
  old_product: ProductType;
  new_product: ProductType;
}
exchange
Exchange
required
Exchange of the instrument.
tradingsymbol
string
required
Trading symbol.
transaction_type
TransactionType
required
BUY or SELL.
position_type
'overnight' | 'day'
required
Whether to convert the overnight or day position.
quantity
string
required
Quantity to convert.
old_product
ProductType
required
Current product code.
new_product
ProductType
required
Target product code.

GTTParams

interface GTTParams {
  trigger_type: TriggerType;
  tradingsymbol: string;
  exchange: Exchange;
  trigger_values: number[];
  last_price: number;
  orders: {
    transaction_type: TransactionType;
    quantity: number;
    product: ProductType;
    order_type: OrderType;
    price: number;
  }[];
}
trigger_type
TriggerType
required
'single' or 'two-leg'.
tradingsymbol
string
required
Trading symbol.
exchange
Exchange
required
Exchange.
trigger_values
number[]
required
One value for single, two values for two-leg.
last_price
number
required
Current last traded price used as the reference.
orders
object[]
required

MarginOrder

An order object used as input to orderMargins() and orderBasketMargins().
exchange
Exchange
required
Exchange.
tradingsymbol
string
required
Trading symbol.
transaction_type
TransactionType
required
BUY or SELL.
variety
Variety
required
Order variety.
product
ProductType
required
Product code.
order_type
OrderType
required
Order type.
quantity
number
required
Order quantity.
price
number
Limit price (optional).
trigger_price
number
Trigger price (optional).

Response interfaces

SessionData

Returned by generateSession() and renewAccessToken().
user_id
string
Permanent user ID registered with the broker and exchanges.
user_name
string
User’s real name.
user_shortname
string
Abbreviated version of the user’s name.
email
string
User’s registered email.
user_type
string
Role at the broker — individual for all retail users.
broker
string
Broker identifier.
exchanges
string[]
Exchanges enabled on the account.
products
string[]
Margin product types enabled for the user.
order_types
string[]
Order types enabled for the user.
api_key
string
API key for which authentication was performed.
access_token
string
The authentication token for all subsequent requests. Expires at 6 AM the next day.
public_token
string
Token for public session validation.
refresh_token
string
Long-standing token for renewing access (available to approved platforms).
login_time
string
User’s last login timestamp.
meta
object
avatar_url
string
Full URL to the user’s PNG avatar, if set.

Order

Returned by getOrders(), getOrderHistory(), and as postback data.
order_id
string
Unique order ID.
parent_order_id
string | null
Parent order ID for multi-leg orders (CO).
exchange_order_id
string | null
Exchange-assigned order ID. null if the order never reached the exchange.
placed_by
string
User ID of the order placer.
variety
string
Order variety (regular, amo, co, etc.).
status
string
Current status: COMPLETE, REJECTED, CANCELLED, OPEN, or others.
tradingsymbol
string
Trading symbol of the instrument.
exchange
string
Exchange.
instrument_token
number
Numeric instrument identifier.
transaction_type
string
BUY or SELL.
order_type
string
Order type.
product
string
Margin product code.
validity
string
Order validity.
price
number
Limit price at order placement.
quantity
number
Total quantity ordered.
trigger_price
number
Stop trigger price.
average_price
number
Average fill price (complete orders only).
pending_quantity
number
Remaining unfilled quantity.
filled_quantity
number
Quantity already filled.
disclosed_quantity
number
Disclosed quantity in the public order book.
order_timestamp
Date
When the order was registered by the API.
exchange_timestamp
Date | null
When the order was registered by the exchange.
exchange_update_timestamp
string | null
When the order state last changed at the exchange.
status_message
string | null
Human-readable status description.
status_message_raw
string | null
Raw OMS status message for failed orders.
cancelled_quantity
number
Quantity that was cancelled.
meta
object | string
Arbitrary metadata attached by the system.
tag
string | null
Optional order tag.
guid
string
Deduplication request ID.
market_protection
number
Market protection flag: 0 or 1.

Trade

Returned by getTrades() and getOrderTrades().
trade_id
string
Exchange-assigned trade ID.
order_id
string
Associated order ID.
exchange_order_id
string | null
Exchange-assigned order ID.
tradingsymbol
string
Trading symbol.
exchange
string
Exchange.
instrument_token
number
Numeric instrument identifier.
transaction_type
string
BUY or SELL.
product
string
Margin product code.
average_price
number
Price at which the quantity was filled.
filled
number
Filled quantity for this trade.
quantity
number
Total order quantity.
fill_timestamp
Date
When the trade was filled at the exchange.
order_timestamp
Date
When the order was placed.
exchange_timestamp
Date
When the order was registered at the exchange.

Position

Returned inside getPositions().
tradingsymbol
string
Trading symbol.
exchange
string
Exchange.
instrument_token
number
Numeric instrument identifier.
product
string
Product code applied to the position.
quantity
number
Net quantity held.
overnight_quantity
number
Quantity carried forward from the previous day.
multiplier
number
Lot size multiplier for P&L calculation.
average_price
number
Average acquisition price.
close_price
number
Previous day’s closing price.
last_price
number
Current market price.
value
number
Net value of the position.
pnl
number
Net profit and loss.
m2m
number
Mark-to-market returns.
unrealised
number
Unrealised intraday returns.
realised
number
Realised intraday returns.
buy_quantity
number
Quantity bought.
buy_price
number
Average buy price.
buy_value
number
Net value of buys.
buy_m2m
number
M2M on bought quantity.
day_buy_quantity
number
Quantity bought today.
day_buy_price
number
Average buy price today.
day_buy_value
number
Value of today’s buys.
sell_quantity
number
Quantity sold.
sell_price
number
Average sell price.
sell_value
number
Net value of sells.
sell_m2m
number
M2M on sold quantity.
day_sell_quantity
number
Quantity sold today.
day_sell_price
number
Average sell price today.
day_sell_value
number
Value of today’s sells.

PortfolioHolding

Returned by getHoldings().
tradingsymbol
string
Trading symbol.
exchange
string
Exchange.
instrument_token
number
Numeric instrument identifier.
isin
string
Standard ISIN for stocks listed on multiple exchanges.
product
string
Margin product applied to the holding.
price
number
Purchase price.
quantity
number
Net quantity (T+1 + realised).
used_quantity
number
Quantity sold from the net holding.
t1_quantity
number
Quantity on T+1 (post-execution, pre-delivery).
realised_quantity
number
Quantity delivered to DEMAT.
authorised_quantity
number
Quantity authorised at the depository for sale.
authorised_date
string
Date from which the authorised quantity can be sold.
opening_quantity
number
Quantity carried forward overnight.
collateral_quantity
number
Quantity pledged as collateral.
collateral_type
string
Type of collateral.
discrepancy
boolean
true if the holding has a price discrepancy.
average_price
number
Average acquisition price.
last_price
number
Current market price.
close_price
number
Previous day’s closing price.
pnl
number
Net profit and loss.
day_change
number
Absolute day change.
day_change_percentage
number
Percentage day change.

Instrument

Returned by getInstruments().
instrument_token
string
Numeric token for WebSocket subscriptions.
exchange_token
string
Exchange-issued token.
tradingsymbol
string
Trading symbol.
name
string
Company name (equity instruments).
last_price
number
Last traded price.
expiry
Date
Expiry date (derivatives only).
strike
number
Strike price (options only).
tick_size
number
Minimum price movement.
lot_size
number
Quantity per lot.
instrument_type
'EQ' | 'FUT' | 'CE' | 'PE'
Instrument type.
segment
string
Market segment.
exchange
Exchange
Exchange.

Quote

Returned by getQuote() as values in a Record<string, Quote>.
instrument_token
number
Numeric instrument identifier.
timestamp
string
Exchange timestamp of the quote packet.
last_trade_time
string | null
Last trade timestamp.
last_price
number
Last traded price.
volume
number
Total volume traded today.
average_price
number
Volume-weighted average price.
buy_quantity
number
Total pending buy quantity.
sell_quantity
number
Total pending sell quantity.
last_quantity
number
Last traded quantity.
open_interest
number
Outstanding contracts (F&O only).
net_change
number
Absolute change from previous close.
lower_circuit_limit
number
Current lower circuit limit.
upper_circuit_limit
number
Current upper circuit limit.
oi
number
Open interest.
oi_day_high
number
Highest OI recorded today.
oi_day_low
number
Lowest OI recorded today.
ohlc
object
depth
object
5-level market depth.

UserMargin

Returned by getMargins().
enabled
boolean
Whether this segment is enabled for the user.
net
number
Net cash balance available for trading.
available
object
utilised
object

UserProfile

Returned by getProfile().
user_id
string
Permanent user ID.
user_name
string
Real name.
user_shortname
string
Short name.
email
string
Email.
user_type
string
Role — individual for retail users.
broker
string
Broker identifier.
exchanges
string[]
Enabled exchanges.
products
string[]
Enabled product types.
order_types
string[]
Enabled order types.
meta
object
avatar_url
string | null
PNG avatar URL.

Margin

Full margin response from orderMargins() and orderBasketMargins(). Extends CompactMargin.
type
string
equity or commodity.
tradingsymbol
string
Trading symbol.
exchange
string
Exchange.
total
number
Total margin blocked.
span
number
SPAN margin.
exposure
number
Exposure margin.
option_premium
number
Option premium.
additional
number
Additional margin.
bo
number
Bracket order margin.
cash
number
Cash credit.
var
number
VAR margin.
leverage
number
Leverage allowed for the trade.
pnl
object
charges
object

CompactMargin

Compact margin response returned when you pass 'compact' to orderMargins().
type
string
equity or commodity.
tradingsymbol
string
Trading symbol.
exchange
string
Exchange.
total
number
Total margin blocked.

MFOrder

Returned by getMFOrders().
order_id
string
Unique order ID.
exchange_order_id
string | null
Exchange-assigned order ID.
tradingsymbol
string
ISIN of the fund.
status
string | null
Current status (COMPLETE, REJECTED, CANCELLED, OPEN).
status_message
string | null
Human-readable status description.
folio
string | null
AMC folio number for completed buy orders.
fund
string
Fund name.
order_timestamp
Date
API registration timestamp.
exchange_timestamp
Date
Exchange registration timestamp.
settlement_id
string
Exchange settlement ID.
transaction_type
string
BUY or SELL.
amount
number
Amount invested.
variety
string
Order variety (regular, sip).
purchase_type
string | null
FRESH or ADDITIONAL (null for SELL).
quantity
number
Units allotted or sold.
price
number
Buy or sell price.
last_price
number
Latest NAV.
average_price
number
Allotted or sold NAV.
placed_by
string
User ID of the placer.
last_price_date
string
Date of latest NAV.
tag
any
Optional order tag.

MFSIP

Returned by getMFSIPS().
sip_id
string
Unique SIP ID.
tradingsymbol
string
ISIN of the fund.
fund
string
Fund name.
dividend_type
string
growth or payout.
transaction_type
string
BUY or SELL.
status
string
ACTIVE, PAUSED, or CANCELLED.
created
Date
When the SIP was registered.
frequency
string
monthly, weekly, or quarterly.
next_instalment
string
Upcoming instalment date.
instalment_amount
number
Amount per instalment.
instalments
number
Total instalments (-1 for indefinite).
last_instalment
Date
Date of the last triggered instalment.
pending_instalments
number
Remaining instalments (-1 for indefinite).
instalment_day
number
Day of month for monthly SIPs (0 otherwise).
completed_instalments
number
Number of completed instalments.
tag
string
Optional tag.

MFHolding

Returned by getMFHoldings().
folio
string | null
AMC folio number.
average_price
number
Average NAV at purchase.
last_price
number
Latest NAV.
last_price_date
string
Date of latest NAV.
pledged_quantity
number
Pledged quantity.
fund
string
Fund name.
tradingsymbol
string
ISIN.
pnl
number
Net returns on the holding.
quantity
number
Available quantity.

MFInstrument

Returned by getMFInstruments().
tradingsymbol
string
ISIN of the fund.
amc
string
AMC code as per the exchange.
name
string
Fund name.
purchase_allowed
boolean
Whether purchases are allowed.
redemption_allowed
boolean
Whether redemptions are allowed.
minimum_purchase_amount
number
Minimum first-purchase amount.
purchase_amount_multiplier
number
Buy amount must be a multiple of this.
minimum_additional_purchase_amount
number
Minimum additional purchase amount.
minimum_redemption_quantity
number
Minimum sell quantity.
redemption_quantity_multiplier
number
Sell quantity multiple.
dividend_type
string
growth or payout.
scheme_type
string
equity, debt, or elss.
plan
string
direct or regular.
settlement_type
string
Settlement type (e.g., T1, T2).
last_price
number
Latest NAV.
last_price_date
Date
Date of latest NAV.

Trigger

Returned by getGTT() and inside the array from getGTTs().
id
number
GTT trigger ID.
user_id
string
User ID of the trigger owner.
type
string
Trigger type (single or two-leg).
created_at
string
Creation timestamp.
updated_at
string
Last update timestamp.
expires_at
string
Expiry timestamp.
status
string
Status: active, triggered, disabled, expired, cancelled, rejected, or deleted.
condition
object
orders
object[]
Array of GTT order legs.
meta
any
Arbitrary metadata.

Build docs developers (and LLMs) love