Automatically stream and download the Yahoo! Finance stock price using Python
Attention: Yahoo! Finance deprecated the API in late 2017. Please refer to this article and learn how to use Google Finance as an alternative. Thanks to the Pandas package in Python, now we can stream the stock price from Yahoo! automatically within 1 second. And of course, it's free! I am going to show you the example of downloading stock price of US Oil, Facebook, Best Buy, and Expedia from Jan 1st, 2014 to Dec 1st, 2015 and saving the data into a CSV file on your local drive. ======== Code Start ======== import pandas.io.data as pdweb import datetime #import the library you need from pandas stockprice = pdweb.get_data_yahoo([ 'USO',' FB','BBY','EXPE' ],start = datetime.datetime(2014,1,1), en d=datetime.datetime(2015,12,1) )['Adj Close'] #set the stocks you would like to download and the time frame stockprice.to_csv(' stockprice.csv ') #save it to your local drive. It's in the same folder where yo...