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

Filing Date? #18

Closed gregjasonroberts closed 4 years ago

gregjasonroberts commented 4 years ago

Aside from scraping the headers within the SEC url, do you have a method for pulling the respective Filing Date for each document? Thanks!

joeyism commented 4 years ago

I added a feature in 5.4.1

Essentially, adding as_documents param to get_documents will change the return from a list of lxml.html.HtmlElement to a list of edgar.document.Documents, which has filing date under .content['Filing Date']

For example

from edgar import Company
from edgar import TXTML

company = Company("BOSTON SCIENTIFIC CORP", "0000885725")
tree = company.get_all_filings(filing_type = "10-K")
docs = Company.get_documents(tree, no_of_documents=5, as_documents=True)
doc = docs[0]
doc.content['Filing Date']

and if you want to parse the text, you can run

text = TXTML.parse_full_10K(doc.element)
text