Just wanted to say that I am very impressed by this blog and very grateful that you share this with us. You’ve got me hooked. The next month when the next rotation signal is generated, the system indicates that I should have been holding a different fund in the prior month, FSCHX. In the book, he used a data set consisting of monthly stock prices, dividends and earnings to ascertain whether or not the stock market is overvalued compared to historical levels. It was the biggest one-day fall in world stock markets since September 11, 2001.
Dr. Shiller uses monthly dividend and earnings data that are computed from the S&P four-quarter totals for each quarter since 1926 which are then linearly extrapolated to month figures. CAPE is defined as the stock price divided by the moving average of ten years of earnings corrected for inflation using the Consumer Price Index. I combined both methods mentioned above, and I was able to download more than 5000 historical data (1 week back-fill) within 5 minutes!
This video here presents is a trick to speed up the download up to 10 times faster or even more, making the complete back-fill of historical data within a tea break time. However, for stock options we only generally have/care about data out two decimal places so the 32 bit precision is plenty. I was considering roughly testing using prices generated using Black-Scholes, but real data is obviously better. FYI: There are actually some API changes happening with the Options class within pandas right now.
I think version 0.11 of Pandas was working somewhat, though it would not get all the option prices. Pandas is under heavy development and it seems that since the time I wrote this code, the api has gone trough some breaking changes. If someone has the time the code should be updated to just query for options data that actually exists in the time month range passed in. I am not sure how to parse this information from the HTML. Right now it will query Yahoo for each month of data even when there are no options available for that month/year for the get_forward_data method. Sell company stock in your 401K or company stock options as they become vested.
I have posted an updated chart for the returns of the S&P 500 Index during the period between 1926-2014. As of the date that this article was posted, the YTD total return of the S&P 500 Index was -2.59%. While buying on margin can let you buy it at $40 and sell it at $50 and walk away with $10 profit per share on a good day, a bad call or falling stock can land you thousands of dollars in the whole. To manage your risk, avoid taking out loans from the brokerage to raise the initial funds for stock trading and never borrow from sources like a home equity line of credit or credit cards to invest in the stock market. Part of a winning stock trading strategy is to dump losers to limit your losses.