Bank Nifty Algo Trading: Zerodha API, Python Setup & SEBI Legal Framework

Manual Bank Nifty trading has two enemies: speed (you cannot react in milliseconds) and emotion (you override your own rules). Algorithmic trading eliminates both. This guide shows you how to set up a Bank Nifty options algo using Zerodha's Kite Connect API and Python — from zero to running your first automated trade.

▲ +5.0% Vol: $394M

SEBI's circular dated 16 March 2023 established rules for algo trading by retail investors:

Zerodha Kite Connect API Setup

  1. Subscribe to Kite Connect: Go to developers.kite.trade → Sign up → ₹2,000/month subscription. This gives you API access.
  2. Create an app: In the Kite Connect dashboard, create a new app. Note your api_key and api_secret.
  3. Generate access token: The login flow requires manual authentication once per day (Kite uses TOTP for security). After login, you receive an access_token valid for the entire trading session.
  4. Install Python library: pip install kiteconnect

Python Environment

Required libraries: kiteconnect (Zerodha API), pandas (data manipulation), numpy (calculations), schedule (time-based triggers), logging (trade logging). Optional: scipy (Black-Scholes calculations), telegram-send (notifications).

The basic flow: authenticate → fetch Bank Nifty spot and option chain → apply strategy logic → place order → manage position → log everything.

Automating a Short Straddle Strategy

Example: automated short straddle with adjustment rules.

  1. At 9:20 AM: Fetch Bank Nifty spot. Find ATM strike (nearest 100). Sell ATM CE + ATM PE. Log entry premiums.
  2. Every 5 minutes: Check combined premium. If combined P&L exceeds -30% of collected premium, trigger SL exit.
  3. If one leg doubles: Close both legs, re-sell straddle at new ATM. Maximum 2 adjustments.
  4. At 3:15 PM: Close all positions regardless of P&L. No overnight hold.
  5. Log: Entry prices, exit prices, adjustments, P&L, VIX at entry, PCR at entry. Save to CSV for backtesting.

Critical Risk Controls

Alternative Platforms

PlatformCostLanguageBank Nifty Support
Kite Connect (Zerodha)₹2,000/moPython, Java, JSFull F&O
Smart API (Angel One)FreePython, JavaFull F&O
Fyers APIFreePythonFull F&O
Streak (no-code)₹500/moVisual builderLimited
Jugaad TraderFreePythonFull F&O

Best free option: Angel One Smart API — no monthly charge, full F&O access, Python support. The trade-off is slightly slower execution compared to Zerodha.

Free Calculator
F&O Margin & STT Calculator
Calculate exact margin requirements, STT, stamp duty, and brokerage. Compare costs across Zerodha, Angel One, Groww, Upstox.
Calculate Margin & Charges →

Frequently Asked Questions

Is algo trading legal for Bank Nifty in India?

Yes. SEBI permits retail traders to use broker APIs for automated trading. No exchange approval is needed for API-based orders. Brokers like Zerodha, Angel One, and Fyers provide official APIs. Rate limits apply (3 orders/second on Zerodha). Co-location access is not available for retail.

How much does Zerodha API cost?

Kite Connect subscription costs Rs 2,000 per month. This provides API access for automated trading. Standard brokerage of Rs 20 per order still applies on each trade. Historical data APIs have additional charges. Angel One and Fyers offer free API access.

Can I algo trade Bank Nifty options without coding?

Yes. Streak (by Zerodha) provides a visual strategy builder for no-code algo trading. You create conditions using dropdown menus, and Streak executes them automatically. However, Streak has limited options strategy support compared to custom Python code.

What is the minimum capital for Bank Nifty algo trading?

For option buying algos: Rs 50,000 is sufficient. For option selling algos: Rs 3,00,000 minimum (margin for 2 lots + buffer). Add Rs 2,000/month for Zerodha API subscription. Total first-month cost: Rs 3,02,000 minimum for selling-based algos.

Start Trading Bank Nifty Today

Open a trading account and put these strategies into practice. Get $30 free credit to start.

Claim $30 Free Credit → 18+ | Trading involves risk. Capital at risk.
Risk Disclaimer

Options trading carries a high level of risk and is not suitable for all investors. Bank Nifty options are highly volatile instruments. Past performance is not indicative of future results. Content on BankNiftyOptions.com is for educational purposes only. Consult a SEBI-registered advisor before trading. Only trade with capital you can afford to lose. 18+ only.