def search_company_filings_by_cik(self, cik, filing_type, filing_subtype, no_of_entries, filing_date_before, filing_pattern, filing_rsrc_cache): # TODO: build dynamic from file filing_types = ["425", "8-K", "10-K", "10-Q"] filing_subtypes = ["EX-1", "EX-2", "EX-3", "EX-4", "EX-5", "EX-6", "EX-7", "EX-8", "EX-9", "EX-10", "EX-11", "EX-12", "EX-13", "EX-14", "EX-15", "EX-16", "EX-17", "EX-18", "EX-19", "EX-20", "EX-21", "EX-22", "EX-23", "EX-24", "EX-25", "EX-25", "AEX-26", "EX-28", "EX-29", "EX-31", "EX-32", "EX-33", "EX-34", "EX-35", "EX-99"] if filing_type in filing_types: if filing_subtype in filing_subtypes or \ re.match(r'EX-\d\d\.*', filing_subtype, re.IGNORECASE) or \ filing_subtype in filing_types : edgar = Edgar() self.alogger.debug("Getting company registration from endpoint") company_name = edgar.get_company_name_by_cik(cik=cik) self.search_company(company_name, cik, filing_type, filing_subtype, no_of_entries, filing_date_before, filing_pattern, filing_rsrc_cache) else: print("{} not a recognized filing subtype.".format(filing_subtype)) print("Supported filing subtypes:") for filing_subtype in filing_subtypes: print(filing_subtype) else: print("{} not a recognized filing type.".format(filing_type)) print("Supported filing types:") for filing_type in filing_types: print(filing_type)
def main(): # initialize the EDGAR database edgar = Edgar() # has_ex_10(edgar) training_sentences = get_training_sentences( 'training_sentences/sentences_200_2.csv') entity_finder_ui(training_sentences)
def find_company_by_name(self, name): """ Requests EDGAR for a company by name and obtains it's CIK number :param name: Company name :return: None. """ if not "".__eq__(name): edgar = Edgar() try: company_cik = edgar.get_cik_by_company_name(name=name.upper()) print("{0}:{1}".format(name.upper(), company_cik)) except Exception as e: print("Error: ", e) else: print("No name provided (-n|-N options)")
def find_company_by_names_fuzzy(self, names): """ Requests EDGAR for a company by name pattern to obtain a list of potentials :param names: A pattern for a name :return: None. Prints list of possible matches """ if len(names) != 0: edgar = Edgar() for n in names: if not "".__eq__(n): possible_companies = edgar.find_company_name(n) for pc in possible_companies: cik = edgar.get_cik_by_company_name(pc) # Provide more details to help choose the right one if self.aconfig['args'].edgar_company_names_fuzzy_detail: print("\nName/CIK: {0}:{1}".format(pc, cik)) cik_feed = self.aconfig['args'].endpoint + \ "/cgi-bin/browse-edgar?action=getcompany&CIK=" + \ cik + "&output=atom" try: response = requests.get(cik_feed) od = xmltodict.parse(response.content) state_inc = od['feed']['company-info']['state-of-incorporation'] state_loc = od['feed']['company-info']['state-location'] print("{0:>10} : {1}/{2}".format("State Incorporated/State Located", state_inc, state_loc)) print("{0:>5}".format("Addresses:")) for k, addresses in od['feed']['company-info']['addresses'].items(): for addr in addresses: print() for k, v in addr.items(): print("{0:>10} {1}".format(k,v)) except requests.ConnectionError as ce: print("Error fetching atom feed: ", ce) except xml.parsers.expat.ExpatError as xe: print("Error fetching atom feed: ", xe) print("---") else: print("{0}:{1}".format(pc, cik)) else: print("Skipping empty name") else: print("No names provided (-N option)")
def fetch10K(company, start, end): edgar = Edgar(company, '10') docs = edgar.getFilingDocuments(start, end) print "get back doc count: ", len(docs) for d in docs: print d
from edgar import Company, TXTML, XBRLElement, XBRL, Edgar db = Edgar() comp_name = 'TESLA, INC.' company = Company(comp_name, db.all_companies_dict[comp_name]) ''' company = Company("Oracle Corp", "0001341439") tree = company.get_all_filings(filing_type = "10-K") docs = Company.get_documents(tree, no_of_documents=5) print (docs) text = TXTML.parse_full_10K(docs[0]) #print (text) #company = edgar.Company(Ticker,"21344") #print company company = Company("Oracle Corp", "0001341439") results = company.get_data_files_from_10K("EX-101.INS", isxml=True) xbrl = XBRL(results[0]) element = XBRLElement(xbrl.relevant_children_parsed[15]).to_dict()#// returns a dictionary of name, value, and schemaRef print(element) '''
from edgar import Edgar edgar = Edgar() possible_companies = edgar.find_company_name("Cisco System")