Selaa lähdekoodia

Add dragon v2 workspace memory files

erwin 1 kuukausi sitten
vanhempi
commit
2e3dee5cfa

+ 965 - 0
research/dragon/v2/MEMORY.md

@@ -0,0 +1,965 @@
+## 2026-04-04
+
+- `dragon/v2` 目录当前仅发现一个主数据文件:`龙泉回测20260109.data.xlsx`。
+- 已完成对该工作簿的结构与交易数据统计;主表为 `龙泉`,另有规则说明表 `焚诀(规则)`。
+- 数据口径需要区分三类内容:真实买卖、辅助信号、持仓期间估值与年度收益汇总,不能把整张表直接当作纯成交流水。
+- 用户确认:表内未重新开仓就再次出现的“卖点”只是看空信号标记,不是真实交易卖点。
+- 用户确认:`C1` 就是 `C4`,只是命名不同。
+- 用户确认:`QL凤凰线` 的 `B/S` 本质是上穿/下穿计算。
+- 用户确认:本轮重构只针对 `399673`,不扩展到 ETF。
+- 用户确认:持仓中再次出现的 `BUY` 视为辅助看多信号,不视为加仓。
+- 已按持仓状态拆分输出:
+- `true_trade_events.csv`:真实交易事件序列
+- `true_trades.csv`:配对后的完整交易流水
+- `auxiliary_signals.csv`:辅助信号标记
+- `trade_split_summary.md`:摘要
+- 已完成第一阶段重构:
+- `dragon_workbook.py`:工作簿解析与真实交易/辅助信号分层
+- `dragon_indicators.py`:399673 日线指标重建,含 `A1/B1/C1/KDJ/QL`
+- `dragon_state_machine.py`:基础状态机骨架
+- `dragon_validate.py`:原始行情与 Excel 标记对齐验证
+- `dragon_validation.md`:验证摘要
+
+- Dragon v2 strategy reconstruction reached second-stage exit-state refinement.
+- `dragon_strategy.py` now has explicit high-regime exit handling, hot-exit ql reentry, and sell-signal-node counting instead of daily negative-B1 counting.
+- Key workbook dates now align on the strategy side: `2019-03-25`, `2020-03-09`, `2020-07-24`, `2021-06-16`, `2021-06-21`, `2021-07-16`, `2022-07-08`, `2022-07-11`, `2022-07-15`.
+- Latest verified fit in `research/dragon/v2`: real BUY overlap `78/106`, real SELL overlap `70/105`, aux BUY overlap `0/1`, aux SELL overlap `15/21`; strategy trades `97`, win rate `44.33%`, avg return `2.42%`.
+- Further refined fit in `research/dragon/v2`: real BUY overlap `96/106`, real SELL overlap `88/105`; remaining misses are now concentrated in edge/manual-style dates rather than the main regime trunk.
+- New recovered pattern classes:
+- `ql_high_zone_take_profit` / `ql_mid_zone_take_profit`
+- `deep_oversold_rebound_buy`
+- `oversold_recovery_buy`
+- `super_hot_trend_hold` to retain the later `2025-10-14` crash-protection exit instead of exiting on the first light `B1<0` wobble.
+- Latest edge refinement lifted fit to real BUY overlap `98/106` and real SELL overlap `91/105`.
+- Recovered late-sample edge behavior includes:
+- `oversold_reversal_after_ql_buy`
+- `oversold_rebound_take_profit`
+- `predictive_b1_break_exit`
+- `predictive_error_reentry_buy`
+- Also fixed a same-bar execution bug where a new buy could immediately flow into the sell branch on the same row.
+
+- Final fit refinement on 2026-04-04 closed the remaining real-trade gaps.
+- Added narrow rules in `dragon_strategy.py`:
+- `post_washout_kdj_reentry_buy`
+- `glued_mid_zone_wait_kdj_confirmation`
+- `oversold_low_zone_wait_kdj_confirmation`
+- also narrowed `low_zone_wait_kdj_confirmation` from broad `<30` to `14<=c1<30`
+- also changed `run()` so flat-state buy logic can evaluate non-standard reentry days, which was required for workbook real BUY `2019-07-04`
+- latest verified fit after rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `15/21`
+- strategy trades `130`, win rate `42.31%`, avg return `1.84%`, median return `-0.77%`
+- key recovered final dates:
+- sells: `2017-10-30`, `2018-10-08`, `2019-06-17`
+- buy: `2019-07-04`
+
+- Subsequent optimization pass on 2026-04-04 improved quality while preserving full real-trade alignment.
+- Added `buy_block_glued_high_weak_rebound` in `dragon_strategy.py`, narrowed to glued-entry candidates with `c1 > 68` and `b1 < -0.08`.
+- This reduced high-zone weak rebound false positives without breaking `106/106` real buys and `105/105` real sells.
+- Added `_should_emit_aux_sell()` and changed flat-state aux sell emission to:
+- sell-after-exit confirmation within 10 days, or
+- `c1 > 80`, or
+- `kdj_sell` with `c1 > 60` and `b1 < -0.05`
+- Also corrected `dragon_backtest.py` evaluation window to trim strategy outputs to workbook start and end dates, removing post-workbook 2026 extra events from fit.
+- Latest verified fit after this quality pass:
+- real BUY overlap `106/106`, strategy real BUY `120`, extra real BUY `14`
+- real SELL overlap `105/105`, strategy real SELL `119`, extra real SELL `14`
+- aux BUY overlap `1/1`, strategy aux BUY `45`
+- aux SELL overlap `18/21`, strategy aux SELL `94`, extra aux SELL `76`
+- strategy trades `120`, win rate `44.17%`, avg return `2.10%`, median return `-0.59%`
+
+- Continued refinement later on 2026-04-04 pushed the strategy further while preserving full real-trade alignment.
+- Additional buy-side filters added in `dragon_strategy.py`:
+- more precise glued-entry false-rebound filters
+- deep oversold false-start filters
+- post-sell rebound false-start filters
+- dual-gold false-rebound filter for the narrow `18<c1<20` weak case
+- Latest verified fit after these refinements:
+- real BUY overlap `106/106`, strategy real BUY `111`, extra real BUY `5`
+- real SELL overlap `105/105`, strategy real SELL `110`, extra real SELL `5`
+- aux BUY overlap `1/1`, strategy aux BUY `45`
+- aux SELL overlap `18/21`, strategy aux SELL `89`, extra aux SELL `71`
+- strategy trades `111`, win rate `45.05%`, avg return `2.32%`, median return `-0.60%`
+- remaining extra real BUY dates:
+- `2020-10-28`, `2023-02-13`, `2023-05-10`, `2023-10-26`, `2024-11-27`
+- remaining extra real SELL dates:
+- `2020-10-23`, `2022-12-27`, `2023-05-19`, `2023-11-10`, `2024-11-22`
+- at this stage the remaining extras are harder cases; several are profitable or act as state bridges to preserve workbook-aligned later exits, so future pruning should be more conservative.
+
+- Phase 1 residual attribution completed on 2026-04-04 without changing core strategy logic.
+- Added script `dragon_residual_attribution.py`.
+- Generated outputs:
+- `dragon_residual_trade_attribution.csv`
+- `dragon_residual_trade_review.md`
+- The residual review covers 10 current extra real-trade rows and classifies them into:
+- `DELETE_CANDIDATE`: `2020-10-23`, `2022-12-27`, `2023-05-10`, `2023-05-19`
+- `KEEP_BRIDGE`: `2020-10-28`
+- `KEEP_ALPHA`: `2023-10-26`, `2023-11-10`
+- `OBSERVE_BRIDGE`: `2023-02-13`, `2024-11-27`
+- `OBSERVE`: `2024-11-22`
+- Important conclusion: remaining residuals are no longer homogeneous noise; they split into premature exits, bridge entries needed for aligned downstream sells, and profitable isolated alpha trades.
+
+- Phase 2 residual cleanup completed on 2026-04-04 with additional narrow rule edits in `dragon_strategy.py`.
+- Applied:
+- tighter `oversold_reversal_after_ql_buy` to remove weak sample `2023-05-10` while keeping `2023-08-28`
+- tighter `early_failed_rebound_exit` so it only fires under mild `b1` weakness, removing `2022-12-27`
+- narrow ql-only follow-through hold before `knife_take_profit_2_glued` to suppress `2020-10-23`
+- narrow `mid_hot_wait_ql_confirmation` hold to prevent the aligned `2020-11-11` sell from shifting forward to `2020-11-10`
+- Latest verified fit after serial rerun:
+- real BUY overlap `106/106`, strategy real BUY `108`, extra real BUY `2`
+- real SELL overlap `105/105`, strategy real SELL `107`, extra real SELL `2`
+- aux BUY overlap `1/1`
+- aux SELL overlap `18/21`, strategy aux SELL `85`
+- strategy trades `108`, win rate `44.44%`, avg return `2.49%`, median return `-0.61%`
+- Remaining extra real BUY dates:
+- `2023-10-26`
+- `2024-11-27`
+- Remaining extra real SELL dates:
+- `2023-11-10`
+- `2024-11-22`
+- Updated residual interpretation:
+- `2023-10-26` / `2023-11-10` remain `KEEP_ALPHA`
+- `2024-11-27` remains `OBSERVE_BRIDGE`
+- `2024-11-22` remains `OBSERVE`
+
+- Phase 3 residual cleanup completed on 2026-04-04 by resolving the last bridge chain around `2024-11-22 -> 2024-11-27 -> 2024-11-28 -> 2024-11-29`.
+- Added two narrow rules in `dragon_strategy.py`:
+- `long_glued_wait_predictive_break` to stop the premature `2024-11-22` ql-only exit on a long-held glued trade
+- a long-held extension of `predictive_b1_break_exit` to emit the aligned `2024-11-28` sell after the post-ql decay actually broke down
+- Resulting event chain now matches workbook structure:
+- `2024-11-27` became `AUX_BUY` while still holding
+- `2024-11-28` is the real aligned `predictive_b1_break_exit`
+- `2024-11-29` remains aligned `predictive_error_reentry_buy`
+- Latest verified fit after serial rerun:
+- real BUY overlap `106/106`, strategy real BUY `107`, extra real BUY `1`
+- real SELL overlap `105/105`, strategy real SELL `106`, extra real SELL `1`
+- aux BUY overlap `1/1`, strategy aux BUY `48`
+- aux SELL overlap `18/21`, strategy aux SELL `85`
+- strategy trades `107`, win rate `44.86%`, avg return `2.52%`, median return `-0.60%`
+- Remaining residual real-trade rows are now only one profitable alpha pair:
+- extra real BUY `2023-10-26`
+- extra real SELL `2023-11-10`
+- Current strategic judgment: this residual pair should be kept unless the explicit objective changes from "robust reconstruction + quality" to "strict workbook mimicry even at the cost of profitable alpha".
+
+- Phase 4 auxiliary-signal optimization started on 2026-04-04.
+- Added auxiliary-signal audit outputs:
+- `dragon_aux_signal_audit.py`
+- `dragon_aux_signal_audit.csv`
+- `dragon_aux_signal_review.md`
+- Aux BUY logic in `dragon_strategy.py` was tightened with strength filters and cooldown; it now only emits for stronger holding-period reconfirmation states.
+- Aux SELL logic was kept on the original robust trunk, then refined with:
+- duplicate-cooldown suppression
+- a narrow `state_crash_followthrough` path that recovered workbook aux sell `2025-10-17`
+- suppression of premature high-zone `kdj-only` aux sells when `b1` is not yet meaningfully negative, which moved alignment from `2019-04-10 -> 2019-04-11` and `2021-07-23 -> 2021-07-26`
+- Latest verified fit after serial rerun:
+- real BUY overlap `106/106`, strategy real BUY `107`, extra real BUY `1`
+- real SELL overlap `105/105`, strategy real SELL `106`, extra real SELL `1`
+- aux BUY overlap `1/1`, strategy aux BUY `19`
+- aux SELL overlap `19/21`, strategy aux SELL `82`
+- strategy trades `107`, win rate `44.86%`, avg return `2.52%`, median return `-0.60%`
+- Current audit conclusion:
+- auxiliary BUY redundancy has been materially compressed (`48 -> 19`)
+- auxiliary SELL overlap improved (`18 -> 19`) but count is still only marginally compressed (`85 -> 82`)
+- the dominant remaining unmatched bucket is `SELL / post_exit_confirmation`, so any future compression should focus on clustering repeated post-exit bearish confirmations by exit-cycle rather than by global date spacing
+
+- Stage 2 tail was completed later on 2026-04-04 with structural outputs and cycle-based aux-sell compression.
+- Added and validated `dragon_trade_path_trace.py`.
+- Generated:
+- `dragon_trade_path_trace.csv`
+- `dragon_rule_taxonomy.md`
+- Important fix: Layer 4 path attribution now correctly combines holding-period aux BUY and post-exit aux SELL up to the next real BUY; it no longer misses flat-period bearish confirmations.
+- Added cycle audit tooling:
+- `dragon_aux_sell_cycle_audit.py`
+- `dragon_aux_sell_cycle_audit.csv`
+- `dragon_aux_sell_cycle_summary.csv`
+- `dragon_aux_sell_cycle_review.md`
+- Applied one narrow strategy refinement in `dragon_strategy.py`:
+- for `post_exit_confirmation`, only the first aux signal of the same side (`ql` or `kdj`) is emitted within a flat sell-cycle; this preserves workbook-style `ql -> kdj` double confirmation cycles while removing redundant same-side repeats
+- Latest verified fit after serial rerun:
+- real BUY overlap `106/106`, strategy real BUY `107`, extra real BUY `1` (`2023-10-26`)
+- real SELL overlap `105/105`, strategy real SELL `106`, extra real SELL `1` (`2023-11-10`)
+- aux BUY overlap `1/1`, strategy aux BUY `19`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy trades `107`, win rate `44.86%`, avg return `2.52%`, median return `-0.60%`
+- Cycle audit result after compression:
+- repeated `post_exit_confirmation` cycles dropped from `10` to `3`
+- zero-workbook-anchor repeated cycles dropped from `8` to `1`
+- remaining protected double-confirmation cycles:
+- `2022-07-08 -> 2022-09-26` with matched `2022-07-11` and `2022-07-15`
+- `2018-12-06 -> 2019-01-18` with matched `2018-12-07`
+- remaining zero-anchor repeated candidate:
+- `2023-12-04 -> 2024-01-18` with `2023-12-13` and `2023-12-14`
+- Strategic conclusion: Stage 2 is now materially complete; further aux-sell compression should stop unless a new rule can remove the last candidate without risking protected `ql -> kdj` cycles.
+
+- Stage 3 robustness validation was started on 2026-04-04 with executable reporting rather than manual inspection.
+- Added `dragon_robustness_report.py`.
+- Generated:
+- `dragon_trade_quality.csv`
+- `dragon_trade_group_summary.csv`
+- `dragon_yearly_performance.csv`
+- `dragon_rule_contribution_entry.csv`
+- `dragon_rule_contribution_exit.csv`
+- `dragon_rule_stability.csv`
+- `dragon_robustness_report.md`
+- Key first-pass findings from Stage 3:
+- baseline trade quality: avg MFE `6.66%`, avg MAE `-2.66%`, avg exit followthrough over next 5 bars `-2.95%`
+- holding buckets are highly asymmetric:
+- `00-05d`: win rate `0%`, avg return `-2.03%`
+- `06-10d`: avg return `-0.81%`
+- `21-40d`: avg return `6.33%`
+- `41d+`: win rate `100%`, avg return `24.13%`
+- sample split improved in the later regime:
+- `2016-2020`: avg return `1.95%`, profit factor `2.83`
+- `2021-2025`: avg return `3.15%`, profit factor `3.81`
+- current realized-trade attribution highlights:
+- strongest entry contributor remains `glued_buy`
+- weaker entry bucket needing review is `deep_oversold_rebound_buy`
+- largest realized drag removal comes from exit rule `knife_take_profit_2_glued`
+- Important limitation documented in the report:
+- threshold perturbation and true leave-one-rule-out reruns still require parameterizing hard-coded logic in `dragon_strategy.py`
+
+- Stage 3 modules A-D were materially advanced later on 2026-04-04.
+- Module A parameterization:
+- added `dragon_strategy_config.py`
+- `dragon_strategy.py` now accepts `DragonRuleEngine(config=...)`
+- default config was serially verified to preserve the current baseline exactly:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy trades `107`, avg return `2.52%`
+- First parameterized controls now include:
+- post-exit aux sell window / duplicate suppression / same-side cycle cap
+- high-zone kdj-only aux suppression thresholds
+- glued high weak rebound thresholds
+- deep oversold rebound thresholds
+- oversold recovery thresholds
+- oversold reversal after ql thresholds
+- post-sell rebound thresholds
+- predictive b1 break thresholds
+- `knife_take_profit_2_wait_ql` switch
+
+- Module B rerun-based ablation completed:
+- added:
+- `dragon_rule_ablation.py`
+- `dragon_rule_ablation.csv`
+- `dragon_rule_ablation.md`
+- Key ablation findings:
+- `glued_buy` remains the structural backbone; disabling it drops real-buy overlap to `46` and real-sell overlap to `52`
+- `deep_oversold_rebound_buy` is the clearest weak entry family:
+- disabling it improves avg return by about `+0.54%`
+- but drops overlap to real BUY `93`, real SELL `92`
+- `predictive_b1_break_exit`, `early_crash_probe_buy`, `oversold_reversal_after_ql_buy`, and `oversold_recovery_buy` look directionally weak but only small positive deltas and still break alignment when removed
+- disabling `knife_take_profit_2_glued` in rerun form produced no headline metric change, implying its current drag is partly replaced by alternative same-cycle exits rather than disappearing cleanly
+- disabling the aux same-side cycle cap did not change real-trade metrics, confirming the Stage 2 compression is a safe hygiene rule
+
+- Module C threshold perturbation completed:
+- added:
+- `dragon_threshold_perturbation.py`
+- `dragon_threshold_perturbation.csv`
+- `dragon_threshold_perturbation.md`
+- `dragon_threshold_sensitivity_summary.csv`
+- Fragile parameters from first perturbation pack:
+- `predictive_b1_break_short_b1_max`
+- `predictive_b1_break_long_b1_max`
+- `deep_oversold_entry_c1_max`
+- `deep_oversold_entry_b1_min`
+- Relatively robust parameters:
+- `post_exit_confirmation_window_days`
+- `aux_sell_high_zone_kdj_only_block_c1`
+- `glued_high_weak_rebound_high_c1`
+- `glued_high_weak_rebound_high_b1`
+- Important inference: optimization leverage is no longer mainly in the aux layer; it concentrates in weak oversold entry logic and fragile predictive-break exits
+
+- Module D reporting completed:
+- added:
+- `dragon_stability_report.py`
+- `dragon_stage3_stability_report.md`
+- Current stage judgment:
+- Stage 2 is complete
+- Stage 3 now has working trade-quality, rerun ablation, threshold perturbation, and summary reporting
+- best next optimization target is `deep_oversold_rebound_buy`, but only through a guarded redesign that preserves workbook alignment rather than blunt removal
+
+- Continued Stage 3 work then focused specifically on `deep_oversold_rebound_buy`.
+- Added localized audit outputs:
+- `dragon_deep_oversold_audit.py`
+- `dragon_deep_oversold_audit.csv`
+- `dragon_deep_oversold_subtype_summary.csv`
+- `dragon_deep_oversold_review.md`
+- Key finding:
+- all `18` current deep-oversold entries are workbook-aligned, so this family cannot be optimized by blunt deletion
+- the weakest subtypes are:
+- `positive_b1_rebound` (`3` trades, win rate `0%`, avg return about `-2.32%`)
+- `shallow_false_start` (`6` trades, avg return about `-1.71%`)
+- better relative subtype is:
+- `classic_oversold` (`5` trades, win rate `60%`, avg return about `+0.04%`)
+- Strategy was then refactored to preserve identical trading behavior while exposing subtype reasons:
+- `deep_oversold_rebound_buy:positive_b1_rebound`
+- `deep_oversold_rebound_buy:deep_capitulation`
+- `deep_oversold_rebound_buy:classic_oversold`
+- `deep_oversold_rebound_buy:shallow_false_start`
+- `deep_oversold_rebound_buy:mixed_oversold`
+- Important engineering lesson:
+- subtype labels initially broke downstream exact `entry_reason == ...` sell logic; fixed by adding family-aware `_entry_reason_is(...)` checks in `dragon_strategy.py`
+- Final verified result after subtype refactor:
+- trading behavior unchanged
+- real BUY overlap remains `106/106`
+- real SELL overlap remains `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy trades `107`, avg return `2.52%`
+- New stage judgment:
+- the next safe optimization frontier is not “remove deep oversold”
+- it is “design subtype-aware delayed confirmation or alternate entry routing for `positive_b1_rebound` and `shallow_false_start` while preserving workbook-aligned dates where required”
+
+- A subsequent local redesign pass then implemented the first safe default optimization inside the deep-oversold family.
+- Added config controls in `dragon_strategy_config.py` for deep-oversold subtype routing / blocking experiments.
+- Default strategy change actually applied:
+- shallow-false-start entries with `ql_buy` now defer to same-day fallback rules
+- very light positive-B1 rebound with `a1 > -0.02` now also defers to same-day fallback rules
+- This rerouted four weak subtype dates without changing any real trade dates:
+- `2018-01-02` -> now `glued_buy`
+- `2018-10-19` -> now `dual_gold_resonance_buy`
+- `2023-06-02` -> now `dual_gold_resonance_buy`
+- `2024-09-11` -> now `glued_buy`
+- Verified result after rerun:
+- baseline fit unchanged at real BUY `106/106`, real SELL `105/105`, aux BUY `1/1`, aux SELL `19/21`, strategy trades `107`
+- Deep-oversold family count was reduced from `18` to `14` while preserving all aligned dates.
+- Added focused experiment outputs:
+- `dragon_deep_oversold_experiments.py`
+- `dragon_deep_oversold_experiments.csv`
+- `dragon_deep_oversold_experiments.md`
+- Focused experiment conclusion:
+- blocking remaining `positive_b1_rebound` gives about `+0.10%` avg-return improvement but drops overlap to BUY `104`, SELL `103`
+- blocking remaining `shallow_false_start` without `ql` gives about `+0.15%` but drops overlap to BUY `103`, SELL `102`
+- blocking both gives about `+0.26%` but drops overlap to BUY `101`, SELL `100`
+- Strategic conclusion:
+- safe deep-oversold cleanup has likely been exhausted under the current “preserve 106/105” objective
+- further improvement now requires explicit user acceptance of alignment loss, or a more complex bridge-style replacement rule
+
+- Additional safe simplification was later applied to the entry tree without changing baseline fit or performance.
+- `non_glued_positive_expansion_buy` was narrowed so it only applies when not `dual_gold`.
+- In-sample effect:
+- `2016-07-13` and `2020-04-30` now route to `dual_gold_resonance_buy` on the same dates
+- baseline stays unchanged at real BUY `106/106`, real SELL `105/105`, aux BUY `1/1`, aux SELL `19/21`, strategy trades `107`, avg return `2.52%`
+- Current research judgment:
+- `non_glued_positive_expansion_buy` should be treated as a redundant label, not a separate alpha family
+- `predictive_b1_break` should be treated as a frozen bridge rule under the workbook-preserving objective
+- the remaining meaningful weak-family frontier is no longer generic rule deletion but subtype-aware redesign / replacement under strict alignment constraints
+
+- The workbook-preserving version is now formalized as the current research baseline rather than only a working reconstruction state.
+- New baseline-pack outputs:
+- `dragon_walk_forward_validation.py`
+- `dragon_walk_forward_summary.csv`
+- `dragon_walk_forward_family_year.csv`
+- `dragon_walk_forward_family_stability.csv`
+- `dragon_walk_forward_report.md`
+- `dragon_research_baseline.py`
+- `dragon_baseline_config_snapshot.json`
+- `dragon_formal_research_baseline.md`
+- Fixed-baseline walk-forward conclusions:
+- anchored expanding windows positive `8/10`
+- rolling 3Y windows positive `7/8`
+- `glued_buy` remains the clearest persistent structural alpha family
+- `deep_oversold_rebound_buy` remains the weakest persistent family and should be handled via subtype redesign, not blunt deletion under the current objective
+- Formal family classification now used for future work:
+- core alpha: `glued_buy`, `early_crash_probe_buy`, `oversold_recovery_buy`
+- structural support: `dual_gold_resonance_buy`, `deep_oversold_rebound_buy:classic_oversold`
+- frozen bridge: `predictive_b1_break_exit`, `predictive_error_reentry_buy`, related split-preserving hold gates
+- redundant label: `non_glued_positive_expansion_buy`
+- active research: weak deep-oversold subtypes, `post_washout_kdj_reentry_buy`, `oversold_reversal_after_ql_buy`, `post_sell_rebound_buy`, and the short-holding drag buckets `00-05d` / `06-10d`
+- Operational implication:
+- future optimization should fork from `dragon_baseline_config_snapshot.json`
+- any alignment loss must be treated as a branch with an explicit objective change, not as a silent tweak on the formal baseline
+
+- Further Track A work added a switchable delayed-confirmation experiment path for weak `deep_oversold` subtypes without changing the formal baseline.
+- Strategy-side additions:
+- pending-state handling for weak deep-oversold setups in `dragon_strategy.py`
+- config switches `deep_oversold_confirm_weak_with_ql` and `deep_oversold_confirm_window_bars`
+- New outputs:
+- `dragon_deep_oversold_confirmation_experiments.csv`
+- `dragon_deep_oversold_confirmation_event_changes.csv`
+- `dragon_deep_oversold_confirmation_experiments.md`
+- `dragon_deep_oversold_confirmation_review.md`
+- Stable conclusion from that pack:
+- delayed `QL` confirmation improves alpha-first branch metrics mainly by vetoing weak subtype trades, not by producing genuinely better confirmed entries
+- `2022-03-11`, `2024-01-18`, `2024-01-23` are clean veto candidates
+- delayed confirmed replacements like `2022-03-17` and `2024-08-30` still lose money
+- Research implication:
+- for weak deep-oversold subtypes, the higher-priority alpha-first direction is selective veto / removal before more elaborate confirmation logic
+- under the workbook-preserving objective, this branch should remain experimental only and should not be ported into the formal baseline
+
+- Follow-up Track-A work confirmed that narrow selective veto is stronger than both delayed confirmation and broad weak-subtype blocking for the alpha-first branch.
+- New strategy-side experiment hooks:
+- `deep_oversold_selective_positive_b1_c1_max`
+- `deep_oversold_selective_shallow_c1_min`
+- `deep_oversold_selective_shallow_b1_min`
+- `deep_oversold_selective_mixed_c1_max`
+- `deep_oversold_selective_mixed_require_no_ql`
+- New outputs:
+- `dragon_deep_oversold_selective_veto_experiments.csv`
+- `dragon_deep_oversold_selective_veto_event_changes.csv`
+- `dragon_deep_oversold_selective_veto_experiments.md`
+- `dragon_deep_oversold_selective_veto_review.md`
+- Best alpha-first branch in that pack:
+- `selective_veto_plus_mixed_c1_lt_10_2_no_ql`
+- result about `103` trades, avg_return `2.81%`, profit_factor `3.96`, real BUY / SELL overlap `102 / 101`
+- This beats broad blocking of all remaining weak deep-oversold subtypes while losing fewer aligned dates.
+- Trade-level implication:
+- the valuable direction is not “delete all weak subtype trades”
+- it is “remove a smaller pathological subset”
+- current best veto candidate removes:
+- `2022-02-09` mixed_oversold
+- `2022-03-11` positive_b1_rebound
+- `2024-01-18` shallow_false_start
+- `2024-01-23` shallow_false_start
+- while keeping:
+- `2022-03-16` positive_b1_rebound
+- `2024-08-29` shallow_false_start
+- Operational conclusion:
+- Track A priority order is now:
+- narrow selective veto
+- then delayed confirmation only if paired with extra quality filters
+- broad subtype deletion last
+
+- Stage 3 is now formally complete and split into two explicit baselines.
+- Official reconstruction branch:
+- `workbook_preserving`
+- metrics `106/106` real BUY, `105/105` real SELL, `107` trades, avg_return `2.52%`, profit_factor `3.31`
+- Performance-oriented research branch:
+- `alpha_first_selective_veto`
+- metrics `102/101` real BUY / SELL overlap, `103` trades, avg_return `2.81%`, profit_factor `3.96`
+- branch outputs:
+- `dragon_alpha_first_baseline.md`
+- `dragon_alpha_first_config_snapshot.json`
+- `dragon_alpha_first_branch_summary.csv`
+- `dragon_alpha_first_branch_comparison.csv`
+- `dragon_alpha_first_branch_walk_forward.csv`
+- `dragon_alpha_first_branch_trade_diff.csv`
+- `dragon_stage3_completion.md`
+- Stable governance going forward:
+- `workbook_preserving` is the authoritative reconstruction baseline
+- `alpha_first_selective_veto` is the leading alpha-first research branch
+- future optimization must declare branch first; do not mix workbook-preserving and alpha-first changes silently
+
+- Post-closure branch extension review on 2026-04-04 formally tested a glued-focused short-holding candidate above the current alpha-first branch.
+- Added:
+- `dragon_glued_alpha_candidate.py`
+- `dragon_glued_alpha_candidate_summary.csv`
+- `dragon_glued_alpha_candidate_comparison.csv`
+- `dragon_glued_alpha_candidate_holding_buckets.csv`
+- `dragon_glued_alpha_candidate_walk_forward.csv`
+- `dragon_glued_alpha_candidate_trade_diff_vs_alpha.csv`
+- `dragon_glued_alpha_candidate_trade_diff_vs_workbook.csv`
+- `dragon_glued_alpha_candidate_config_snapshot.json`
+- `dragon_glued_alpha_candidate_review.md`
+- New research branch definition:
+- `alpha_first_glued_selective_veto`
+- config = current `alpha_first_selective_veto` plus glued veto:
+- `glued_selective_hot`: `c1 >= 40`, `b1 >= 0.10`
+- `glued_selective_low`: `23 <= c1 < 28`, `b1 <= 0.02`
+- Branch-level result:
+- trades `92`
+- avg_return `3.35%`
+- profit_factor `4.95`
+- real BUY / SELL overlap `90 / 89`
+- walk-forward:
+- anchored `9/10` positive years, avg test return `3.86%`
+- rolling 3Y `7/8` positive years, avg test return `4.78%`
+- Important governance conclusion:
+- glued candidate is stronger on performance and short-holding drag than `alpha_first_selective_veto`
+- but overlap loss is much larger (`102/101 -> 90/89`)
+- therefore keep `alpha_first_selective_veto` as the official alpha-first baseline
+- treat `alpha_first_glued_selective_veto` as the next research branch, not a replacement baseline
+- Trade-diff nuance:
+- candidate mostly removes `glued_buy` trades (`12` removals vs alpha-first), but also introduces one fallback reroute:
+- `2021-11-22 -> 2021-11-30`, `dual_gold_resonance_buy -> small_positive_a1_declining:kdj_sell`
+
+- Follow-up glued attribution and refinement work on 2026-04-04 split the glued veto branch into two qualitatively different buckets.
+- Added:
+- `dragon_glued_veto_attribution.py`
+- `dragon_glued_veto_attribution.csv`
+- `dragon_glued_veto_bucket_summary.csv`
+- `dragon_glued_veto_review.md`
+- Attribution result for the `12` removed trades vs `alpha_first_selective_veto`:
+- removed-set avg_return `-1.60%`
+- removed-set win_rate `8.33%`
+- removed-set profit_factor `0.03`
+- bucket split:
+- `low_weak_range`: `4` trades, win_rate `0%`, avg_return `-2.35%`, avg_holding `3.0` -> clean promotion candidate
+- `hot_positive_b1`: `8` trades, win_rate `12.5%`, avg_return `-1.23%`, avg_holding `6.1` -> directionally correct, but one micro-profit sample remains
+- key attribution judgment:
+- `low_weak_range` should be treated as the clean conservative glued filter
+- `hot_positive_b1` should not be rolled back, but should be narrowed rather than used in the original broad form
+
+- Strategy parameterization was extended with `glued_selective_hot_c1_max` and then tested through:
+- `dragon_glued_refine_experiments.py`
+- `dragon_glued_refine_experiments.csv`
+- `dragon_glued_refine_experiments.md`
+- `dragon_glued_refined_candidate_config.json`
+- `dragon_glued_refined_trade_diff_vs_full.csv`
+- new branch config helper:
+- `alpha_first_glued_refined_hot_cap_config()`
+
+- New refined glued research candidate:
+- `glued_veto_hot_cap75_and_low`
+- metrics:
+- trades `92`
+- avg_return `3.36%`
+- profit_factor `4.98`
+- real BUY / SELL overlap `91 / 90`
+- short buckets:
+- `00-05d` `-1.67%`
+- `06-10d` `-0.59%`
+- This refined candidate dominates the previous full glued candidate (`90/89`, `3.35%`, `PF 4.95`) by restoring the only super-hot micro-profit trade:
+- restored `2021-11-05 -> 2021-11-18`, `glued_buy -> ql_mid_zone_take_profit`
+- removed the fallback reroute `2021-11-22 -> 2021-11-30`, `dual_gold_resonance_buy -> small_positive_a1_declining:kdj_sell`
+- Governance implication:
+- current official alpha-first baseline still remains `alpha_first_selective_veto`
+- but the next best research branch is no longer the old full glued candidate
+- it is now the refined glued branch with hot cap `75` plus the intact low weak-range veto
+
+- Formal upgrade-review package for the refined glued branch was completed on 2026-04-04.
+- Added:
+- `dragon_glued_refined_branch_review.py`
+- `dragon_glued_refined_branch_summary.csv`
+- `dragon_glued_refined_branch_comparison.csv`
+- `dragon_glued_refined_branch_walk_forward.csv`
+- `dragon_glued_refined_branch_trade_diff.csv`
+- `dragon_glued_refined_holding_breakdown.csv`
+- `dragon_glued_refined_yearly_breakdown.csv`
+- `dragon_glued_refined_family_breakdown.csv`
+- `dragon_glued_refined_regime_breakdown.csv`
+- `dragon_glued_refined_branch_config_snapshot.json`
+- `dragon_glued_refined_branch_review.md`
+- Branch-level result for `alpha_first_glued_refined_hot_cap`:
+- trades `92`
+- avg_return `3.36%`
+- profit_factor `4.98`
+- avg_MFE `7.57%`
+- avg_MAE `-2.57%`
+- real BUY / SELL overlap `91 / 90`
+- Walk-forward versus current `alpha_first_selective_veto`:
+- anchored `8/10 -> 9/10`, avg test return `3.40% -> 3.87%`
+- rolling 3Y `7/8 -> 7/8`, avg test return `4.30% -> 4.79%`
+- Refined-vs-alpha trade diff:
+- removed `11`
+- added `0`
+- avg_return delta `+0.55%`
+- profit_factor delta `+1.02`
+- overlap delta `-11 / -11`
+- Formal governance judgment from the review:
+- upgrade gate passes on headline quality and walk-forward thresholds
+- but governance still should remain explicit because overlap loss is still large
+- current recommendation remains:
+- keep `alpha_first_selective_veto` as the formal alpha-first baseline
+- mark `alpha_first_glued_refined_hot_cap` as the leading next alpha-first candidate
+
+- Added removed-trade attribution package for the refined branch:
+- `dragon_glued_refined_removed_trade_attribution.py`
+- `dragon_glued_refined_removed_trade_attribution.csv`
+- `dragon_glued_refined_removed_trade_review.md`
+- Removed-set result vs current alpha-first:
+- removed trades `11`
+- removed-set avg_return `-1.81%`
+- removed-set win_rate `0%`
+- removed-set profit_factor `0.00`
+- recommendation mix:
+- `KEEP_REMOVAL` `11`
+- `OBSERVE_REMOVAL` `0`
+- `OVER_REMOVAL` `0`
+- bucket split:
+- `hot_positive_b1_cap75`: `7` trades, avg_return `-1.50%`
+- `low_weak_range`: `4` trades, avg_return `-2.35%`
+- Strong inference:
+- the refined branch no longer removes any profitable sample from the current alpha-first baseline
+- it is now a fully removal-driven cleanup of weak short-holding glued trades
+
+- Final alpha-branch governance package was completed on 2026-04-04.
+- Added:
+- `dragon_alpha_branch_governance.py`
+- `dragon_alpha_branch_governance_matrix.csv`
+- `dragon_alpha_branch_governance_decision.json`
+- `dragon_alpha_branch_governance.md`
+- Governance gates used:
+- `headline_quality_gate`
+- `stability_gate`
+- `removal_quality_gate`
+- `alignment_cost_gate`
+- Gate definitions:
+- headline quality requires avg_return delta `>= +0.30%`, profit_factor delta `>= +0.50`, and no short-bucket deterioration
+- stability requires anchored and rolling walk-forward to be no worse than the current formal alpha branch
+- removal quality requires `OVER_REMOVAL = 0`, `OBSERVE_REMOVAL <= 1`, removed-set win_rate `<= 5%`, removed-set avg_return `< 0`
+- alignment cost requires incremental overlap loss no worse than `8` additional BUYs and `8` additional SELLs vs the current formal alpha branch for automatic promotion
+- Final governance result:
+- current formal alpha branch remains `alpha_first_selective_veto`
+- leading candidate branch is `alpha_first_glued_refined_hot_cap`
+- gate status:
+- `headline_quality_gate = PASS`
+- `stability_gate = PASS`
+- `removal_quality_gate = PASS`
+- `alignment_cost_gate = FAIL`
+- final decision:
+- `DUAL_TRACK_GOVERNANCE`
+- practical meaning:
+- keep `alpha_first_selective_veto` as the formal alpha branch for now
+- keep `alpha_first_glued_refined_hot_cap` as the governed leading candidate
+- if objective explicitly shifts toward stronger alpha at the cost of more workbook divergence, refined glued should be the first branch promoted
+
+- User explicitly endorsed the stronger alpha-first judgment after reviewing the governance package and requested a forward research plan under that direction.
+- Working implication for next planning round:
+- research should pivot from workbook-style residual cleanup to formalizing and validating the stronger alpha candidate path
+- `alpha_first_glued_refined_hot_cap` should be treated as the primary forward research subject, with `alpha_first_selective_veto` retained as the control branch
+
+- Formalization validation pack for the stronger alpha candidate was completed after the user approved the alpha-first direction.
+- Added governance-direction docs:
+- `dragon_research_direction_update.md`
+- `dragon_forward_branch_roles.md`
+
+- Added cost-stress package:
+- `dragon_cost_stress_test.py`
+- `dragon_cost_stress_test.csv`
+- `dragon_cost_stress_test.md`
+- Cost-stress conclusion:
+- refined branch remains ahead of current alpha under all tested cost levels
+- at `20 bps/side`, current alpha CAGR `23.55%`, refined CAGR `26.62%`
+- refined minus current alpha CAGR delta widens from about `+2.62%` at `0 bps` to about `+3.07%` at `20 bps`
+- implication: refined edge is not only a zero-cost backtest artifact
+
+- Added local-neighborhood sensitivity package:
+- `dragon_glued_refined_sensitivity.py`
+- `dragon_glued_refined_sensitivity.csv`
+- `dragon_glued_refined_sensitivity_summary.csv`
+- `dragon_glued_refined_sensitivity.md`
+- Sensitivity conclusion:
+- tested local neighborhood cases `81`
+- avg_return range `3.23% -> 3.42%`
+- profit_factor range `4.66 -> 5.11`
+- overlap floor `89/89`
+- robust-nearby cases `52`
+- important inference:
+- the refined branch is locally stable; it is not dependent on a single knife-edge threshold point
+
+- Added year/regime consistency package:
+- `dragon_glued_refined_year_regime_review.py`
+- `dragon_glued_refined_year_regime_review.csv`
+- `dragon_glued_refined_regime_review.csv`
+- `dragon_glued_refined_holding_review.csv`
+- `dragon_glued_refined_family_review.csv`
+- `dragon_glued_refined_year_regime_review.md`
+- Year/regime conclusion:
+- refined improves yearly avg_return in `6` sell-year buckets out of `11`
+- refined improves avg_return in `3` regime buckets out of `4`
+- holding-bucket improvements are concentrated exactly where intended:
+- `00-05d` and `06-10d`
+- medium and long holding buckets are preserved rather than damaged
+- strongest family-level improvement is still `glued_buy`
+
+- Added equity/drawdown package:
+- `dragon_equity_curve_review.py`
+- `dragon_equity_curve_review.csv`
+- `dragon_drawdown_review.csv`
+- `dragon_monthly_return_review.csv`
+- `dragon_yearly_return_review.csv`
+- `dragon_equity_curve_review.md`
+- Equity/drawdown conclusion:
+- refined branch has the best growth-quality profile in the pack
+- CAGR `31.32%`
+- max_drawdown `-12.79%`
+- drawdown_duration `16` trades
+- Calmar `2.45`
+- compared with current alpha:
+- current alpha CAGR `28.70%`, max_drawdown `-14.84%`, Calmar `1.93`
+- implication: refined branch improves both growth and drawdown quality rather than trading one for the other
+
+- Stage judgment after formalization validation:
+- `alpha_first_glued_refined_hot_cap` now passes:
+- headline quality
+- walk-forward stability
+- removed-trade quality
+- cost pressure
+- local threshold-neighborhood stability
+- equity-curve / drawdown quality
+- remaining blocker is no longer quantitative robustness
+- remaining blocker is only governance preference around workbook divergence
+
+- Added `dragon_alpha_promotion_decision.md` to convert the current dual-track governance into an explicit promotion tree.
+- New operational conclusion:
+- governance-neutral default remains `DUAL_TRACK_GOVERNANCE`
+- if objective is explicitly alpha-first, the recommended promoted branch is `alpha_first_glued_refined_hot_cap`
+- branch roles are now fixed more clearly:
+- `alpha_first_glued_refined_hot_cap` = forward research default
+- `alpha_first_selective_veto` = benchmark control
+- `workbook_preserving` = reconstruction reference
+- main blocker to formal promotion is documented as governance preference only, not missing quantitative proof
+
+- Added `dragon_forward_research_plan.md` as the explicit next-stage plan file.
+- This plan fixes the next research sequence as:
+- Phase 1: freeze branch roles and objective
+- Phase 2: refined-branch alpha attribution
+- Phase 3: execution-aware robustness validation
+- Phase 4: formal strategy governance
+- Phase 5: final strategy memo
+- Immediate next execution target is Phase 2 on `alpha_first_glued_refined_hot_cap`.
+
+- Completed the refined-branch alpha attribution pack:
+- `dragon_refined_alpha_attribution.py`
+- `dragon_refined_family_decomposition.csv`
+- `dragon_refined_alpha_attribution.csv`
+- `dragon_refined_removed_trade_recheck.csv`
+- `dragon_refined_edge_review.md`
+- Main finding:
+- refined alpha is still primarily a `glued_buy` story
+- improvement comes from deleting low-quality short glued trades, not from adding complex new paths
+- removed trades vs control remain `11`, all `KEEP_REMOVAL`, removed-set avg_return `-1.81%`, win_rate `0%`
+
+- Completed the execution-aware robustness pack:
+- `dragon_refined_execution_validation.py`
+- `dragon_refined_execution_stress.csv`
+- `dragon_refined_latency_review.csv`
+- `dragon_refined_risk_cluster_review.csv`
+- `dragon_refined_stability_review.md`
+- Key findings:
+- next-open execution still favors refined: avg_return `3.31%` vs control `2.76%`, PF `4.73` vs `3.78`
+- next-close execution still favors refined: avg_return `2.44%` vs control `1.98%`, PF `2.78` vs `2.37`
+- next-open + `20 bps/side` still favors refined: CAGR `25.51%` vs `22.40%`, PF `3.64` vs `2.92`
+- risk clustering also improved under next-open:
+- max loss streak `8` vs `10`
+- worst 5-trade sum `-7.96%` vs `-10.11%`
+- max drawdown `-13.19%` vs `-17.84%`
+
+- Completed the formal governance package:
+- `dragon_formal_strategy_governance.md`
+- `dragon_parameter_governance.md`
+- `dragon_strategy_monitoring_template.csv`
+- `dragon_formal_strategy_memo.md`
+- Current terminal judgment in workspace:
+- `alpha_first_glued_refined_hot_cap` is now the best strategy branch from a quant perspective
+- if it is not formally promoted, that should be treated as a governance choice rather than an unresolved research gap
+
+## 2026-04-05
+
+- Moved from research formalization into quasi-production packaging.
+- Added `dragon_rc1_release.py` and generated:
+- `dragon_rc1_release.md`
+- `dragon_rc1_config_snapshot.json`
+- `RC1` is now the frozen release candidate of `alpha_first_glued_refined_hot_cap`.
+
+- Added `dragon_daily_signal_pipeline.py` and generated:
+- `dragon_daily_signal_snapshot.csv`
+- `dragon_daily_branch_status.csv`
+- `dragon_daily_monitor_snapshot.csv`
+- `dragon_daily_rc1_manifest.json`
+- `dragon_daily_signal_report.md`
+- plus dated archives in `daily_reports/`
+
+- Latest live run used request date `2026-04-05` and correctly resolved the actual latest market bar to `2026-04-03`.
+- Latest live status on `2026-04-03`:
+- both refined and control branches are flat
+- latest real event for both is `2026-02-13 SELL knife_take_profit_2_glued`
+- no new event fired on `2026-04-03`
+
+- Monitoring snapshot after threshold fix:
+- warnings `0`
+- hard breaches `0`
+- next_open avg_return delta vs control `+0.53%`
+- next_open PF delta vs control `+0.92`
+- next_open max_drawdown refined `-13.19%`
+- next_open max loss streak refined `8`
+- next_open + `20 bps/side` CAGR refined/control `25.17% / 22.07%`
+
+- Monitoring template bug fixed:
+- `next_open_max_drawdown` threshold direction was wrong for negative drawdown values
+- corrected from `>=` style to `<=` style
+- after rerun the monitor became fully green
+
+- Added forward-observation infrastructure:
+- `dragon_forward_observation_pipeline.py`
+- `dragon_forward_observation_log.csv`
+- `dragon_forward_observation_state.json`
+- `dragon_signal_change_log.csv`
+- `dragon_signal_change_review.md`
+- `dragon_branch_divergence_log.csv`
+- `dragon_branch_divergence_report.md`
+- `dragon_monitor_history.csv`
+- `dragon_monitor_health_report.md`
+- `dragon_forward_weekly_summary.csv`
+- `dragon_forward_weekly_review.md`
+- `forward_reports/` for dated observation archives
+
+- First forward-observation state on latest market bar `2026-04-03`:
+- refined and control are both flat
+- same latest real event `2026-02-13 SELL knife_take_profit_2_glued`
+- divergence level `none`
+- all monitor metrics currently `ok`
+- the system is now able to accumulate forward logs and streak-based monitor history instead of only producing one-off daily snapshots
+
+- Added `dragon_next_stage_opinion_cn.md`.
+- This Chinese memo fixes the current strategic opinion explicitly:
+- do not continue optimizing the strategy core now
+- the best next action is to stop core tuning and accumulate forward observations on `RC1`
+- future research should only touch weak secondary families in separate branches
+- promotion or non-promotion of `RC1` should now be decided by forward samples plus governance, not by more in-sample tuning
+
+- HTML reporting layer is now available for the forward-observation workflow.
+- Daily and weekly HTML outputs now exist as first-class artifacts:
+- `dragon_reports_index.html`
+- `dragon_daily_signal_report.html`
+- `dragon_forward_weekly_review.html`
+- dated archives in `html_reports/`
+- Daily / weekly report coverage now includes all three strategy roles:
+- `workbook_preserving`
+- `alpha_first_selective_veto`
+- `alpha_first_glued_refined_hot_cap`
+- Important note for future sessions:
+- PowerShell terminal output may display Chinese mojibake when reading UTF-8 files directly
+- the generated HTML files themselves were verified as valid UTF-8 and should be checked in a browser, not judged from terminal rendering alone
+
+- HTML nav bug was fixed after the first rollout:
+- root pages and archived pages require different relative hrefs
+- archived pages in `html_reports/` now link within their own directory correctly
+- HTML presentation was upgraded further with:
+- RC1 summary cards on the index page
+- inline equity-curve and yearly-return charts on the index page
+- `update_dragon_reports.ps1` as a one-click refresh entry point
+
+- Chinese usage docs now also have HTML pages:
+- `dragon_html_report_usage_cn.html`
+- `dragon_html_report_quickstart_cn.html`
+- they are linked from the index page and generated for both root and `html_reports/`
+
+- Historical full-trade detail reporting is now part of the daily HTML package.
+- Generated artifacts:
+- `dragon_historical_trade_details.csv`
+- `dragon_historical_trade_details.html`
+- dated CSV archive in `daily_reports/`
+- dated HTML archive in `html_reports/`
+- This page is linked from the daily report and index page so the user can audit complete historical trade flows directly from the latest report.
+
+- There is now a dedicated investor-facing theory page for the strategy and indicators:
+- `dragon_indicator_strategy_guide_cn.md`
+- `dragon_indicator_strategy_guide_cn.html`
+- That guide page was later upgraded into a fuller illustrated explainer with:
+- indicator quick-reference cards
+- market-state interpretation table
+- detailed threshold / trigger examples
+- representative real BUY / SELL rule glossary with RC1 counts
+- live three-branch comparison table
+- common-misconception section
+- report-reading path section
+- The guide and historical detail pages are now cross-linked:
+- clicking a rule name in the guide jumps into historical detail with prefilled URL-query filters
+- historical detail page shows the incoming filter source and offers a one-click clear-filters link
+- historical detail page also supports expandable per-trade drilldown rows with quick same-rule navigation
+- expanded detail rows now include previous/next same-branch trade navigation with auto-expand + scroll
+- linked from the shared HTML nav as `指标原理`
+- Historical detail reporting now includes per-trade indicator audit windows.
+- Each expanded row lazily renders buy-date and sell-date `前后 10 个交易日` mini-tables.
+- Fields include `close / a1 / b1 / c1 / KDJ / QL`.
+- Report generation can auto-refresh full indicator coverage through `DragonIndicatorEngine`.
+- Persisted cache file: `dragon_indicator_snapshot_full.csv`.
+- Embedded indicator coverage in detail HTML now reaches `2026-04-03` instead of stopping at `2026-01-30`.
+- Historical detail snapshots now also include per-branch same-window strategy events.
+- Snapshot cards show rule summary plus tagged `真实BUY / 真实SELL / 辅助BUY / 辅助SELL` entries in a `策略事件` column.
+- Historical detail snapshots were then upgraded with a window-level event summary strip.
+- Each snapshot card now summarizes the +/-10 trading-day window using embedded event payloads:
+- total event count
+- counts for `真实BUY / 真实SELL / 辅助BUY / 辅助SELL`
+- nearest event before the marker day
+- same-day event summary
+- nearest event after the marker day
+- Implementation stayed inside `dragon_html_reports.py`; no strategy-core logic was changed.
+- Verified by rerunning:
+- `py -3 -m py_compile dragon_html_reports.py`
+- `py -3 dragon_html_reports.py`
+- and checking both root and archived historical detail HTML for `snapshot-summary` / `总事件` / `前一条` markers.
+- Explicit handoff state for future Codex CLI/session switches:
+- latest finished task is this historical-detail event-summary-strip enhancement
+- refreshed artifacts:
+- `dragon_historical_trade_details.html`
+- `html_reports/dragon_historical_trade_details_2026-04-03.html`
+- this was a reporting/auditability change only, not a strategy or signal-logic change
+
+- A later formal code review on the current production chain found and fixed three practical issues:
+- `dragon_daily_signal_pipeline.py` had two governance monitor metrics hard-coded (`removed_trade_over_removal_count`, `local_sensitivity_robust_case_count`)
+- they now load dynamically from:
+- `dragon_glued_refined_removed_trade_attribution.csv`
+- `dragon_glued_refined_sensitivity.csv`
+- next-bar execution models in both:
+- `dragon_daily_signal_pipeline.py`
+- `dragon_refined_execution_validation.py`
+- no longer silently fall back to same-bar close when no next bar exists
+- missing next-bar execution prices are now `NaN` and excluded by `_apply_execution_model(...)`
+- `dragon_forward_observation_pipeline.py` weekly summary no longer duplicates global warning/divergence counts into every branch row
+- it now adds a separate `system_monitor` row for global monitor-level counts
+- verification reruns completed successfully after these fixes
+
+- Later external review findings were also fixed:
+- `dragon_indicators.py` no longer hard-codes a workstation-only dependency path
+- it now resolves the repo root relative to `__file__` and loads shared dependencies from `<repo>/dragon`
+- `dragon_alpha_first_baseline.py` now filters branch trades by both `buy_date` and `sell_date` against the workbook event window
+- this removes post-window exits from alpha-branch summary statistics
+- alpha-vs-workbook trade-diff generation in the same script was aligned to the same filtered workbook trade set
+- verified result:
+- `dragon_alpha_first_branch_trade_diff.csv` no longer contains the old `2026-01-05 -> 2026-01-20` out-of-window trade
+- `dragon_alpha_first_baseline.md` now reports removed trades `4`
+
+- A later consistency sweep standardized workbook-window trade filtering across the research/evaluation pack.
+- Principle fixed:
+- in workbook-window statistics, trade filters must constrain both `buy_date` and `sell_date`
+- not only `buy_date`
+- Updated scripts include:
+- `dragon_backtest.py`
+- `dragon_cost_stress_test.py`
+- deep-oversold experiment scripts
+- glued/refined candidate and branch-review scripts
+- predictive-break experiment script
+- `dragon_rc1_release.py`
+- `dragon_refined_alpha_attribution.py`
+- `dragon_refined_execution_validation.py`
+- `dragon_rule_ablation.py`
+- short-holding audit / experiment scripts
+- `dragon_strategy_overview.py`
+- `dragon_threshold_perturbation.py`
+- Explicit exception kept:
+- `dragon_daily_signal_pipeline.py` remains live/forward oriented and is not capped by workbook end date
+- representative reruns succeeded after the sweep
+
+- System review closure on `2026-04-05`:
+- fixed the last cross-report inconsistencies by unifying bounded evaluation windows and CAGR year calculations
+- `dragon_alpha_first_baseline.py` now uses the same `2016-01-01 -> 2025-12-31` release window as `dragon_strategy_overview.py` and `dragon_glued_refined_branch_review.py`
+- `dragon_rc1_release.py` and `dragon_refined_execution_validation.py` now derive evaluation years from the window dates instead of hard-coding `10.0`
+- important execution lesson: if `dragon_system_review.py` is run in parallel with its upstream generators, it can temporarily read stale outputs; rerun it after upstream artifacts complete
+- final result after rerun:
+- `dragon_review_branch_metric_consistency.md` shows `0` mismatches
+- `dragon_strategy_overview.csv` is now aligned with the branch-specific summary and release artifacts
+- review focus has shifted from internal metric-definition drift to governance / monitoring interpretation
+
+- Later second-pass review on `2026-04-05` fixed additional governance/reporting defects:
+- in `dragon_alpha_branch_governance.py`, `alignment_cost_gate` no longer incorrectly fails when overlap delta is positive
+- in the same file, an empty removed-trade set no longer fails `removal_quality_gate`
+- the same governance report's final recommendation section now follows `final_decision` instead of always defaulting toward keeping the old alpha branch
+- in `dragon_html_reports.py`, `system_monitor` is now rendered with user-facing Chinese labels instead of raw internal names
+- no new high-severity strategy-core issue was found in that second pass
+
+- The next P1 engineering fix on `2026-04-05` closed the monitor-chain silent-failure gap:
+- `dragon_daily_signal_pipeline.py` now marks missing metric values as `missing_data` instead of blank status
+- `dragon_forward_observation_pipeline.py` now treats `missing_data` as hard-breach-equivalent for monitoring purposes while also tracking a separate `missing_data_count`
+- daily/weekly HTML now expose the missing-metric count, and weekly HTML remains backward-compatible with older observation/divergence logs
+- this means missing upstream research artifacts will now surface explicitly in monitoring rather than appearing as a false clean run
+
+- The next major P2 refactor on `2026-04-05` introduced shared single-source modules:
+- `dragon_shared.py` for evaluation window constants, year calculation, formatting helpers, and profit-factor helper
+- `dragon_execution_common.py` for execution-aware apply/summary/risk-cluster helpers
+- main-chain scripts and core branch-summary scripts were migrated to these shared modules
+- this removed key script-to-script helper imports such as:
+- daily pipeline importing formatting from `dragon_strategy_overview.py`
+- daily pipeline importing execution helpers from `dragon_refined_execution_validation.py`
+- post-refactor system review still reports `0` metric mismatches, so the consolidation did not change quantitative outputs
+
+- Session governance update on `2026-04-05`:
+- the useful code changes for `dragon/v2` were already committed in git as `9f7ce16` with message `Add dragon v2 strategy research and reporting code`
+- user explicitly requires workspace memory files to be committed too, not just kept locally
+- follow-up git work should therefore include `MEMORY.md`, `USER.md`, and daily notes under `memory/` when they contain important session context

+ 21 - 0
research/dragon/v2/USER.md

@@ -0,0 +1,21 @@
+# User Notes
+
+- 用户当前关注 `cyb50-quant/research/dragon/v2` 下的回测文件分析与交易数据总结。
+- 用户明确说明:回测表里的重复“卖点”应视为看空信号,不计入真实交易。
+- 用户确认:`C1=C4`;`QL凤凰线` 的 `B/S` 是上穿/下穿;只做 `399673`;持仓中再次出现的 `BUY` 归类为辅助看多信号。
+
+- User preference: treat repeated SELL without reopen as auxiliary bearish signals, not real trades.
+- User preference: `BUY` while already holding is auxiliary bullish signal, not add-on.
+- User constraint: only reconstruct and optimize for index `399673`, no ETF extension.
+- User preference: robustness first, reduce useless trades second, preserve large-trend profit third, annualized return last.
+- User preference: wants detailed design explained before major quant refactors, then direct execution.
+- User preference: residual pruning should preserve full real-trade alignment first; profitable alpha trades and bridge trades should not be removed without downstream replacement proof.
+- User approved execution order: finish Stage 2 rule-layer reconstruction first, then start Stage 3 robustness validation.
+- User preference: after plan approval, continue working autonomously unless an important adjustment or clarification is needed.
+- Historical operating assumption: `alpha_first_selective_veto` was kept as the formal alpha-first branch before the later stronger alpha-first direction was adopted.
+- Latest direction signal: user supports the stronger alpha-first viewpoint and wants the next research plan oriented toward formalizing the better-performing branch rather than continuing workbook-style micro-alignment.
+- Latest execution instruction: continue autonomously without small confirmations until the agreed stage target is reached.
+- Current branch usage preference: use `alpha_first_glued_refined_hot_cap` as the forward research default, keep `alpha_first_selective_veto` as the benchmark control, and keep `workbook_preserving` only as the reconstruction reference.
+- User preference: before switching Codex CLI/session surfaces, record important completed changes explicitly in workspace memory so follow-up work can resume without losing context.
+- User preference: memory files in this workspace must also be committed to git, otherwise important context may be lost across sessions.
+- User instruction: useful code changes can be committed directly without asking again.

+ 752 - 0
research/dragon/v2/memory/2026-04-04.md

@@ -0,0 +1,752 @@
+## 2026-04-04
+
+- 用户请求:分析 `dragon/v2` 目录下文件,总结交易数据。
+- 目录内实际只有一个 Excel 文件:`龙泉回测20260109.data.xlsx`。
+- 工作簿包含两个 sheet:
+- `龙泉`:交易节点、阶段估值、年度收益汇总
+- `焚诀(规则)`:策略规则文字说明
+- 关键统计结论:
+- 初始资金 `55,450`
+- 2025-12-31 已实现资金 `910,785.96`
+- 2016-2025 累计收益约 `+1542.54%`,资金约 `16.43x`
+- 对应 CAGR 约 `32.30%`
+- 用户确认表内 `21` 个未重新开仓就再次出现的卖点只是看空信号标记,不是真实交易卖点
+- 另有 `1` 个持仓中再次买入记录,当前先归类为持仓中辅助看多信号
+- 已输出 `true_trade_events.csv`、`true_trades.csv`、`auxiliary_signals.csv`、`trade_split_summary.md`
+- 按真实交易口径,可配对 `105` 笔完整交易,胜率约 `44.8%`,均值收益约 `+3.15%`
+- 后续分析结论:
+- 短持有交易(0-10 天)整体显著亏损,11 天以上才开始明显转正
+- `KDJ/QL双金叉`、`刀口舔血2`、带明确信号标签的买点质量明显高于未标注买点
+- 空仓后的重复卖点看空标记有一定信息量,到下一次真实买点前平均还能多跌约 `4.1%`,但只有约 `60%` 有效,更适合做仓位/等待过滤,不适合作为硬性 veto
+- 用户补充确认:
+- `C1` 与 `C4` 为同一指标的不同名称
+- `QL凤凰线` 的 `B/S` 是上穿/下穿的计算结果
+- 本轮重构只针对 `399673`
+- 持仓中再次出现的 `BUY` 视为辅助看多信号
+- 已完成第一阶段代码实现并生成:
+- `dragon_workbook.py`
+- `dragon_indicators.py`
+- `dragon_state_machine.py`
+- `dragon_validate.py`
+- `dragon_indicator_snapshot.csv`
+- `dragon_workbook_layers.csv`
+- `dragon_signal_alignment.csv`
+- `dragon_validation.md`
+- 当前验证结果:
+- 明确标记口径下,`KDJ` 对齐 `197/197` 的买点、`196/197` 的死叉;唯一死叉错位日为 `2018-05-23`
+- `QL` 的 `B/S` 标记对齐 `112/112`
+- 已实现 `dragon_strategy.py` 与 `dragon_backtest.py`,完成第一版可执行规则树与基线回测
+- 当前基线贴合度:
+- 真实买点:工作簿 `106`,策略 `97`,重合 `78`
+- 真实卖点:工作簿 `105`,策略 `96`,重合 `64`
+- 辅助买点:工作簿 `1`,策略 `48`,重合 `0`
+- 辅助卖点:工作簿 `21`,策略 `195`,重合 `11`
+- 当前基线交易统计:`96` 笔,胜率约 `42.71%`,平均收益约 `+2.23%`,中位数约 `-0.61%`
+- 当前最明显的问题:
+- 买入规则过度偏向 `glued_buy`,共 `77` 笔
+- 卖出规则过度偏向 `knife_take_profit_2_glued`,共 `70` 笔
+- 说明 `见好就收1/2`、高位大行情退出、预警减仓点、股灾兜底等高位退出规则仍未充分编码
+- 后续推进:
+- 已补入 `crash_protection_exit`,`2025-10-14` 已成功命中真实卖点
+- 已生成 `dragon_event_gaps.csv` 与 `dragon_event_gaps.md`,用于系统化分析工作簿未命中/额外命中事件
+- 当前关键偏差集中在:
+- `2019-03-25` 预警减仓点
+- `2020-03-09` / `2020-07-24` / `2020-08-07` 的大行情高位退出
+- `2021-06-16` / `2021-07-16` 的“大行情第一次不卖、第二次确认再卖”逻辑
+- `2022-07-08` / `2022-07-11` 的预警减仓与正式卖点拆分
+
+- Later refinement on `dragon_strategy.py`:
+- added explicit high-regime exit handling before generic glued exits
+- changed `B1 negative count` from daily accumulation to sell-signal-node accumulation
+- blocked premature ql-only high-zone exits such as `2021-06-03`
+- recovered workbook-style key events: `2019-03-25`, `2020-03-09`, `2020-07-24`, `2021-06-16`, `2021-06-21`, `2021-07-16`, `2022-07-08`, `2022-07-11`, `2022-07-15`
+- current fit after rerun:
+- real BUY overlap `78/106`
+- real SELL overlap `70/105`
+- aux BUY overlap `0/1`
+- aux SELL overlap `15/21`
+- strategy trades `97`, win rate `44.33%`, avg return `2.42%`, median return `-0.59%`
+- Later refinements after more rule work:
+- added `ql_high_zone_take_profit` / `ql_mid_zone_take_profit`
+- added `deep_oversold_rebound_buy` and `oversold_recovery_buy`
+- added `super_hot_trend_hold` to preserve `2025-10-14` crash-protection exit
+- latest verified fit:
+- real BUY overlap `96/106`
+- real SELL overlap `88/105`
+- missing real BUY down to `10`
+- missing real SELL down to `17`
+- strategy trades `118`, win rate `44.07%`, avg return `2.04%`, median return `-0.61%`
+- important recovered dates in this stage:
+- buys: `2022-02-09`, `2022-02-15`, `2022-03-11`, `2022-03-16`, `2022-04-27`, `2022-09-26`, `2022-11-01`, `2023-06-12`
+- sells: `2020-05-22`, `2021-11-18`, `2024-03-22`, `2022-02-11`, `2022-02-22`, `2022-03-15`, `2022-03-25`, `2022-05-24`, `2022-09-30`, `2022-11-10`, `2023-06-21`, `2025-10-14`
+- Final edge-pattern refinements in this session:
+- fixed same-bar buy/sell execution bug in `run()`
+- added `oversold_reversal_after_ql_buy`
+- added `oversold_rebound_take_profit`
+- added `predictive_b1_break_exit` and `predictive_error_reentry_buy`
+- latest verified fit:
+- real BUY overlap `98/106`
+- real SELL overlap `91/105`
+- missing real BUY down to `8`
+- missing real SELL down to `14`
+- remaining misses are concentrated in early `2016-2019` samples
+- recovered late-sample dates:
+- `2023-08-28`, `2023-09-07`, `2023-10-12`, `2024-11-28`, `2024-11-29`
+
+- Final pass today closed all remaining real-trade gaps in `dragon/v2`.
+- Root causes were three overly broad ql-only exit paths and one non-standard post-washout reentry day.
+- Implemented:
+- narrow `low_zone_wait_kdj_confirmation` to `14<=c1<30`
+- add `glued_mid_zone_wait_kdj_confirmation`
+- add `oversold_low_zone_wait_kdj_confirmation`
+- add `post_washout_kdj_reentry_buy`
+- allow `_buy_decision()` evaluation while flat even on non-buy-signal days, so workbook-style special reentry can be captured
+- final verified fit after serial rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `15/21`
+- strategy trades `130`, win rate `42.31%`, avg return `1.84%`, median return `-0.77%`
+
+- Later quality optimization on the same day:
+- added `buy_block_glued_high_weak_rebound` with `c1 > 68` and `b1 < -0.08` to cut false glued entries in high weak rebound states
+- compressed flat-state auxiliary sell output via `_should_emit_aux_sell()`
+- aux sell now only emits for:
+- repeated bearish confirmation within 10 days after a real sell
+- or high-zone renewed weakness (`c1 > 80`)
+- or `kdj_sell` with `c1 > 60` and `b1 < -0.05`
+- corrected `dragon_backtest.py` to trim strategy evaluation to workbook min/max dates, not just min date
+- latest verified fit after these changes:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- extra real BUY `14`
+- extra real SELL `14`
+- aux BUY overlap `1/1`
+- aux SELL overlap `18/21`
+- strategy aux SELL `94` vs prior `181`
+- strategy trades `120`, win rate `44.17%`, avg return `2.10%`, median return `-0.59%`
+
+- Continued late-session optimization cut remaining extra real trades from `14+14` down to `5+5` without breaking full real-trade alignment.
+- Current verified fit:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- extra real BUY `5`
+- extra real SELL `5`
+- aux BUY overlap `1/1`
+- aux SELL overlap `18/21`
+- strategy aux SELL `89`
+- strategy trades `111`, win rate `45.05%`, avg return `2.32%`, median return `-0.60%`
+- Remaining extra real BUY dates:
+- `2020-10-28`, `2023-02-13`, `2023-05-10`, `2023-10-26`, `2024-11-27`
+- Remaining extra real SELL dates:
+- `2020-10-23`, `2022-12-27`, `2023-05-19`, `2023-11-10`, `2024-11-22`
+- Important lesson: some apparent extra buys are state-bridge entries that preserve later workbook-aligned sells, so pruning must always be verified on downstream sell alignment, not just on local buy precision.
+
+- Phase 1 attribution outputs created:
+- `dragon_residual_attribution.py`
+- `dragon_residual_trade_attribution.csv`
+- `dragon_residual_trade_review.md`
+- Current residual recommendation split:
+- delete candidates: `2020-10-23`, `2022-12-27`, `2023-05-10`, `2023-05-19`
+- keep bridge: `2020-10-28`
+- keep alpha: `2023-10-26`, `2023-11-10`
+- observe bridge: `2023-02-13`, `2024-11-27`
+- observe: `2024-11-22`
+
+- Phase 2 residual cleanup was then executed directly in `dragon_strategy.py`.
+- Implemented three narrow filters:
+- block the weak `oversold_reversal_after_ql_buy` pattern around `23<c1<26`, `b1>-0.12`, `a1>-0.035`
+- narrow `early_failed_rebound_exit` from any `b1<0` to mild weakness `-0.05<b1<0`
+- add a ql-only follow-through hold before `knife_take_profit_2_glued` for the narrow `2020-10-23` pattern
+- A follow-up hot-zone hold `mid_hot_wait_ql_confirmation` was added after the first rerun to restore the workbook-aligned `2020-11-11` sell that had shifted to `2020-11-10`
+- Latest verified fit after serial rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- extra real BUY `2`: `2023-10-26`, `2024-11-27`
+- extra real SELL `2`: `2023-11-10`, `2024-11-22`
+- aux BUY overlap `1/1`
+- aux SELL overlap `18/21`, strategy aux SELL `85`
+- strategy trades `108`, win rate `44.44%`, avg return `2.49%`, median return `-0.61%`
+- Net result: all four prior `DELETE_CANDIDATE` residual rows were removed, and the remaining residual set is now only `KEEP_ALPHA` plus `OBSERVE/OBSERVE_BRIDGE`.
+
+- Phase 3 residual cleanup then targeted the last bridge chain `2024-11-22 -> 2024-11-27 -> 2024-11-28 -> 2024-11-29`.
+- Full-history uniqueness checks showed:
+- the long-held ql-only fade pattern around `2024-11-22` was unique
+- the long-held predictive break pattern around `2024-11-28` was also unique
+- Implemented:
+- `long_glued_wait_predictive_break` to hold through the premature `2024-11-22` ql-only exit
+- a long-held extension of `predictive_b1_break_exit` so the same position exits on `2024-11-28`
+- Latest verified fit after serial rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- extra real BUY `1`: `2023-10-26`
+- extra real SELL `1`: `2023-11-10`
+- aux BUY overlap `1/1`, strategy aux BUY `48`
+- aux SELL overlap `18/21`, strategy aux SELL `85`
+- strategy trades `107`, win rate `44.86%`, avg return `2.52%`, median return `-0.60%`
+- `2024-11-27` is no longer a real extra buy; it is now a holding-period auxiliary bullish signal.
+- Residual review now contains only one `KEEP_ALPHA` pair: `2023-10-26` / `2023-11-10`.
+
+- Phase 4 auxiliary-signal optimization then started on 2026-04-04.
+- Added audit tooling and outputs:
+- `dragon_aux_signal_audit.py`
+- `dragon_aux_signal_audit.csv`
+- `dragon_aux_signal_review.md`
+- Aux BUY optimization:
+- added strength-gated holding reconfirmation logic plus cooldown in `dragon_strategy.py`
+- reduced strategy aux BUY from `48` to `19` while preserving workbook overlap `1/1`
+- Aux SELL optimization:
+- initially tested a broader redesign, then rolled back to the more robust original trunk
+- kept only duplicate-cooldown suppression plus a narrow `state_crash_followthrough` path
+- recovered workbook aux sell `2025-10-17`
+- also suppressed premature high-zone `kdj-only` aux sells so workbook dates `2019-04-11` and `2021-07-26` now align
+- Latest verified fit after serial rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`, strategy aux BUY `19`
+- aux SELL overlap `19/21`, strategy aux SELL `82`
+- strategy trades `107`, win rate `44.86%`, avg return `2.52%`, median return `-0.60%`
+- Current bottleneck from audit:
+- the main remaining unmatched auxiliary cluster is `SELL / post_exit_confirmation` with `53` unmatched rows
+- future compression should be based on grouping by real-sell cycle, not only simple date cooldowns
+
+- User approved sequence: finish Stage 2 first, then move into Stage 3 robustness validation.
+- Stage 2 structural outputs were completed and verified:
+- `dragon_trade_path_trace.csv`
+- `dragon_rule_taxonomy.md`
+- `dragon_aux_sell_cycle_audit.csv`
+- `dragon_aux_sell_cycle_summary.csv`
+- `dragon_aux_sell_cycle_review.md`
+- `dragon_trade_path_trace.py` was corrected so Layer 4 links both in-position aux BUY and post-exit aux SELL until the next real BUY, matching the agreed auxiliary-layer definition.
+- A narrow cycle-aware aux-sell dedupe was then added to `dragon_strategy.py`:
+- within `post_exit_confirmation`, only the first same-side signal (`ql` or `kdj`) is emitted in a flat cycle
+- this keeps workbook-style `ql -> kdj` double confirmation cycles but removes same-side repeat noise
+- Latest verified fit after rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- extra real BUY `1`: `2023-10-26`
+- extra real SELL `1`: `2023-11-10`
+- aux BUY overlap `1/1`, strategy aux BUY `19`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy events `307`, strategy trades `107`
+- win rate `44.86%`, avg return `2.52%`, median return `-0.60%`
+- Cycle compression effect:
+- repeated `post_exit_confirmation` cycles `10 -> 3`
+- zero-anchor repeated cycles `8 -> 1`
+- remaining protected double-confirmation cycles are `2022-07-08 -> 2022-09-26` and `2018-12-06 -> 2019-01-18`
+- remaining zero-anchor repeated candidate is `2023-12-04 -> 2024-01-18`
+
+- Stage 3 was then started with a first executable robustness pack.
+- Added `dragon_robustness_report.py`.
+- Generated:
+- `dragon_trade_quality.csv`
+- `dragon_trade_group_summary.csv`
+- `dragon_yearly_performance.csv`
+- `dragon_rule_contribution_entry.csv`
+- `dragon_rule_contribution_exit.csv`
+- `dragon_rule_stability.csv`
+- `dragon_robustness_report.md`
+- First results:
+- baseline `107` trades, avg MFE `6.66%`, avg MAE `-2.66%`, avg exit followthrough 5d `-2.95%`
+- short holding buckets remain the main weakness:
+- `00-05d` win rate `0%`, avg return `-2.03%`
+- `06-10d` avg return `-0.81%`
+- long holding buckets contain most alpha:
+- `21-40d` avg return `6.33%`
+- `41d+` win rate `100%`, avg return `24.13%`
+- later sample is stronger than earlier sample:
+- `2016-2020` avg return `1.95%`, profit factor `2.83`
+- `2021-2025` avg return `3.15%`, profit factor `3.81`
+- current attribution focus for next optimization round:
+- entry side: `deep_oversold_rebound_buy`
+- exit side: `knife_take_profit_2_glued`
+- report explicitly notes the next engineering gap: parameterize hard-coded thresholds before formal perturbation and true leave-one-rule-out reruns
+
+- Stage 3 continued and delivered the next three modules in this same session.
+- Module A:
+- added `dragon_strategy_config.py`
+- parameterized `dragon_strategy.py` so `DragonRuleEngine(config=...)` can run experiments without changing default baseline behavior
+- default config was verified to preserve:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy trades `107`, avg return `2.52%`
+
+- Module B:
+- added `dragon_rule_ablation.py`
+- generated `dragon_rule_ablation.csv` and `dragon_rule_ablation.md`
+- rerun ablation findings:
+- `glued_buy` is still the backbone; disabling it collapses overlap to BUY `46`, SELL `52`
+- `deep_oversold_rebound_buy` is the clearest weak entry family:
+- disabling it raises avg return by about `+0.54%`
+- but breaks overlap to BUY `93`, SELL `92`
+- `predictive_b1_break_exit` and some oversold rebound/reentry rules look mildly weak, but current evidence is not enough to cut them directly because alignment still degrades
+- disabling `knife_take_profit_2_glued` caused no top-level metric change in rerun form, suggesting replacement by alternate same-cycle exits
+
+- Module C:
+- added `dragon_threshold_perturbation.py`
+- generated:
+- `dragon_threshold_perturbation.csv`
+- `dragon_threshold_perturbation.md`
+- `dragon_threshold_sensitivity_summary.csv`
+- first perturbation pack conclusions:
+- fragile parameters:
+- `predictive_b1_break_short_b1_max`
+- `predictive_b1_break_long_b1_max`
+- `deep_oversold_entry_c1_max`
+- `deep_oversold_entry_b1_min`
+- robust parameters:
+- `post_exit_confirmation_window_days`
+- `aux_sell_high_zone_kdj_only_block_c1`
+- `glued_high_weak_rebound_high_c1`
+- `glued_high_weak_rebound_high_b1`
+
+- Module D:
+- added `dragon_stability_report.py`
+- generated `dragon_stage3_stability_report.md`
+- current quantitative judgment:
+- short holding buckets remain the main drag
+- `glued_buy` remains core alpha structure
+- optimization leverage is now concentrated in weak oversold entry logic and fragile predictive-break exit thresholds
+- auxiliary sell layer is no longer the main optimization frontier
+
+- Deep-oversold focus work was then completed in the same session.
+- Added localized audit artifacts:
+- `dragon_deep_oversold_audit.py`
+- `dragon_deep_oversold_audit.csv`
+- `dragon_deep_oversold_subtype_summary.csv`
+- `dragon_deep_oversold_review.md`
+- Audit result:
+- all `18` deep-oversold trades are workbook-aligned
+- weakest subtypes are `positive_b1_rebound` and `shallow_false_start`
+- relatively better subtype is `classic_oversold`
+- Strategy research granularity was improved without changing behavior:
+- `deep_oversold_rebound_buy` now emits subtype-tagged reasons
+- a family-aware `_entry_reason_is(...)` helper was added so subtype labels do not break downstream sell logic
+- Verified after rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy trades `107`, avg return `2.52%`
+- Practical conclusion:
+- next optimization should target subtype-aware redesign of `positive_b1_rebound` and `shallow_false_start`, not the full deep-oversold family
+
+- One more subtype-aware pass was then executed.
+- Default safe optimization applied:
+- shallow-false-start entries with `ql_buy` are now routed to same-day fallback rules instead of remaining inside the deep-oversold family
+- very light positive-B1 rebound with `a1 > -0.02` is also routed to same-day fallback
+- Rerouted dates:
+- `2018-01-02` -> `glued_buy`
+- `2018-10-19` -> `dual_gold_resonance_buy`
+- `2023-06-02` -> `dual_gold_resonance_buy`
+- `2024-09-11` -> `glued_buy`
+- Verified after rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy trades `107`, avg return `2.52%`
+- deep-oversold family count reduced from `18` to `14`
+- Added focused experiment outputs:
+- `dragon_deep_oversold_experiments.py`
+- `dragon_deep_oversold_experiments.csv`
+- `dragon_deep_oversold_experiments.md`
+- Focused experiment results show the remaining weak subtype blocking is not acceptable under current objective:
+- block remaining positive-B1 rebound -> BUY `104`, SELL `103`
+- block remaining shallow-false-start without ql -> BUY `103`, SELL `102`
+- block both -> BUY `101`, SELL `100`
+- Conclusion: safe cleanup is mostly exhausted; any further deep-oversold optimization now requires accepting alignment loss or inventing more complex replacement logic
+
+- Continued Stage 3 optimization then removed one redundant weak entry label from the effective in-sample decision tree.
+- In `dragon_strategy.py`, `non_glued_positive_expansion_buy` was narrowed to non-`dual_gold` cases only.
+- This pushed the two historical in-sample occurrences (`2016-07-13`, `2020-04-30`) onto the later `dual_gold_resonance_buy` fallback branch on the same dates.
+- Verified after serial rerun:
+- real BUY overlap `106/106`
+- real SELL overlap `105/105`
+- aux BUY overlap `1/1`
+- aux SELL overlap `19/21`, strategy aux SELL `75`
+- strategy trades `107`, avg return `2.52%`, profit factor `3.31`
+- Structural implication:
+- `dual_gold_resonance_buy` count increased from `11` to `14`
+- `non_glued_positive_expansion_buy` now has no remaining in-sample trades and should be treated as a redundant label, not an independent alpha family
+- `dragon_stage3_stability_report.md` was updated to record this judgment.
+
+- Stage 3 was then formally closed into a research baseline package instead of continuing blind residual tuning.
+- Added `dragon_walk_forward_validation.py`.
+- Generated:
+- `dragon_walk_forward_summary.csv`
+- `dragon_walk_forward_family_year.csv`
+- `dragon_walk_forward_family_stability.csv`
+- `dragon_walk_forward_report.md`
+- Walk-forward conclusions on the fixed current baseline:
+- anchored expanding windows positive out-of-sample years `8/10`
+- rolling 3Y windows positive out-of-sample years `7/8`
+- strongest persistent family remains `glued_buy`; `early_crash_probe_buy` also remains strong but smaller-sample
+- weakest family persistence remains `deep_oversold_rebound_buy`; `dual_gold_resonance_buy` and `post_sell_rebound_buy` are secondary / weaker persistence families
+
+- Added `dragon_research_baseline.py`.
+- Generated:
+- `dragon_baseline_config_snapshot.json`
+- `dragon_formal_research_baseline.md`
+- Formal baseline classification now fixed as:
+- core alpha families: `glued_buy`, `early_crash_probe_buy`, `oversold_recovery_buy`
+- structural support families: `dual_gold_resonance_buy`, `deep_oversold_rebound_buy:classic_oversold`
+- frozen bridge rules: `predictive_b1_break_exit`, `predictive_error_reentry_buy`, plus related internal hold gates that only preserve workbook split paths
+- redundant label: `non_glued_positive_expansion_buy`
+- active research families: remaining weak deep-oversold subtypes, `post_washout_kdj_reentry_buy`, `oversold_reversal_after_ql_buy`, `post_sell_rebound_buy`
+- Current stage judgment:
+- the workbook-preserving reconstruction baseline is now formalized
+- next work should target either:
+- Track A: subtype-aware redesign of weak deep-oversold entries
+- Track B: short-holding drag reduction in `00-05d` / `06-10d`
+- not further predictive-break tuning or aux-layer micro-optimization
+
+- Continued Track A work then implemented a switchable deep-oversold confirmation branch in `dragon_strategy.py` and `dragon_strategy_config.py`, with default behavior still unchanged.
+- New config controls:
+- `deep_oversold_confirm_weak_with_ql`
+- `deep_oversold_confirm_window_bars`
+- Added pending-state support for weak deep-oversold subtype setups so alpha-first experiments can delay entry until later `QL` confirmation without touching the formal baseline.
+- Added `dragon_deep_oversold_confirmation_experiments.py`.
+- Generated:
+- `dragon_deep_oversold_confirmation_experiments.csv`
+- `dragon_deep_oversold_confirmation_event_changes.csv`
+- `dragon_deep_oversold_confirmation_experiments.md`
+- `dragon_deep_oversold_confirmation_review.md`
+- Key result:
+- `QL` confirmation for weak deep-oversold subtypes improves alpha-first branch metrics somewhat (`avg_return` up to about `2.73%`, `profit_factor` up to about `3.66`)
+- but this improvement comes mainly from vetoing weak trades, not from turning them into strong confirmed winners
+- `2022-03-11`, `2024-01-18`, `2024-01-23` are clean veto wins
+- delayed confirmed entries such as `2022-03-17` and `2024-08-30` still remain losing trades
+- Quant implication:
+- for future alpha-first research, weak deep-oversold redesign should prioritize selective veto / removal before adding more confirmation complexity
+- for the workbook-preserving baseline, no change should be applied from this branch
+
+- Track A then moved from delayed-confirmation to narrow selective-veto experiments.
+- Added more alpha-first experiment hooks in `dragon_strategy_config.py` / `dragon_strategy.py`:
+- `deep_oversold_selective_positive_b1_c1_max`
+- `deep_oversold_selective_shallow_c1_min`
+- `deep_oversold_selective_shallow_b1_min`
+- `deep_oversold_selective_mixed_c1_max`
+- `deep_oversold_selective_mixed_require_no_ql`
+- Added `dragon_deep_oversold_selective_veto_experiments.py`.
+- Generated:
+- `dragon_deep_oversold_selective_veto_experiments.csv`
+- `dragon_deep_oversold_selective_veto_event_changes.csv`
+- `dragon_deep_oversold_selective_veto_experiments.md`
+- `dragon_deep_oversold_selective_veto_review.md`
+- Key result:
+- best branch is `selective_veto_plus_mixed_c1_lt_10_2_no_ql`
+- metrics: `103` trades, avg_return about `2.81%`, profit_factor about `3.96`
+- this is better than broad blocking of all remaining weak subtypes (`102` trades, avg_return about `2.78%`, profit_factor about `3.76`)
+- and also loses fewer aligned dates
+- Best branch removes four clearly weak deep-oversold trades:
+- `2022-02-09`
+- `2022-03-11`
+- `2024-01-18`
+- `2024-01-23`
+- while preserving the more borderline chains:
+- `2022-03-16`
+- `2024-08-29`
+- Current quant judgment:
+- Track A priority is now clear:
+- narrow pathological-pattern veto > delayed `QL` confirmation > broad subtype deletion
+- workbook-preserving baseline still unchanged
+- alpha-first branch best current candidate is the selective-veto package, not the confirmation package
+
+- Stage 3 was then formally closed with branch-level governance and completion artifacts.
+- Added `dragon_alpha_first_baseline.py`.
+- Generated:
+- `dragon_alpha_first_baseline.md`
+- `dragon_alpha_first_config_snapshot.json`
+- `dragon_alpha_first_branch_summary.csv`
+- `dragon_alpha_first_branch_comparison.csv`
+- `dragon_alpha_first_branch_holding_buckets.csv`
+- `dragon_alpha_first_branch_walk_forward.csv`
+- `dragon_alpha_first_branch_trade_diff.csv`
+- Alpha-first candidate baseline fixed as `alpha_first_selective_veto` with:
+- trades `103`
+- avg_return about `2.81%`
+- profit_factor about `3.96`
+- real BUY / SELL overlap `102 / 101`
+- short-holding buckets improved versus workbook baseline:
+- `00-05d` about `-2.03% -> -1.72%`
+- `06-10d` about `-0.81% -> -0.69%`
+- walk-forward also improved modestly while keeping the same positive-year counts:
+- anchored `8/10` positive years, average test return improved
+- rolling 3Y `7/8` positive years, average test return improved
+- trade diff vs workbook baseline is simple and interpretable:
+- removed only 4 pathological deep-oversold trades
+- added 0 new trades
+
+- Added final closure document:
+- `dragon_stage3_completion.md`
+- Final stage judgment:
+- Stage 1 complete
+- Stage 2 complete
+- Stage 3 complete
+- Current governance:
+- `workbook_preserving` is the authoritative reconstruction baseline
+- `alpha_first_selective_veto` is the leading performance-oriented research branch
+- future work must explicitly choose the branch before continuing optimization
+
+- Follow-up short-holding governance review completed after Stage 3 closure.
+- Confirmed `dragon_short_holding_master_review.md` already existed and was valid.
+- Added `alpha_first_glued_selective_veto` in `dragon_branch_configs.py` plus formal review script `dragon_glued_alpha_candidate.py`.
+- Generated:
+- `dragon_glued_alpha_candidate_summary.csv`
+- `dragon_glued_alpha_candidate_comparison.csv`
+- `dragon_glued_alpha_candidate_holding_buckets.csv`
+- `dragon_glued_alpha_candidate_walk_forward.csv`
+- `dragon_glued_alpha_candidate_trade_diff_vs_alpha.csv`
+- `dragon_glued_alpha_candidate_trade_diff_vs_workbook.csv`
+- `dragon_glued_alpha_candidate_config_snapshot.json`
+- `dragon_glued_alpha_candidate_review.md`
+- Candidate result:
+- trades `92`
+- avg_return `3.35%`
+- profit_factor `4.95`
+- real BUY / SELL overlap `90/89`
+- short buckets improved further:
+- `00-05d` `-1.67%`
+- `06-10d` `-0.58%`
+- walk-forward improved too:
+- anchored `9/10` positive, avg test return `3.86%`
+- rolling 3Y `7/8` positive, avg test return `4.78%`
+- Governance conclusion:
+- do not replace current formal alpha-first baseline yet
+- keep `alpha_first_selective_veto` as official alpha-first branch
+- keep `alpha_first_glued_selective_veto` as next research branch because overlap loss is much larger (`102/101 -> 90/89`)
+- Trade-diff detail:
+- vs alpha-first, glued candidate removes `12` trades and adds `1`
+- all `12` removals are `glued_buy`
+- added trade is fallback reroute `2021-11-22 -> 2021-11-30`, `dual_gold_resonance_buy -> small_positive_a1_declining:kdj_sell`
+
+- Continued immediately with glued-branch residual attribution instead of blind retuning.
+- Added:
+- `dragon_glued_veto_attribution.py`
+- `dragon_glued_veto_attribution.csv`
+- `dragon_glued_veto_bucket_summary.csv`
+- `dragon_glued_veto_review.md`
+- Attribution result on the `12` removed trades vs `alpha_first_selective_veto`:
+- removed-set avg_return `-1.60%`
+- win_rate `8.33%`
+- profit_factor `0.03`
+- bucket split:
+- `low_weak_range`: `4` trades, all losing, avg_return `-2.35%`, avg_holding `3.0`, clean promotion candidate
+- `hot_positive_b1`: `8` trades, `7` keep-veto + `1` observe-veto, avg_return `-1.23%`, avg_holding `6.1`
+- only borderline sample is:
+- `2021-11-05 -> 2021-11-18`, `glued_buy -> ql_mid_zone_take_profit`, return `+0.69%`
+- this suggested narrowing hot veto instead of rolling back glued veto globally
+
+- Added configurable hot-cap support:
+- `glued_selective_hot_c1_max` in `dragon_strategy_config.py`
+- corresponding condition update in `dragon_strategy.py`
+- Added focused refinement pack:
+- `dragon_glued_refine_experiments.py`
+- `dragon_glued_refine_experiments.csv`
+- `dragon_glued_refine_experiments.md`
+- `dragon_glued_refined_candidate_config.json`
+- `dragon_glued_refined_trade_diff_vs_full.csv`
+- added branch helper `alpha_first_glued_refined_hot_cap_config()` in `dragon_branch_configs.py`
+
+- Refined glued candidate result:
+- `glued_veto_hot_cap75_and_low`
+- trades `92`
+- avg_return `3.36%`
+- profit_factor `4.98`
+- real BUY / SELL overlap `91/90`
+- This is better than the prior full glued candidate on both performance and overlap.
+- Minimal diff vs prior full glued branch:
+- add back `2021-11-05 -> 2021-11-18`, `glued_buy -> ql_mid_zone_take_profit`
+- remove fallback reroute `2021-11-22 -> 2021-11-30`, `dual_gold_resonance_buy -> small_positive_a1_declining:kdj_sell`
+- Updated stage judgment:
+- `alpha_first_selective_veto` still remains the formal alpha-first baseline
+- next research branch should now be the refined glued candidate, not the old full glued candidate
+
+- Completed the formal upgrade-review pack for the refined glued branch.
+- Added:
+- `dragon_glued_refined_branch_review.py`
+- `dragon_glued_refined_branch_summary.csv`
+- `dragon_glued_refined_branch_comparison.csv`
+- `dragon_glued_refined_branch_walk_forward.csv`
+- `dragon_glued_refined_branch_trade_diff.csv`
+- `dragon_glued_refined_holding_breakdown.csv`
+- `dragon_glued_refined_yearly_breakdown.csv`
+- `dragon_glued_refined_family_breakdown.csv`
+- `dragon_glued_refined_regime_breakdown.csv`
+- `dragon_glued_refined_branch_config_snapshot.json`
+- `dragon_glued_refined_branch_review.md`
+- Result for `alpha_first_glued_refined_hot_cap`:
+- trades `92`
+- avg_return `3.36%`
+- profit_factor `4.98`
+- avg_MFE `7.57%`
+- avg_MAE `-2.57%`
+- real BUY / SELL overlap `91/90`
+- walk-forward:
+- anchored `9/10`, avg test return `3.87%`
+- rolling 3Y `7/8`, avg test return `4.79%`
+- relative to current `alpha_first_selective_veto`:
+- avg_return `+0.55%`
+- profit_factor `+1.02`
+- overlap `-11/-11`
+- removed trades `11`, added trades `0`
+- Governance conclusion from the review:
+- quality and walk-forward gate now pass
+- but promotion still should not be silent because the overlap loss remains material
+- recommended status remains:
+- keep `alpha_first_selective_veto` as formal alpha-first baseline
+- keep `alpha_first_glued_refined_hot_cap` as the leading next alpha-first candidate
+
+- Also completed refined removed-trade attribution.
+- Added:
+- `dragon_glued_refined_removed_trade_attribution.py`
+- `dragon_glued_refined_removed_trade_attribution.csv`
+- `dragon_glued_refined_removed_trade_review.md`
+- Removed-set result vs current alpha-first:
+- removed trades `11`
+- avg_return `-1.81%`
+- win_rate `0%`
+- profit_factor `0.00`
+- recommendation mix:
+- `KEEP_REMOVAL` `11`
+- `OBSERVE_REMOVAL` `0`
+- `OVER_REMOVAL` `0`
+- The refined branch now removes only losing short-holding glued trades from the current alpha-first baseline; no profitable sample remains in the removed set.
+
+- Completed final alpha-branch governance package.
+- Added:
+- `dragon_alpha_branch_governance.py`
+- `dragon_alpha_branch_governance_matrix.csv`
+- `dragon_alpha_branch_governance_decision.json`
+- `dragon_alpha_branch_governance.md`
+- Final gate results:
+- `headline_quality_gate = PASS`
+- `stability_gate = PASS`
+- `removal_quality_gate = PASS`
+- `alignment_cost_gate = FAIL`
+- explicit deltas of refined candidate vs current formal alpha:
+- avg_return `+0.55%`
+- profit_factor `+1.02`
+- BUY overlap `-11`
+- SELL overlap `-11`
+- removed trades `11`, added trades `0`
+- Final governance decision:
+- `DUAL_TRACK_GOVERNANCE`
+- Meaning:
+- `alpha_first_selective_veto` stays as the formal alpha-first baseline
+- `alpha_first_glued_refined_hot_cap` becomes the governed leading candidate, but not auto-promoted because overlap loss exceeds the automatic-promotion tolerance
+
+- User then explicitly supported the stronger alpha-first view and asked for the next research direction and detailed plan under that stance.
+- Planning implication:
+- next roadmap should treat `alpha_first_glued_refined_hot_cap` as the main forward candidate and `alpha_first_selective_veto` as the benchmark control, rather than continuing workbook-style fine-tuning.
+
+- Executed the first full formalization-validation pack under the stronger alpha-first direction.
+- Added:
+- `dragon_research_direction_update.md`
+- `dragon_forward_branch_roles.md`
+- `dragon_cost_stress_test.py`
+- `dragon_cost_stress_test.csv`
+- `dragon_cost_stress_test.md`
+- `dragon_glued_refined_sensitivity.py`
+- `dragon_glued_refined_sensitivity.csv`
+- `dragon_glued_refined_sensitivity_summary.csv`
+- `dragon_glued_refined_sensitivity.md`
+- `dragon_glued_refined_year_regime_review.py`
+- `dragon_glued_refined_year_regime_review.csv`
+- `dragon_glued_refined_regime_review.csv`
+- `dragon_glued_refined_holding_review.csv`
+- `dragon_glued_refined_family_review.csv`
+- `dragon_glued_refined_year_regime_review.md`
+- `dragon_equity_curve_review.py`
+- `dragon_equity_curve_review.csv`
+- `dragon_drawdown_review.csv`
+- `dragon_monthly_return_review.csv`
+- `dragon_yearly_return_review.csv`
+- `dragon_equity_curve_review.md`
+
+- Core validation conclusions:
+- cost stress:
+- refined remains ahead at every tested cost level
+- at `20 bps/side`, current alpha CAGR `23.55%`, refined CAGR `26.62%`
+- local sensitivity:
+- neighborhood cases `81`
+- avg_return range `3.23% -> 3.42%`
+- PF range `4.66 -> 5.11`
+- robust-nearby cases `52`
+- year/regime:
+- improvements concentrate in short-holding cleanup and `glued_buy`
+- medium and long buckets are preserved
+- equity curve:
+- refined is best on growth and drawdown quality together
+- CAGR `31.32%`
+- max DD `-12.79%`
+- Calmar `2.45`
+
+- Updated stage judgment:
+- the refined alpha candidate now looks quantitatively robust across:
+- cost pressure
+- local threshold perturbation
+- year/regime consistency
+- drawdown quality
+- the only remaining blocker is governance preference on workbook divergence, not lack of quantitative evidence
+
+- Added `dragon_alpha_promotion_decision.md`.
+- This document converts the prior "governed candidate" status into an explicit recommendation tree:
+- keep `alpha_first_selective_veto` if workbook continuity is still a hard governance constraint
+- promote `alpha_first_glued_refined_hot_cap` if the objective is explicitly robust alpha first
+- otherwise keep dual-track governance but use refined as the forward research default and selective-veto as the benchmark control
+- Practical conclusion after this step:
+- quant evidence now points clearly to refined as the better strategy branch
+- non-promotion is now a governance choice, not an evidence gap
+
+- Added `dragon_forward_research_plan.md` so the next-stage roadmap is fixed in one file for later verification.
+- The plan formalizes the next work around `alpha_first_glued_refined_hot_cap` and splits it into:
+- branch freeze
+- alpha attribution
+- execution-aware robustness
+- formal governance
+- final strategy memo
+- Immediate execution focus remains Phase 2: explain exactly where refined alpha comes from.
+
+- Completed Phase 2 refined attribution work.
+- Added:
+- `dragon_refined_alpha_attribution.py`
+- `dragon_refined_family_decomposition.csv`
+- `dragon_refined_alpha_attribution.csv`
+- `dragon_refined_removed_trade_recheck.csv`
+- `dragon_refined_edge_review.md`
+- Main conclusions:
+- refined alpha still comes mainly from `glued_buy`
+- the branch wins by deleting weak short glued trades rather than adding complex paths
+- removed trades vs control remain `11`, all classified `KEEP_REMOVAL`
+- removed-set avg_return `-1.81%`, win_rate `0%`
+
+- Completed execution-aware robustness validation.
+- Added:
+- `dragon_refined_execution_validation.py`
+- `dragon_refined_execution_stress.csv`
+- `dragon_refined_latency_review.csv`
+- `dragon_refined_risk_cluster_review.csv`
+- `dragon_refined_stability_review.md`
+- Main conclusions:
+- refined still leads under next-open execution: avg_return `3.31%` vs `2.76%`, PF `4.73` vs `3.78`
+- refined still leads under next-close execution: avg_return `2.44%` vs `1.98%`, PF `2.78` vs `2.37`
+- refined still leads under next-open + `20 bps/side`: CAGR `25.51%` vs `22.40%`, PF `3.64` vs `2.92`
+- refined also improves risk clusters under next-open:
+- max loss streak `8` vs `10`
+- worst 5-trade sum `-7.96%` vs `-10.11%`
+- max drawdown `-13.19%` vs `-17.84%`
+
+- Completed formal strategy packaging.
+- Added:
+- `dragon_formal_strategy_governance.md`
+- `dragon_parameter_governance.md`
+- `dragon_strategy_monitoring_template.csv`
+- `dragon_formal_strategy_memo.md`
+- This closes the staged roadmap from Phase 1 through Phase 5 in the current session.
+- Workspace-level conclusion is now explicit:
+- `alpha_first_glued_refined_hot_cap` is the best branch quantitatively
+- if not promoted, that is now a governance decision rather than a missing-research issue

+ 433 - 0
research/dragon/v2/memory/2026-04-05.md

@@ -0,0 +1,433 @@
+## 2026-04-05
+
+- Started the quasi-production phase after the formal research and governance pack was completed on `2026-04-04`.
+- The next practical objective shifted from further historical tuning to:
+- freeze the current best branch as `RC1`
+- generate daily signals on live-updated data
+- generate a monitoring snapshot against formal thresholds
+
+- Added `dragon_rc1_release.py`.
+- Generated:
+- `dragon_rc1_release.md`
+- `dragon_rc1_config_snapshot.json`
+- `RC1` was frozen from branch `alpha_first_glued_refined_hot_cap`.
+- Frozen headline:
+- trades `91`
+- win_rate `52.75%`
+- avg_return `3.42%`
+- profit_factor `5.11`
+- compounded `1424.12%`
+- CAGR `31.31%`
+- max_drawdown `-12.79%`
+
+- Added `dragon_daily_signal_pipeline.py`.
+- Generated:
+- `dragon_daily_signal_snapshot.csv`
+- `dragon_daily_branch_status.csv`
+- `dragon_daily_monitor_snapshot.csv`
+- `dragon_daily_rc1_manifest.json`
+- `dragon_daily_signal_report.md`
+- plus dated archive copies under `daily_reports/`
+
+- Live data fetch was validated through `akshare -> data_fetcher_v2 -> dragon_indicators`.
+- Request date was `2026-04-05`, but the actual latest available market bar was correctly identified as `2026-04-03`.
+- This avoids treating the weekend as a trading day.
+
+- Daily branch status on latest available bar `2026-04-03`:
+- refined branch `alpha_first_glued_refined_hot_cap`: flat
+- control branch `alpha_first_selective_veto`: flat
+- latest real event for both branches: `2026-02-13 SELL knife_take_profit_2_glued`
+- latest bar values:
+- close `3317.184`
+- a1 `-0.0157`
+- b1 `-0.1435`
+- c1 `47.26`
+- latest bar had no new real or aux events for either branch
+
+- Monitoring snapshot on `2026-04-03` after fixing the drawdown-threshold direction:
+- warnings `0`
+- hard breaches `0`
+- next_open avg_return delta vs control `+0.53%`
+- next_open profit_factor delta vs control `+0.92`
+- next_open max_drawdown refined `-13.19%`
+- next_open max loss streak refined `8`
+- next_open + `20 bps/side` CAGR refined/control `25.17% / 22.07%`
+
+- A small implementation bug was found and fixed:
+- `dragon_strategy_monitoring_template.csv` had the drawdown threshold direction wrong for negative drawdown values
+- it was corrected from `>=` to `<=`
+- after rerun, monitoring status became fully `ok`
+
+- Practical workspace status after this step:
+- the best branch is now frozen as `RC1`
+- daily signal production is runnable
+- daily monitoring is runnable
+- the project is ready to move into forward observation / daily tracking rather than more in-sample tuning
+
+- Continued immediately into the forward-observation layer.
+- Patched `dragon_daily_signal_pipeline.py` so `as_of_request_date` is dynamic rather than hard-coded.
+
+- Added `dragon_forward_observation_pipeline.py`.
+- Generated:
+- `dragon_forward_observation_log.csv`
+- `dragon_forward_observation_state.json`
+- `dragon_signal_change_log.csv`
+- `dragon_signal_change_review.md`
+- `dragon_branch_divergence_log.csv`
+- `dragon_branch_divergence_report.md`
+- `dragon_monitor_history.csv`
+- `dragon_monitor_health_report.md`
+- `dragon_forward_weekly_summary.csv`
+- `dragon_forward_weekly_review.md`
+- plus dated CSV archives under `forward_reports/`
+
+- First forward-observation snapshot on latest bar `2026-04-03`:
+- both refined and control branches remained flat
+- same latest real event: `2026-02-13|SELL|knife_take_profit_2_glued`
+- divergence level `none`
+- signal change log only contains initial `branch_initialized` records for both branches
+- monitor history now has the first dated row-set with all metrics in `ok`
+
+- Practical implication:
+- the project now has:
+- frozen `RC1`
+- daily signal generation
+- daily monitor generation
+- cumulative forward observation log
+- branch divergence tracking
+- monitor history with streak counters
+- weekly forward summary scaffold
+- next work should focus on accumulating real forward observations rather than changing the strategy core
+
+- Added formal HTML reporting pages on top of the forward-observation layer.
+- `dragon_daily_signal_pipeline.py` now emits three-strategy daily status including:
+- `workbook_preserving`
+- `alpha_first_selective_veto`
+- `alpha_first_glued_refined_hot_cap`
+- `dragon_forward_weekly_summary.csv` now also includes all three strategies.
+- Rebuilt `dragon_html_reports.py` to generate:
+- `dragon_reports_index.html`
+- `dragon_daily_signal_report.html`
+- `dragon_forward_weekly_review.html`
+- dated archive copies under `html_reports/`
+- `html_reports/index.html`
+- Verified the HTML files are proper UTF-8 text; prior Chinese mojibake came from PowerShell display, not file corruption.
+
+- Fixed HTML internal-link bug:
+- root pages and archived pages now use different relative link maps
+- links inside `html_reports/` no longer incorrectly point to nested `html_reports/html_reports/...`
+- Added next-step presentation upgrade:
+- index page now includes headline RC1 summary cards
+- index page now includes inline equity and yearly-return charts
+- added one-click refresh script `update_dragon_reports.ps1`
+
+- Added HTML versions of the Chinese usage docs:
+- `dragon_html_report_usage_cn.html`
+- `dragon_html_report_quickstart_cn.html`
+- these are now linked from the main HTML index page and from the shared top navigation
+- archived copies are also generated into `html_reports/`
+
+- Added historical full-trade detail outputs for all three strategies:
+- `dragon_historical_trade_details.csv`
+- `dragon_historical_trade_details.html`
+- dated archive CSV in `daily_reports/`
+- dated archive HTML in `html_reports/`
+- Detail fields now include:
+- buy/sell date
+- buy/sell price
+- buy/sell reason
+- holding days
+- return_pct
+- capital_before
+- pnl_amount
+- capital_after
+- Daily report and index page now both link directly to the historical detail page for audit use.
+
+- Added investor-facing indicator/strategy theory guide:
+- source markdown: `dragon_indicator_strategy_guide_cn.md`
+- html page: `dragon_indicator_strategy_guide_cn.html`
+- archived html copy in `html_reports/`
+
+- Upgraded the investor-facing guide page into a fuller illustrated explainer.
+- Added sections:
+- `指标速查卡`
+- `按市场状态来理解指标`
+- `详细指标值与触发举例`
+- `常见真实买卖规则速查表`
+- `三版本当前统计对照`
+- `普通投资者最容易误解的 4 件事`
+- `看完原理后,下一步看哪里`
+- Verified that both `dragon_indicator_strategy_guide_cn.html` and `html_reports/dragon_indicator_strategy_guide_cn.html` contain the new sections and still include the 3 SVG diagrams.
+- The guide now also includes RC1-oriented rule tables with:
+- representative real BUY / SELL rules
+- typical trigger ranges / event conditions
+- historical occurrence counts from `dragon_historical_trade_details.csv`
+- Added cross-page drilldown:
+- rule names in `dragon_indicator_strategy_guide_cn.html` now link directly to `dragon_historical_trade_details*.html`
+- links carry URL params for `branch=alpha_first_glued_refined_hot_cap` plus rule keyword
+- historical detail page now reads `branch/year/keyword` from query parameters and auto-applies filters on load
+- historical detail page also now shows a visible source banner when opened from a filtered deep link
+- added a `清空筛选,查看完整明细` link that resets back to the plain page path
+- historical detail page was further upgraded with expandable per-trade detail rows
+- each trade now has:
+- `详情 / 收起` toggle
+- verdict, point-difference, equivalent units, holding bucket
+- quick links for same buy rule / same sell rule / same strategy-year / full detail
+- Added adjacent-trade navigation inside expanded detail rows:
+- `上一笔同策略交易`
+- `下一笔同策略交易`
+- clicking adjacent-trade links expands the target row and scrolls to it
+- linked from index, daily report, and the shared top navigation as `指标原理`
+- Historical detail HTML was upgraded again for audit depth.
+- Each expanded trade row now includes:
+- `买入日前后 10 个交易日`
+- `卖出日前后 10 个交易日`
+- Snapshot fields:
+- `date`
+- marker (`买入日` / `卖出日`)
+- `close`
+- `a1`
+- `b1`
+- `c1`
+- `KDJ`
+- `QL`
+- Snapshots are rendered on demand when a row is expanded, not pre-expanded for all trades.
+- `dragon_html_reports.py` now auto-loads indicator coverage for this page:
+- first tries local snapshot coverage
+- if coverage is insufficient, fetches and recomputes full history through `DragonIndicatorEngine`
+- writes `dragon_indicator_snapshot_full.csv`
+- uses an in-process cache so root + archived historical detail pages only fetch once per rebuild
+- Verified final embedded indicator coverage now reaches `2026-04-03`.
+- This fixes the earlier detail-page gap where embedded indicator rows stopped at `2026-01-30`.
+
+- Historical detail HTML was upgraded one more step from indicator-only snapshots to audit snapshots.
+- Each snapshot card now also shows:
+- rule summary in the card header
+- same-window strategy events for the current branch
+- event tags distinguish:
+- `真实BUY`
+- `真实SELL`
+- `辅助BUY`
+- `辅助SELL`
+- `dragon_html_reports.py` now rebuilds branch event payloads for:
+- `workbook_preserving`
+- `alpha_first_selective_veto`
+- `alpha_first_glued_refined_hot_cap`
+- these event payloads are rendered inside the snapshot mini-table as a new `策略事件` column
+
+- Historical detail snapshots were upgraded again with a window-level event summary strip.
+- In each buy/sell snapshot card, `dragon_html_reports.py` now computes from embedded `eventMap`:
+- total event count in the +/-10 trading-day window
+- counts for `真实BUY / 真实SELL / 辅助BUY / 辅助SELL`
+- nearest event before the marker day
+- same-day event summary
+- nearest event after the marker day
+- The summary is rendered as `.snapshot-summary` under the mini-table and above the indicator note.
+- Rebuild verification completed successfully:
+- `py -3 -m py_compile dragon_html_reports.py`
+- `py -3 dragon_html_reports.py`
+- verified root and archived historical detail HTML both contain the new summary script/output markers:
+- `snapshot-summary`
+- `总事件`
+- `前一条 / 当日 / 后一条`
+
+- Handoff note for future Codex CLI/session switch:
+- latest completed UI/reporting change is the historical-detail snapshot event-summary strip in `dragon_html_reports.py`
+- generated outputs already refreshed:
+- `dragon_historical_trade_details.html`
+- `html_reports/dragon_historical_trade_details_2026-04-03.html`
+- status:
+- implemented
+- rebuilt
+- verified
+- scope remained reporting-only; no strategy-core or branch-logic changes were made in this step
+
+- A formal code review was then run on the current productionized chain:
+- `dragon_strategy.py`
+- `dragon_daily_signal_pipeline.py`
+- `dragon_forward_observation_pipeline.py`
+- `dragon_refined_execution_validation.py`
+- `dragon_html_reports.py`
+- Main findings fixed immediately:
+- daily monitor no longer hard-codes `removed_trade_over_removal_count=0` and `local_sensitivity_robust_case_count=52`
+- these two metrics are now loaded dynamically from:
+- `dragon_glued_refined_removed_trade_attribution.csv`
+- `dragon_glued_refined_sensitivity.csv`
+- next-bar execution models no longer silently fall back to same-bar close when the next bar is missing
+- missing next-bar prices are now set to `NaN`, then excluded inside `_apply_execution_model(...)`
+- `_summary(...)` and `_risk_cluster(...)` were hardened for empty post-filter trade sets
+- weekly summary no longer repeats global warning/divergence counts inside every branch row
+- `dragon_forward_weekly_summary.csv` now keeps branch rows branch-local and adds a separate `system_monitor` row for global monitor/divergence counts
+- Verification rerun completed:
+- `py -3 -m py_compile dragon_daily_signal_pipeline.py dragon_refined_execution_validation.py dragon_forward_observation_pipeline.py dragon_html_reports.py`
+- `py -3 dragon_daily_signal_pipeline.py`
+- `py -3 dragon_forward_observation_pipeline.py`
+- `py -3 dragon_refined_execution_validation.py`
+
+- External review findings were then fixed:
+- `dragon_indicators.py` no longer depends on hard-coded workstation path `D:\\work\\project\\cyb50-quant\\dragon`
+- it now resolves repo root from `__file__` and imports dependencies from `<repo>/dragon`
+- `dragon_alpha_first_baseline.py` now trims trades by both:
+- `buy_date`
+- `sell_date`
+- against workbook event window, so post-window exits are excluded from branch summary stats
+- also aligned alpha-vs-workbook trade diff to the same filtered workbook trade set
+- verified after rerun:
+- `py -3 -m py_compile dragon_indicators.py dragon_alpha_first_baseline.py`
+- `py -3 dragon_alpha_first_baseline.py`
+- `py -3 dragon_daily_signal_pipeline.py`
+- confirmed:
+- `dragon_alpha_first_branch_trade_diff.csv` no longer contains `2026-01-05 -> 2026-01-20`
+- `dragon_alpha_first_baseline.md` now reports removed trades `4` instead of the stale `5`
+
+- A broader workbook-window consistency sweep was then completed across evaluation/research scripts.
+- Rule used for this sweep:
+- if a script is generating in-sample / workbook-window research statistics, trade filtering must constrain both:
+- `buy_date`
+- `sell_date`
+- not just `buy_date`
+- Files updated in this sweep:
+- `dragon_backtest.py`
+- `dragon_cost_stress_test.py`
+- `dragon_deep_oversold_confirmation_experiments.py`
+- `dragon_deep_oversold_experiments.py`
+- `dragon_deep_oversold_selective_veto_experiments.py`
+- `dragon_equity_curve_review.py`
+- `dragon_glued_alpha_candidate.py`
+- `dragon_glued_refined_branch_review.py`
+- `dragon_glued_refined_removed_trade_attribution.py`
+- `dragon_glued_refined_sensitivity.py`
+- `dragon_glued_refine_experiments.py`
+- `dragon_predictive_break_experiments.py`
+- `dragon_rc1_release.py`
+- `dragon_refined_alpha_attribution.py`
+- `dragon_refined_execution_validation.py`
+- `dragon_rule_ablation.py`
+- `dragon_short_holding_audit.py`
+- `dragon_short_holding_experiments.py`
+- `dragon_strategy_overview.py`
+- `dragon_threshold_perturbation.py`
+- Explicit non-sweep exception:
+- `dragon_daily_signal_pipeline.py` remained live-oriented and was not upper-bounded by workbook end date on purpose
+- Regression verification completed:
+- full `py_compile` passed for all updated scripts
+- representative reruns passed for:
+- `dragon_backtest.py`
+- `dragon_strategy_overview.py`
+- `dragon_rc1_release.py`
+- `dragon_refined_execution_validation.py`
+- `dragon_cost_stress_test.py`
+- `dragon_rule_ablation.py`
+- `dragon_threshold_perturbation.py`
+- `dragon_glued_refined_branch_review.py`
+- `dragon_glued_refined_sensitivity.py`
+- `dragon_glued_alpha_candidate.py`
+- `dragon_short_holding_audit.py`
+
+- System review closure completed later on `2026-04-05`.
+- Root cause of the remaining review warnings was confirmed to be metric-window inconsistency, not strategy-core divergence.
+- `dragon_alpha_first_baseline.py` was further aligned to the same bounded release window used by the main summary pack:
+- `2016-01-01` to `2025-12-31`
+- This removed the stale real-BUY overlap drift caused by the workbook terminal `2026-01-05` BUY event being counted in only one report family.
+- CAGR-year consistency was also unified:
+- `dragon_rc1_release.py` no longer hard-codes `10.0` years
+- `dragon_refined_execution_validation.py` no longer hard-codes `10.0` years
+- both now derive evaluation years from the release window dates, matching `dragon_strategy_overview.py`
+- Important operational lesson:
+- the first rerun of `dragon_system_review.py` was launched in parallel with upstream generators, so it briefly read stale outputs
+- rerunning `dragon_system_review.py` after upstream artifacts finished removed the false residual mismatches
+- Final verified review state after the sequential rerun:
+- `dragon_review_branch_metric_consistency.md` -> mismatches `0`
+- `dragon_alpha_first_branch_summary.csv` -> workbook `105/105`, alpha `101/101`
+- `dragon_strategy_overview.csv` -> fully aligned with branch summaries
+- `dragon_rc1_config_snapshot.json` CAGR -> aligned with `dragon_strategy_overview.csv`
+- `dragon_system_review_final.md` now classifies `dragon_strategy_overview.csv` as directly trustable
+- Remaining caution is now report interpretation / forward monitoring, not internal metric-definition drift.
+
+- A second-pass governance/reporting review was completed after system-review closure.
+- Confirmed and fixed two real governance/reporting issues:
+- `dragon_alpha_branch_governance.py`
+- fixed `alignment_cost_gate` so it only blocks on overlap loss worse than `-8`; positive overlap improvements no longer fail the gate by mistake
+- fixed `removal_quality_gate` so an empty removed-trade set no longer fails promotion automatically
+- fixed the final `## Recommendation` section so it now matches `final_decision` instead of always biasing toward “keep current alpha”
+- `dragon_html_reports.py`
+- normalized `system_monitor` display labels from internal raw names to user-facing Chinese labels
+- removed the ad-hoc post-dict assignment for `BRANCH_ROLES["system_monitor"]`
+- verification rerun completed:
+- `py -3 -m py_compile dragon_alpha_branch_governance.py dragon_html_reports.py`
+- `py -3 dragon_alpha_branch_governance.py`
+- `py -3 dragon_html_reports.py`
+- current reviewed judgment:
+- no new high-severity strategy-core issue found in this second pass
+- remaining items are mainly governance-threshold choices and presentation polish, not signal correctness defects
+
+- The highest-priority remaining engineering risk was then fixed:
+- monitor-chain missing values no longer pass silently
+- `dragon_daily_signal_pipeline.py`
+- `_compare_numeric(...)` now returns `missing_data` for `NaN`
+- monitor rows no longer get blank status when `actual_value` is missing
+- daily monitor summary now reports:
+- `warning_count`
+- `hard_breach_count` where `missing_data` is treated as hard-breach-equivalent
+- `missing_data_count`
+- `dragon_forward_observation_pipeline.py`
+- monitor summary now carries `missing_data_count` and includes `missing_data` inside `hard_breach_count`
+- monitor change log now tracks `monitor_missing_data_count_changed`
+- monitor history `hard_breach_streak` now also counts `missing_data`
+- observation log and divergence log now persist `monitor_missing_data_count` / `missing_data_count`
+- `dragon_html_reports.py`
+- added `missing_data` badge color
+- daily/weekly HTML now display `缺失指标数`
+- weekly HTML is backward-compatible with older logs that do not yet contain the new column
+- verification completed:
+- `py -3 -m py_compile dragon_daily_signal_pipeline.py dragon_forward_observation_pipeline.py dragon_html_reports.py dragon_system_review.py`
+- `py -3 dragon_daily_signal_pipeline.py`
+- `py -3 dragon_forward_observation_pipeline.py`
+- `py -3 dragon_html_reports.py`
+- `py -3 dragon_system_review.py`
+- direct function-level verification:
+- `daily._compare_numeric(float('nan'), ...) -> 'missing_data'`
+- forward monitor summary treats `missing_data` as part of hard-breach-equivalent count
+
+- P2 single-source refactor was then executed on the main reporting/evaluation chain.
+- Added shared modules:
+- `dragon_shared.py`
+- centralizes `START_DATE`, `END_DATE`, `evaluation_years(...)`, `profit_factor(...)`, `format_pct(...)`, `format_num(...)`
+- `dragon_execution_common.py`
+- centralizes execution-aware `apply_execution_model(...)`, `summary(...)`, `risk_cluster(...)`
+- Main-chain scripts migrated to shared modules:
+- `dragon_strategy_overview.py`
+- `dragon_rc1_release.py`
+- `dragon_refined_execution_validation.py`
+- `dragon_daily_signal_pipeline.py`
+- `dragon_cost_stress_test.py`
+- `dragon_equity_curve_review.py`
+- Also migrated core branch-summary family scripts:
+- `dragon_alpha_first_baseline.py`
+- `dragon_glued_refined_branch_review.py`
+- `dragon_glued_refined_sensitivity.py`
+- Important structural improvement:
+- daily/RC1 scripts no longer import formatting helpers from `dragon_strategy_overview.py`
+- daily signal pipeline no longer imports execution helpers from `dragon_refined_execution_validation.py`
+- instead both use dedicated shared modules
+- Verification reruns completed:
+- `py -3 -m py_compile` passed for shared modules and migrated scripts
+- reruns passed for:
+- `dragon_strategy_overview.py`
+- `dragon_rc1_release.py`
+- `dragon_refined_execution_validation.py`
+- `dragon_daily_signal_pipeline.py`
+- `dragon_cost_stress_test.py`
+- `dragon_equity_curve_review.py`
+- `dragon_alpha_first_baseline.py`
+- `dragon_glued_refined_branch_review.py`
+- `dragon_glued_refined_sensitivity.py`
+- `dragon_system_review.py`
+- Post-refactor consistency check:
+- `dragon_review_branch_metric_consistency.md` still shows `Mismatches: 0`
+- `dragon_strategy_overview.csv`, `dragon_alpha_first_branch_summary.csv`, `dragon_glued_refined_branch_summary.csv`, and `dragon_rc1_config_snapshot.json` remain aligned
+
+- Session persistence note:
+- the useful `dragon/v2` code changes were already committed as git commit `9f7ce16` (`Add dragon v2 strategy research and reporting code`)
+- user then explicitly required that workspace memory files must also be committed, otherwise future sessions may lose context
+- immediate next git action should be a separate memory-only commit covering `MEMORY.md`, `USER.md`, and the daily memory files