Files
Chan/docs/IMPLEMENTATION_REPORT/ECR-002.md
T
jackyu66gitandCursor df27b4dde8 refactor: ECR-002 拆分 runtime 包并加深 analyze 契约(已审)
将 web/services/runtime.py 拆为 runtime/ 子模块并保持门面兼容;补齐 ESS 文档、门面/契约/TF_DF 测试与 CODE_REVIEW Approve。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 18:15:23 +08:00

39 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# IMPLEMENTATION_REPORT — ECR-002
**Date:** 2026-08-06
**Status:** Implemented(待 CODE_REVIEW
**Change Level:** L3(行为冻结)
## What changed
`web/services/runtime.py`~1178 行)拆为包 `web/services/runtime/`
| Module | Responsibility |
|--------|----------------|
| `state.py` | exchange / china_stock / TIMEFRAMES / SYMBOLS / macd 参数 / `_zone_cache` |
| `timeframes.py` | 周期换算、默认值、大小比较、zone TTL |
| `market_data.py` | K 线拉取(datasvc / ccxt / A 股)、元信息刷新 |
| `indicators.py` | `add_indicators` / `calculate_macd` |
| `analyze.py` | `analyze_chan` / `classify_trend_stage` |
| `serialize.py` | ChanMACD 序列化、JSON 清洗、未完成线段 |
| `__init__.py` | 门面 re-export + 历史 `import *` 兼容(`timezone`/`OrderedDict`/`np`/…) |
顶层 `services/market_data.py` 等薄 shim 仍从 `services.runtime` 再导出。
**未做(ECR 可选):** `chart_tv.js` 拆分。
## Compatibility
- `from services.runtime import *` / `import services.runtime as R` 保持可用
- `/api/analyze` 字段未删减
- golden 未改算法
## Tests
`docs/TEST_REPORT/ECR-002.md`13 passed)。
## Follow-ups
- CODE_REVIEW Approve
- 可选:`symbols.macd_config` POST 写回 `state.macd_*`(历史 quirks,本 ECR 未改)