You can still download Yahoo! Finance data using Pandas Datareader using this quick hack
As you may have heard, Yahoo! finance has decommissioned its historical data API, causing many programs that relied on it to stop working. However...
Today I've releases a small Python library called
fix-yahoo-finance that aims to
offer a temporary fix to the problem by scraping the data from Yahoo! finance and
returning a Pandas DataFrame/Panel in the same format as pandas_datareader's
Here's how to use it
from pandas_datareader import data as pdr import fix_yahoo_finance # <== that's all it takes :-) # download dataframe data = pdr.get_data_yahoo("SPY", start="2017-01-01", end="2017-04-30") # download Panel data = pdr.get_data_yahoo(["SPY", "IWM"], start="2017-01-01", end="2017-04-30")
I've also added some options to make life easier, like groupping by ticker instead of OHLC and auto-adjustment of data and option to return a Pandas Panel or a MultiIndex DataFrame.
=> Visit the Github repository for more info and installation instructions.
* Note that this library in intented to be a temporary fix until the good fellas of pandas-datareader find a solution, or while you update your code to work with a different data provider.
P.S. Don't forget to register for upcoming webinar I'm doing with the guys over at futures.io on May 24. It's going to be part two of the Trading with Python series.
Backtesting & Optimization Trading Strategies w/ Python
- Different types of backtesting
- How to prepare your data
- Backtesting pitfalls and how to avoid them
- Optimizing strategy parameters
- Monte Carlo optimization
- Forward testing
Register here ==> https://on.futures.io/rr3yh
Updated on 21 May 2017. For the latest version and comments, please see: