-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
43 lines (28 loc) · 830 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from DataHandler import tickerLoader
from DataHandler import downloader
from models import company
from DataHandler import writer
import os
path = os.path.abspath(os.getcwd())
data_path = os.path.join(path, 'Data\TickersForAnalysis1.csv')
year = '2017'
#tickers and names
tickerList = tickerLoader.getList(data_path)
print(tickerList)
companies = []
#Financial Info
for ticker in tickerList:
print(ticker['Ticker'])
try:
finData = downloader.getData(ticker['Ticker'], year)
row = company.Company(ticker['Name'], ticker['Ticker'], finData[0], finData[1], finData[2])
except TypeError:
continue
except ValueError:
continue
except ZeroDivisionError:
continue
else:
companies.append(row)
writer.saveToJson(companies)
writer.saveToExcel(companies)