def beta_html(self, value_str): if value_str == 'N/A': return value_str value = misc.to_float_value(value_str) if value >= 1.25: return format.red(value_str) if value >= 1.05: return format.orange(value_str) return format.green(value_str)
def treynor_html(self, value_str): if value_str == 'N/A': return value_str value = misc.to_float_value(value_str) if value > 5: return format.green(value_str) if value <= 0: return format.red(value_str) return format.orange(value_str)
def yearly_perf_html(self, value_str): if value_str == 'N/A': return value_str value = misc.to_float_value(value_str) if value >= 10: return format.green(value_str) if value >= 3: return format.orange(value_str) return format.red(value_str)
def expense_ratio_html(self): exp_ratio = self.expense_ratio() if exp_ratio == 'N/A': return format.orange(exp_ratio) expense_ratio = misc.to_float_value(exp_ratio) if expense_ratio >= 0.5: return format.red(exp_ratio) if expense_ratio >= 0.4: return format.orange(exp_ratio) return format.green(exp_ratio)
def fund_pe(self): try: return misc.to_float_value(self.holdings_dict['Price/Earnings']) except: return self.holdings_dict.get('Price/Earnings', 'N/A')
def perf_weekly_by_month(self): perf_month = misc.to_float_value(self.attr_dict['Perf Month']) return metric.compound(perf_month / 100, 4.33)
def perf_weekly_by_quarter(self): perf_quarter_str = self.attr_dict['Perf Quarter'] == '-' and \ self.attr_dict['Perf YTD'] or self.attr_dict['Perf Quarter'] perf_quarter = misc.to_float_value(perf_quarter_str) return metric.compound(perf_quarter / 100, 13)
def perf_weekly_by_half_year(self): perf_half_year_str = self.attr_dict['Perf Half Y'] == '-' and \ self.attr_dict['Perf YTD'] or self.attr_dict['Perf Half Y'] perf_half_year = misc.to_float_value(perf_half_year_str) return metric.compound(perf_half_year / 100, 26)
def rsi_value(self): return misc.to_float_value(self.attr_dict['RSI (14)'])