Skip to content

Commit 08fdfd0

Browse files
committed
Document IBKR profile status matrix
1 parent 6e36f7f commit 08fdfd0

2 files changed

Lines changed: 64 additions & 8 deletions

File tree

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,19 @@ The mainline runtime now follows one path only:
4343
- `tech_pullback_cash_buffer`
4444

4545

46-
**IBKR profile matrix**
46+
**IBKR profile status**
4747

48-
| Canonical profile | Display name | Enabled | Default | Rollback | Domain | Runtime note |
49-
| --- | --- | --- | --- | --- | --- | --- |
50-
| `global_etf_rotation` | Global ETF Rotation Defense | Yes | Yes | Yes | `us_equity` | current rollback line |
51-
| `russell_1000_multi_factor_defensive` | Russell 1000 Multi-Factor Defensive | Yes | No | No | `us_equity` | defensive stock baseline |
52-
| `tech_pullback_cash_buffer` | Tech Pullback Cash Buffer | Yes | No | No | `us_equity` | current IBKR paper dry-run candidate |
48+
| Canonical profile | Display name | Eligible | Enabled | Default | Rollback | Domain | Runtime note |
49+
| --- | --- | --- | --- | --- | --- | --- | --- |
50+
| `global_etf_rotation` | Global ETF Rotation Defense | Yes | Yes | Yes | Yes | `us_equity` | current rollback line |
51+
| `russell_1000_multi_factor_defensive` | Russell 1000 Multi-Factor Defensive | Yes | Yes | No | No | `us_equity` | defensive stock baseline |
52+
| `tech_pullback_cash_buffer` | Tech Pullback Cash Buffer | Yes | Yes | No | No | `us_equity` | current IBKR paper dry-run candidate |
53+
54+
Check the current matrix locally:
55+
56+
```bash
57+
python3 scripts/print_strategy_profile_status.py
58+
```
5359

5460
**Pool (22 ETFs + 1 safe haven):**
5561

@@ -287,7 +293,7 @@ Recommended setup:
287293

288294
On every push to `main`, the workflow updates the existing Cloud Run service with the values above and removes legacy env vars that should now live in the account-group config (`IB_CLIENT_ID`, `IB_GATEWAY_INSTANCE_NAME`, `IB_GATEWAY_MODE`) plus the older transport vars (`IB_GATEWAY_HOST`, `IB_GATEWAY_PORT`, `TELEGRAM_CHAT_ID`). If `IB_GATEWAY_ZONE` or `IB_GATEWAY_IP_MODE` are blank in GitHub, the workflow also removes them from Cloud Run to avoid drift.
289295

290-
For now, `STRATEGY_PROFILE` still only supports one strategy profile. The current strategy domain is `us_equity`, and the repo now keeps a thin strategy registry so future expansion can grow by domain + profile instead of mixing strategy and platform in one layer. `ACCOUNT_GROUP` now selects one account-group config entry, and the service fails fast if that runtime identity is incomplete.
296+
`STRATEGY_PROFILE` is now resolved from a platform capability matrix plus a rollout allowlist. The current strategy domain is `us_equity`, and the repo keeps the runtime registry thin: `eligible` means the platform can run the strategy in theory, while `enabled` means the current rollout really allows it. `ACCOUNT_GROUP` now selects one account-group config entry, and the service fails fast if that runtime identity is incomplete.
291297

292298
Important:
293299

@@ -513,7 +519,7 @@ IB_GATEWAY_IP_MODE=internal
513519

514520
每次 push 到 `main` 时,这个 workflow 会把上面这些值同步到现有 Cloud Run 服务里,并清掉已经转移到账号组配置里的旧 env(`IB_CLIENT_ID``IB_GATEWAY_INSTANCE_NAME``IB_GATEWAY_MODE`)以及更早的传输层 env(`IB_GATEWAY_HOST``IB_GATEWAY_PORT``TELEGRAM_CHAT_ID`)。如果 GitHub 里没有配置 `IB_GATEWAY_ZONE``IB_GATEWAY_IP_MODE`,workflow 也会把 Cloud Run 上这两个旧值一起删除,避免双配置源漂移。
515521

516-
`STRATEGY_PROFILE` 当前只有一个可用值;当前策略域是 `us_equity`,本地策略注册表只用于域和 profile 校验`ACCOUNT_GROUP` 是严格必填项,并会选中一份账号组配置。运行身份不完整时,服务会直接失败,不再静默回退。
522+
`STRATEGY_PROFILE` 现在由平台能力矩阵和 rollout allowlist 一起决定。当前策略域仍是 `us_equity``eligible` 表示平台理论上能跑,`enabled` 表示当前 rollout 真正放开`ACCOUNT_GROUP` 是严格必填项,并会选中一份账号组配置。运行身份不完整时,服务会直接失败,不再静默回退。
517523

518524
注意:
519525

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from __future__ import annotations
2+
3+
import json
4+
import sys
5+
from pathlib import Path
6+
7+
8+
ROOT = Path(__file__).resolve().parents[1]
9+
QPK_SRC = ROOT.parent / "QuantPlatformKit" / "src"
10+
UES_SRC = ROOT.parent / "UsEquityStrategies" / "src"
11+
12+
for candidate in (ROOT, QPK_SRC, UES_SRC):
13+
candidate_str = str(candidate)
14+
if candidate_str not in sys.path:
15+
sys.path.insert(0, candidate_str)
16+
17+
from strategy_registry import get_platform_profile_status_matrix # noqa: E402
18+
19+
20+
def _print_table(rows: list[dict[str, object]]) -> None:
21+
headers = (
22+
"canonical_profile",
23+
"display_name",
24+
"eligible",
25+
"enabled",
26+
"is_default",
27+
"is_rollback",
28+
"domain",
29+
)
30+
widths = {
31+
header: max(len(header), *(len(str(row.get(header, ""))) for row in rows))
32+
for header in headers
33+
}
34+
print(" ".join(header.ljust(widths[header]) for header in headers))
35+
print(" ".join("-" * widths[header] for header in headers))
36+
for row in rows:
37+
print(" ".join(str(row.get(header, "")).ljust(widths[header]) for header in headers))
38+
39+
40+
def main() -> int:
41+
rows = get_platform_profile_status_matrix()
42+
if "--json" in sys.argv:
43+
print(json.dumps(rows, indent=2, sort_keys=True))
44+
return 0
45+
_print_table(rows)
46+
return 0
47+
48+
49+
if __name__ == "__main__":
50+
raise SystemExit(main())

0 commit comments

Comments
 (0)