The Yahoo Finance API is a range of libraries/APIs/methods used to obtain historical and real time data for a variety of financial markets and products, as shown on Yahoo Finance- https://finance.yahoo.com/.
Some of the offerings include market data on Cryptocurrencies, regular currencies, stocks and bonds, fundamental and options data, and market analysis and news.
Why to use Yahoo Finance ?
- Free
- Simple and easy to use
Installation
- yfinance
pip install yfinance
2. pandas_datareader
pip install pandas_datareader
Code
And that’s how you can fetch stocks historical data and save it locally on your disk, it can be automated to get real-time/live data as well.