예제 #1
0
def test():
    t1 = time.time()
    # file containig company name and corresponding cik codes
    seccrawler = SecCrawler()

    company_code_list = list()  # company code list
    cik_list = list()  # cik code list
    date_list = list()  # pror date list
    count_list = list()

    try:
        crs = open("data.txt", "r")
    except:
        print "No input file Found"

    # get the comapny  quotes and cik number from the file.
    for columns in (raw.strip().split() for raw in crs):
        company_code_list.append(columns[0])
        cik_list.append(columns[1])
        date_list.append(columns[2])
        count_list.append(columns[3])

    # call different  API from the crawler
    for i in range(1, len(cik_list)):
        seccrawler.filing_10Q(str(company_code_list[i]), str(cik_list[i]),
                              str(date_list[i]), str(count_list[i]))
        seccrawler.filing_10K(str(company_code_list[i]), str(cik_list[i]),
                              str(date_list[i]), str(count_list[i]))
        seccrawler.filing_8K(str(company_code_list[i]), str(cik_list[i]),
                             str(date_list[i]), str(count_list[i]))

    t2 = time.time()
    print "Total Time taken: ",
    print(t2 - t1)
    crs.close()
예제 #2
0
파일: test.py 프로젝트: deyugo/SEC-Edgar
def test():
	t1 = time.time()
	# file containig company name and corresponding cik codes
	seccrawler = SecCrawler()

	companyCodeList = list()    # company code list
	cikList = list()	        # cik code list
	dateList = list()           # pror date list
	countList = list()

	try:
		crs = open("data.txt", "r")
	except:
		print "No input file Found"

	# get the comapny  quotes and cik number from the file.
	for columns in ( raw.strip().split() for raw in crs ):
	    companyCodeList.append(columns[0])
	    cikList.append(columns[1])
	    dateList.append(columns[2])
	    countList.append(columns[3])

	del cikList[0]; del companyCodeList[0]; del dateList[0]

	for i in range(len(cikList)):
		seccrawler.filing_10Q(str(companyCodeList[i]), str(cikList[i]), str(dateList[i]), str(countList[i]))
		seccrawler.filing_10K(str(companyCodeList[i]), str(cikList[i]), str(dateList[i]), str(countList[i]))
		seccrawler.filing_8K(str(companyCodeList[i]), str(cikList[i]), str(dateList[i]), str(countList[i]))

	t2 = time.time()
	print "Total Time taken: ",
	print (t2-t1)
	crs.close()
예제 #3
0
def test():
    t1 = time.time()
    # file containig company name and corresponding cik codes
    seccrawler = SecCrawler()

    company_code_list = list()  # company code list
    cik_list = list()  # cik code list
    date_list = list()  # pror date list
    count_list = list()

    print("Enter the company name?")
    comp11 = str(input())
    cik11 = get_cik(comp11)
    print("Enter the date in format YYYYMMDD?")
    date11 = str(input())
    company_code_list.append(comp11)
    cik_list.append(cik11)
    date_list.append(date11)
    count_list.append("2")

    # call different  API from the crawler
    for i in range(len(cik_list)):
        seccrawler.filing_10Q(str(company_code_list[i]), str(cik_list[i]),
                              str(date_list[i]), str(count_list[i]))
        seccrawler.filing_10K(str(company_code_list[i]), str(cik_list[i]),
                              str(date_list[i]), str(count_list[i]))
        # seccrawler.filing_8K(str(company_code_list[i]), str(cik_list[i]),
        #     str(date_list[i]), str(count_list[i]))

    t2 = time.time()
    print("Total Time taken: "),
    print(t2 - t1)
예제 #4
0
def find_and_save_10K_to_folder(ticker,
                                from_date=None,
                                number_of_documents=40,
                                doc_format='xbrl'):
    if from_date is None:
        from_date = datetime.today().strftime('%Y%m%d')
    crawler = SecCrawler()
    cik, company_name = get_cik_and_name_from_ticker(ticker)
    crawler.filing_10K(ticker, cik, company_name, from_date,
                       number_of_documents, doc_format)
예제 #5
0
def test():
    t1 = time.time()
    # file containig company name and corresponding cik codes
    seccrawler = SecCrawler()

    company_code_list = list()  # company code list
    cik_list = list()  # cik code list
    date_list = list()  # pror date list
    count_list = list()

    try:
        f = open("data.txt", "w")
    except:
        print("No input file found")

    try:
        workbook = xlrd.open_workbook('listofITfirms.xls')
    except:
        print("No input file found")

    sheet = workbook.sheet_by_index(0)
    sheet.cell_value(0, 0)

    # Extracting number of rows
    print(sheet.nrows)
    f.write("Ticker   CIK        priorto(YYYYMMDD) Count\n")
    sheet.cell_value(0, 4)

    # need to just keep incrementing... How many?
    # range from 2 to 1514 # has headers
    for i in range(1, 3):
        # f.write("%s,%s\n" % sheet.cell_value(i, 1))
        #print("%d\n" % i)
        if sheet.cell_value(i, 1) and sheet.cell_value(i, 4):
            f.write("%s   %d   20190101   100\n" %
                    (sheet.cell_value(i, 1), sheet.cell_value(i, 4)))
    f.close()

    try:
        crs = open("data.txt", "r")
    except:
        print("No input file Found")

    # get the comapny  tickers and cik number from the file.
    for columns in (raw.strip().split() for raw in crs):
        company_code_list.append(columns[0])
        cik_list.append(columns[1])
        date_list.append(columns[2])
        count_list.append(columns[3])

    # call different  API from the crawler
    row = 1  # needs to match the range end
    col = 1

    for i in range(1, len(cik_list)):
        seccrawler.filing_10K(str(company_code_list[i]), str(cik_list[i]),
                              str(date_list[i]), str(count_list[i]))

    t2 = time.time()
    print("Total Time taken: "),
    print(t2 - t1)
    crs.close()