'Check volatility results against values calculated manually'

def test_volatility(self):

    nassets = 3
    ann_vol = AnnualizedVolatility()
    today = pd.Timestamp('2016', tz='utc')
    assets = np.arange(nassets, dtype=np.float64)
    returns = np.random.normal(loc=0.001, scale=0.01, size=(ann_vol.window_length, nassets))
    out = np.empty(shape=(nassets,), dtype=np.float64)
    ann_vol.compute(today, assets, out, returns, 252)
    mean = np.mean(returns, axis=0)
    annualized_variance = ((((returns - mean) ** 2).sum(axis=0) / returns.shape[0]) * 252)
    expected_vol = np.sqrt(annualized_variance)
    np.testing.assert_almost_equal(out, expected_vol, decimal=8)
