MCPcopy Create free account
hub / github.com/Open-Quant/openquant / test_portfolio_fixture_smoke

Function test_portfolio_fixture_smoke

python/tests/test_bindings_contract.py:149–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147
148
149def test_portfolio_fixture_smoke():
150 prices = _load_fixture_prices()
151 ivp = openquant.portfolio.allocate_inverse_variance(prices)
152 mv = openquant.portfolio.allocate_min_vol(prices)
153 msr = openquant.portfolio.allocate_max_sharpe(prices, risk_free_rate=0.0)
154
155 for out in (ivp, mv, msr):
156 weights, risk, port_ret, sharpe = out
157 assert len(weights) == 3
158 assert sum(weights) == pytest.approx(1.0, abs=1e-6)
159 assert isinstance(risk, float)
160 assert isinstance(port_ret, float)
161 assert isinstance(sharpe, float)
162
163
164def test_portfolio_rejects_ragged_matrix():

Callers

nothing calls this directly

Calls 1

_load_fixture_pricesFunction · 0.85

Tested by

no test coverage detected