Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Migration details and follow-up guidance live in [`docs/strategy_contract_migrat

For the stricter end-state rules for new US equity strategies, see:

- [`docs/us_equity_strategy_onboarding.md`](./docs/us_equity_strategy_onboarding.md)
- [`docs/us_equity_strategy_onboarding.zh-CN.md`](./docs/us_equity_strategy_onboarding.zh-CN.md)
- [`docs/us_equity_cross_platform_strategy_spec.md`](./docs/us_equity_cross_platform_strategy_spec.md)
- [`docs/us_equity_cross_platform_strategy_spec.zh-CN.md`](./docs/us_equity_cross_platform_strategy_spec.zh-CN.md)
- [`docs/us_equity_execution_translation_spec.md`](./docs/us_equity_execution_translation_spec.md)
Expand Down Expand Up @@ -148,6 +150,8 @@ Cloud Run and self-hosted runner deployments should continue to deploy the strat

以后新增美股策略要遵守的更严格跨平台规范见:

- [`docs/us_equity_strategy_onboarding.md`](./docs/us_equity_strategy_onboarding.md)
- [`docs/us_equity_strategy_onboarding.zh-CN.md`](./docs/us_equity_strategy_onboarding.zh-CN.md)
- [`docs/us_equity_cross_platform_strategy_spec.md`](./docs/us_equity_cross_platform_strategy_spec.md)
- [`docs/us_equity_cross_platform_strategy_spec.zh-CN.md`](./docs/us_equity_cross_platform_strategy_spec.zh-CN.md)
- [`docs/us_equity_live_switch_runbook.md`](./docs/us_equity_live_switch_runbook.md)
Expand Down
6 changes: 3 additions & 3 deletions docs/platform_runtime_inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ For the current platform / strategy-domain / live-profile matrix, see [`platform
- strategy selectors such as `STRATEGY_PROFILE`
- secret selector variables such as `*_SECRET_NAME`
- Secret Manager is the runtime source of truth for sensitive values that Cloud Run services actually consume.
- GitHub Secrets are still valid for CI/CD bootstrap values such as `GCP_SA_KEY`, and can remain as temporary fallbacks where runtime migration is not fully finished.
- The US equity Cloud Run env-sync workflows use GitHub OIDC + Workload Identity Federation. `GCP_SA_KEY` is not required for those workflows.
- GitHub Secrets can remain as temporary runtime fallbacks where migration is not fully finished.

## Current inventory

Expand Down Expand Up @@ -160,8 +161,7 @@ For the current platform / strategy-domain / live-profile matrix, see [`platform

### Keep in GitHub Secrets

- `GCP_SA_KEY`
- temporary bootstrap fallbacks if a runtime migration is still in progress
- temporary fallback values if a runtime migration is still in progress

### Keep in Secret Manager

Expand Down
6 changes: 2 additions & 4 deletions docs/platform_runtime_inventory.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ _校验快照日期:2026-04-14_
- `STRATEGY_PROFILE` 这类策略选择器
- `*_SECRET_NAME` 这类 secret 选择器
- Secret Manager 负责 Cloud Run 运行时真正要吃的敏感值。
- GitHub Secrets 依然保留给 CI/CD 启动凭据用,比如:
- `GCP_SA_KEY`
- 以及运行时迁移还没完成时的临时 fallback
- 美股 Cloud Run env-sync workflow 使用 GitHub OIDC + Workload Identity Federation,不再需要 `GCP_SA_KEY`。
- GitHub Secrets 可以继续保留给运行时迁移还没完成时的临时 fallback。

## 当前清单

Expand Down Expand Up @@ -162,7 +161,6 @@ _校验快照日期:2026-04-14_

### 继续放在 GitHub Secrets

- `GCP_SA_KEY`
- 迁移还没结束时的临时 fallback

### 应该放在 Secret Manager
Expand Down
21 changes: 13 additions & 8 deletions docs/platform_strategy_matrix.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Platform Strategy Matrix

_Verified snapshot: 2026-04-14_
_Verified snapshot: 2026-04-15_

This page is the short answer to one question:

Expand All @@ -16,7 +16,8 @@ For repository responsibility boundaries, see [`platform_repo_boundaries.md`](./
- `us_equity`
- `crypto`
- Runtime repositories already expose `STRATEGY_PROFILE`, but this is **not** a full multi-strategy marketplace yet.
- Today, each US equity platform can switch among its enabled live `us_equity` profiles through its rollout allowlist.
- Today, each US equity platform can switch among the live `runtime_enabled` `us_equity` profiles published by `UsEquityStrategies`.
- Platform runtime adapters are generated from strategy input/target-mode declarations plus platform capabilities, so new in-contract profiles should not need per-platform allowlist edits.
- The shared contract is in `QuantPlatformKit`; real `us_equity` strategy implementations now live in `UsEquityStrategies`, while platform repositories own runtime adapters and broker execution.

## Current platform matrix
Expand All @@ -40,12 +41,16 @@ Platforms currently in this domain:

Important limitation:

- This does **not** mean every `us_equity` strategy can already run on every `us_equity` platform.
- It only means these platforms now share the same top-level domain and compatibility model.
- Each concrete strategy still needs its own platform-compatibility declaration and runtime fit.
- This does **not** mean any arbitrary future `us_equity` strategy can run by name alone.
- It means strategies that stay inside the shared input/target-mode contract can be admitted through `UsEquityStrategies` metadata and generated runtime adapters.
- If a strategy needs a new input type or broker capability, the shared contract and platform capability matrix must be extended first.

Current live profiles in `us_equity`:
Currently enabled live profiles in `us_equity`:

- `dynamic_mega_leveraged_pullback`
- `global_etf_rotation`
- `mega_cap_leader_rotation_dynamic_top20`
- `russell_1000_multi_factor_defensive`
- `soxl_soxx_trend_income`
- `tqqq_growth_income`
- `tech_communication_pullback_enhancement`
Expand Down Expand Up @@ -77,8 +82,8 @@ These pieces are already real and shared:

These are **not** true yet:

- selecting any future `us_equity` strategy on any `us_equity` platform by one env change
- every strategy having complete adapter coverage on every broker
- selecting a future `us_equity` strategy before it has a catalog entry, manifest, base runtime adapter spec, and supported input contract
- running strategies that require new platform capabilities before those capabilities are added to the shared matrix
- independent strategy repositories outside `UsEquityStrategies` that are already used in production

## Recommended interpretation
Expand Down
23 changes: 14 additions & 9 deletions docs/platform_strategy_matrix.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 平台策略矩阵

_核对时间:2026-04-14_
_核对时间:2026-04-15_

这页只回答一个问题:

Expand All @@ -16,7 +16,8 @@ _核对时间:2026-04-14_
- `us_equity`
- `crypto`
- 各个平台仓库现在都已经保留了 `STRATEGY_PROFILE` 入口,但这**还不是**真正的多策略平台。
- 现在每个美股平台仓库都可以通过 rollout allowlist 在已启用的 live `us_equity` profile 之间切换。
- 现在每个美股平台仓库都可以在 `UsEquityStrategies` 发布的 live `runtime_enabled` `us_equity` profile 之间切换。
- 平台 runtime adapter 会根据策略输入、target mode 和平台 capability 自动生成;规范内的新 profile 不应该再需要三个平台分别手写 allowlist。
- 共享契约在 `QuantPlatformKit`;真实的 `us_equity` 策略实现现在放在 `UsEquityStrategies`,平台仓库负责运行时适配和券商执行。

## 当前平台矩阵
Expand All @@ -40,14 +41,18 @@ _核对时间:2026-04-14_

但要注意:

- 这**不等于**任何一个 `us_equity` 策略现在都能直接在这三个平台上切换运行
- 它只表示这些平台已经共享同一层“策略大类 + 兼容性”抽象
- 真正的具体策略,仍然要单独声明自己支持哪些平台、是否真的适合那个运行时
- 这**不等于**任意未来 `us_equity` 策略只靠名字就能跑
- 它表示只要策略遵守共享输入和 target-mode 契约,就可以通过 `UsEquityStrategies` 元数据和生成式 runtime adapter 接入
- 如果策略需要新的输入类型或券商能力,要先扩共享契约和平台 capability matrix

当前 `us_equity` 域里线上在跑的 profile 有:
当前 `us_equity` 域里已经启用的 live profile 有:

- `soxl_soxx_trend_income`
- `dynamic_mega_leveraged_pullback`
- `global_etf_rotation`
- `mega_cap_leader_rotation_dynamic_top20`
- `russell_1000_multi_factor_defensive`
- `tqqq_growth_income`
- `soxl_soxx_trend_income`
- `tech_communication_pullback_enhancement`

### `crypto`
Expand Down Expand Up @@ -77,8 +82,8 @@ _核对时间:2026-04-14_

下面这些现在都**还不是真的**:

- 只改一个 env 就能让任意未来 `us_equity` 策略在任意 `us_equity` 平台上跑起来
- 每条策略都完整覆盖每个券商适配器
- 未来策略没有 catalog、manifest、基础 runtime adapter spec 和标准输入契约时,不能只改一个 env 就上线
- 需要新平台能力的策略,在 capability matrix 扩展前不能直接跑
- `UsEquityStrategies` 之外已经投入生产使用的独立策略仓库

## 当前推荐理解方式
Expand Down
5 changes: 5 additions & 0 deletions docs/us_equity_cross_platform_strategy_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ Current live profiles can migrate incrementally, but the end state should be:
`feature_snapshot` artifact delivery
- `tech_communication_pullback_enhancement`: portable through standardized `feature_snapshot`
artifact delivery
- `mega_cap_leader_rotation_dynamic_top20`: portable through standardized
`feature_snapshot` artifact delivery
- `dynamic_mega_leveraged_pullback`: portable through standardized
`feature_snapshot` artifact delivery plus canonical market, benchmark, and
portfolio inputs

New profiles should target the end state immediately instead of adding more
one-off runtime contracts.
4 changes: 4 additions & 0 deletions docs/us_equity_cross_platform_strategy_spec.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,9 @@ allowlist 只影响 `enabled`,不要再手写一堆“这个策略天生只能
- 通过标准化 `feature_snapshot` artifact contract 实现跨平台
- `tech_communication_pullback_enhancement`
- 通过标准化 `feature_snapshot` artifact contract 实现跨平台
- `mega_cap_leader_rotation_dynamic_top20`
- 通过标准化 `feature_snapshot` artifact contract 实现跨平台
- `dynamic_mega_leveraged_pullback`
- 通过标准化 `feature_snapshot` artifact contract,加标准 market、benchmark 和 portfolio 输入实现跨平台

以后新策略应该直接朝这个目标写,不要再新增一堆一次性的运行时契约。
58 changes: 47 additions & 11 deletions docs/us_equity_live_switch_runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ Do **not** use it to justify switching a profile that is not already supported b

Current live US equity profiles:

- `dynamic_mega_leveraged_pullback`
- `global_etf_rotation`
- `tqqq_growth_income`
- `soxl_soxx_trend_income`
- `mega_cap_leader_rotation_dynamic_top20`
- `russell_1000_multi_factor_defensive`
- `soxl_soxx_trend_income`
- `tqqq_growth_income`
- `tech_communication_pullback_enhancement`

Note: older deployments may still accept `qqq_tech_enhancement` as a legacy alias for `tech_communication_pullback_enhancement`, but runbooks should use the canonical profile name.
Expand All @@ -24,7 +26,7 @@ Current runtime platforms:
- `schwab`
- `longbridge`

For the current five-profile scope, all three platforms now report the full matrix as `eligible=true` and `enabled=true`. That means live switching is now an operational change, not a strategy-contract migration.
For the current seven-profile scope, all three platforms now report the full matrix as `eligible=true` and `enabled=true`. That means live switching is now an operational change, not a strategy-contract migration.

## Operational profile groups

Expand All @@ -35,13 +37,16 @@ Treat the live profiles as two operational groups:
- `tqqq_growth_income`
- `soxl_soxx_trend_income`
- **Snapshot-backed profiles**
- `dynamic_mega_leveraged_pullback`
- `mega_cap_leader_rotation_dynamic_top20`
- `russell_1000_multi_factor_defensive`
- `tech_communication_pullback_enhancement`

The platform scripts now expose this view directly:

- `input_mode`
- `requires_snapshot_artifacts`
- `requires_snapshot_manifest_path`
- `requires_strategy_config_path`

So the operator does not need to remember the distinction from profile names alone.
Expand Down Expand Up @@ -107,15 +112,19 @@ If any of those checks fail, stop. That is a code or rollout problem, not a live

| Profile | Extra runtime inputs beyond `STRATEGY_PROFILE` |
| --- | --- |
| `dynamic_mega_leveraged_pullback` | feature snapshot path + snapshot manifest path |
| `global_etf_rotation` | none |
| `tqqq_growth_income` | none |
| `mega_cap_leader_rotation_dynamic_top20` | feature snapshot path + snapshot manifest path |
| `russell_1000_multi_factor_defensive` | feature snapshot path |
| `soxl_soxx_trend_income` | none |
| `russell_1000_multi_factor_defensive` | feature snapshot path + snapshot manifest path |
| `tqqq_growth_income` | none |
| `tech_communication_pullback_enhancement` | feature snapshot path + snapshot manifest path + strategy config path |

Notes:

- `tech_communication_pullback_enhancement` on IBKR may also keep a reconciliation output path when the deployment wants that artifact.
- `dynamic_mega_leveraged_pullback` also uses market history, benchmark history, and portfolio snapshot, but the platform runtime supplies those from broker/runtime data, not extra artifact env.
- `russell_1000_multi_factor_defensive` currently requires the snapshot path but not a manifest path.
- When switching away from a feature-snapshot profile, remove stale snapshot/config envs from the service instead of leaving them behind.

## Step 3: update GitHub-managed runtime variables
Expand All @@ -140,8 +149,8 @@ Optional:
Feature-snapshot profiles additionally need:

- `IBKR_FEATURE_SNAPSHOT_PATH`
- `IBKR_FEATURE_SNAPSHOT_MANIFEST_PATH`
- `IBKR_STRATEGY_CONFIG_PATH` for `tech_communication_pullback_enhancement`
- `IBKR_FEATURE_SNAPSHOT_MANIFEST_PATH` when the selected profile requires a manifest
- `IBKR_STRATEGY_CONFIG_PATH` when the selected profile requires an external runtime config

Remove when not needed:

Expand All @@ -163,8 +172,8 @@ Optional:
Feature-snapshot profiles additionally need:

- `SCHWAB_FEATURE_SNAPSHOT_PATH`
- `SCHWAB_FEATURE_SNAPSHOT_MANIFEST_PATH`
- `SCHWAB_STRATEGY_CONFIG_PATH` when the chosen profile uses an external config file
- `SCHWAB_FEATURE_SNAPSHOT_MANIFEST_PATH` when the selected profile requires a manifest
- `SCHWAB_STRATEGY_CONFIG_PATH` when the selected profile requires an external runtime config

Remove when not needed:

Expand All @@ -190,8 +199,8 @@ Optional:
Feature-snapshot profiles additionally need:

- `LONGBRIDGE_FEATURE_SNAPSHOT_PATH`
- `LONGBRIDGE_FEATURE_SNAPSHOT_MANIFEST_PATH`
- `LONGBRIDGE_STRATEGY_CONFIG_PATH`
- `LONGBRIDGE_FEATURE_SNAPSHOT_MANIFEST_PATH` when the selected profile requires a manifest
- `LONGBRIDGE_STRATEGY_CONFIG_PATH` when the selected profile requires an external runtime config

Remove when not needed:

Expand Down Expand Up @@ -354,6 +363,33 @@ Why:
- non-snapshot profiles do not need the feature-snapshot artifact chain
- SG often carries dry-run as an operational choice, not as a profile requirement

### Example E: switch LongBridge SG dry-run to `dynamic_mega_leveraged_pullback`

Keep:

- `ACCOUNT_PREFIX=SG`
- `ACCOUNT_REGION=SG`
- `LONGPORT_SECRET_NAME`
- `LONGPORT_APP_KEY_SECRET_NAME`
- `LONGPORT_APP_SECRET_SECRET_NAME`

Set:

- `STRATEGY_PROFILE=dynamic_mega_leveraged_pullback`
- `LONGBRIDGE_FEATURE_SNAPSHOT_PATH`
- `LONGBRIDGE_FEATURE_SNAPSHOT_MANIFEST_PATH`
- `LONGBRIDGE_DRY_RUN_ONLY=true`

Remove if present:

- `LONGBRIDGE_STRATEGY_CONFIG_PATH`

Why:

- the strategy uses a feature snapshot for the dynamic mega-cap pool
- the daily market, benchmark, and portfolio inputs are supplied by the platform runtime
- dry-run is a deployment choice, not part of the strategy contract

## Rollback rules

Rollback is simple if you keep it operational:
Expand Down
Loading
Loading