December 2018
Beginner to intermediate
684 pages
21h 9m
English
The following code downloads and extracts all historical filings contained in the Financial Statement and Notes (FSN) datasets for the given range of quarters (see edgar_xbrl.ipynb for addition details):
SEC_URL = 'https://www.sec.gov/files/dera/data/financial-statement-and-notes-data-sets/'first_year, this_year, this_quarter = 2014, 2018, 3past_years = range(2014, this_year)filing_periods = [(y, q) for y in past_years for q in range(1, 5)]filing_periods.extend([(this_year, q) for q in range(1, this_quarter + 1)])for i, (yr, qtr) in enumerate(filing_periods, 1): filing = f'{yr}q{qtr}_notes.zip' path = data_path / f'{yr}_{qtr}' / 'source' response = requests.get(SEC_URL + filing).content ...