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-ts exports values as JavaScript const objects rather than TypeScript enum declarations. This is intentional: it lets you pass a plain string literal or use the const object interchangeably, giving you full autocomplete and type-checking without forcing you to import anything. Class member constants are also available on every KiteConnect and KiteTicker instance for drop-in compatibility with kiteconnectjs.

Three ways to use constants

1

Option 1: String literal

Every parameter that accepts a specific set of values is typed as a union of string literals. You can pass the string directly and TypeScript will validate it at compile time.
import { KiteConnect } from 'kiteconnect-ts';

const kc = new KiteConnect({ api_key: 'YOUR_API_KEY' });

const instruments = await kc.getInstruments(['NSE']);
2

Option 2: Imported const object

Import the named const object and access its members. This is the recommended approach when you want explicit names in your code and full IDE autocompletion.
import { Exchange, KiteConnect } from 'kiteconnect-ts';

const kc = new KiteConnect({ api_key: 'YOUR_API_KEY' });

const instruments = await kc.getInstruments([Exchange.NSE]);
3

Option 3: Class member constants

Every constant is also exposed as a readonly member on the KiteConnect instance. This is primarily for backwards compatibility when migrating from kiteconnectjs.
import { KiteConnect } from 'kiteconnect-ts';

const kc = new KiteConnect({ api_key: 'YOUR_API_KEY' });

const instruments = await kc.getInstruments([kc.EXCHANGE_NSE]);

Available const objects

The following const objects are exported from kiteconnect-ts and can be imported directly.

Exchange

Supported stock and commodity exchanges.
MemberValue
Exchange.NSE'NSE'
Exchange.BSE'BSE'
Exchange.NFO'NFO'
Exchange.CDS'CDS'
Exchange.BCD'BCD'
Exchange.BFO'BFO'
Exchange.MCX'MCX'

TransactionType

Direction of a trade.
MemberValue
TransactionType.BUY'BUY'
TransactionType.SELL'SELL'

ProductType

Margin product types.
MemberValue
ProductType.NRML'NRML'
ProductType.MIS'MIS'
ProductType.CNC'CNC'
ProductType.CO'CO'
ProductType.BO'BO'

OrderType

Order execution types.
MemberValue
OrderType.LIMIT'LIMIT'
OrderType.MARKET'MARKET'
OrderType.SL'SL'
OrderType['SL-M']'SL-M'

Variety

Order varieties.
MemberValue
Variety.amo'amo'
Variety.auction'auction'
Variety.bo'bo'
Variety.co'co'
Variety.iceberg'iceberg'
Variety.regular'regular'

Validity

Order validity windows.
MemberValue
Validity.DAY'DAY'
Validity.IOC'IOC'
Validity.TTL'TTL'

TriggerType

GTT (Good Till Triggered) order types.
MemberValue
TriggerType['two-leg']'two-leg'
TriggerType.single'single'

KiteConnect class member constants

Every KiteConnect instance exposes the following readonly properties. They hold the same string values as the const objects above.
kc.PRODUCT_MIS      // 'MIS'
kc.PRODUCT_CNC      // 'CNC'
kc.PRODUCT_NRML     // 'NRML'
kc.PRODUCT_CO       // 'CO'
kc.PRODUCT_BO       // 'BO'

KiteTicker mode constants

The KiteTicker instance exposes three readonly mode constants used with ticker.setMode().
PropertyValueDescription
ticker.modeFull'full'Full quote including market depth (184 bytes for tradable, 32 bytes for indices)
ticker.modeQuote'quote'Quote excluding market depth (44 bytes for tradable, 28 bytes for indices)
ticker.modeLTP'ltp'Last traded price only (8 bytes)
import { KiteTicker } from 'kiteconnect-ts';

const ticker = new KiteTicker({
  api_key: 'YOUR_API_KEY',
  access_token: 'YOUR_ACCESS_TOKEN',
});

ticker.on('connect', () => {
  const tokens = [738561];
  ticker.subscribe(tokens);
  ticker.setMode(ticker.modeFull, tokens);
});

ticker.connect();

Build docs developers (and LLMs) love