Kite Connect CLI — Multi-account Zerodha trading positions viewer
Project description
KCLI — Kite Connect CLI
A multi-account Zerodha Kite Connect positions viewer with a beautiful terminal interface.
╦╔═╔═╗╦ ╦
╠╩╗║ ║ ║
╩ ╩╚═╝╩═╝╩
Kite Connect CLI
Architecture
┌─────────────────┐ HTTPS ┌──────────────────┐ Kite API ┌─────────────────┐
│ kcli (CLI) │ ──────────────── │ FastAPI Server │ ──────────────────│ Zerodha Kite │
│ Your Machine │ │ Google Cloud │ │ Connect API │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
~/.kcli/config.yaml
- CLI (
kcli): Runs on your machine. Beautiful color-coded terminal UI. - Server: Runs on Google Cloud (Cloud Run). Proxies Kite API calls.
- Config: Multi-account config stored locally at
~/.kcli/config.yaml.
Quick Start
1. Deploy the Server
# Build and deploy to Cloud Run
cd server
gcloud run deploy kcli-server \
--source . \
--region asia-south1 \
--allow-unauthenticated \
--set-env-vars AUTH_TOKEN=your-secret-token
2. Install the CLI
# From the project root
pip install -e .
3. Initialize Config
# Create the default config file
kcli config --init
# Edit the config with your accounts
# Open ~/.kcli/config.yaml and add your Kite API credentials
Config file format (~/.kcli/config.yaml):
server:
url: "https://your-cloud-run-url.run.app"
auth_token: "your-secret-token"
accounts:
- name: "Trading Account 1"
api_key: "your_api_key_1"
api_secret: "your_api_secret_1"
- name: "Trading Account 2"
api_key: "your_api_key_2"
api_secret: "your_api_secret_2"
4. Login to Kite
# Initialize and authenticate all accounts
kcli init
This will:
- Send your account configs to the server
- Display login URLs for each account
- Prompt you to paste the
request_tokenafter logging in via browser
Note: Kite access tokens expire daily (~6 AM IST). You need to run
kcli initonce each trading day.
5. View Positions
# View positions across all accounts
kcli positions
Commands
| Command | Description |
|---|---|
kcli init |
Authenticate all accounts (daily) |
kcli positions |
View positions across all accounts |
kcli status |
Check authentication status |
kcli config --init |
Create default config file |
kcli config --show |
Show current config (secrets masked) |
kcli config --path |
Print config file path |
Development
Run Server Locally
cd server
pip install -r requirements.txt
AUTH_TOKEN=test-token uvicorn main:app --reload --port 8080
Run CLI
pip install -e .
kcli --help
Getting Kite API Credentials
- Go to Kite Developer Console
- Create a new app
- Note your API Key and API Secret
- Set the Redirect URL to your server's callback URL
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kitecli-0.1.0b1.tar.gz.
File metadata
- Download URL: kitecli-0.1.0b1.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef137d89cf6625cdbecb36830a27161b0c3c3d7a278dc2b5b477c54761b46333
|
|
| MD5 |
f5c100a7169624abd9f9f354d892689b
|
|
| BLAKE2b-256 |
f61ce04bdd4a0bb60f7b5be52f0909dc9028f891a61cdda4424be41a307ca72b
|
File details
Details for the file kitecli-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: kitecli-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5c07d82e576e50033b1fb1e2072f4c84856482af1a49f05c54eac7856ea0391
|
|
| MD5 |
509a5acedaaf8e383afc6f2b46ec25b5
|
|
| BLAKE2b-256 |
f7d6c5c86d6bbe1133077d820810fa3e317f6e36e716cd813488152971935120
|