Education only. This is not investment advice and nothing here is a buy or sell recommendation. Trading carries risk of loss, and past results do not predict the future. Backtests are hypothetical: practise on paper only, never connect broker API keys or place live orders from these lessons. For personal advice, talk to a SEBI-registered Investment Adviser.
By the end of this lesson you will know which free price data you may use and its limits, have NIFTY 50 daily data saved as a CSV, and have run a check script that finds problems before they spoil your backtest.
You need: the backtest-lab project from lesson 1, your coding agent, an internet connection · Time: 9 minutes
A backtest is only as good as its prices. Free sources are fine for learning, but each has limits:
- yfinance is a free, open-source Python library that reads Yahoo Finance prices. Its own README says it is not affiliated with Yahoo, is meant for research and education, and that Yahoo's data is for personal use; you should read Yahoo's terms. It is unofficial, so it can break when Yahoo changes something, and data can have gaps or errors. NSE symbols end in
.NS(for exampleINFY.NS), BSE in.BO, and the NIFTY 50 index is^NSEI. - Exchange websites (NSE, BSE) offer some files to download by hand. Their terms of use limit automated collection (scraping) and how the data may be used, so read them before you rely on their files, and never point a script at them.
- Paid data vendors exist for serious, clean, licensed data. You don't need them to learn.
Why?"Free" does not mean "do anything you like". Using data inside its terms, for your own learning, keeps you safe, and knowing a source is unofficial reminds you to check its numbers.
- yfinance is a free, open-source Python library that reads Yahoo Finance prices. Its own README says it is not affiliated with Yahoo, is meant for research and education, and that Yahoo's data is for personal use; you should read Yahoo's terms. It is unofficial, so it can break when Yahoo changes something, and data can have gaps or errors. NSE symbols end in
Log in free to read the rest of this lesson
Every lesson is free. A free account unlocks all of them and saves your progress.
Still to come in this lesson:
- Download once, save a CSV
- Check the data before you trust it
- Look at it
- Recap