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

Function test_risk_metrics_smoke

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

Source from the content-addressed store, hash-verified

25
26def test_risk_metrics_smoke():
27 returns = [-0.02, 0.01, 0.015, -0.01, 0.005]
28 var_95 = openquant.risk.calculate_value_at_risk(returns, 0.05)
29 es_95 = openquant.risk.calculate_expected_shortfall(returns, 0.05)
30 cdar_95 = openquant.risk.calculate_conditional_drawdown_risk(returns, 0.05)
31
32 assert var_95 == pytest.approx(-0.01)
33 assert es_95 == pytest.approx(-0.02)
34 assert isinstance(cdar_95, float)
35
36
37def test_filters_indices_and_timestamps():
38 close = [100.0, 101.2, 100.8, 102.4, 101.9, 103.1]

Callers

nothing calls this directly

Tested by

no test coverage detected