Skip to content

Commit 9f76901

Browse files
committed
docs: publish strategy contract release line
1 parent 5174d9e commit 9f76901

4 files changed

Lines changed: 82 additions & 3 deletions

File tree

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ It is not intended to contain:
2727
- Cloud Run entrypoints
2828
- scheduler or workflow orchestration specific to one strategy
2929

30+
## Strategy contract boundary
31+
32+
The current mainline split is:
33+
34+
- platform repositories assemble `StrategyContext`
35+
- platform repositories load a strategy entrypoint through `load_strategy_entrypoint(...)`
36+
- strategy repositories return a unified `StrategyDecision`
37+
- platform-local decision mappers turn that decision into broker orders, notifications, and runtime state updates
38+
39+
Strategy repositories should expose `manifest + evaluate(ctx)` and keep any migration-window runtime metadata behind `StrategyRuntimeAdapter`. Broker-specific order sequencing and UI layout should stay out of strategy outputs.
40+
41+
Migration details and follow-up guidance live in [`docs/strategy_contract_migration.md`](./docs/strategy_contract_migration.md).
42+
3043
## Package layout
3144

3245
```text
@@ -73,7 +86,7 @@ PYTHONPATH=src python3 -m unittest discover -s tests
7386
`QuantPlatformKit` is a shared dependency, not a runtime service. Strategy repos should pin a fixed Git tag such as:
7487

7588
```text
76-
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.6.0
89+
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.7.0
7790
```
7891

7992
Cloud Run and self-hosted runner deployments should continue to deploy the strategy repositories only. See [docs/deployment_model.md](./docs/deployment_model.md) for:
@@ -108,6 +121,19 @@ Cloud Run and self-hosted runner deployments should continue to deploy the strat
108121

109122
这个仓库是各平台仓库共享的公共依赖。
110123

124+
### 策略契约边界
125+
126+
当前主线边界已经固定为:
127+
128+
- 平台仓库负责组装 `StrategyContext`
129+
- 平台仓库通过 `load_strategy_entrypoint(...)` 加载策略入口
130+
- 策略仓库只返回统一的 `StrategyDecision`
131+
- 平台自己的 decision mapper 再把决策映射成券商订单、通知和运行时状态更新
132+
133+
策略仓库应该暴露 `manifest + evaluate(ctx)`;如果迁移窗口里还需要少量运行时元数据,就放在 `StrategyRuntimeAdapter` 里,不要把券商专属下单顺序或展示布局塞回策略输出。
134+
135+
迁移说明和后续约束见 [`docs/strategy_contract_migration.md`](./docs/strategy_contract_migration.md)
136+
111137
### 目录结构
112138

113139
```text

README.zh-CN.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@
1616
- Cloud Run 入口
1717
- 某一个策略仓库自己的调度编排
1818

19+
## 策略契约边界
20+
21+
当前主线边界已经固定为:
22+
23+
- 平台仓库负责组装 `StrategyContext`
24+
- 平台仓库通过 `load_strategy_entrypoint(...)` 加载策略入口
25+
- 策略仓库只返回统一的 `StrategyDecision`
26+
- 平台自己的 decision mapper 再把决策映射成券商订单、通知和运行时状态更新
27+
28+
策略仓库应该暴露 `manifest + evaluate(ctx)`;如果迁移窗口里还需要少量运行时元数据,就放在 `StrategyRuntimeAdapter` 里,不要把券商专属下单顺序或展示布局塞回策略输出。
29+
30+
迁移说明和后续约束见 [`docs/strategy_contract_migration.md`](./docs/strategy_contract_migration.md)
31+
1932
[English README](./README.md)
2033

2134
## 目录结构
@@ -63,7 +76,7 @@ PYTHONPATH=src python3 -m unittest discover -s tests
6376
`QuantPlatformKit` 是共享依赖,不单独部署。策略仓库应该固定依赖某个 Git tag,例如:
6477

6578
```text
66-
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.6.0
79+
quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@v0.7.0
6780
```
6881

6982
部署相关说明见:

docs/strategy_contract_migration.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ PR1 kept the old global compatibility helpers for one compatibility window.
1818
They have now been removed in the next-window cleanup batch; platforms should use
1919
`resolve_platform_strategy_definition(...)` and `get_enabled_profiles_for_platform(...)`.
2020

21+
## Fixed-tag release line
22+
23+
The current boundary-refactor release line is:
24+
25+
- `QuantPlatformKit`: `v0.7.0`
26+
- `UsEquityStrategies`: `v0.7.0`
27+
- `CryptoStrategies`: `v0.4.0`
28+
29+
Downstream repositories should prefer these fixed tags over long-lived commit SHA pins.
30+
2131
## How strategy repos should migrate next
2232

2333
### 1. Add manifest + evaluate entrypoint per live profile
@@ -96,6 +106,36 @@ During the compatibility window, old component loaders may stay in place behind
96106
- `LongBridgePlatform` / `CharlesSchwabPlatform`: remove allocation shims and hard-coded strategy asset lists.
97107
- `BinancePlatform`: replace `core` / `rotation` shims with a unified entrypoint and explicit artifact contract.
98108

109+
## How to add a strategy profile
110+
111+
1. Add a `StrategyManifest` for the live profile in the strategy repository.
112+
2. Expose a unified `entrypoint` or `manifest + evaluate(ctx)` pair.
113+
3. Keep legacy strategy functions as internal adapters only if they are still needed for rollback safety.
114+
4. Return only contract fields from the unified path:
115+
- `positions`
116+
- `budgets`
117+
- `risk_flags`
118+
- `diagnostics`
119+
5. Cover the new profile with contract and regression tests before wiring it into a platform runtime.
120+
121+
## How to add a platform
122+
123+
1. Resolve the canonical profile through platform policy and `load_strategy_entrypoint(...)`.
124+
2. Build `StrategyContext` from platform-owned market data, portfolio snapshots, runtime config, and validated artifacts.
125+
3. Keep broker-specific behavior in a local decision mapper:
126+
- order sizing
127+
- order type preference
128+
- notifications
129+
- runtime state updates
130+
4. Do not read private strategy constants or platform-only fields from strategy returns in `main.py`.
131+
132+
## How to add an upstream artifact provider
133+
134+
1. Fetch and validate provider payloads in the platform repository, not inside the pure strategy repo.
135+
2. Normalize the accepted payload into `ctx.artifacts` or a platform-owned runtime helper before calling `evaluate(ctx)`.
136+
3. Validate freshness, shape, version, and optional checksum at the platform boundary.
137+
4. Keep the strategy layer focused on decision logic over normalized inputs, not provider-specific transport details.
138+
99139
## PR6 cleanup status
100140

101141
### Mainline status by repository

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "quant-platform-kit"
7-
version = "0.6.0"
7+
version = "0.7.0"
88
description = "Shared broker adapters, domain models, execution ports, and notification utilities for QuantStrategyLab strategies."
99
readme = "README.md"
1010
requires-python = ">=3.9"

0 commit comments

Comments
 (0)