# Automated 10-K XBRL data grab using the SEC file structure

I would like to write a program that takes as input a list of CIK/year/quarter entries. The program should iterate through the list and, for each entry, grab XBRL financial data from the SEC website for the given CIK/year/quarter combination.

I can decipher some parts of the SEC file structure, but not all. For example, post fixing Archives/edgar/data/1288776/11/ to the SEC base address gives a directory listing of all filings for the year 2011, for the company with CIK 1288776. Unfortunately I cannot make sense of the naming convention within this directory.

One way around this is to simply use the SEC's search tool. However, this requires that I use a web crawler and I would prefer to use ftp directly.

Can anyone clarify how accession numbers are assigned? How do others go about pulling financials from the SEC website?

-

Look in

edgar/full-index/{YYYY}/QTR{N}/xbrl.idx


You can grab the compressed version too:

xbrl.{Z,sit,gz,zip}


This will state what file you want.

For example, I want AOL's 10-K that was filed in the first quarter of 2012. So I download

edgar/full-index/2012/QTR1/xbrl.gz


After decompressing, I see that AOL's 10-K is available at

edgar/data/1468516/0001193125-12-076633.txt

-
Could you please elaborate a bit more on this useful info? – Bob Hopez Oct 20 '13 at 5:56