Notes from building a Kite Connect intraday bot: daily login, static IP, charge math, paper mode

abhishekrajpurohit
I built a small intraday (MIS) bot on Kite Connect in Python and wrote up what I'd tell anyone starting one in 2026. Short version:

1. The daily login. The access_token dies every day, so the bot needs a morning step: open the login URL, grab the request_token from the redirect, call generate_session, and save the token for the day.

2. Static IP first. API orders now have to come from the IP registered in your developer profile, and you can only change it about once a week. Pick the VPS before you write strategy code. Paper trading doesn't need it.

3. Rate limits. Quotes are 1 request a second, so batch symbols into one quote() call instead of looping.

4. Put the stop-loss at Zerodha, not only in your code. Place the SL order right after the entry fills, so a crash or lost connection doesn't leave the position naked.

5. Do the charge math before the strategy. On a small-target trade, brokerage + STT + exchange + GST + stamp ate about 30% of a ₹400 gross win in my numbers, and one 1% stop wiped out 7–8 winners.

6. Paper mode by default. Live needs two switches (config and a --live flag). Record every price to CSV while paper trading, so you can replay real days through new code.

Full write-up with the code (login flow, order placement, the charge function, replay): https://abhishekrajpurohit.in/blog/algo-trading-zerodha-kite-connect-python

Happy to answer questions on the auth flow or order handling. Corrections welcome if anything here is out of date.
Tagged:
Sign In or Register to comment.