quantlab.acquisition.wrds.crsp.year_pages#

quantlab.acquisition.wrds.crsp.year_pages(start, end)[source]#

Split [start, end] into calendar-year pages, clipped to the window.

The acquisition downloads one page per year. A page is also the unit of resume: a failed page is downloaded again in full. A year keeps a retry to about 250 trading days per PERMNO while keeping a long history to a few dozen pages per batch.

Parameters:
start, endstr, date or datetime

First and last day of the window, inclusive.

Returns:
list of tuple of (date, date)

[(page_start, page_end), ...] in ascending order, or [] when start is after end.

Examples

>>> year_pages("2018-06-01", "2020-03-31")
[(datetime.date(2018, 6, 1), datetime.date(2018, 12, 31)),
 (datetime.date(2019, 1, 1), datetime.date(2019, 12, 31)),
 (datetime.date(2020, 1, 1), datetime.date(2020, 3, 31))]
>>> year_pages("2020-03-31", "2018-06-01")
[]