Package: edgar
EDGARA small library to access files from SEC's edgar.Installationpip install edgarExampleTo get a company's latest 5 10-Ks, runfromedgarimportCompanycompany=Company("Oracle Corp","0001341439")tree=company.get_all_filings(filing_type="10-K")docs=Company.get_documents(tree,no_of_documents=5)orfromedgarimportCompany,TXTMLcompany=Company("INTERNATIONAL BUSINESS MACHINES CORP","0000051143")doc=company.get_10K()text=TXTML.parse_full_10K(doc)To get all companies and find a specific one, runfromedgarimportEdgaredgar=Edgar()possible_companies=edgar.find_company_name("Cisco System")To avoid pull of all company data from sec.gov on Edgar initialization, pass in a local path to the datafromedgarimportEdgaredgar=Edgar("/path/to/cik-lookup-data.txt")possible_companies=edgar.find_company_name("Cisco System")To get XBRL data, runfromedgarimportCompany,XBRL,XBRLElementcompany=Company("Oracle Corp","0001341439")results=company.get_data_files_from_10K("EX-101.INS",isxml=True)xbrl=XBRL(results[0])XBRLElement(xbrl.relevant_children_parsed[15]).to_dict()//returnsadictionaryofname,value,andschemaRefAPICompanyCompany(name,cik,timeout=10)name (company name)cik (company CIK number)timeout (optional) (default: 10)Methodsget_filings_url(self, filing_type="", prior_to="", ownership="include", no_of_entries=100) -> strReturns a url to fetch filings datafiling_type: The type of document you want. i.e. 10-K, S-8, 8-K. If not specified, it'll return all documentsprior_to: Time prior which documents are to be retrieved. If not specified, it'll return all documentsownership: defaults to include. Options are include, exclude, only.no_of_entries: defaults to 100. Returns the number of entries to be returned. Maximum is 100.get_all_filings(self, filing_type="", prior_to="", ownership="include", no_of_entries=100) -> lxml.html.HtmlElementReturns the HTML in the form oflxml.htmlfiling_type: The type of document you want. i.e. 10-K, S-8, 8-K. If not specified, it'll return all documentsprior_to: Time prior which documents are to be retrieved. If not specified, it'll return all documentsownership: defaults to include. Options are include, exclude, only.no_of_entries: defaults to 100. Returns the number of entries to be returned. Maximum is 100.get_10Ks(self, no_of_documents=1, as_documents=False) -> List[lxml.html.HtmlElement]Returns the HTML in the form oflxml.htmlof concatenation of all the documents in the 10-Kno_of_documents (default: 1): numer of documents to be retrievedWhenas_documentsis set toTrue, it returns-> List[edgar.document.Documents]a list ofDocumentsget_document_type_from_10K(self, document_type, no_of_documents=1) -> List[lxml.html.HtmlElement]Returns the HTML in the form oflxml.htmlof the document within 10-Kdocument_type: Tye type of document you want, i.e. 10-K, EX-3.2no_of_documents (default: 1): numer of documents to be retrievedget_data_files_from_10K(self, document_type, no_of_documents=1, isxml=False) -> List[lxml.html.HtmlElement]Returns the HTML in the form oflxml.htmlof the data file within 10-Kdocument_type: Tye type of document you want, i.e. EX-101.INSno_of_documents (default: 1): numer of documents to be retrievedisxml (default: False): by default, things aren't case sensitive and is parsed withhtmlinlxml. If this is True, then it is parsed withetree` which is case sensitiveClass Methodget_documents(self, tree: lxml.html.Htmlelement, no_of_documents=1, debug=False, as_documents=False) -> List[lxml.html.HtmlElement]Returns a list of strings, each string contains the body of the specified document from inputtree: lxml.html form that is returned from Company.getAllFilingsno_of_documents: number of document returned. If it is 1, the returned result is just one string, instead of a list of strings. Defaults to 1.debug (default:False): ifTrue, displays the URL and formWhenas_documentsis set toTrue, it returns-> List[edgar.document.Documents]a list ofDocumentsEdgarGets all companies from EDGARget_cik_by_company_name(company_name: str) -> str: Returns the CIK if given the exact name or the companyget_company_name_by_cik(cik: str) -> str: Returns the company name if given the CIK (with the000s)find_company_name(words: str) -> List[str]: Returns a list of company names by exact word matchingmatch_company_by_company_name(self, name, top=5) -> List[Dict[str, Any]]: Returns a list of dictionarys, with company names, CIK, and their fuzzy match scoretop (default: 5)returns the top number of fuzzy matches. If set toNone, it'll return the whole list (which is a lot)XBRLParses data from XBRLPropertiesrelevant_childrenget children that are notcontextrelevant_children_parsedget children that are notcontext,unit,schemaRefcleans tagsDocumentsFiling and Documents Details for the SEC EDGAR Form (such as 10-K)Documents(url,timeout=10)Propertiesurl: str: URL of the documentcontent: dict: Dictionary of meta data of the documentcontent['Filing Date']: str: Document filing datecontent['Accepted']: str: Document accepted datetimecontent['Period of Report']: str: The date period that the document is forelement: lxml.html.HtmlElement: The HTML element for the Document (from the url) so it can be further parsedContribution