Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kiteconnectjs

> 编程语言
Open source

The official typescript client library for the Kite Connect trading APIs

398 stars0 likes1 views
WebsiteGitHub

About

The official typescript client library for the Kite Connect trading APIs

The Kite Connect API TypeScript/JavaScript Client

The official TypeScript/JavaScript for communicating with the Kite Connect API.

Kite Connect is a set of REST-like APIs that expose many capabilities required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (WebSockets), and more, with the simple HTTP API collection.

Zerodha Technology (c) 2024. Licensed under the MIT License.

Documentation

  • Typescript client documentation
  • Kite Connect HTTP API documentation

Requirements

  • NodeJS v18.0.0+

Installation

Install via npm

bash
npm install kiteconnect@latest

Or via yarn

bash
yarn add kiteconnect

Getting started with API

…

Getting started WebSocket client

…

Auto re-connect WebSocket client

Optionally, you can enable client-side auto re-connection to automatically reconnect if the connection is dropped. It is very useful when the client-side network is unreliable and patchy.

Enable auto re-connection with a preferred interval and time. For example:

typescript
// Enable auto reconnect with 5 second interval and retry for maximum of 20 times.
ticker.autoReconnect(true, 20, 5);

// You can also set re-connection times to -1 for infinite re-connections
ticker.autoReconnect(true, -1, 5);
  • Event reconnecting is called when auto re-connection is triggered and event callback carries two additional params reconnection interval set and current re-connection count.

  • Event noreconnect is called when number of auto re-connections exceeds the maximum re-connection count set. For example if maximum re-connection count is set as 20 then after 20th re-connection this event will be triggered. Also note that the current process is exited when this event is triggered.

  • Event connect will be triggered again when re-connection succeeds.

Here is an example demonstrating auto reconnection.

…

Run unit tests

bash
npm run test

Generate documentation

$ npm install typedoc --save-dev
$ npx typedoc --out ./docs

Changelog

Check CHANGELOG.md

A typical web application

In a typical web application where a new instance of views, controllers etc. are created per incoming HTTP request, you will need to initialise a new instance of Kite client per request as well. This is because each individual instance represents a single user that's authenticated, unlike an admin API where you may use one instance to manage many users.

Hence, in your web application, typically:

  • You will initialise an instance of the Kite client
  • Redirect the user to the login_url()
  • At the redirect url endpoint, obtain the request_token from the query parameters
  • Initialise a new instance of Kite client, use request_access_token() to obtain the access_token along with authenticated user data
  • Store this response in a session and use the stored access_token and initialise instances of Kite client for subsequent API calls.

Issues· 13 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言