Python Edgar package - get CIK number

845 views Asked by At

I am reading S-1 filings from Edgar sec. I get my initial data from Bloomberg. Through the company name I can look for the matching CIK number using the term get_cik_by_company_name(company_name: str). I should be able to get the CIK number which I than want to save in a list -> cik_list. However it is not working - Invalid Syntax for str.

BloombergList ist the Excel Bloomberg created with all the relevant company names. In column 4 I got the names which I import as a list, than get the matching CIK and than export the CIK list in the right order back to the BloombergList - theoretically.

I am happy if someone can help. Thanks in advance.

#needed packages
import pandas as pd
from openpyxl import load_workbook
from edgar import Edgar

#from excel get company names
book = load_workbook('BloombergList.xlsx')
sheet = book['Cleaned up']

for row in sheet.rows:
    row_list = row[4].value 
    print (row_list)
    
#use edgar package to get CIK numbers from row_list
edgar = Edgar()

cik_list = []

for x in row_list:
    possible_companies = edgar.find_company_name(x)
    cik_list.append(get_cik_by_company_name(company_name: str))

#export generated CIK numbers back to excel
df = pd.DataFrame({'CIK':[cik_list]})
df.to_excel('BloombergList.xlsx', sheet_name="CIK", index=False)

print ("done")
0

There are 0 answers