def StockScreener_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     marketcap_high = self.textTicker2.get()
     marketcap_low = self.textTicker3.get()
     beta_high = self.textTicker4.get()
     beta_low = self.textTicker5.get()
     dividend_high = self.textTicker6.get()
     dividend_low = self.textTicker7.get()
     sector = self.textTicker8.get()
     industry = self.textTicker9.get()
     exchange = self.textTicker10.get()
     entered_years = self.buttonYears_var.get()
     print(
         '\n---- CLICK EVENT StockScreener_click ---- Selected criteria are are: '
         + marketcap_high + ' ' + marketcap_low + ' ' + beta_high + ' ' +
         beta_low + ' ' + dividend_high + ' ' + dividend_low + ' ' +
         sector + ' ' + industry + ' ' + exchange)
     Quote = Analyses('stockscreener',
                      period=entered_years,
                      api_key=self.apikey,
                      statistic=' ')
     criteria_list = [
         marketcap_high, marketcap_low, beta_high, beta_low, dividend_high,
         dividend_low, sector, industry, exchange
     ]
     Quote.Stock_screener(criteria_list)
 def YieldSearch_click(self):
     marketcap_high = self.textTicker2.get()
     marketcap_low = self.textTicker3.get()
     beta_high = self.textTicker4.get()
     beta_low = self.textTicker5.get()
     dividend_high = self.textTicker6.get()
     dividend_low = self.textTicker7.get()
     sector = self.textTicker8.get()
     industry = self.textTicker9.get()
     exchange = self.textTicker10.get()
     targetYield = self.textYield.get()
     entered_years = self.buttonYears_var.get()
     print(
         '\n---- CLICK EVENT Yeld finder click ---- Selected criteria are are: '
         + marketcap_high + ' ' + marketcap_low + ' ' + beta_high + ' ' +
         beta_low + ' ' + dividend_high + ' ' + dividend_low + ' ' +
         sector + ' ' + industry + ' ' + exchange)
     Quote = Analyses('stockscreener',
                      period=entered_years,
                      api_key=self.apikey,
                      statistic=' ')
     criteria_list = [
         marketcap_high, marketcap_low, beta_high, beta_low, dividend_high,
         dividend_low, sector, industry, exchange
     ]
     Quote.Stock_screener(criteria_list, 1,
                          targetYield)  #YIELD function is enabled
 def Ticker_list_click(self):  #TO DO
     print(
         '\n---- CLICK EVENT Ticker_list_click : Ticker list will be listed /saved_data/Ticker_list.csv  ---- '
     )
     entered_years = self.buttonYears_var.get()
     Quote = Analyses('list',
                      period=entered_years,
                      api_key=self.apikey,
                      statistic=' ')
     Quote.Ticker_list()  #Get the ticker list
 def ANALYZE_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print('\n---- CLICK EVENT ANALYZE ---- Selected ticker is/are: ' +
           entered_tickers)
     ticker_list = entered_tickers.split(',')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         a = Analyses(ticker=entered_tickers,
                      period=entered_years,
                      api_key=self.apikey,
                      statistic='')
         #a.title_data = ['Earning Per Share','netIncomeRatio']
         (date, eps,
          netIncomeRatio) = a.Get_document_for(ticker,
                                               'epsdiluted',
                                               'netIncomeRatio',
                                               document='income_statement')
         (date_2, bookValuePerShare,
          roe) = a.Get_document_for(ticker,
                                    'bookValuePerShare',
                                    'roe',
                                    document='metrics')
         (date_2, dividendYield,
          roe) = a.Get_document_for(ticker,
                                    'dividendYield',
                                    'roe',
                                    document='metrics')
         tickers_dict_eps[ticker] = {
             'x': date,
             'y1': eps,
             'y2': dividendYield
         }
         tickers_dict_debt[ticker] = {
             'x': date_2,
             'y1': bookValuePerShare,
             'y2': roe
         }
     a.title_data = [
         'Earning Per Share Diluted =\n (NetIncome - PreferredDividends)/SharesOutstanding',
         'dividendYield %',
         'bookValuePerShare =\n (TotalEquity-PreferredEquity)/SharesOutstanding',
         'ROE =\n NetIncome/SharholdersEquity'
     ]
     print(
         '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'
     )
     click_data = ['EPS', 'netIncomeRatio', 'BVPS', 'ROE']
     plot = a.Multiple_plots(ticker_list, tickers_dict_eps,
                             tickers_dict_debt, 'Analyze')
 def CashFlow_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print('\n---- CLICK EVENT CashFlow ---- Selected ticker is/are: ' +
           entered_tickers)
     ticker_list = entered_tickers.split(',')
     print('-- You selected ' + str(len(ticker_list)) + ' tickers \n')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         CashFlow = Analyses(ticker=entered_tickers,
                             period=entered_years,
                             api_key=self.apikey,
                             statistic=' ')
         (date, netCashProvidedByOperating,
          netCashUsedForInvesting) = CashFlow.Get_document_for(
              ticker,
              'netCashProvidedByOperatingActivities',
              'netCashUsedForInvestingActivites',
              document='cash_flow')
         (date_2, netCashUsedProvidedByFinancing,
          netChangeInCash) = CashFlow.Get_document_for(
              ticker,
              'netCashUsedProvidedByFinancingActivities',
              'netChangeInCash',
              document='cash_flow')
         tickers_dict_eps[ticker] = {
             'x': date,
             'y1': netCashProvidedByOperating,
             'y2': netCashUsedForInvesting
         }
         tickers_dict_debt[ticker] = {
             'x': date_2,
             'y1': netCashUsedProvidedByFinancing,
             'y2': netChangeInCash
         }
         #print(tickers_dict_eps
     CashFlow.title_data = [
         'netCashProvidedByOperatingActivities',
         'netCashUsedProvidedByForInvestingActivities',
         'netCashUsedProvidedByFinancingActivities', 'netChangeInCash'
     ]
     plot = CashFlow.Multiple_plots(ticker_list, tickers_dict_eps,
                                    tickers_dict_debt, 'CashFlow')
 def Profitability_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print(
         '\n---- CLICK EVENT Profitability ---- Selected ticker is/are: ' +
         entered_tickers)
     ticker_list = entered_tickers.split(',')
     #print('-- You selected '+str(len(ticker_list))+' tickers \n')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         IncomeStatement = Analyses(ticker=entered_tickers,
                                    period=entered_years,
                                    api_key=self.apikey,
                                    statistic='%')
         (date, grossProfitRatio,
          operatingIncome) = IncomeStatement.Get_document_for(
              ticker,
              'grossProfitRatio',
              'operatingIncomeRatio',
              document='income_statement')
         (date_2, returnOnTangibleAssets,
          roic) = IncomeStatement.Get_document_for(ticker,
                                                   'returnOnTangibleAssets',
                                                   'roic',
                                                   document='metrics')
         tickers_dict_eps[ticker] = {
             'x': date,
             'y1': grossProfitRatio,
             'y2': operatingIncome
         }
         tickers_dict_debt[ticker] = {
             'x': date_2,
             'y1': returnOnTangibleAssets,
             'y2': roic
         }
     IncomeStatement.title_data = [
         'grossProfitRatio', 'operatingIncomeRatio',
         'returnOnTangibleAssets', 'roic '
     ]
     plot = IncomeStatement.Multiple_plots(ticker_list, tickers_dict_eps,
                                           tickers_dict_debt,
                                           'Profitability')
 def DebtFigures_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print('\n---- CLICK EVENT DebtFigures ---- Selected ticker is/are: ' +
           entered_tickers)
     ticker_list = entered_tickers.split(',')
     #print('-- You selected '+str(len(ticker_list))+' tickers \n')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         DebtFigures = Analyses(ticker=entered_tickers,
                                period=entered_years,
                                api_key=self.apikey,
                                statistic='  ')
         (date, Current_ratio,
          Debt_to_Assets) = DebtFigures.Get_document_for(ticker,
                                                         'currentRatio',
                                                         'debtToAssets',
                                                         document='metrics')
         (date_2, bookValuePerShare,
          debtToEquity) = DebtFigures.Get_document_for(ticker,
                                                       'netDebtToEBITDA',
                                                       'debtToEquity',
                                                       document='metrics')
         tickers_dict_eps[ticker] = {
             'x': date,
             'y1': Current_ratio,
             'y2': Debt_to_Assets
         }
         tickers_dict_debt[ticker] = {
             'x': date_2,
             'y1': bookValuePerShare,
             'y2': debtToEquity
         }
     DebtFigures.title_data = [
         'CurrentRatio =\n CurrentAssets/CurrentLiabilities',
         'DebtToAssets =\n STDebts+LTDebts/TotalAssets',
         'netDebtToEBITDA =\n TotalDebt - Cash&Equivalents / EBITDA',
         'debtToEquity =\n TotalLiabilities/ShareholdersEquity'
     ]
     plot = DebtFigures.Multiple_plots(ticker_list, tickers_dict_eps,
                                       tickers_dict_debt, 'DebtFigures')
 def BalanceSheet_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print('\n---- CLICK EVENT BalanceSheet ---- Selected ticker is/are: ' +
           entered_tickers)
     ticker_list = entered_tickers.split(',')
     print('-- You selected ' + str(len(ticker_list)) + ' tickers \n')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         BalanceSheet = Analyses(ticker=entered_tickers,
                                 period=entered_years,
                                 api_key=self.apikey,
                                 statistic='log')
         (date, totalCurrentLiabilities,
          totalCurrentAssets) = BalanceSheet.Get_document_for(
              ticker, 'totalCurrentLiabilities', 'totalCurrentAssets',
              'balance_sheet')
         (date_2, shortTermDebt,
          longTermDebt) = BalanceSheet.Get_document_for(
              ticker,
              'shortTermDebt',
              'longTermDebt',
              document='balance_sheet')
         tickers_dict_eps[ticker] = {
             'x': date,
             'y1': totalCurrentLiabilities,
             'y2': totalCurrentAssets
         }
         tickers_dict_debt[ticker] = {
             'x': date_2,
             'y1': shortTermDebt,
             'y2': longTermDebt
         }
         #print(tickers_dict_eps
     BalanceSheet.title_data = [
         'totalCurrentLiabilities', 'totalCurrentAssets', 'shortTermDebt',
         'longTermDebt'
     ]
     plot = BalanceSheet.Multiple_plots(ticker_list, tickers_dict_eps,
                                        tickers_dict_debt, 'BalanceSheet')
Example #9
0
 def Growth_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print('\n---- CLICK EVENT Growth_click ---- Selected ticker is/are: ' +
           entered_tickers)
     ticker_list = entered_tickers.split(',')
     print('-- You selected ' + str(len(ticker_list)) + ' tickers \n')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         Growth = Analyses(ticker=entered_tickers,
                           period=entered_years,
                           api_key=self.apikey,
                           statistic='%')
         (date, revenueGrowth,
          operatingIncomeGrowth) = Growth.Get_document_for(
              ticker, 'revenueGrowth', 'operatingIncomeGrowth',
              'financial-growth')
         (date_2, netIncomeGrowth,
          epsdilutedGrowth) = Growth.Get_document_for(
              ticker,
              'netIncomeGrowth',
              'epsdilutedGrowth',
              document='financial-growth')
         tickers_dict_eps[ticker] = {
             'x': date,
             'y1': revenueGrowth,
             'y2': operatingIncomeGrowth
         }
         tickers_dict_debt[ticker] = {
             'x': date_2,
             'y1': netIncomeGrowth,
             'y2': epsdilutedGrowth
         }
         #print(tickers_dict_eps
     Growth.title_data = [
         'revenueGrowth', 'operatingIncomeGrowth', 'netIncomeGrowth',
         'epsdilutedGrowth'
     ]
     plot = Growth.Multiple_plots(ticker_list, tickers_dict_eps,
                                  tickers_dict_debt, 'Growth')
Example #10
0
 def IncomeStatement_click(self):
     tickers_dict_eps = dict()
     tickers_dict_debt = dict()
     entered_tickers = self.textTicker.get()
     entered_years = self.buttonYears_var.get()
     print(
         '\n---- CLICK EVENT IncomeStatement ---- Selected ticker is/are: '
         + entered_tickers)
     ticker_list = entered_tickers.split(',')
     print('-- You selected ' + str(len(ticker_list)) + ' tickers \n')
     for ticker in ticker_list:
         print('---- Collecting data for ' + str(ticker))
         IncomeStatement = Analyses(ticker=entered_tickers,
                                    period=entered_years,
                                    api_key=self.apikey,
                                    statistic='log')
         (date, Revenue, NetIncome) = IncomeStatement.Get_document_for(
             ticker, 'revenue', 'netIncome', document='income_statement')
         (date_2, operatingIncome,
          ebitda) = IncomeStatement.Get_document_for(
              ticker,
              'operatingIncome',
              'ebitda',
              document='income_statement')
         tickers_dict_eps[ticker] = {
             'x': date,
             'y1': Revenue,
             'y2': NetIncome
         }
         tickers_dict_debt[ticker] = {
             'x': date_2,
             'y1': operatingIncome,
             'y2': ebitda
         }
     IncomeStatement.title_data = [
         'Revenue', 'NetIncome', 'OperatingIncome', 'Ebitda '
     ]
     plot = IncomeStatement.Multiple_plots(ticker_list, tickers_dict_eps,
                                           tickers_dict_debt,
                                           'IncomeStatement')
Example #11
0
 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)
Example #12
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)