Example #1
0
def test_annualized_adjusted_rate():
    """ Check annual rate of return."""
    pa = np.array(dummy_data, dtype=schema)
    ra = metrics.rate_array(pa)
    aar = metrics.annualized_adjusted_rate(ra)
    # This is not a great test ... needs to be independently calculated, 
    #     as does the rate array data.
    np.testing.assert_almost_equal(aar, 2.6020844941637074)
Example #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