def book_value_per_share(ticker, date, object): totalAssets = RatiosFunctions.get_total_asset(ticker, date) totalLiab = RatiosFunctions.get_total_liabilities(ticker, date) shares = RatiosFunctions.get_outstanding_shares(ticker, object) try: bookValuePerShare = (float(totalAssets) - float(totalLiab)) / float(shares) except: print("################## Function book_value_per_share: " + ticker + " Datum: " + date + " Total Assets: " + str(totalAssets) + " Total Liabilities: " + str(totalLiab)) return bookValuePerShare
def book_value_per_share_in_percent(ticker, date, object): dateOneYearEarlier = RatiosFunctions.calculate_one_year_before(date) currentValue = book_value_per_share(ticker, date, object) beforevalue = book_value_per_share(ticker, dateOneYearEarlier, object) return str( int((float(currentValue) - float(beforevalue)) / float(beforevalue) * 100))
def price_per_earnings(ticker, date, objectNumber): net_income = RatiosFunctions.get_net_income(ticker, date) dividends_paid = RatiosFunctions.get_dividende_is_paid(ticker, date) outstanding_shares = RatiosFunctions.get_outstanding_shares( ticker, objectNumber) #x = (float(net_income) + float(dividends_paid)) #print("x: " + str(x)) y = float(outstanding_shares) #print("y: " + str(y)) earnings_per_share = float(net_income) / y share_price = Functions.get_stock_price(ticker, date) pricePerearnings = str(float(share_price) / float(earnings_per_share)) if float(pricePerearnings) > 0: return pricePerearnings else: return 0
def price_per_earnings_percent(ticker, date, object): dateOneYearEarlier = RatiosFunctions.calculate_one_year_before(date) currentValue = price_per_earnings(ticker, date, object) beforevalue = price_per_earnings(ticker, dateOneYearEarlier, object) if beforevalue == 0 or beforevalue is None or beforevalue == '0' or beforevalue == '0.00' or str( beforevalue) == "None": return "null" elif currentValue == 0 or currentValue is None or currentValue == '0' or currentValue == '0.00' or str( currentValue) == "None": return "null" return str( int((float(currentValue) - float(beforevalue)) / float(beforevalue) * 100))
def __init__(self, ticker, date, object_number): self.symbole = ticker self.quarterly = date[0] + date[1] + date[2] + date[3] self.objectNumber = object_number self.totalLiabilities = DBFunctions.get_finance_variable_in_percent( ticker, date, "totalLiab", "Balance_Sheet") self.pricePerEarnings = RatiosFunctions.price_per_earnings_percent( ticker, date, object_number) self.capitalExpenditures = DBFunctions.get_capital_expenditures( ticker, date) self.stockPrice = Functions.get_stock_price(ticker, date) self.returnOnInvestment = RatiosFunctions.get_return_on_investment( ticker, date) self.bookValuePerShare = RatiosFunctions.book_value_per_share_in_percent( ticker, date, object_number) self.pricePerBookRatioPerShare = RatiosFunctions.price_per_book_ratio_per_share_percent( ticker, date, object_number) self.esgRating = DBFunctions.get_esg_rating(ticker, date) self.totalAssets = DBFunctions.get_finance_variable_in_percent( ticker, date, "totalAssets", "Balance_Sheet") self.retainedEarnings = DBFunctions.get_finance_variable_in_percent( ticker, date, "retainedEarnings", "Balance_Sheet") self.totalCurrentAssets = DBFunctions.get_finance_variable_in_percent( ticker, date, "totalCurrentAssets", "Balance_Sheet") self.totalAssets = DBFunctions.get_finance_variable_in_percent( ticker, date, "changeToLiabilities", "Cash_Flow") self.totalCashflowsFromInvesting = DBFunctions.get_finance_variable_in_percent( ticker, date, "totalCashflowsFromInvesting", "Cash_Flow") self.netIncome = DBFunctions.get_finance_variable_in_percent( ticker, date, "netIncome", "Cash_Flow") self.changeToNetincome = DBFunctions.get_finance_variable_in_percent( ticker, date, "changeToNetincome", "Cash_Flow") self.capitalExpenditures = DBFunctions.get_finance_variable_in_percent( ticker, date, "capitalExpenditures", "Cash_Flow") self.changeReceivables = DBFunctions.get_finance_variable_in_percent( ticker, date, "changeReceivables", "Cash_Flow") self.researchDevelopment = DBFunctions.get_finance_variable_in_percent( ticker, date, "researchDevelopment", "Income_Statement") self.incomeBeforeTax = DBFunctions.get_finance_variable_in_percent( ticker, date, "incomeBeforeTax", "Income_Statement") self.ebit = DBFunctions.get_finance_variable_in_percent( ticker, date, "ebit", "Income_Statement") self.grossProfit = DBFunctions.get_finance_variable_in_percent( ticker, date, "grossProfit", "Income_Statement") self.totalRevenue = DBFunctions.get_finance_variable_in_percent( ticker, date, "totalRevenue", "Income_Statement") self.costOfRevenue = DBFunctions.get_finance_variable_in_percent( ticker, date, "costOfRevenue", "Income_Statement") self.sector = DBFunctions.get_sector(ticker)
def __init__(self, symbole, quarterly): self.symbole = symbole self.quarterly = quarterly self.total_liabilities = f.get_total_liabilities(symbole, quarterly)