コード例 #1
0
 def calc_variance(self):
     """ A method for returning the portfolio variance.
     """
     
     port_ratearray = self.calc_port_rates()
     
     self.volatility = volatility(port_ratearray)
     self.variance = self.volatility**2
     
     return self.variance
コード例 #2
0
    def update_metrics(self):
        self.dates = self.stock_data['date']
        self.stock_prices = self.stock_data['adjclose']
        self.bench_prices = self.bench_data['adjclose']
        self.ratearray = rate_array(self.stock_data)
        self.bencharray = rate_array(self.bench_data)

        # TODO: Not sure if these are the metrics I'm looking for...
        self.annual_volatility = volatility(self.ratearray)
        self.beta = beta_bb(self.ratearray, self.bencharray)
        self.annualized_adjusted_return = annualized_adjusted_rate(self.ratearray, rfr=0.01)
        self.expected_return = expected_return(self.ratearray,
                                               self.bencharray,
                                               rfr=self.rfr)
        return