Download historical stock data from Yahoo Finance using Python

preview_player
Показать описание
In this tutorial, I will share a script I use to easily download historical stock data from Yahoo finance using just a few lines of code in Python to help me analyze different stocks.

There are several Python libraries you can use these days to download stock data from Yahoo finance, but for me, I prefer directly to go to the source. In this tutorial, I will show you how we can make a request call to Yahoo Finance's back-end to access the stock data and export them as CSV files.

► Buy Me a Coffee? Your support is much appreciated!
-------------------------------------------------------------------------------------------
☕ Venmo: @Jie-Jenn

► Support my channel so I can continue making free contents
---------------------------------------------------------------------------------------------------------------

#Stock #YahooFinance #HistoricalStockData #Python
Рекомендации по теме
Комментарии
Автор

To import price for for monthly interval, Yahoo Finance has change the parameter value from "1m" to "1mo".

jiejenn
Автор

such tremendous value in an 8 minute video! exactly what I needed, only a few lines of code

Dan-ufvh
Автор

Great tutorial! The step by step way you explain the time conversion functions is superb. Hope you continue doing this as a series. Liked and subscribed.

priyamd
Автор

Crazy good. Thank you for creating this vid.

kingau
Автор

Thank you. I have been trying to script this for a long time!

lpc
Автор

Hello Sir, This video tutorial was great, learned something new. Thanks a lot! :)

sid
Автор

Thank you for this great introduction!
Could you please make a series on this topic?!
How do you build your portfolio? How do you choose stocks - based on which criteria?

EpoKeins
Автор

Hi thanks for the upload! Do you think you can do a video tutorial for showing the stock option data using yahoo finance api or any other api?

Also, is there a way to change the periods so that it automatically pulls the most recent X years of data as opposed to having to go back into the code and changing the dates each time?

cvillejin
Автор

When I print 'query_string', I am able to get the link. However, it automatically downloads the csv straight to my computer rather than asking me. Because of this, my data isn't on my python IDE. Any suggestions on how to fix this?

macaeallen
Автор

Great and useful content! Nice tutorial

danielwang
Автор

I basically copied the entire thing.. and then "query_string in my terminal but a hyperlink doesnt show up for me too look at it... I need help !

Also, any time i write code and run the module i never see any results. Newb here.

joerocks
Автор

Awesome tutorial! It is the simplest and best way to download the price data. Thanks a lot.

Do you have any tips for downloading the historical fundamentals number such as PE, PB etc?

indiaeye
Автор

Nice!!! Did this with the data on redfin

patrickmueller
Автор

Awesome video with clear explanation!! I ran your code, however I'm missing my middle "Low" Column. Instead of numbers, each item in the column just says "..." any thoughts?

ahubuni
Автор

Thank you so much Jie! I got it right first try lol

eddiehillergrand
Автор

Thanks for the video! If I wanted to take just the numbers from the 'Close' column, how would I do that? When I try (using df['Close']) it outputs more than just the actual number values of that column.

samjockel
Автор

Thanks for the video. Is there a way to get the intraday data between the given two dates?

krishnangdalal
Автор

thanks for making this video. good job 👏

rahmaaja
Автор

Hi there! is there a way to pull other fields such as EV, Revenue, market cap, forward revenue estimates on a monthly periodicity please? (revenue is published every quarter and not every month so there could be 3x the same Revenue number to represent a quarter) . thanks!

jd
Автор

This wasn't working for me, I was getting a 404 error. After a bit of fruitlessness and frustration I have found the issue. I was forgetting to use the download link, not the webpage address.

Hopefully this will help anyone else having similar PEBKAC issues.

alastermyst