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.

Once your KiteTicker connection is open, you use subscribe() and setMode() to tell the server which instruments to stream and at what granularity. Each instrument is identified by its numeric token, and you can mix modes across tokens — for example, streaming full depth on a handful of liquid contracts while tracking the rest in LTP mode.
Instrument tokens are available from KiteConnect.getInstruments(). The token for a symbol is the instrument_token field in the response.

subscribe(tokens)

Send an array of instrument tokens to start receiving ticks for those instruments. New subscriptions default to ltp mode unless you call setMode() afterward.
ticker.subscribe([738561]);

// Subscribe to multiple tokens at once
ticker.subscribe([738561, 779521, 408065]);
The method returns the tokens array unchanged.

unsubscribe(tokens)

Stop receiving ticks for the given tokens. The server immediately stops sending updates for unsubscribed tokens.
ticker.unsubscribe([738561]);

// Unsubscribe multiple tokens
ticker.unsubscribe([738561, 779521]);

setMode(mode, tokens)

Assign a tick mode to an array of tokens. You can call this at any time to upgrade or downgrade the data for a set of subscribed instruments.
ticker.setMode(ticker.modeLTP, [738561]);    // minimal — last price only
ticker.setMode(ticker.modeQuote, [738561]);  // OHLC + volume + buy/sell quantities
ticker.setMode(ticker.modeFull, [738561]);   // quote + 5-level market depth + OI

Tick structures by mode

The smallest packet — 8 bytes. Delivered for all instrument types.
interface TickLtp {
  tradable: boolean;       // false for index instruments
  mode: 'ltp';
  instrument_token: number;
  last_price: number;
}
Example tick:
{
  tradable: true,
  mode: 'ltp',
  instrument_token: 738561,
  last_price: 1234.50,
}

autoReconnect(t, max_retry, max_delay)

Configure or toggle auto-reconnect at any time. This method is also called internally during construction using the params you pass to the constructor.
// Enable with custom limits
ticker.autoReconnect(true, 10, 5);

// Disable reconnection entirely
ticker.autoReconnect(false);
ParameterTypeDefaultDescription
tbooleantrue to enable, false to disable
max_retrynumber50Maximum reconnection attempts (up to 300)
max_delaynumber60Maximum interval in seconds between retries (minimum 5)

disconnect()

Close the WebSocket connection immediately. The close event fires when the connection shuts down cleanly.
ticker.disconnect();

connected()

Check whether the WebSocket is currently open and ready to send or receive messages.
if (ticker.connected()) {
  ticker.subscribe([738561]);
} else {
  console.log("Not connected yet");
}
Returns true when the underlying socket is in the OPEN state, false otherwise.

Build docs developers (and LLMs) love