joeyism / py-edgar

A small library to access files from SEC's edgar
GNU General Public License v3.0
227 stars 52 forks source link

Allow for passing of sub document to get one part of a filing #5

Open nickderobertis opened 5 years ago

nickderobertis commented 5 years ago

Thanks for putting together this EDGAR tool.

I needed to get just one exhibit from the 10-K, so I added this functionality into the getDocuments function, but using a keyword argument so that the original usage of the function is unchanged.

I tried to set up the xpath generally so that it will work for any exhibit/sub-document type, you just need to pass the name of it and it will do a string match on the Type column.

Usage would be like this:

edgar.getDocuments(tree, sub_document='EX-21.01', noOfDocuments=5)

I hope you'll include this in the main module, I think it could be very useful to others.

nickderobertis commented 5 years ago

I ended up also needing to get some metadata for the filings - e.g. period of report. I created a Filing class to manage getting this metadata as well as the original logic to get documents and sub documents. I also created a new function, getFilings, which returns Filing instances so that further actions can be taken on them by the user (track metadata and download document). The original getDocuments function still has the same behavior.

If you want to merge just a portion of these changes, let me know and I can split them up.

joeyism commented 4 years ago

There seems to be a conflict for this. If you can resolve it, I'll merge this in. Thank you