Пример #1
0
def test_volatility():
    df = get_data()
    S = sample_cov(df)
    w = np.array([1 / df.shape[1]] * df.shape[1])
    var = objective_functions.volatility(w, S)
    np.testing.assert_almost_equal(var, 0.04498224489292057)
Пример #2
0
def test_volatility_dummy():
    w = np.array([0.4, 0.4, 0.2])
    data = np.diag([0.5, 0.8, 0.9])
    test_var = objective_functions.volatility(w, data)
    np.testing.assert_almost_equal(test_var, 0.244)
def test_volatility_dummy():
    w = np.array([0.4, 0.4, 0.2])
    data = np.diag([0.5, 0.8, 0.9])
    test_var = objective_functions.volatility(w, data)
    np.testing.assert_almost_equal(test_var, 0.244)
def test_volatility():
    df = get_data()
    S = sample_cov(df)
    w = np.array([1 / df.shape[1]] * df.shape[1])
    var = objective_functions.volatility(w, S)
    np.testing.assert_almost_equal(var, 0.04498224489292057)
def test_volatility():
    df = get_data()
    S = sample_cov(df)
    w = np.array([1 / df.shape[1]] * df.shape[1])
    vol = objective_functions.volatility(w, S)
    np.testing.assert_almost_equal(vol, 0.21209018103844543)