How to Scrape Yahoo Finance Data with Python

How to Scrape Yahoo Finance Data with Python

Financial market data is one of the most valuable data in the current time. If analyzed correctly, it holds the potential of turning an organisation’s economic issues upside down. Among a few of them, Yahoo finance is one such website which provides free access to this valuable data of stocks and commodities prices. In this blog, we are going to implement a simple web crawler in python which will help us in scraping yahoo finance website. Some of the applications of scraping Yahoo finance data can be forecasting stock prices, predicting market sentiment towards a stock, gaining an investive edge and cryptocurrency trading. Also, the process of generating investment plans can make good use of this data!

The yfinance module does something similar

Talk about plagiarism. This same article was first published on March 8, 2019 and exactly matches word for word. The link to the original article is

Yes. I’m republishing the blog and the exact URL was given in the blog at the time of submission.

Hi There,

i have tried the Code but i get no Output at my Console. Can you give me a hint what`s wrong.

Sorry but i am an Python Noob :wink:


I will make a look and will come back

Hi. I’m new to Python. I found your postings instructive. As I was trying your code for scraping world indices and tried to save it to a csv file, my csv file had only the title row. I’m not sure why? Could you provide some insights? FYI, here’s the code:

df = pd.DataFrame({‘Names’: names, ‘Prices’: prices, ‘Change’: changes, ‘% Change’: percentChanges,
‘Market Time’: marketTimes, ‘Open Interest’: openInterests, ‘Volume’: totalVolumes})
df.to_csv(‘worldIndices.csv’, index=True, encoding=‘utf-8’)