Skip to content

// case study · Automation · Python · Zerodha

Algo Trading Bot: a Python bot that places orders on two hedged Zerodha accounts automatically

A Python bot that trades Nifty and VIX-based setups through the Zerodha API on two hedged accounts.

Client
My own project
Where
Runs against Indian markets (NSE)
Type
Trading automation
Live site
Private product
Two-account hedging flow: a morning order on account A, a loss check, then an automatic order on account B

The problem

Placing the same trades by hand every morning, then watching them and reacting when one goes against you, is slow and easy to get wrong under pressure. I wanted the routine, and the hedge that follows a losing trade, to happen by rule instead of by reflex.

What I built

The bot is a Python service built on FastAPI that talks to the Zerodha Kite Connect API:

  • Morning orders. It places the day’s buy or sell order on the first account for Nifty and VIX-based setups.
  • Automatic hedge. When the first account’s trade goes into loss, it places the matching order on the second account without anyone clicking.
  • Guard rails. Order checks, logging of every action and clear stop conditions, so it never acts on a stale or half-failed state.

The same pattern, a schedule plus rules plus an API, is what I build for clients who want repetitive work automated.

Tech stack

  • Python
  • FastAPI
  • Zerodha Kite Connect
  • Scheduling
  • Risk rules

The result

The routine now runs by rule. I treat it as an automation case study: it shows how I wire a broker API, a scheduler and risk rules together. Automated trading carries real risk and none of this is financial advice or a promise of returns.

// free audit

Get a free website audit

Send your website link. I’ll look at speed, mobile layout, Google basics and how easy it is to contact you, and reply within one business day with the three things I’d fix first. No cost, no obligation.

Fill in your website, name and email to unlock your free audit.

By sending this you agree to the privacy policy.