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 @@ -41,6 +41,7 @@ Production schedules should live in domain repositories and call this CLI or the
quant-lifecycle monitor --domain us_equity
quant-lifecycle drift --domain us_equity
quant-lifecycle autopilot --domain us_equity --dry-run
quant-lifecycle evidence --file path/to/evidence.json
quant-lifecycle dashboard --format all
```

Expand Down Expand Up @@ -94,6 +95,9 @@ rw.update_secret("my-token", "new-token-value")
```

## Useful docs
- [`docs/strategy_lifecycle_policy.md`](docs/strategy_lifecycle_policy.md)
- [`docs/strategy_portfolio_action_matrix.md`](docs/strategy_portfolio_action_matrix.md)
- [`docs/evidence_package_template.md`](docs/evidence_package_template.md)

- [`docs/platform_notification_outcomes.md`](docs/platform_notification_outcomes.md)
- [`docs/platform_notification_outcomes.zh-CN.md`](docs/platform_notification_outcomes.zh-CN.md)
Expand Down
7 changes: 7 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ python -m pytest -q
quant-lifecycle monitor --domain us_equity
quant-lifecycle drift --domain us_equity
quant-lifecycle autopilot --domain us_equity --dry-run
quant-lifecycle evidence --file path/to/evidence.json
quant-lifecycle dashboard --format all
```

## 延伸文档

- [`docs/strategy_lifecycle_policy.zh-CN.md`](docs/strategy_lifecycle_policy.zh-CN.md)
- [`docs/strategy_portfolio_action_matrix.zh-CN.md`](docs/strategy_portfolio_action_matrix.zh-CN.md)
- [`docs/evidence_package_template.zh-CN.md`](docs/evidence_package_template.zh-CN.md)

## 云服务抽象层

`quant_platform_kit.cloud` 包为常用云服务定义了协议接口——密钥管理、对象存储、文档数据库、计算发现和部署上下文。平台代码可以通过这些接口编写,无需硬编码到特定云厂商。
Expand Down
6 changes: 3 additions & 3 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Strategy profiles expose a common contract:
| `name` | str | Profile name (snake_case) |
| `domain` | str | Market domain (`us_equity`, `hk_equity`, `crypto`, `quant_combo`) |
| `compatible_platforms` | list[str] | Allowed platform IDs |
| `status` | str | `research_enabled` or `runtime_enabled` |
| `status` | str | lifecycle stage, for example `research_backtest_only`, `shadow_candidate`, `live_candidate`, or `runtime_enabled` |
| `evaluate()` | function | The pure decision function: `(ctx: StrategyContext) -> StrategyDecision` |

Strategy packages and their coverage:
Expand All @@ -158,7 +158,7 @@ Strategy packages and their coverage:
| `crypto-strategies` | Crypto | Live pool rotation, BTC DCA, trend rotation, equity combo | BinancePlatform |
| `quant-us-combo-strategies` | US Combo | Russell Top50 + IBIT (50/50), leveraged combo (TQQQ/SOXL/BOXX + SPY MA200) | Schwab, IBKR, LongBridge, Firstrade |

Catalog metadata is published through `get_runtime_enabled_profiles()` which platforms call to discover available strategies. Status promotion gates (`research_enabled` -> `runtime_enabled`) require passing evidence checks (backtest performance, drawdown limits, slippage tolerance).
Catalog metadata is published through lifecycle-aware profile helpers which platforms call to discover available strategies. Status promotion gates (`research_backtest_only` -> `shadow_candidate` -> `live_candidate` -> `runtime_enabled`) require passing evidence checks (backtest performance, drawdown limits, slippage tolerance).

### 2.3 Snapshot Layer

Expand Down Expand Up @@ -375,7 +375,7 @@ Exclusion lists handle strategies that are technically compatible but not yet ap

```python
SCHWAB_EXCLUDED_LIVE_PROFILES = [
"tecl_xlk_trend_income", # research_enabled, not cleared for live
"tecl_xlk_trend_income", # research_backtest_only, not cleared for live
"soxl_soxx_trend_income", # awaiting promo gate signoff
]
```
Expand Down
10 changes: 10 additions & 0 deletions docs/STRATEGY_PLATFORM_SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ auto-sync layer described below.

## Adding a New Strategy

See also: [`strategy_lifecycle_policy.md`](./strategy_lifecycle_policy.md) for the
promotion ladder and live-enable gate model.

Before requesting live enablement, attach an evidence package that covers:

- backtest summary
- drift / regime notes
- platform compatibility evidence
- plugin gate status, if applicable

1. Add strategy definition to the shared catalog (`us_equity_strategies` or `hk_equity_strategies`)
2. Set `compatible_platforms` to list which platforms support it
3. Add to `runtime_enabled_profiles` for the rollout
Expand Down
43 changes: 43 additions & 0 deletions docs/evidence_package_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Strategy Promotion Evidence Package

This template defines the minimum package to request `live_candidate` review.

## Required contents

- strategy profile name
- target platform(s)
- backtest summary
- drift / regime notes
- platform compatibility evidence
- plugin gate status, if applicable
- operator notes and rollout constraints

## Suggested structure

```text
profile: cn_chinext_growth_momentum_quality
market: cn_equity
requested_stage: live_candidate

1. Backtest summary
2. Drift and regime observations
3. Risk review
4. Platform compatibility evidence
5. Plugin gate status
6. Rollout notes
```

## Acceptance rule

If any of the following are missing, keep the profile out of live settings:

- the profile is not runtime-compatible with the target platform
- the plugin gate is not clearly approved or notification-only
- the evidence does not cover both performance and regime sensitivity
- the request is based on a single good window only

## Ownership

- strategy repo: produces the evidence package
- platform repo: verifies runtime compatibility and gate status
- operator review: makes the final live decision
43 changes: 43 additions & 0 deletions docs/evidence_package_template.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 策略晋级证据包

这份模板定义了请求 `live_candidate` 复核时最少应提交的内容。

## 必要内容

- 策略 profile 名称
- 目标平台
- 回测摘要
- drift / regime 观察
- 平台兼容性证据
- 插件门槛状态(如适用)
- 操作备注与 rollout 限制

## 建议结构

```text
profile: cn_chinext_growth_momentum_quality
market: cn_equity
requested_stage: live_candidate

1. 回测摘要
2. drift 与 regime 观察
3. 风险复核
4. 平台兼容性证据
5. 插件门槛状态
6. rollout 备注
```

## 接受规则

如果缺少以下任一项,就应继续留在 live 之外:

- profile 与目标平台不兼容
- 插件门槛不是明确 approved 或 notification-only
- 证据没有同时覆盖收益表现和 regime 敏感性
- 只依赖单一好窗口

## 责任划分

- 策略仓库:产出证据包
- 平台仓库:验证 runtime 兼容性和门槛状态
- 操作审批:做最终 live 决策
84 changes: 84 additions & 0 deletions docs/strategy_lifecycle_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Strategy Lifecycle Policy

[简体中文](./strategy_lifecycle_policy.zh-CN.md)

This document defines the lifecycle gates for strategy profiles across the
quant repositories.

## Design Goal

The lifecycle should be permissive for research and monitoring, but strict for
capital impact.

- AI monitoring may accelerate review and highlight drift.
- AI monitoring must not bypass the live-enable gate.
- A strategy can be observed earlier than it can trade.
- Live enablement remains a platform decision, not just a backtest decision.

## Recommended Lifecycle Stages

| Stage | Meaning | Capital impact | Typical owner |
| --- | --- | --- | --- |
| `research_backtest_only` | Backtests, feature work, or evidence collection only | none | strategy repo |
| `ai_monitored_candidate` | Eligible for AI review, drift scoring, and shadow tracking | none | strategy lifecycle |
| `shadow_candidate` | Shadow runs are stable enough for repeatable comparisons | none | strategy lifecycle |
| `live_candidate` | Passed validation and is awaiting platform enablement | gated | platform + strategy |
| `runtime_enabled` | Exposed by `get_runtime_enabled_profiles()` and allowed in runtime settings | yes | platform repo |

### Practical interpretation

- `research_backtest_only` is the default for anything new.
- `ai_monitored_candidate` is the lowest-friction review stage when the
organization already has automated monitoring.
- `shadow_candidate` should require repeatable shadow consistency, not just one
good backtest.
- `live_candidate` should only be used when the strategy has enough evidence to
justify platform enablement.
- `runtime_enabled` is the only stage that should influence live deployment
defaults.

## Three-Gate Rule

A strategy should clear all three gates before live use:

1. **Strategy gate**
- Does the strategy have enough history, risk characterization, and drift
tolerance to move beyond research?
2. **Plugin gate**
- If the strategy depends on plugins, are those plugins at least
`automation_approved` or explicitly `notification_only`?
3. **Platform gate**
- Does the target platform expose the profile via
`get_runtime_enabled_profiles()` and accept the required runtime inputs?

Any one of these gates failing should keep the profile out of live settings.

## Recommended Promotion Policy

- Keep the monitoring threshold relatively low so candidates are visible early.
- If AI monitoring already exists, use it to move promising profiles into
`ai_monitored_candidate` quickly; this stage is for visibility, not capital.
- Keep the live-enable threshold high so runtime exposure remains deliberate.
- Prefer promotion by evidence package, not by ad hoc overrides. A promotion
package should include backtest summary, drift notes, risk review, and
platform compatibility evidence.
- See [`evidence_package_template.md`](./evidence_package_template.md) for the
recommended package shape.
- When a strategy is a wrapper or orchestrator, promote it only after the
wrapped components are stable and the wrapper itself has been validated.

## Repo-Level Guidance

- **US equity**: long-history trend / rotation profiles can move through the
lifecycle earlier; wrapper combos should stay candidate-first.
- **HK equity**: keep live exposure narrow and promote only stable runtime
profiles.
- **CN equity**: treat QMT-specific optional runtime profiles separately from
the main live catalog.
- **Crypto**: keep the monitoring stage permissive, but use a stricter live
gate because regime shifts are faster.

## Operational Rule

If a profile is not returned by `get_runtime_enabled_profiles()`, it should
stay out of live runtime settings regardless of monitoring status.
70 changes: 70 additions & 0 deletions docs/strategy_lifecycle_policy.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 策略生命周期门槛策略

[English](./strategy_lifecycle_policy.md)

本文定义量化仓库中策略 profile 的生命周期门槛。

## 设计目标

生命周期应当对研究和监控保持宽松,但对资金影响保持严格。

- AI 监控可以加快复核和暴露 drift。
- AI 监控不能绕过 live 启用门槛。
- 策略可以先被观察,再允许交易。
- live 启用仍然是平台决策,不只是回测结论。

## 推荐生命周期阶段

| 阶段 | 含义 | 资金影响 | 常见归属 |
| --- | --- | --- | --- |
| `research_backtest_only` | 仅回测、特征开发或证据收集 | 无 | 策略仓库 |
| `ai_monitored_candidate` | 可进入 AI 复核、drift 打分和 shadow 跟踪 | 无 | 策略生命周期 |
| `shadow_candidate` | shadow 运行已经稳定,可做重复对比 | 无 | 策略生命周期 |
| `live_candidate` | 已通过验证,等待平台启用 | 受门槛控制 | 平台 + 策略 |
| `runtime_enabled` | 会被 `get_runtime_enabled_profiles()` 暴露并允许进入运行时设置 | 有 | 平台仓库 |

### 实际含义

- `research_backtest_only` 适合作为所有新策略的默认起点。
- 如果组织已经有自动监控,`ai_monitored_candidate` 可以作为最低摩擦的复核阶段。
- `shadow_candidate` 应该要求重复 shadow 一致性,而不是只看一次漂亮回测。
- `live_candidate` 只适合证据足够支持平台启用的策略。
- `runtime_enabled` 才应该影响 live 配置默认值。

## 三道门槛

策略进入 live 之前,应同时通过三道门槛:

1. **策略门槛**
- 是否具备足够的历史、风险画像和 drift 容忍度,能从研究阶段前进?
2. **插件门槛**
- 如果策略依赖插件,这些插件是否至少是 `automation_approved`,
或者被明确标记为 `notification_only`?
3. **平台门槛**
- 目标平台是否通过 `get_runtime_enabled_profiles()` 暴露该 profile,
并接受所需运行时输入?

任意一项不过关,都应该继续留在 live 之外。

## 推荐晋级策略

- 监控阈值可以相对低一些,让候选策略尽早可见。
- 如果组织已经有自动 AI 监控,就用它尽快把合适的 profile 推到
`ai_monitored_candidate`;这一层只为可见性,不为资金。
- live 启用阈值要保持高一些,确保运行时暴露是明确决策。
- 以证据包晋级,而不是临时 override。证据包至少应包含回测摘要、
drift 记录、风险复核和平台兼容性证据。
- 证据包建议结构见 [`evidence_package_template.zh-CN.md`](./evidence_package_template.zh-CN.md)。
- 如果策略是 wrapper / orchestrator,应先确认被包装组件稳定,再考虑给 wrapper 晋级。

## 仓库级建议

- **美股**:长历史趋势 / 轮动策略可以更早进入生命周期推进;wrapper combo 应优先保持 candidate 状态。
- **港股**:保持 live 暴露范围窄,只晋级稳定的 runtime profile。
- **A 股**:把 QMT 专用的可选 runtime profile 和主 live catalog 分开看待。
- **加密货币**:监控阶段可以宽松一些,但 live 门槛应更严格,因为 regime 切换更快。

## 运行规则

如果某个 profile 没有被 `get_runtime_enabled_profiles()` 返回,那么它就不应该进入 live runtime settings,
无论监控状态是否已经打开。
Loading
Loading