def NOW_click(self):
     tickers_quote = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print('\n---- CLICK EVENT  NOW_click ---- Selected ticker is/are: ' +
           entered_tickers)
     ticker_list = entered_tickers.split(',')
     print('---- You selected ' + str(len(ticker_list)) + ' tickers')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         Quote = Analyses(ticker,
                          period=entered_years,
                          api_key=self.apikey,
                          statistic=' ')
         price, priceAvg50, priceAvg200, eps, sharesOutstanding, marketCap = Quote.Get_quote_for(
             ticker)
         today = Quote.today
         #Thoise values are evaluated at the latest date
         currentRatio, quickRatio, cashRatio, grossProfitMargin, operatingProfitMargin, netProfitMargin, returnOnAssets, returnOnEquity, unused_0, unused_1, operatingCashFlowPerShare, freeCashFlowPerShare = Quote.Ratios(
         )  #return 12 strings
         latest_ratio_date = Quote.today
         bookValuePerShare, debtToAssets, debtToEquity, enterpriseValue, enterpriseValueOverEBITDA, freeCashFlowPerShare, researchAndDdevelopementToRevenue, roe, roic = Quote.Metrics(
         )
         beta, volAvg, lastDiv, dcf, ipoDate, industry, sector = Quote.Profile(
         )
         tickers_quote[ticker] = {
             'Today': today,
             'beta': beta,
             'volAvg': volAvg,
             'lastDiv': lastDiv,
             'dcf': dcf,
             'ipoDate': ipoDate,
             'industry': industry,
             'sector': sector,
             'marketCap': marketCap,
             'price': price,
             'priceAvg50': priceAvg50,
             'priceAvg200': priceAvg200,
             'EPS': eps,
             'bookValuePerShare': bookValuePerShare,
             'roe': roe,
             'roic': roic,
             'sharesOutstanding': sharesOutstanding,
             'Latest report date': latest_ratio_date,
             'currentRatio': currentRatio,
             'quickRatio': quickRatio,
             'debtToAssets': debtToAssets,
             'debtToEquity': debtToEquity,
             'cashRatio': cashRatio,
             'grossProfitMargin': grossProfitMargin,
             'operatingProfitMargin': operatingProfitMargin,
             'netProfitMargin': netProfitMargin,
             'returnOnAssets': returnOnAssets,
             'returnOnEquity': returnOnEquity,
             'researchAndDdevelopementToRevenue':
             researchAndDdevelopementToRevenue,
             'operatingCashFlowPerShare': operatingCashFlowPerShare,
             'freeCashFlowPerShare': freeCashFlowPerShare,
             'enterpriseValue': enterpriseValue,
             'enterpriseValueOverEBITDA': enterpriseValueOverEBITDA
         }
     index_for_dataframe = Quote.title_data = [
         'Today', 'beta', 'volAvg', 'lastDiv', 'dcf', 'ipoDate', 'industry',
         'sector', 'marketCap', 'price', 'priceAvg50', 'priceAvg200', 'EPS',
         'bookValuePerShare', 'roe', 'roic', 'sharesOutstanding',
         'Latest report date', 'currentRatio', 'quickRatio', 'debtToAssets',
         'debtToEquity', 'cashRatio', 'grossProfitMargin',
         'operatingProfitMargin', 'netProfitMargin', 'returnOnAssets',
         'returnOnEquity', 'researchAndDdevelopementToRevenue',
         'operatingCashFlowPerShare', 'freeCashFlowPerShare',
         'enterpriseValue', 'enterpriseValueOverEBITDA'
     ]
     #print('Dict is '+str(tickers_quote))
     mydict = tickers_quote
     #with open('dict.csv', 'w') as csv_file:
     #	writer = csv.writer(csv_file)
     #	for key, value in mydict.items():
     #		writer.writerow([key, value])
     frame = pd.DataFrame(tickers_quote,
                          columns=entered_tickers.split(","),
                          index=index_for_dataframe)
     print('Frame is ' + str(frame))
     if (len(entered_tickers) > 1):
         f = open(
             "saved_data/dataframe/" + entered_tickers.replace(',', '_') +
             "_now_click.log", "w")
         print(frame, file=f)
         frame.to_csv(r'saved_data/csv/' +
                      entered_tickers.replace(',', '_') + '_now_click.csv',
                      index=index_for_dataframe)
     print('-- NOW_click printed on files for: ' + entered_tickers)
     Quote.Get_Industry_Ratios(industry)
Beispiel #2
0
 def CashFlowCalculator(self):
     tickers_quote = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print('\n----   CashFlowCalculator ---- Selected ticker is/are: ' +
           entered_tickers)
     ticker_list = entered_tickers.split(',')
     print('---- You selected ' + str(len(ticker_list)) + ' tickers')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         Quote = Analyses(ticker,
                          period=entered_years,
                          api_key=self.apikey,
                          statistic=' ')
         price, priceAvg50, priceAvg200, eps, sharesOutstanding, marketCap = Quote.Get_quote_for(
             ticker)
         #Thoise values are evaluated at the latest date
         revenue, netIncome, ebitda, depreciationAndAmortization, interestExpense, incomeTaxExpense, operatingIncome, date, period = Quote.IncomeStatement(
             history_year='latest')  #return 12 strings
         date, period, totalAssets, totalLiabilities, totalCurrentAssets, totalCurrentLiabilities, totalNonCurrentAssets, shortTermDebt, longTermDebt, cashAndShortTermInvestments, retainedEarnings, propertyPlantEquipmentNet = Quote.BalanceSheet(
             history_year='latest')  #return 14 strings
         date, period, operatingCashFlow, capitalExpenditure, dividendsPaid, commonStockRepurchased, changeInWorkingCapital, netCashProvidedByOperatingActivities, commonStockIssued, capitalExpenditure, freeCashFlow = Quote.CashFlowStatement(
             history_year='latest')  #return 14 strings
         latest_ratio_date = Quote.today
         tickers_quote[ticker] = {
             'date': date,
             'period': period,
             'price': price,
             'sharesOutstanding': sharesOutstanding,
             'revenue': revenue,
             'netIncome': netIncome,
             'ebitda': ebitda,
             'depreciationAndAmortization': depreciationAndAmortization,
             'interestExpense': interestExpense,
             'incomeTaxExpense': incomeTaxExpense,
             'operatingIncome': operatingIncome,
             'totalAssets': totalAssets,
             'totalLiabilities': totalLiabilities,
             'totalCurrentAssets': totalCurrentAssets,
             'totalCurrentLiabilities': totalCurrentLiabilities,
             'totalNonCurrentAssets': totalNonCurrentAssets,
             'shortTermDebt': shortTermDebt,
             'longTermDebt': longTermDebt,
             'cashAndShortTermInvestments': cashAndShortTermInvestments,
             'retainedEarnings': retainedEarnings,
             'operatingCashFlow': operatingCashFlow,
             'capitalExpenditure': capitalExpenditure,
             'dividendsPaid': dividendsPaid,
             'commonStockRepurchased': commonStockRepurchased,
             'changeInWorkingCapital': changeInWorkingCapital,
             'netCashProvidedByOperatingActivities':
             netCashProvidedByOperatingActivities,
             'commonStockIssued': commonStockIssued,
             'capitalExpenditure': capitalExpenditure,
             'freeCashFlow': freeCashFlow,
             'propertyPlantEquipmentNet': propertyPlantEquipmentNet
         }
     index_for_dataframe = Quote.title_data = [
         'date', 'period', 'price', 'sharesOutstanding', 'revenue',
         'netIncome', 'ebitda', 'depreciationAndAmortization',
         'interestExpense', 'incomeTaxExpense', 'operatingIncome',
         'totalAssets', 'totalLiabilities', 'totalCurrentAssets',
         'totalCurrentLiabilities', 'totalNonCurrentAssets',
         'shortTermDebt', 'longTermDebt', 'cashAndShortTermInvestments',
         'retainedEarnings', 'operatingCashFlow', 'capitalExpenditure',
         'dividendsPaid', 'commonStockRepurchased',
         'changeInWorkingCapital', 'netCashProvidedByOperatingActivities',
         'commonStockIssued', 'capitalExpenditure', 'freeCashFlow',
         'propertyPlantEquipmentNet'
     ]
     mydict = tickers_quote
     frame = pd.DataFrame(tickers_quote,
                          columns=entered_tickers.split(","),
                          index=index_for_dataframe)
     print('Frame is ' + str(frame))
     if (len(entered_tickers) > 1):
         f = open(
             "saved_data/dataframe/" + entered_tickers.replace(',', '_') +
             "_cashflowcalculator.log", "w")
         print(frame, file=f)
         frame.to_csv(r'saved_data/csv/' +
                      entered_tickers.replace(',', '_') +
                      '_cashflowcalculator.csv',
                      index=index_for_dataframe)
     print('-- CashFlowCalculator printed on files for: ' + entered_tickers)