Skip to content

A Jupyter Notebook that reproduces a Barron's article showing the results of being able to be out of the market for the worst five days of each year.

License

Notifications You must be signed in to change notification settings

mayest/Market-Timing

Repository files navigation

Market-Timing

Rewards of Perfect Market Timing

Timothy R. Mayes, Ph.D. (http://www.tvmcalcs.com)
1 January 2019


This code will calculate the rewards that can be had given great skill at market timing. It shows the value of a portfolio where the trader is good enough to be out of the market on the worst N days between the start and end dates. Obviously, this is not possible in reality, but it is interesting.

The impetus for this idea was “The Truth About Timing,” by Jacqueline Doherty, Barron’s (November 5, 2001). In order to replicate those results, load the data and then call the total_returns function as:

total_returns(data['1/1/1966':'10/29/2001'],5,invest=1).round(2)

Actually, the exact dates that were used isn't clear. The chart in the article says that it starts in Feb 1966, but the table implies that it starts at the beginning of 1966 (3 January 1966). Also, there may be some slight rounding or data issues that cause the results here to vary a bit from the results reported in the Barron's article.

Finally, note that you can substitute your own data (different index or stock, different time frame, whatever), but this is probably best used if you have complete data for each calendar year. That is because the calculations drop the n worst/best days by calendar year.

Data is from Yahoo! Finance as of 1 January 2019, and includes the daily adjusted close of the S&P 500 each day from 1 January 1950 to 31 December 2018. Reproduced Barron's Chart

You can run the Jupyter notebook in your browser without having Python or Jupyter installed on your computer by clicking the Binder button below.

Binder

About

A Jupyter Notebook that reproduces a Barron's article showing the results of being able to be out of the market for the worst five days of each year.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published