---
title: "How do people build an algo with Python and broker APIs?"
description: "A Python algo is a program that reads prices, forms a signal, checks risk and sends orders through a broker's API."
source_url: "https://www.rupeecase.com/learn/questions/build-an-algo-with-python"
---

A Python algo sends every order through risk checks and the broker API

The parts of a retail algo built on a broker API. A rule diagram with no market figures; the rules follow SEBI circulars of 4 Feb 2025 and 30 Sep 2025. Source: SEBI circulars on retail algo trading, Feb and Sep 2025. As of 16 Oct 2026.
An algo runs four jobs in a loop: it reads prices, turns them into a signal, checks the trade against risk limits, and sends the order. Python is often used for the first three because its data and testing tools are wide. The fourth step depends on the broker, because the order goes through the broker's API and the broker decides who may connect and from where.

The chart lists the parts in order. The API connection needs the client specific key, a whitelisted static IP and two factor login. Orders carry the exchange identifier, API sessions are logged out every day, and a high order rate can move a personal algo into the registered category. A risk check should sit between the signal and the order, with a loss limit, a position limit and a kill switch the program can trigger on its own.

Testing comes before any live order. Run the logic on dated historical data, and keep the test period apart from the period that shaped the rules. Then paper trade, and only then trade real money, at a size where a bad day can be survived. Keep a log of every order and every rejection, because the broker and the exchange can ask for them.

A backtest that looks good is not proof of profit. Costs, slippage and the way a rule was picked can all make a test look better than the live result. The [backtesting question](/learn/questions/backtest-option-strategy) shows how a test should be set up before its result is read.

**Before you trade.** Derivatives trading carries a high risk of loss. SEBI's study "Profitability of Individual Traders in the Equity Derivatives Segment (FY25 to FY26)" (August 2026) found that 87.7% of individual traders in equity F&O made net losses in FY26, with aggregate net losses of Rs 91,685 crore. [Read the SEBI study](https://www.sebi.gov.in/reports-and-statistics/research/aug-2026/study-profitability-of-individual-traders-in-the-equity-derivatives-segment-fy25-fy26-_103835.html)

How do people build an algo with Python and broker APIs?A Python algo is a program that reads prices, forms a signal, checks risk and sends orders through a broker's API, and in India that last step must follow the broker's key, static IP and login rules and the SEBI retail framework. Writing the code is the easy part; testing on dated data, paper trading and watching the live system is where most of the work sits.

LGo deeper

## Where Learn teaches this.
[Go deeperBuilding a compliant retail algo10 min, Advanced](/learn/path-19/module-19-5-building-a-compliant-algo)

SSources

## Go to the source.
3 sources, SEBI the most cited

The publisher of each source listed below. Source: Module undefined source list.
1. [SEBI circular, Safer participation of retail investors in algorithmic trading (4 Feb 2025)](https://www.sebi.gov.in/legal/circulars/feb-2025/safer-participation-of-retail-investors-in-algorithmic-trading_91614.html) SEBI
2. [SEBI circular, extension of timeline for the algo framework (30 Sep 2025)](https://www.sebi.gov.in/sebi_data/attachdocs/sep-2025/1759232056254.pdf) SEBI
3. [NSE circular NSE/INVG/67858, implementation standards for retail algo trading (5 May 2025)](https://nsearchives.nseindia.com/content/circulars/INVG67858.pdf) NSE

?Questions people ask

## Related questions.
[QuestionWhat was the NSE colocation case, and how does HFT work in India?Intermediate](/learn/questions/nse-colocation-case)[QuestionHFT, MFT and LFT: what is the difference?Intermediate](/learn/questions/hft-vs-mft-vs-lft)[QuestionIs algo trading legal in India for retail?Beginner](/learn/questions/is-algo-trading-legal-in-india)[QuestionHow do I backtest an option strategy in India, or in Python?Intermediate](/learn/questions/backtest-option-strategy)[QuestionWhat are SEBI's F&O rules on lot size, weekly expiry and upfront premium?Beginner](/learn/questions/sebi-fo-rules)[QuestionHow do people set a stop loss on options, and when do they exit?Beginner, trap check](/learn/questions/stop-loss-on-options)

[All 130 questions](/learn/questions/)

    Explore next

## Go deeper on this question.

* [QuestionDo SEBI registered algo platforms make algo trading profitable?A short answer with a dated chart](/learn/questions/algo-platforms-and-profitability)
* [ToolOption payoff builderLegs on a dated Nifty chain, breakevens and charges](/learn/tools/payoff-builder)
* [GlossaryInvesting glossary, 230 termsPlain word definitions, and the app’s own](/learn/glossary)

      Community

## Join my WhatsApp group.

      Scan the code, fillFill one short form, and join my WhatsApp group. Slides, sources, factsheets and the rebalance logs live there, and members join a daily Google Meet with me.

      New to RupeeCase? [Getting started](/getting-started) [See the terminal](/terminal)

        [Sign up for RupeeCase](https://invest.rupeecase.com/signup)
        [Join the WhatsApp group](https://forms.gle/C6HMtM1Z2GfeocQV7)

      [One form, one group](https://forms.gle/C6HMtM1Z2GfeocQV7)Scan with your phone camera

Education only, not investment advice, a research report or a recommendation to buy, sell or hold any security. RupeeCase (QC Alpha Technologies Pvt Ltd) is not registered with SEBI as an investment adviser or research analyst. Contracts and prices shown are for illustration only, come from NSE end of day files at least 30 days old, and are not recommendatory. Derivatives trading carries a high risk of loss.
