From 44747c0bbc4017cfea6c5bccdc367c609856b657 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Sun, 23 Aug 2026 20:16:36 +0800 Subject: [PATCH 1/2] docs: add cross asset strategy inventory Co-Authored-By: Codex --- docs/cross_asset_integration_plan.zh-CN.md | 14 +++++++++++ .../cross_asset_strategy_inventory.json | 24 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 docs/cross_asset_integration_plan.zh-CN.md create mode 100644 docs/registry/cross_asset_strategy_inventory.json diff --git a/docs/cross_asset_integration_plan.zh-CN.md b/docs/cross_asset_integration_plan.zh-CN.md new file mode 100644 index 00000000..49c0637f --- /dev/null +++ b/docs/cross_asset_integration_plan.zh-CN.md @@ -0,0 +1,14 @@ +# 跨资产主线接入计划 + +此前生命周期矩阵主要覆盖美股策略。本清单补上中国股票、港股和加密策略的统一入口,但它是 inventory,不把各仓库已有的 `runtime_enabled` 字样误当成完整 P0-P6 证据。 + +接入顺序: + +1. 将各仓库 catalog 导出到统一 inventory。 +2. 为每个策略绑定 owner、数据 manifest、evidence package 和 RiskSnapshot。 +3. 先接入 research/shadow,每日记录运行结果。 +4. 再按策略自身证据推进 P4/P5。 +5. live 权限继续由原有 broker gate 控制,自动系统不能扩大权限。 + +当前覆盖:CN equity 8 条、HK equity 3 条、crypto 5 条;详见 +`docs/registry/cross_asset_strategy_inventory.json`。 diff --git a/docs/registry/cross_asset_strategy_inventory.json b/docs/registry/cross_asset_strategy_inventory.json new file mode 100644 index 00000000..a83788fe --- /dev/null +++ b/docs/registry/cross_asset_strategy_inventory.json @@ -0,0 +1,24 @@ +{ + "schema_version": "cross_asset_strategy_inventory.v1", + "generated_at": "2026-08-23", + "inventory_only": true, + "source_policy": "Repository catalog inventory; entries do not assert P0-P6 evidence or grant trading authority.", + "entries": [ + {"id": "cn_industry_etf_rotation", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "接入统一 lifecycle matrix、每日 risk snapshot 和 shadow evidence。"}, + {"id": "cn_industry_etf_rotation_aggressive", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "补齐组合级风险边界与统一 shadow 记录。"}, + {"id": "cn_index_etf_tactical_rotation", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "接入统一插件 catalog 和 P0-P3 evidence package。"}, + {"id": "cn_chinext_growth_momentum_quality", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "核对真实数据证据与 Risk Gate 消费。"}, + {"id": "cn_dividend_quality_snapshot", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "接入 snapshot freshness、组合风险和 shadow 记录。"}, + {"id": "cn_chinext_tactical_rotation", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "建立统一 P3 evidence package。"}, + {"id": "cn_star_growth_momentum_quality", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "建立统一 P3 evidence package。"}, + {"id": "cn_equity_combo", "domain": "cn_equity", "owner_repo": "CnEquityStrategies", "catalog_status": "research_backtest_only", "next_action": "作为组合 orchestrator 接入统一风险层,不直接获得 live 权限。"}, + {"id": "hk_global_etf_tactical_rotation", "domain": "hk_equity", "owner_repo": "HkEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "接入统一 lifecycle matrix 与每日 shadow/risk 记录。"}, + {"id": "hk_low_vol_dividend_quality_snapshot", "domain": "hk_equity", "owner_repo": "HkEquityStrategies", "catalog_status": "runtime_enabled", "next_action": "接入 snapshot freshness 与组合级风险聚合。"}, + {"id": "hk_equity_combo", "domain": "hk_equity", "owner_repo": "HkEquityStrategies", "catalog_status": "research_backtest_only", "next_action": "保持 research_active,补证据后再评估 shadow。"}, + {"id": "crypto_live_pool_rotation", "domain": "crypto", "owner_repo": "CryptoStrategies", "catalog_status": "runtime_enabled", "next_action": "接入 pool artifact、统一 Risk Gate 和每日运行记录。"}, + {"id": "crypto_leader_rotation", "domain": "crypto", "owner_repo": "CryptoStrategies", "catalog_status": "runtime_enabled", "next_action": "补齐统一 P0-P3 evidence 与组合风险记录。"}, + {"id": "crypto_btc_dca", "domain": "crypto", "owner_repo": "CryptoStrategies", "catalog_status": "runtime_enabled", "next_action": "接入统一 shadow/forward 与资金风险快照。"}, + {"id": "crypto_trend_rotation", "domain": "crypto", "owner_repo": "CryptoStrategies", "catalog_status": "research_backtest_only", "next_action": "保持 research_active,完成证据和风险重构。"}, + {"id": "crypto_equity_combo", "domain": "crypto", "owner_repo": "CryptoStrategies", "catalog_status": "research_backtest_only", "next_action": "作为 shadow orchestrator 研究,不直接进入 live。"} + ] +} From 1ff835965090bea6f6e04e4210d1bd6d56d836b2 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Mon, 24 Aug 2026 01:24:32 +0800 Subject: [PATCH 2/2] feat: define runtime selectable allowlist contract Co-Authored-By: Codex --- docs/runtime_selectable_allowlist_v1.zh-CN.md | 24 ++++++++++++++++ ...t_runtime_selectable_allowlist_contract.py | 28 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 docs/runtime_selectable_allowlist_v1.zh-CN.md create mode 100644 tests/test_runtime_selectable_allowlist_contract.py diff --git a/docs/runtime_selectable_allowlist_v1.zh-CN.md b/docs/runtime_selectable_allowlist_v1.zh-CN.md new file mode 100644 index 00000000..5d2c0a03 --- /dev/null +++ b/docs/runtime_selectable_allowlist_v1.zh-CN.md @@ -0,0 +1,24 @@ +# Runtime-selectable allowlist v1 + +`runtime-selectable allowlist` 描述某个平台在当前部署中可以选择的策略 profile;它不等于策略生命周期状态,也不授予 live 权限。 + +## 边界 + +- catalog 负责描述策略生命周期和证据状态; +- allowlist 负责描述 runtime 可选择的 profile; +- authority policy、Risk Gate 和 broker permission 负责决定是否可以执行; +- 缺少 allowlist、证据或 authority 时,profile 必须保持 `PARKED`/`live_candidate`,不能自动执行。 + +```json +{ + "schema": "qsl.runtime_selectable_allowlist.v1", + "platform": "example", + "domain": "us_equity", + "profiles": ["example_profile"], + "source_digest": "", + "generated_at": "", + "permission_effect": "none" +} +``` + +迁移期间,旧 `get_runtime_enabled_profiles()` 只能作为一次性读取适配器;新代码不得继续写入旧 status 字段。迁移完成后,各 broker/runtime 应只消费本 allowlist,并独立校验 authority、Risk Gate、回滚引用和 broker 权限。 diff --git a/tests/test_runtime_selectable_allowlist_contract.py b/tests/test_runtime_selectable_allowlist_contract.py new file mode 100644 index 00000000..16eae653 --- /dev/null +++ b/tests/test_runtime_selectable_allowlist_contract.py @@ -0,0 +1,28 @@ +import json +from pathlib import Path + + +ROOT = Path(__file__).parents[1] + + +def test_runtime_selectable_allowlist_document_keeps_permission_boundary(): + text = (ROOT / "docs/runtime_selectable_allowlist_v1.zh-CN.md").read_text() + assert "qsl.runtime_selectable_allowlist.v1" in text + assert '"permission_effect": "none"' in text + assert "不等于策略生命周期状态" in text + assert "不授予 live 权限" in text + + +def test_allowlist_example_is_not_an_authority_policy(): + example = { + "schema": "qsl.runtime_selectable_allowlist.v1", + "platform": "example", + "domain": "us_equity", + "profiles": ["example_profile"], + "source_digest": "0" * 64, + "generated_at": "2026-08-24T00:00:00Z", + "permission_effect": "none", + } + assert json.loads(json.dumps(example))["permission_effect"] == "none" + assert "authority" not in example + assert "broker" not in example