def getData(self): info = stockretriever.get_current_info([self.ticker]) self.sharePrice = float(info['Bid']) self.marketCap = convertString.convertString( info['MarketCapitalization']) self.ebitda = convertString.convertString(info['EBITDA']) self.eps = info['EPSEstimateCurrentYear'] #Equity Multiples self.PEGRatio = info['PEGRatio'] self.PERatio = info['PERatio'] self.PriceBook = info['PriceBook'] self.calculateEnterpriseValue() self.amortization = float(raw_input("Enter Amortization:")) self.depreciation = float(raw_input("Enter Depreciation:")) self.sales = float(raw_input("Enter Sales:")) self.UnleveredFreeCashFlow = float( raw_input("Enter Unlevered Free Cash Flow:")) self.EBIT = self.ebitda - self.amortization - self.depreciation #Enterprise Values print self.ebitda #print self.enterpriseValue self.evEBITDA = self.enterpriseValue / self.ebitda self.evEBIT = self.enterpriseValue / self.EBIT self.evSales = self.enterpriseValue / self.sales self.evUnleveredCF = self.enterpriseValue / self.UnleveredFreeCashFlow
def getData(self): info = stockretriever.get_current_info([self.ticker]) self.sharePrice = float(info['Bid']) self.marketCap = convertString.convertString(info['MarketCapitalization']) self.ebitda = convertString.convertString(info['EBITDA']) self.eps = info['EPSEstimateCurrentYear'] #Equity Multiples self.PEGRatio = info['PEGRatio'] self.PERatio = info['PERatio'] self.PriceBook = info['PriceBook'] self.calculateEnterpriseValue(); self.amortization = float(raw_input("Enter Amortization:")) self.depreciation = float(raw_input("Enter Depreciation:")) self.sales = float(raw_input("Enter Sales:")) self.UnleveredFreeCashFlow = float(raw_input("Enter Unlevered Free Cash Flow:")) self.EBIT = self.ebitda - self.amortization - self.depreciation #Enterprise Values print self.ebitda #print self.enterpriseValue self.evEBITDA = self.enterpriseValue/self.ebitda self.evEBIT = self.enterpriseValue/self.EBIT self.evSales = self.enterpriseValue/self.sales self.evUnleveredCF = self.enterpriseValue/self.UnleveredFreeCashFlow
def prettyJson(jsonStr, tab=''): for key in jsonStr.keys(): if type(jsonStr[key]) is dict: print(key + "\n", end='') prettyJson(jsonStr[key], tab + '\t') else: print(tab, key, ": ", convertString(jsonStr[key]))
def parseJson(self, jsonStr): for key in jsonStr.keys(): if type(jsonStr[key]) is dict: print(key + "\t") self.parseJson(jsonStr[key]) else: print(key, ": ", convertString(jsonStr[key]))
def convertToken(token, line,t,v,i,understood,variables, oldIdent): """ Converts a token in Python into an equivelent Perl string """ if t == tokenize.COMMENT: line,i,understood,variables = convertComment(token,line,t,v,i,understood,variables) elif t == tokenize.NAME: if keyword.iskeyword(v): if v == 'print': line, i, understood, variables = convertPrint(token,line,t,v,i,understood,variables) elif v == 'not' : line, i, understood, variables = convertNot (token,line,t,v,i,understood,variables) elif v == 'and' : line += '&& ' elif v == 'or' : line += '|| ' elif v == 'if' : line, i, understood, variables = convertIf (token,line,t,v,i,understood,variables, oldIdent) elif v == 'for' : line, i, understood, variables = convertFor (token,line,t,v,i,understood,variables, oldIdent) elif v == 'while': line, i, understood, variables = convertWhile(token,line,t,v,i,understood,variables, oldIdent) elif v == 'elif' : line, i, understood, variables = convertElif (token,line,t,v,i,understood,variables, oldIdent) elif v == 'else' : line, i, understood, variables = convertElse (token,line,t,v,i,understood,variables, oldIdent) elif v == 'break': line += 'last ' elif v == 'continue': line += 'next' elif v == 'import': line += '' else: line += v + ' ' understood = False elif v == 'range': line, i, understood, variables = convertRange(token, line, t,v,i,understood, variables) elif v == 'sys' : line, i, understood, variables = convertSys (token, line, t,v,i,understood, variables, oldIdent) elif v == 'int' : line, i, understood, variables = convertInt (token, line, t,v,i,understood, variables) elif v == 'len' : line, i, understood, variables = convertLen (token, line, t,v,i,understood, variables) elif v =='sorted': line, i, understood, variables = convertSorted(token, line, t,v,i,understood, variables) else: line, i, understood, variables = convertVariableName(token,line,t,v,i,understood,variables) elif t == tokenize.STRING: line,i,understood,variables = convertString(token,line, t, v, i,understood,variables) elif t == tokenize.NEWLINE: line, i,understood,variables = convertLineEnd(token,line,t,v,i,understood,variables); elif t == tokenize.NL: line, i,understood,variables = convertLineEnd(token,line,t,v,i,understood,variables); elif t == tokenize.NUMBER:line += v + ' ' elif t == tokenize.OP and re.match(r'^[<>&^|~=*,/%-]$|^\*\*$|<<|>>|>=|<=|!=|==|\+=|-=|\*=|%=|&=',v): line += v + ' ' elif t == tokenize.OP and v == '+' and len(token) - i > 1 and\ (((token[i+1][1] in variables) and variables[token[i+1][1]] == 'STRING') or token[i-1][0] == tokenize.STRING or token[i+1][0] == tokenize.STRING or getType(token, i+1, understood, variables)[0] == 'STRING'): line += '. ' elif t == tokenize.OP and v == '+': line += '+ '; elif t == tokenize.OP and v == '[': line, i, understood, variables = convertSquareBraketOP(token, line, t,v,i,understood, variables) elif t == tokenize.OP and re.match('[(]',v): line, i,understood,variables = convertGrouping(token,line,t,v,i,understood,variables) elif t == tokenize.ENDMARKER: print "", else: