endpointsfrom the xts package in R. I am sure it exists, but I made this crude
getEndPeriodfunction and thought I would apply here with S&P 500 data from the Federal Reserve Bank of St. Louis (FRED). Finding endpoints is important in finance to handle things like rebalancing.
The formatting function supplied to
getEndPeriod is flexible so it
can use d3.js, moment.js, or any custom function
that allows comparison to find breaks.