diff --git a/pyproject.toml b/pyproject.toml index 62597b4..14320de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,8 +13,8 @@ authors = [{ name = "QuantStrategyLab" }] dependencies = [ "flask>=3.0", "pandas>=2.0", - "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@69a0256934d081b5ef309a885384b9eb9f62cf90", - "cn-equity-strategies @ git+https://github.com/QuantStrategyLab/CnEquityStrategies.git@12c0cd4801060fcb2f9452ffd9a7f48df446ddd0", + "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@68fcad8c68ab48a1109d99715f8315af449de493", + "cn-equity-strategies @ git+https://github.com/QuantStrategyLab/CnEquityStrategies.git@33d605622ded78a006efef4297b7e786cadf1a27", ] [project.optional-dependencies] diff --git a/qsl.toml b/qsl.toml index 49cf49c..9465c9d 100644 --- a/qsl.toml +++ b/qsl.toml @@ -6,8 +6,8 @@ allow_legacy = false enforce_bundle = true [qsl.requires] -quant_platform_kit = "69a0256934d081b5ef309a885384b9eb9f62cf90" -cn_equity_strategies = "12c0cd4801060fcb2f9452ffd9a7f48df446ddd0" +quant_platform_kit = "68fcad8c68ab48a1109d99715f8315af449de493" +cn_equity_strategies = "33d605622ded78a006efef4297b7e786cadf1a27" [qsl.compat] bundle = "2026.07.3" diff --git a/tests/test_dry_run_cycle.py b/tests/test_dry_run_cycle.py index 41a09d9..6e5297a 100644 --- a/tests/test_dry_run_cycle.py +++ b/tests/test_dry_run_cycle.py @@ -32,7 +32,10 @@ def test_load_platform_runtime_settings_from_env(monkeypatch: pytest.MonkeyPatch assert settings.market_history_path == market_history_csv -def test_dry_run_cycle_returns_target_weights(monkeypatch: pytest.MonkeyPatch, market_history_csv: str): +def test_dry_run_cycle_fails_closed_on_concentrated_target( + monkeypatch: pytest.MonkeyPatch, + market_history_csv: str, +): monkeypatch.setenv("STRATEGY_PROFILE", CN_INDUSTRY_ETF_ROTATION_PROFILE) monkeypatch.setenv("QMT_DRY_RUN_ONLY", "true") monkeypatch.setenv("QMT_MARKET_HISTORY_PATH", market_history_csv) @@ -55,12 +58,14 @@ def test_dry_run_cycle_returns_target_weights(monkeypatch: pytest.MonkeyPatch, m ) assert report["status"] == "ok" assert report["strategy_profile"] == CN_INDUSTRY_ETF_ROTATION_PROFILE - assert report["target_weights"] - assert report["order_previews"] + assert report["target_weights"] == {} + assert report["order_previews"] == [] + assert report["risk_flags"] == ["rejected:concentration"] + assert report["diagnostics"]["risk_gate"] == "REJECT" assert report["dry_run_only"] is True -def test_dry_run_cycle_supports_aggressive_industry_profile( +def test_aggressive_industry_profile_fails_closed_on_concentration( monkeypatch: pytest.MonkeyPatch, market_history_csv: str, ): @@ -86,4 +91,7 @@ def test_dry_run_cycle_supports_aggressive_industry_profile( ) assert report["status"] == "ok" assert report["strategy_profile"] == CN_INDUSTRY_ETF_ROTATION_AGGRESSIVE_PROFILE - assert report["target_weights"] + assert report["target_weights"] == {} + assert report["order_previews"] == [] + assert report["risk_flags"] == ["rejected:concentration"] + assert report["diagnostics"]["risk_gate"] == "REJECT" diff --git a/tests/test_main.py b/tests/test_main.py index be2b761..2e18bb7 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -28,4 +28,7 @@ def test_dry_run_endpoint(client): assert response.status_code == 200 payload = response.get_json() assert payload["status"] == "ok" - assert payload["target_weights"] + assert payload["target_weights"] == {} + assert payload["order_previews"] == [] + assert payload["risk_flags"] == ["rejected:concentration"] + assert payload["diagnostics"]["risk_gate"] == "REJECT" diff --git a/tests/test_qsl_metadata.py b/tests/test_qsl_metadata.py index 1f7b32b..d53a984 100644 --- a/tests/test_qsl_metadata.py +++ b/tests/test_qsl_metadata.py @@ -15,5 +15,5 @@ def test_qsl_metadata_has_runtime_platform_fields() -> None: assert qsl["enforce_bundle"] is True assert qsl["compat"]["bundle"] == "2026.07.3" requires = qsl["requires"] - assert requires["quant_platform_kit"] == "69a0256934d081b5ef309a885384b9eb9f62cf90" - assert requires["cn_equity_strategies"] == "12c0cd4801060fcb2f9452ffd9a7f48df446ddd0" + assert requires["quant_platform_kit"] == "68fcad8c68ab48a1109d99715f8315af449de493" + assert requires["cn_equity_strategies"] == "33d605622ded78a006efef4297b7e786cadf1a27" diff --git a/uv.lock b/uv.lock index 042f7a1..7a31b40 100644 --- a/uv.lock +++ b/uv.lock @@ -6,10 +6,10 @@ resolution-markers = [ "python_full_version >= '3.14' and sys_platform == 'emscripten'", "python_full_version >= '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'win32'", - "python_full_version < '3.12' and sys_platform == 'win32'", "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform == 'emscripten'", - "python_full_version < '3.12' and sys_platform == 'emscripten'", "python_full_version >= '3.12' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.12' and sys_platform == 'win32'", + "python_full_version < '3.12' and sys_platform == 'emscripten'", "python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] @@ -37,7 +37,7 @@ wheels = [ [[package]] name = "cn-equity-strategies" version = "0.1.0" -source = { git = "https://github.com/QuantStrategyLab/CnEquityStrategies.git?rev=12c0cd4801060fcb2f9452ffd9a7f48df446ddd0#12c0cd4801060fcb2f9452ffd9a7f48df446ddd0" } +source = { git = "https://github.com/QuantStrategyLab/CnEquityStrategies.git?rev=33d605622ded78a006efef4297b7e786cadf1a27#33d605622ded78a006efef4297b7e786cadf1a27" } dependencies = [ { name = "pandas" }, { name = "quant-platform-kit" }, @@ -450,18 +450,18 @@ test = [ [package.metadata] requires-dist = [ - { name = "cn-equity-strategies", git = "https://github.com/QuantStrategyLab/CnEquityStrategies.git?rev=12c0cd4801060fcb2f9452ffd9a7f48df446ddd0" }, + { name = "cn-equity-strategies", git = "https://github.com/QuantStrategyLab/CnEquityStrategies.git?rev=33d605622ded78a006efef4297b7e786cadf1a27" }, { name = "flask", specifier = ">=3.0" }, { name = "pandas", specifier = ">=2.0" }, { name = "pytest", marker = "extra == 'test'", specifier = ">=8" }, - { name = "quant-platform-kit", git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=69a0256934d081b5ef309a885384b9eb9f62cf90" }, + { name = "quant-platform-kit", git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=68fcad8c68ab48a1109d99715f8315af449de493" }, ] provides-extras = ["test"] [[package]] name = "quant-platform-kit" version = "0.10.0" -source = { git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=69a0256934d081b5ef309a885384b9eb9f62cf90#69a0256934d081b5ef309a885384b9eb9f62cf90" } +source = { git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=68fcad8c68ab48a1109d99715f8315af449de493#68fcad8c68ab48a1109d99715f8315af449de493" } [[package]] name = "six"