feat(ECR-007): Wyckoff Live Structure with Confirmed/Live isolation
Add live.py lifecycle and event candidates; assemble confirmed vs live in engine; Summary partition; execution_signal source=confirmed only. Keep strategies untouched; do not lower Confirmed thresholds for Live. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# WYCKOFF-LIVE-STRUCTURE-001
|
||||
|
||||
**Status:** FROZEN
|
||||
**Depends on:** WYCKOFF-MULTI-CYCLE-001
|
||||
**Scope:** Live / Developing 结构层(独立于 Confirmed Engine)
|
||||
|
||||
## 核心原则
|
||||
|
||||
| Layer | 定位 |
|
||||
|-------|------|
|
||||
| Confirmed Engine | 历史结构事实 |
|
||||
| Live Engine | 当前结构推演 |
|
||||
|
||||
禁止:
|
||||
|
||||
- 降低 Spring/SOS Confirmed 条件
|
||||
- 用 Live candidate 替代 Confirmed event
|
||||
- Execution 消费 Live / FORMING / Candidate / Prediction
|
||||
|
||||
## 状态机
|
||||
|
||||
```
|
||||
UNKNOWN → FORMING → CONFIRMED → COMPLETED
|
||||
```
|
||||
|
||||
## 数据契约(Live 不进 events[])
|
||||
|
||||
```json
|
||||
{
|
||||
"cycles": [{
|
||||
"id": 0,
|
||||
"lifecycle": "FORMING",
|
||||
"confirmed": { "phases": [], "events": [] },
|
||||
"live": {
|
||||
"phase_candidate": "D",
|
||||
"event_candidates": [{ "type": "SOS", "confidence": 0.62, "confirmed": false }],
|
||||
"next_expected": "LPS",
|
||||
"confidence": { "cycle": 0.72, "phase": 0.68, "event": 0.55, "overall": 0.65 }
|
||||
}
|
||||
}],
|
||||
"live": { "...": "顶层镜像 cycles[0].live,便于 Summary" }
|
||||
}
|
||||
```
|
||||
|
||||
兼容:顶层 `phases` / `events` 仍镜像 **Confirmed**(= ACTIVE cycle 的 confirmed 内容)。
|
||||
|
||||
## Candidate v1(仅启发式)
|
||||
|
||||
- Range Formation:横盘时长、波动收敛 → Potential Trading Range
|
||||
- Phase C candidate:测低 / 下影 / 缩量
|
||||
- Event candidates:Spring / SOS / LPS / UTAD only
|
||||
|
||||
## Confidence
|
||||
|
||||
可解释分层:`cycle` / `phase` / `event` / `overall`(structure+volume+event 加权),禁止黑盒 “AI probability”。
|
||||
|
||||
## Execution
|
||||
|
||||
```
|
||||
assert execution_signal.source == "confirmed"
|
||||
```
|
||||
|
||||
## No Change
|
||||
|
||||
- Confirmed 检测阈值、MULTI-CYCLE-001 排序、缠论 / strategies / chan_tv
|
||||
|
||||
## Only Change
|
||||
|
||||
- `chanlun/analysis/wyckoff/live.py`
|
||||
- engine 组装 `lifecycle` / `confirmed` / `live`
|
||||
- Summary 面板分区
|
||||
- 测例
|
||||
@@ -0,0 +1,76 @@
|
||||
# WYCKOFF-LIVE-VALIDATION-001
|
||||
|
||||
**Status:** DRAFT(待确认执行后 FROZEN)
|
||||
**Depends on:** WYCKOFF-LIVE-STRUCTURE-001(已 FROZEN)
|
||||
**Goal:** 验证 Live 是否有预测价值,而非继续加事件规则
|
||||
|
||||
## 不做
|
||||
|
||||
- 不新增 BC / AR / ST / UT / UTAD(v1 已够)
|
||||
- 不降低 Confirmed 门槛
|
||||
- 不让 Execution 消费 Live
|
||||
|
||||
## 目标指标(先看演化,不看「准确率」口号)
|
||||
|
||||
### 1) Candidate → Confirmed 转化率
|
||||
|
||||
```
|
||||
candidate_to_confirmed_rate = confirmed_count / candidate_count
|
||||
```
|
||||
|
||||
按 event type 分组:Spring / SOS / LPS / UTAD。
|
||||
|
||||
### 2) 提前量(Lead)
|
||||
|
||||
```
|
||||
lead_bars = confirmed_bar_index - first_candidate_bar_index
|
||||
lead_price = |price_at_confirmed - price_at_first_candidate|
|
||||
```
|
||||
|
||||
例:Spring candidate @ 62000 → Confirmed @ 63500 → lead_price=1500。
|
||||
|
||||
### 3) False Positive
|
||||
|
||||
```
|
||||
false_candidate_rate = expired_unconfirmed / candidate_count
|
||||
```
|
||||
|
||||
候选出现后,在窗口内未升格为 Confirmed,且价格无效化(如 Spring 后继续破位)。
|
||||
|
||||
## 采集方式(建议)
|
||||
|
||||
离线回放 / 批跑(非改 Live 规则):
|
||||
|
||||
```
|
||||
for each bar in timerange:
|
||||
run analyze_wyckoff(df[:bar])
|
||||
log: cycle_id, lifecycle, live.candidates[], confirmed.events[]
|
||||
```
|
||||
|
||||
输出:`reports/wyckoff_live_validation_{symbol}_{tf}_{date}.json` + 简表 CSV。
|
||||
|
||||
## Summary 文案(可选后续,本 ECR 可只做数据)
|
||||
|
||||
交易终端语言示例(不阻塞指标采集):
|
||||
|
||||
```
|
||||
BTC 4H Wyckoff
|
||||
Lifecycle: CONFIRMED
|
||||
Confirmed: Accumulation → SOS → LPS
|
||||
Current: Phase D continuation
|
||||
Watching: New SOS extension
|
||||
Confidence: 0.60
|
||||
Risk: Below LPS invalidation
|
||||
```
|
||||
|
||||
## 验收
|
||||
|
||||
1. 能对 BTC 4h(及可选 1h)跑出至少一类 Spring/SOS 的转化率与提前量
|
||||
2. 报告可复现(固定 timerange + seed/数据快照说明)
|
||||
3. 不修改 Confirmed / Live 检测逻辑(只读 + 日志)
|
||||
|
||||
## Only Change(确认执行后)
|
||||
|
||||
- `scripts/` 或 `tests/` 下批跑采集脚本
|
||||
- `docs/notes` 或 `reports/` 输出样例
|
||||
- 可选:Summary 文案升级(独立小项)
|
||||
@@ -0,0 +1,62 @@
|
||||
# WYCKOFF-MULTI-CYCLE-001
|
||||
|
||||
**Status:** FROZEN
|
||||
**Scope:** Wyckoff Cycle Detection Layer
|
||||
|
||||
## No Change
|
||||
|
||||
- `chan.py` / 笔 / 段 / 中枢
|
||||
- `strategies/`
|
||||
- `/chan_tv`
|
||||
|
||||
## Only Change
|
||||
|
||||
- wyckoff range detection
|
||||
- wyckoff engine payload
|
||||
- API localization
|
||||
- chart rendering
|
||||
- tests
|
||||
|
||||
## Frozen Rules
|
||||
|
||||
1. 每个 TF 最大 8 个周期
|
||||
2. `cycles[0]` 永远为 ACTIVE;`cycles[1:]` 为 HISTORICAL
|
||||
3. **禁止**用 `cycles[-1]` 判断 active;唯一来源:`active_cycle = cycles[0]`
|
||||
4. 周期不可重叠;按时间倒序(近 → 远)
|
||||
5. 顶层字段只镜像 `cycles[0]`
|
||||
6. 历史 cycle 只用于展示/分析,不参与当前交易决策
|
||||
7. 多 TF 只同步 active cycle(`prefer_start_time` ← 主 TF `cycles[0]`)
|
||||
8. 每个 cycle 必须可追溯:`period` / `status` / `role` / `confidence`
|
||||
9. 嵌套箱:`overlap_ratio < 0.2` 才可并存;否则丢弃
|
||||
10. 验收重点:历史周期稳定复现 + active 不漂移
|
||||
|
||||
## Layer Duties
|
||||
|
||||
```
|
||||
range.py
|
||||
_detect_in_window() → TradingRange # 仅起止、高低、结构分
|
||||
detect_trading_ranges() → list[TR] # 倒序扫 + 过滤 + mask
|
||||
|
||||
engine.py
|
||||
phases / events / VP / confidence aggregation → cycles[]
|
||||
```
|
||||
|
||||
## Filter Order(不可改)
|
||||
|
||||
```
|
||||
candidate window
|
||||
→ detect range
|
||||
→ quality filter
|
||||
→ trend contamination filter
|
||||
→ overlap filter (<0.2)
|
||||
→ accept cycle
|
||||
→ mask
|
||||
```
|
||||
|
||||
禁止先 mask 再判断质量。
|
||||
|
||||
## Display / Summary (2026-08-06)
|
||||
|
||||
- 图面阶段标记:`{TF} C{id} Phase {X}`;事件:`{TF} C{id} {Event}`
|
||||
- Cycle Summary 面板:消费 `cycles[0]`,写入 `window.wyckoffCycleSummary`
|
||||
- 检测算法本轮不改;质量阈值 / 历史层折叠为后续项
|
||||
Reference in New Issue
Block a user