Skip to content

    How to Start Algo Trading in India

    Quick answer

    Start algo trading in India: SEBI order to trade ratio, API approval, a real Python Nifty snippet, costs, and tax. Illustrative, not advice.

    19 June 2026
    17 min read
    3,342 words

    Key Takeaways

    • 1.Algo trading for retail traders in India is now governed by SEBI's framework finalised in 2025, which makes your broker the registered point of control. Every automated order must flow through an exchange approved algo that carries a unique algo ID and a static IP registration.
    • 2.Any retail strategy that places more than a set number of orders per second is treated as an algo and must be registered. Brokers tag your orders, throttle your API, and enforce the exchange order to trade ratio so a runaway loop does not flood the order book.
    • 3.You connect through a broker API such as Kite Connect, Upstox API, or Angel One SmartAPI. The broker, not you, takes SEBI and exchange approval for the algo, so pick a broker whose API terms allow your style of automation before you write a line of code.
    • 4.F&O profits are taxed as business income at your slab rate, not as capital gains. Equity delivery is STCG 20 percent or LTCG 12.5 percent above Rs 1.25 lakh. STT, exchange fees, GST, and brokerage quietly eat into every automated round trip, so model costs before going live.
    • 5.All numbers here are illustrative for learning only. Backtest, then paper trade, then start with one lot. Nothing in algo trading guarantees a profit and a bad loop can lose real money fast.

    What Algo Trading Actually Means Under Indian Rules

    Algo trading means a computer program places or modifies your orders using a fixed set of rules instead of you clicking the buy and sell buttons. In India the important point is not the code, it is the regulatory boundary. The Securities and Exchange Board of India (SEBI) issued a circular in February 2025 and the exchanges NSE and BSE published operational rules through 2025 that brought retail API trading formally under the algo framework. The framework went live in a phased manner during 2025.

    The rule that matters most for a beginner is this. The moment your software, and not your finger, decides when an order is sent, the exchange wants that order tagged as an algo order. Below a low order rate threshold, broadly framed around ten orders per second per user, your orders are treated like ordinary fast manual trades. Cross that rate, or run any auto place and auto cancel logic, and the order must carry a registered algo ID. Your broker registers the algo with the exchange on your behalf, and your trades are sent from a registered static IP so the exchange can trace every automated order to a known source.

    This is why you cannot simply download a script from the internet and point it at the live market. The legal responsibility for an approved algo sits with the registered broker, who must take exchange approval for the strategy logic, control the rate of orders, and supervise it. As a retail trader you operate inside that approved envelope. Understanding this saves you from building something the exchange will not let you run.

    The SEBI Algo Rules You Must Know Before You Code

    Three concrete controls shape what your algo is allowed to do. The first is the order to trade ratio, often shortened to OTR. Every order you send that does not result in a trade still consumes exchange capacity. To stop algos from spamming and cancelling thousands of orders, the exchange measures the ratio of orders placed to orders actually executed. A high OTR triggers penalties that your broker passes on to you, and persistent abuse can get an algo throttled or switched off. Strategies that place quotes and cancel them rapidly are the ones that get caught by OTR limits, so a beginner placing simple directional orders rarely has a problem here.

    The second control is API approval and registration. You access the market through a broker API. SEBI's framework requires brokers to register the algo and route it from a fixed, declared IP address, and to tag each algo order with a unique algo ID so it can be audited. Open APIs that just place orders without registration are not permitted for unattended algos. In practice you apply through your broker, accept their algo terms, and they map your strategy to an approved category.

    The third is the split between a white box and a black box algo. A white box algo has logic that is fully disclosed and explainable to the trader and exchange. A black box algo hides its logic, and under the framework it carries heavier obligations including research report registration. As a retail trader starting out, you almost always want a transparent white box rule set, both because it is simpler to register and because you can actually understand why it traded.

    • Order to trade ratio (OTR): keep cancellations low so you do not trip exchange penalties that the broker bills back to you.
    • Unique algo ID: every automated order is tagged so the exchange can trace it. Your broker assigns this when the algo is registered.
    • Static IP registration: unattended algos must send orders from a fixed declared IP, which is why most traders run on a VPS or a cloud server with a stable address.
    • Order rate threshold: roughly ten orders per second per user is the broad line above which orders must be treated and registered as algo orders.
    • Two factor authentication: broker APIs require a daily login token, so a fully unattended algo still needs a session refresh step each trading day.
    Tip

    Before you build anything, read your chosen broker's algo and API policy page in full. Rules and exact thresholds get updated by SEBI and the exchanges, so always confirm the current order rate limit, OTR penalty slab, and registration process on the official broker and exchange pages on the day you go live.

    Choosing a Broker and API for Automation

    Your broker choice decides what is technically and legally possible. In India the widely used retail trading APIs are Zerodha's Kite Connect, Upstox's Upstox API, and Angel One's SmartAPI. Each gives you programmatic order placement, live and historical data, and a websocket for streaming quotes. They differ in monthly API cost, rate limits, data depth, and how cleanly they fit the registered algo framework, so compare them against your actual strategy rather than on brand name.

    FactorWhat to checkWhy it matters
    API costMonthly fee for the connect or order APIA scalping algo that pays a flat monthly fee needs enough volume to justify it
    Rate limitsOrders per second and requests per minute allowedDecides whether your strategy can place orders fast enough without being throttled
    Historical dataDepth and granularity of candles availableYou need clean minute or tick history to backtest honestly
    Algo registrationWhether the broker supports registering your strategyRequired for unattended automation under the SEBI framework
    Websocket feedLive tick or quote streaming reliabilityA flaky feed makes your entry and exit signals unreliable

    A practical filter for a beginner is to start with the broker where you already hold funds, confirm their API supports the order types you need such as bracket or cover orders, and check that their algo registration path is open to retail clients. Do not optimise for the absolute lowest latency on day one. Correct logic and survivable risk beat raw speed when you are learning.

    A Real Python Strategy Snippet

    Below is a compact, readable example of a simple moving average crossover on Nifty futures using the structure of a typical Indian broker API such as Kite Connect. It is deliberately a white box rule. When the fast 9 period average crosses above the slow 21 period average it goes long one lot, and it exits when the fast average crosses back below. This is illustrative teaching code, not financial advice or a guaranteed system, and the function and constant names are simplified for clarity.

    import pandas as pd
    from kiteconnect import KiteConnect

    kite = KiteConnect(api_key="your_api_key")
    kite.set_access_token("daily_access_token") # refreshed each trading day

    SYMBOL = "NFO:NIFTY26JUNFUT" # current month Nifty future
    LOT_SIZE = 65 # Nifty lot size
    FAST, SLOW = 9, 21

    def get_signal(df):
        df["fast"] = df["close"].rolling(FAST).mean()
        df["slow"] = df["close"].rolling(SLOW).mean()
        prev, last = df.iloc[-2], df.iloc[-1]
        if prev["fast"] <= prev["slow"] and last["fast"] > last["slow"]:
            return "BUY"
        if prev["fast"] >= prev["slow"] and last["fast"] < last["slow"]:
            return "EXIT"
        return "HOLD"

    def place_order(signal):
        if signal == "BUY":
            kite.place_order(variety="regular", exchange="NFO",
                tradingsymbol="NIFTY26JUNFUT", transaction_type="BUY",
                quantity=LOT_SIZE, product="NRML", order_type="MARKET")

    Notice three Indian specifics baked in. The instrument is a Nifty future with a lot size of 65, so quantity is one lot of 75, not a free choice. The access token is refreshed each trading day because broker APIs force a fresh login. And the symbol points to the current month future, which you must roll near expiry. In a real deployment you would add a stop loss, a maximum daily loss cut off, error handling for rejected orders, and OTR friendly logic that does not place and cancel orders in a tight loop.

    Tip

    Never run new code straight on the live API. Run it against historical data first, then on the broker's sandbox or with the smallest size, and add a hard kill switch that stops all trading if the day's loss crosses a fixed rupee limit.

    A Worked Numeric Example on Nifty (Illustrative)

    Suppose the crossover signal fires and your algo buys one lot of Nifty futures at 23,500. Nifty lot size is 65. So the position size is 23,500 multiplied by 75, which is a notional value of Rs 17,62,500. You are not paying that full amount, you post margin, but the profit and loss is calculated on the full lot. Imagine the trend holds and the algo exits at 23,650, a clean 150 point move in your favour. These figures are illustrative only and are not a prediction.

    Gross profit is 150 points multiplied by 75, which equals Rs 11,250. Now subtract the costs that an automated round trip really pays. A discount broker typically charges a flat fee of about Rs 20 per executed order, so roughly Rs 40 for buy plus sell. Securities transaction tax (STT) on futures applies on the sell side at 0.02 percent of the sell turnover. The sell turnover is 23,650 multiplied by 75, which is Rs 17,73,750, so STT is about Rs 355. Add exchange transaction charges, SEBI turnover fees, GST on brokerage and exchange charges, and stamp duty on the buy side, which together come to roughly Rs 60 to Rs 80 for this trade.

    Line itemAmount (Rs)Note
    Gross profit9,750150 points x 65 lot size
    Brokerage40About Rs 20 per side, flat discount broker
    STT on sell7690.05 percent of sell turnover of Rs 15,37,250
    Exchange, SEBI, GST, stamp65Approximate combined statutory and platform charges
    Net profit before tax8,876Gross minus all costs, illustrative

    So a clean Rs 11,250 gross trade nets roughly Rs 10,780 before income tax. That is the honest picture. The costs feel small on a winning futures trade, but on a high frequency strategy that trades many times a day, STT and charges become the single biggest reason an otherwise good backtest loses money live. Always model these costs inside your backtest, not after it.

    How Your Algo Profits Are Taxed in India

    Tax treatment depends on what you trade, and it is not the same across segments. Profits from futures and options are treated as business income, not capital gains. That means F&O gains are added to your total income and taxed at your normal slab rate, and you can claim genuine expenses such as broker charges, data subscriptions, and your VPS cost against that income. Because it is business income, active F&O traders often need to file using the business income forms and may face audit requirements depending on turnover.

    If your algo instead trades equity delivery, the capital gains rules apply. Short term capital gains, for shares held one year or less, are taxed at 20 percent. Long term capital gains, for shares held more than one year, are taxed at 12.5 percent on gains above the Rs 1.25 lakh yearly exemption. Intraday equity, where you square off the same day without taking delivery, is treated as speculative business income and taxed at your slab rate. Keep your trade logs clean, because an algo can generate hundreds of entries that you will need to reconcile at filing time.

    • F&O profit: business income, taxed at your slab rate, expenses deductible.
    • Equity delivery STCG (held one year or less): 20 percent.
    • Equity delivery LTCG (held over one year): 12.5 percent on gains above Rs 1.25 lakh per year.
    • Intraday equity: speculative business income, taxed at slab rate.
    • Keep every contract note and a complete trade ledger, since an algo produces far more transactions than manual trading.

    Backtest Honestly Before You Risk a Rupee

    A backtest runs your rules against past data to see how they would have behaved. The trap is making the backtest look better than reality. The two ways beginners fool themselves are curve fitting, where you tune parameters until the past looks perfect, and ignoring costs, where the backtest forgets STT, brokerage, and slippage. A crossover strategy that shows a beautiful equity curve with zero costs can flip to a loss once you subtract the Rs 470 of costs we calculated on that single Nifty trade across hundreds of trades.

    Build your backtest to include realistic slippage, the difference between the price you expected and the price you actually got. On liquid Nifty and Bank Nifty futures slippage is small, often a tick or two, but on illiquid stock options it can be brutal and can quietly destroy a strategy that looked perfect on paper. After backtesting, move to paper trading or the smallest live size so you can watch real fills, real rejections, and real latency before scaling up.

    Tip

    If a strategy only works with one exact set of parameters and falls apart when you nudge them slightly, it is probably curve fit. Robust strategies stay profitable across a range of nearby settings and across different time periods.

    Risk Controls That Actually Stop Losses

    Automation removes hesitation, which is good for entries and dangerous for losses. A human freezes when a trade goes wrong, but a buggy loop can keep firing orders until your capital is gone. So the most important code in your project is not the entry signal, it is the risk layer. Every live algo needs a hard maximum daily loss that, once hit, flattens all positions and stops trading for the day, no exceptions. It also needs position size limits so a logic error cannot accidentally send ten lots instead of one.

    Set a per trade stop loss in the order itself, not only in your script, because if your script or internet connection dies the broker side stop still protects you. Cap your exposure with sensible position sizing so a single bad trade is survivable. And keep your order rate well below the exchange limit so you never trip OTR penalties or get flagged for flooding the order book.

    • Hard daily loss limit in rupees that flattens everything and halts trading when breached.
    • Broker side stop loss orders so protection survives a script crash or internet drop.
    • Strict position size caps so a bug cannot send a wildly oversized order.
    • A manual kill switch you can hit from your phone to stop all trading instantly.
    • Order rate well under the exchange limit to stay clear of OTR penalties.

    Infrastructure: Where and How to Run It

    An algo must run continuously during market hours without your laptop going to sleep or your home internet dropping. That is why most serious retail algo traders run on a virtual private server or a cloud instance with a stable, declared IP address. This matters twice over. It keeps the algo running reliably, and the framework expects unattended algos to send orders from a registered static IP, so a fixed address is not just convenient, it fits the compliance model.

    Choose a server located close to the exchange region to keep latency low, log every order and every rejection so you can audit what happened, and set up alerts to your phone for errors and for the daily loss limit being hit. Treat the system like infrastructure, not a hobby script. The cheapest way to lose money in algo trading is a silent failure at 9:15 am that nobody notices until the close.

    Common Mistakes Beginners Make

    The first and most expensive mistake is going live without a tested kill switch, so a small bug becomes a large loss. The second is curve fitting a backtest until it looks flawless and then being shocked when live results differ. The third is ignoring costs, especially STT on the sell side of futures and slippage on illiquid options, which together turn many winning backtests into losing live accounts.

    Two more catch beginners often. Forgetting to roll the contract near expiry, so the algo tries to trade an expired or illiquid far month and gets bad fills. And treating the broker API token as permanent, when in fact it expires daily and must be refreshed, so the algo silently stops at the next login without you realising. Build these into your checklist before your first live session.

    Sources and Further Reading

    For authoritative rules and contract specifications, refer to SEBI, NSE India, and Zerodha Varsity. SEBI and the exchanges update the algo framework, order rate thresholds, OTR penalties, and tax provisions over time, so always confirm the current rules and rates on the official source before you build or deploy.

    Sources and Further Reading

    For authoritative data and further reading on this topic, refer to SEBI (Securities and Exchange Board of India), NSE India and Zerodha Varsity. Always confirm current rules, rates and contract specifications on the official source before you trade.

    Related Topics

    algo tradingIndian marketsNSEBSESEBI regulationstrading strategiesautomated trading

    Related Articles

    OneTradeJournal

    The trading journal built for Indian F&O traders. Track your trades, spot patterns, build discipline.

    • Log one trade a day by hand, on purpose
    • AI mentor finds your repeat mistakes
    • Behavioural analytics catch tilt early
    • Trading calendar with P&L heatmap
    • Pre-trade checklist flags risks
    Start journaling

    Yearly ₹2,499 · No broker credentials