All posts
AlgoAlgo • Setup Guide

Algorithmic Trading in India: Complete Setup Guide (2026)

Everything you need to go live in 2026

5 April 202613 min read2,200 wordsBy TradeYogi Research
Featured image
Algo
/blog/algo-setup-india-hero.svg
TL;DR
  • Algo trading is legal for retail in India through approved broker APIs (Zerodha, Angel One, Upstox, Fyers, Dhan)
  • SEBI's 2025 algo rules require retail API usage to be strategy-logged; no formal approval for personal-use algos
  • Python + broker SDK is the standard stack. Host on a ₹500/month VPS for latency below 50ms to NSE colo
  • Full go-live: broker account → API key → backtest framework → paper trade 60 days → ₹10,000 live pilot → scale

Algorithmic trading in India has gone from niche hobbyist territory to mainstream retail practice over the last five years. Between 2020 and 2026, the number of retail traders using broker APIs has grown roughly 40× according to broker disclosure reports, and SEBI has responded with a formalised regulatory framework (the Feb 2025 algo rules) that gives retail algo traders a clear path to operating legitimately. This post is the complete go-live guide for 2026, from picking a broker through to your first live trade.

Is algo trading legal for Indian retail?

Yes — with conditions. SEBI issued final rules in February 2025 covering algorithmic trading by retail investors via broker APIs. The framework requires:

  • Each retail algo strategy must be registered with the broker before going live (the broker handles this; you just supply a strategy name and description)
  • All algo-generated orders must be tagged as such in the order flow (brokers do this automatically via the API)
  • Order-per-second throttling: retail algos are capped at 10 orders per second per broker (plenty for any non-HFT strategy)
  • Strategy logs must be retained for 5 years (your broker keeps these on the server side)

For a personal-use retail algo — one trader, one account, no investors — there is no formal SEBI approval process. You register with the broker and you are good. If you plan to manage other people's money with your algo, you need a Portfolio Manager license, which is a different universe of compliance.

The 2025 rules were largely a formalisation of existing practice. If you were running algos in 2024, you are already compliant as long as your broker supports the new logging requirements — which all major brokers do by default.

Choosing a broker with API support

Five Indian brokers currently offer retail-accessible APIs. Here's how they compare on the metrics that matter for algo traders:

BrokerAPICostRate limitWebsocket quality
ZerodhaKite Connect₹2,000/month10 req/secStable, well-documented
Angel OneSmartAPIFree20 req/secGood, recent v2 improvements
UpstoxUpstox APIFree25 req/secSolid, lower adoption
FyersFyers APIFree15 req/secGood, growing community
DhanDhan APIFree20 req/secNewer, fast iteration

Kite Connect (Zerodha) is the market leader by volume and community support — most open-source algo libraries target it first. Angel One's SmartAPI is the best free alternative and has caught up significantly in 2025. Both are solid choices. We'll use Kite Connect in the examples below, but the patterns translate directly.

The technology stack

Ninety-five percent of Indian retail algos run on Python. The ecosystem is mature, the broker SDKs are first-class, and the backtesting libraries (backtrader, vectorbt, zipline-reloaded) are free and well-supported. Here is the canonical stack:

Language:        Python 3.11+
Broker SDK:      kiteconnect / smartapi-python
Data storage:    PostgreSQL for trades, Parquet for candles
Backtest:        backtrader OR vectorbt
Live scheduling: cron + systemd (Linux), or Task Scheduler (Windows)
Monitoring:      Telegram bot for alerts, Grafana for metrics
Hosting:         Ubuntu 22.04 VPS, DigitalOcean/Hetzner, Mumbai region

The VPS matters for latency. A DigitalOcean or Hetzner droplet in the Mumbai region gives you sub-50ms RTT to NSE's colocation facility. That's not enough for HFT, but it's more than enough for any strategy with holding periods longer than 5 seconds.

Your first live script

Here's a minimal but complete script that logs into Kite Connect, subscribes to NIFTY 50 ticks, and prints them. From this foundation, everything else is incremental.

from kiteconnect import KiteConnect, KiteTicker
import logging

logging.basicConfig(level=logging.INFO)

API_KEY = 'your_api_key'
ACCESS_TOKEN = 'your_daily_access_token'

kite = KiteConnect(api_key=API_KEY)
kite.set_access_token(ACCESS_TOKEN)

# NIFTY 50 spot instrument token
NIFTY_TOKEN = 256265

kws = KiteTicker(API_KEY, ACCESS_TOKEN)

def on_ticks(ws, ticks):
    for tick in ticks:
        print(f"NIFTY: {tick['last_price']} vol={tick.get('volume', 0)}")

def on_connect(ws, response):
    ws.subscribe([NIFTY_TOKEN])
    ws.set_mode(ws.MODE_FULL, [NIFTY_TOKEN])

kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.connect()

The daily access token has to be regenerated every morning because Kite Connect does not support long-lived tokens (a SEBI-mandated design). Most algo traders automate this with a headless login flow using Selenium or Playwright.

Backtesting before going live

Never deploy a strategy to live capital without a clean backtest. Backtrader is the most common Python backtest library, but vectorbt is faster for parameter sweeps. Here's a minimal backtrader example for an EMA crossover:

import backtrader as bt

class EmaCrossover(bt.Strategy):
    params = (('fast', 9), ('slow', 21))

    def __init__(self):
        self.fast = bt.ind.EMA(period=self.p.fast)
        self.slow = bt.ind.EMA(period=self.p.slow)
        self.crossover = bt.ind.CrossOver(self.fast, self.slow)

    def next(self):
        if not self.position and self.crossover > 0:
            self.buy()
        elif self.position and self.crossover < 0:
            self.close()

cerebro = bt.Cerebro()
cerebro.addstrategy(EmaCrossover)
data = bt.feeds.PandasData(dataname=nifty_df)
cerebro.adddata(data)
cerebro.broker.setcash(100000)
cerebro.broker.setcommission(commission=0.0003)
results = cerebro.run()
print(f'Final portfolio value: {cerebro.broker.getvalue():.2f}')

Good backtests include commission modelling, slippage, and walk-forward validation. A 5-year in-sample backtest with no out-of-sample check is not a backtest — it is curve fitting. Always split your data into training (70%) and validation (30%) segments and check that the strategy works on both.

Paper trading: the 60-day rule

Between backtest and live money, every algo should run on paper for at least 60 trading sessions. Paper trading in this context means the algo runs on live market data in real time but submits trades to a simulated broker instead of the real one. It catches three classes of bugs:

  • Data handling bugs — missing ticks, gapped candles, timezone errors
  • Order execution bugs — trying to submit an order when you already have one pending, wrong lot sizes, wrong symbols
  • Timing bugs — strategy expects a 9:15 candle but your code runs at 9:14:58

Every one of these will eventually happen in live. Catching them on paper costs nothing. Catching them on live costs real money and broken positions.

The go-live checklist

When you are finally ready to put real capital on the line, go through this checklist item by item. Do not skip steps.

  1. Backtest profit factor ≥ 1.3 with clean in-sample + out-of-sample split
  2. Paper traded 60+ sessions with correlation ≥ 0.95 to backtest P&L
  3. Telegram alerts set up for every trade open/close and every error
  4. Emergency kill switch tested — you must be able to flatten all positions with a single command
  5. Position sizing code double-checked: risk per trade ≤ 1% of capital
  6. First live run with 10% of target capital (e.g. ₹10,000 if target is ₹1,00,000)
  7. Monitor the first 2 weeks actively — not daily, hourly
  8. Scale to full capital only after 20 successful live trades matching paper-trade expectations

Hosting and reliability

Your laptop is not a production hosting environment. Mumbai-region VPS options that work well for Indian algo traders:

  • DigitalOcean Mumbai droplet (2 CPU / 4 GB RAM): ~₹800/month, good enough for any non-HFT strategy
  • Hetzner Cloud (Helsinki or Falkenstein): ~₹500/month, slightly higher latency (~120ms RTT to NSE) but still fine for holding-period > 10 seconds
  • AWS EC2 Mumbai (t3.small): ~₹1,500/month, enterprise-grade but overkill for one retail strategy

Use systemd to run your algo as a service that auto-restarts on crash. Use cron to schedule daily access-token refresh. Use a Telegram bot to alert you on any exception — silent failures are the worst kind of failure.

Mistakes that kill algo traders

  1. Optimising on the wrong metric. Chasing win rate instead of profit factor. Chasing total return instead of Sharpe. Optimise on risk-adjusted returns or you will find fragile strategies.
  2. Skipping walk-forward validation. In-sample backtests with no OOS check are fiction. Always validate on held-out data.
  3. No kill switch. If your algo misbehaves at 2:47 pm and you need 10 minutes to debug while positions blow up, you do not have a real system.
  4. Running without alerts. Silent failures can go on for days. Alert on every trade and every error.
  5. Overleveraging. The temptation to run the algo at 5% risk per trade because 'the backtest shows more return' has killed more retail algo accounts than any other single cause.

Summary

Algo trading in India in 2026 is legal, accessible, and well-supported by the major brokers. The go-live path is broker API → Python SDK → backtest → paper trade → small pilot → scale. Total cost to set up: under ₹5,000 including VPS for the first year. Total time to go live responsibly: 3-4 months including paper trading.

The technology is the easy part. The hard part is discipline — following your backtested rules, not overriding the algo, accepting losing streaks, and scaling only when the live performance matches the paper results. If you can do that, algo trading will give you a bigger edge and a quieter life than any discretionary trading ever can.

#Algo Trading#Setup#India#SEBI#API

Want this strategy running on autopilot?

TradeYogi automates the logic in this post with one-click backtests, paper trading and live deploys on Indian brokers.

Try TradeYogi free
No credit card required. 14-day full access.

Keep reading