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

Function test_pipeline_run_contract

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

Source from the content-addressed store, hash-verified

33
34
35def test_pipeline_run_contract():
36 timestamps, close, probabilities, sides, asset_prices, asset_names = _toy_pipeline_input()
37
38 out = openquant.pipeline.run_mid_frequency_pipeline(
39 timestamps=timestamps,
40 close=close,
41 model_probabilities=probabilities,
42 model_sides=sides,
43 asset_prices=asset_prices,
44 asset_names=asset_names,
45 cusum_threshold=0.0005,
46 )
47
48 assert set(out.keys()) == {"events", "signals", "portfolio", "risk", "backtest", "leakage_checks"}
49 assert len(out["signals"]["values"]) == len(timestamps)
50 assert len(out["backtest"]["equity_curve"]) == len(timestamps)
51 assert len(out["backtest"]["strategy_returns"]) == len(timestamps) - 1
52 assert len(out["portfolio"]["weights"]) == 3
53 assert sum(out["portfolio"]["weights"]) == pytest.approx(1.0, abs=1e-6)
54 assert out["leakage_checks"]["inputs_aligned"] is True
55 assert out["leakage_checks"]["has_forward_look_bias"] is False
56
57
58def test_pipeline_run_frames():

Callers

nothing calls this directly

Calls 1

_toy_pipeline_inputFunction · 0.85

Tested by

no test coverage detected