Kite (Zerodha)
Kite Connect is Zerodha's trading API. This is the original, best-tested broker in ThetaPrime and the default for new strategies.
Obtaining API Credentials
You need an API Key and API Secret from a Kite Connect app.
- Go to the Kite developer console: https://developers.kite.trade/
- Log in with your Zerodha (Kite) account credentials.
- Click Create new app and choose the Connect app type.
- Fill in the app details:
- App name and Zerodha Client ID — your own values.
- Redirect URL — set this to
http://127.0.0.1:5000/(use the host/port you actually run the app on). This is where Zerodha sends you back after login. - Kite Connect is a paid subscription (₹2,000/month at the time of writing). Complete the subscription to activate the app.
- Open the created app. Copy the API Key and API Secret.
Reference: Kite Connect documentation — https://kite.trade/docs/connect/v3/
Entering Credentials
On the Auth page (top navigation bar), in the Kite (Zerodha) card, enter the API Key and API Secret and click Save & Start Login. You will be redirected to Zerodha to log in (password + TOTP), then returned to the app with an access token.
Credentials are stored securely in the OS keychain — you enter them once.
Daily Login
The Kite access token expires at midnight every day. Each morning:
- Open the app and click Auth in the top navigation bar.
- Your API key is already shown. Click Start Login.
- Zerodha's login page opens. Complete login with your password and TOTP.
- You are redirected back to the dashboard. The badge in the top-right changes from ✕ Kite (red) to ✓ Kite (green).
All scheduled and manual strategy runs pick up the stored token automatically.
Static IP Requirement
SEBI's API trading rules require a fixed IP address for order placement. Ask your ISP for a static IP add-on before creating your Kite app, and register that IP in the app settings alongside the redirect URL. A dynamic IP that later changes will stop matching what's registered and break live order placement until it's updated.
Verifying the Connection
On the Auth page, click Test Session. This calls the Kite profile API with your stored credentials and confirms the token is valid before the market opens.
API Contract Check
Every login doesn't just save the new token — it first calls the read-only endpoints your strategies rely on day-to-day (margins, positions, order history) and checks they actually respond correctly. This catches a broken or changed Kite API before the market opens.
- If all checks pass: the token is saved and the badge turns green.
- If any check fails: the token is not saved — the Auth page shows an error naming exactly which check failed and which feature it would have broken (e.g. position sizing, reconciliation, order retry after a network drop).
If you see this: confirm Zerodha isn't reporting an outage, re-check your API Key/Secret, and try logging in again. Check the App Event Log (Reports page) for the specific error behind the failed check.
Known Limitations
Kite's instrument list only retains expired weekly option strikes for ~7 days. Simulations and historical lookups for dates older than that fall back to Black-Scholes fair value instead of the market's actual traded price — use Breeze for older historical lookups where accuracy matters.