“Should I start a SIP, and on which date?” It is one of the most common questions an investor asks, and most answers are opinions. OpenAlgo now answers it with evidence. The OpenAlgo SIP Backtester replays a systematic investment plan on real price history, charges every installment the way the exchange and the government would, and tells you what you would have ended up with.
In this tutorial I will walk through the tool, then run the same test from Python through its REST API: Rs 10,000 a month into NIFTYBEES, the Nifty 50 ETF, from January 2016 to November 2026.
A quick disclosure: OpenAlgo was created by the founder of Marketcalls. Every number below comes straight from the run output saved with this article.
Where to find it
The SIP Backtester lives in OpenAlgo’s tools hub at /sip-backtester, next to the Portfolio Backtester and Sector Rotation. Everything runs inside your own OpenAlgo installation. There is no data vendor and no subscription.
The form asks for a handful of things:
- Symbol and Exchange. One NSE or BSE instrument, such as a stock or an ETF.
- Start and End dates, up to 30 years apart.
- Amount per installment and the frequency: weekly, fortnightly, monthly or quarterly.
- SIP date, from the 1st to the 28th. It stops at 28 on purpose, because a SIP dated the 31st does not exist in every month.
- Step-up %/yr, an optional yearly increase in the installment.
- Data source: your broker’s history through OpenAlgo, or Historify, OpenAlgo’s local market database.
A benchmark index and the cost model are optional extras.
Two things worth knowing before you click Run. First, nothing is scheduled or bought. It is a pure simulation, so it is safe in any mode. Second, it buys whole shares only, as you must in Indian cash equity, so a small remainder of each installment sits as uninvested cash, just as it would in a real account.
Run it from Python
Every result on the screen also comes back from POST /api/v1/sip/backtest. The installed Python SDK has no named wrapper for this endpoint yet (the SDK prompt doc says so), so we call the documented REST endpoint with requests.
pip install requests plotly kaleido
export OPENALGO_API_KEY="your_api_key"
The frequencies list needs no key, which makes it a handy connection check:
curl --get 'http://127.0.0.1:5000/api/v1/sip/frequencies'
Now the backtest itself. I fixed these inputs before running anything: NIFTYBEES on NSE, Rs 10,000 on the 1st of every month, no step-up, full Indian equity charges, NIFTY as the benchmark, and broker history (source="api") because this ETF was not yet in my Historify store.
import os
import requests
HOST = "http://127.0.0.1:5000"
API_KEY = os.getenv("OPENALGO_API_KEY", "your_api_key")
payload = {
"apikey": API_KEY,
"symbol": "NIFTYBEES",
"exchange": "NSE",
"start_date": "2016-01-01",
"end_date": "2026-11-24",
"amount": 10000,
"frequency": "monthly",
"day_of_month": 1,
"step_up_percent": 0,
"cost_model": "indian_equity",
"benchmark": "NIFTY",
"benchmark_exchange": "NSE_INDEX",
"source": "api", # "db" reads Historify instead
"include_grids": True,
}
data = requests.post(f"{HOST}/api/v1/sip/backtest", json=payload, timeout=180).json()
h = data["headline"]
print(h["invested"], h["final_value"], h["gain"], h["xirr"])
If you have already downloaded the symbol into Historify, switch source to "db". It is faster, works offline, and returns the same answer every time. The full script, sip_backtest.py, prints every figure used below.
What the run produced
| Metric | Result |
|---|---|
| Window | 1 Jan 2016 to 23 Nov 2026, 10.9 years |
| Installments | 131 |
| Money put in | Rs 13,10,000 |
| Final value | Rs 26,15,155 |
| Gain after charges | Rs 13,05,155 |
| XIRR | 12.12% |
| Total charges | Rs 1,553.47 |
The money roughly doubled. XIRR is the right yardstick here: it is the annual return that accounts for when each rupee went in, so the last installment, which was invested for a few days, does not get credit for ten years of growth.

Charges were tiny. Rs 1,553.47 across 131 buys works out to Rs 11.86 per installment, or 0.119% of everything invested. Stamp duty and STT made up almost all of it.
Rupee-cost averaging, measured. The average cost per unit was Rs 144.80, while the average market price on the same dates was Rs 172.17. A fixed amount buys more units when prices are low and fewer when they are high, and here that worked out to a 15.9% lower cost per unit.
It was not a smooth ride. The portfolio’s worst fall was 34.3%, bottoming on 23 March 2020, and it took 80 sessions to recover. The value sat below the money put in for 4.1% of sessions, with a worst shortfall of 18.1%. The backtester shows this so you know what holding on would have felt like, not just where you ended up.
Three comparisons the tool does for you
Against a lumpsum. Putting the same Rs 13,10,000 in on day one would have grown to Rs 47,04,186, an XIRR of 12.44%. The lumpsum won here, as it usually does when the market rises over the period. Of course, most people do not have ten years of savings on day one, which is exactly why SIPs exist.
Against the index. The same schedule into the NIFTY index ended at Rs 24,16,097, an XIRR of 10.77%, so the ETF came out 1.35 points ahead. Read that one carefully: the NIFTY index here is the plain price index without dividends, so it is not a like-for-like total-return comparison.
Against other frequencies. The tool scales the installment so every frequency invests about the same money each year. The results were almost identical: weekly 12.14%, fortnightly 12.15%, monthly 12.12% and quarterly 12.21%.
The SIP date question gets the same treatment. Trying every day from the 1st to the 28th gave XIRRs between 12.10% and 12.22%, a spread of just 0.12 points. On this data, the date you pick barely matters. Starting, and staying with it, matters far more.
Time in the market, by holding period
With grids switched on, the tool also reruns the SIP from a new start date every quarter and reports the best, median and worst XIRR for each holding period.

One-year SIPs were a coin toss with a fat tail: the worst had an XIRR of minus 46.1% and the best 63.4%, and 82.5% of the 40 windows were positive. By three years, 90.6% of windows were positive. Every five, seven and ten year window in this period ended positive, with a worst case of 4.2% XIRR at five years and 10.0% at ten. Only four ten-year windows fit in this data, so treat that last bar as a small sample.
Tips for your own runs
- Download first, then backtest. Pull the symbol into Historify once and use
source="db". Repeated runs are quick and do not depend on your broker session. - Try a step-up.
step_up_percentcompounds yearly, so 10% on Rs 10,000 means Rs 11,000 a month in year two. - Pick an index benchmark. The benchmark must be an index, and the tool runs the identical schedule into it, same money on the same dates, so the comparison is fair.
- Read the warnings list. A range with gaps in the history produces fewer installments rather than an error, and the response tells you.
Wrapping up
The SIP Backtester turns a vague question into a repeatable test with real charges, honest XIRR and the uncomfortable parts, like drawdowns, left in. Use the screen when you want to explore, and the API when you want to run the same test across many ETFs or stocks in one script.
A worked example of testing a single-stock rule with the same SDK is the Supertrend backtest on SBIN. For the idea behind event-driven tests, see Event Driven Backtesting and Event Loops for Traders.
Past results do not predict future returns, and nothing here is a recommendation to buy any instrument. It is a way to check your assumptions against history before you commit real money.
Learn by watching: free videos every week
Market Profile, order flow, Python, AI and OpenAlgo tutorials on YouTube.

