Commit Graph
77 Commits
Author SHA1 Message Date
Justin Gu 781ee6c48a feat(cli): company-info 命令合并 + examples/06_finance 文档完善
合并 company-info(列目录)与 company-info-content(读正文)为一个命令,
板块名改为可选位置参数:无参数列目录,有参数读正文。消除两个相似命令名
导致的混淆(用户曾误用 company-info SH 601088 "公司概况" 报错)。

- company-info:name_or_filename 可选,无则列 F10 板块目录,有则读正文
- company-info-content:保留为隐藏别名(hidden=True),向后兼容 v1.15.1
- 提取 _run_category/_run_content 模块级函数复用逻辑
- 新增 examples/06_finance/{README.md,company_cli.sh,company_web_api.py}
  覆盖 CLI / Python API / Web API 三种调用方式,含 16 个 F10 板块完整列表
- 更新 company_info.py 板块名为实测的 16 板块
- bump 版本号至 1.15.2
2026-06-27 04:22:43 +08:00
Justin Gu 29b6ca33aa feat(cli): 新增 finance-info / company-info / company-info-content 命令
把 TdxClient 上已封装但未暴露给 CLI 的三个 F10/财务方法做成命令,
数据源走通达信原生协议(与 Web 层 /finance /company/* 同源),
覆盖 f10(新浪三表)之外的 F10 全文板块。

- finance-info: 最新财务快照(37 字段单期指标),与 f10 多期三表互补
- company-info: F10 板块目录(最新提示/公司概况/财务分析/... 等 16 板块)
- company-info-content: 读 F10 正文,支持板块名(自动解析)或文件名
  --offset 语义随入参而定:板块名=板块内相对偏移,文件名=绝对偏移
- conn.py: 新增 get_tdx_client() 上下文管理器

补 README 命令表与 CHANGELOG。
2026-06-27 04:02:09 +08:00
Justin Gu e5bc1b1a16 docs: 将 README 中的 Changelog 迁移至独立的 CHANGELOG.md
- README 历史版本记录(1.0.0 → 1.14.5)全部搬运到 CHANGELOG.md
- README Changelog 章节替换为指向 CHANGELOG.md 的链接
- CHANGELOG.md 现包含完整 41 个版本(1.15.0 → 1.0.0)的变更记录
2026-06-25 03:41:54 +08:00
Justin Gu f36e2d6a6c feat(screen): v1.15.0 — 强势股排名 + 修复证券类型识别与名称分批查询
新增:强势股排名(screen strength)
- 全市场按 5/20/60 日涨幅加权合成强势分,纯离线扫描
- 三种预设:steady(稳健)/breakout(妖股)/balanced(均衡)
- CLI: easy-tdx screen strength --preset steady --top 50 --table
- Web API: GET /api/v1/market/strength
- 支持自定义权重、成交额过滤、并发扫描

修复:
- _detect_security_type 代码段不全,ETF/基金/科创板/逆回购被误判为 A 股
- screen strength/rank 名称补齐超 80 只时末尾被丢弃(分批查询)

详见 CHANGELOG.md
2026-06-25 03:33:13 +08:00
Justin Gu 85e0f8a65f feat(chanlun): 分钟级别日期自适应输出时分 YYYY-MM-DD HH:MM 2026-06-17 18:17:32 +08:00
Justin Gu 87f11e409c release: v1.14.4 — 修复 cmd_chanlun.py ruff format CI 失败 2026-06-16 10:03:48 +08:00
Justin Gu aa58bd9e88 release: v1.14.3 — 缠论 CLI table 模式补日期(中枢/买卖点/背驰) 2026-06-16 03:04:12 +08:00
Justin Gu 28aad8a84c release: v1.14.2 — 缠论 JSON 可视化字段增强(中枢/买卖点/背驰补日期) 2026-06-16 02:51:52 +08:00
GitHubandClaude c54071e85e release: v1.14.1 — 高级回测 ExecutionModel 路径 3 个真实数据兼容 Bug 修复
- datetime 类型分歧(致命):Trade.datetime 转 int 与 PortfolioTracker 的 Timestamp key 失配,TWAP/VWAP/Limit 路径交易全部静默丢失、权益曲线恒定、收益归零
- volume 列名分歧:回测认 volume 而真实行情为 vol,滑点 volume 恒 0 退化百分比模式,VWAP 退化为等权
- date/datetime 列名分歧:日线返回 date 列引擎要 datetime,run() 入口由 date 派生下游无感兼容
新增 3 个回归测试(均红灯验证)。650 单测通过,backtest 模块 ruff + mypy strict 清洁。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-15 20:50:49 +08:00
Justin Gu b49cfd66f8 feat(sina): 新增新浪财报三表 — 三层接入(API/CLI/Web),独立数据源 2026-06-15 00:31:13 +08:00
Justin Gu a5ce783487 release: v1.13.1 — cninfo 公告检索 Bug 修复 + PDF 下载 2026-06-15 00:05:52 +08:00
Justin Gu 574b284dd5 fix(cninfo): URL 404 + type null + 表格截断 + PDF 下载(实测 601088 暴露) 2026-06-14 23:58:24 +08:00
Justin Gu c0605698f3 docs(cninfo): 补齐 README 三层接入 demo(Python API + Web 返回结构) 2026-06-14 23:35:06 +08:00
Justin Gu 4b439920fc feat(cninfo): 新增巨潮公告检索 — 三层接入(API/CLI/Web),独立数据源 2026-06-14 23:29:19 +08:00
Justin Gu a12c2122fc feat(indicator): 新增 SAR/VWAP/AROON 三指标 + 注册 FK(30 → 34) 2026-06-14 18:46:02 +08:00
Justin Gu 37635af8f2 release: v1.11.6 — CI mypy/ruff 修复 2026-06-13 21:26:13 +08:00
Justin Gu 88638e82ad release: v1.11.5 — scipy 依赖声明 + 文档同步 + 工程化清理
- pyproject: 新增 science 可选依赖组(scipy),dev 纳入 scipy;版本号 1.11.5
- factor/analysis: spearman 分支加 scipy 软依赖保护,缺失时友好报错
- mac/client: 板块排行吞异常处补 logger.debug
- CLAUDE.md: 架构章节补全 mac/ex/unified/portfolio/factor/offline/screen 子包
- .gitignore: 补全 .coverage、signals.json
- README: 补 1.11.5 changelog
2026-06-13 21:10:35 +08:00
GitHubandClaude a6ed0eac16 docs: add quantitative guide, update README + CHANGELOG, bump v1.11.1
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-12 22:12:19 +08:00
GitHub e6ed6efcd4 chore: bump version to v1.10.5 + update changelog 2026-06-12 17:19:47 +08:00
GitHubandClaude d17895e92b feat(web): full Web API parity with CLI — 18 new endpoints (v1.10.2)
- Board analysis: list/members/belong/summary/ranking/change-ranking (6)
- Capital flow, symbol info, server info (3)
- Quote list, auction, unusual (3)
- Extended market: bars/quote/minute/transaction (4)
- Technical indicators: list + compute (2)
- Multi-client DI: AsyncMacClient + AsyncExTdxClient lifecycle
- 6 MAC enum converters, DictResponse, ComputeIndicatorsRequest schemas
- Web API endpoints: 22 → 40

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-12 16:46:48 +08:00
Justin Gu 06ce712d15 fix: CI mypy job missing [web] deps + update README intro 2026-06-12 03:52:47 +08:00
Justin Gu d904ae7af6 docs(web): update README with serve CLI, docs URL, and install instructions 2026-06-12 03:35:26 +08:00
Justin Gu 54dd65ed85 feat(web): add Web API docs to README, bump version to 1.10.0 2026-06-12 03:10:01 +08:00
GitHubandClaude Opus 4.8 e290ea3f21 feat: add board N-day change ranking (v1.9.10)
- Add get_board_change_ranking() to MacClient and AsyncMacClient
- Add 'board-change-ranking' CLI command (--type/--date/--days/--top/--asc)
- Calculate N-day price change from board index K-lines directly
- Default to listing all boards; --top N to truncate
- 12 unit tests covering calculation, edges, sorting

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 17:40:51 +08:00
Justin Gu c9ed57e66d fix: parallel scan pickle bug — pass strategy file path instead of class to child processes 2026-06-11 04:24:09 +08:00
Justin Gu ddcb9d4425 release: v1.9.8 — CI fixes (ruff .pyi exclude + pytest-asyncio + lint) 2026-06-11 04:11:01 +08:00
Justin Gu 15cc7680c4 release: v1.9.7 — CLI全量集成(workers/cache/chanlun-level/portfolio/multi-level)+ bugfix 2026-06-11 03:57:48 +08:00
Justin Gu d2f4cb126e release: v1.9.6 — Devin AI 12项改进全量落地 2026-06-11 02:40:31 +08:00
GitHubandClaude Opus 4.8 b4f63c85a6 feat: add OBV trend strategy (v1.9.5)
- New obv_trend.py strategy: OBV energy flow trend following
- Entry: OBV > MAOBV*1.02 buffer + MAOBV 20-bar uptrend confirmed
- Exit: OBV drops below MAOBV
- Tunable params: maobv_period(30), maobv_lookback(20), obv_buffer(0.02)
- Update README changelog and strategy table
- Bump version to 1.9.5

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 18:53:06 +08:00
Justin Gu 5aac7d3a39 chore: add risk disclaimer, CI pipeline, pytest coverage config
- Add risk warning after backtest demo output (survivorship bias, overfitting)
- Add disclaimer section at README end
- Add slippage comment to backtest demo command
- Add CI workflow (test + lint + mypy) for PR/push to main
- Add pytest config with coverage threshold (fail_under=50, current=56%)
2026-06-10 12:43:02 +08:00
Justin Gu c867297d45 fix: remove hardcoded version in 'version' command (v1.9.4) 2026-06-10 03:40:28 +08:00
Justin Gu 862f713483 feat: add 'run-all' CLI command for batch strategy backtesting (v1.9.3) 2026-06-10 03:24:31 +08:00
Justin Gu a3d6d93122 feat: strategy screener - scan all stocks by signal, rank by backtest performance (v1.9.2)
- Add 'screen' CLI command group with 'scan' and 'rank' subcommands
- scan: offline signal scanning from local .day files, zero network IO
- rank: backtest ranking of scanned signals by sharpe/drawdown/etc
- Two-step workflow: scan outputs JSON, rank reads JSON and evaluates
- Support --universe (all/sh/sz/custom file), --sort, --names
- Support pipe mode: scan ... | rank --from - --table
- New module: src/easy_tdx/screen/{scanner,ranker,cli}.py
- 20 unit tests (offline, no network required)
2026-06-10 03:03:03 +08:00
Justin Gu 1e99feb7c2 feat: multi-factor combo backtest engine (v1.9.0)
- Add backtest/combo.py: CombinationRunner, extract_factor_signals, combine_masks
- Signal merge modes: AND / OR / MAJORITY (majority default)
- CLI: --combo-strategies and --combo-mode for easy-tdx backtest
- run_all_strategies.py: --combo 2 --combo 3 auto-screen best combos
- Fix MyTT MFI/CR divide-by-zero RuntimeWarning
- 14 new unit tests, 328 total passing
2026-06-10 01:37:28 +08:00
GitHubandClaude Opus 4.8 7f1bc645c2 release: v1.8.2 - 5 new strategies, --show chart, 15 total
- New strategies: dmi_trend, cci_breakout, mfi_volume, trix_cross, mtm_momentum
- run_all_strategies.py --show: dual-axis equity curve vs stock price chart
- zhuoyao_momentum strategy (from earlier commit)
- README: updated strategy table (9→15), changelog, demo screenshots
- Bump version to 1.8.2

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 23:17:04 +08:00
GitHubandClaude Opus 4.8 8fcedeb47a feat(strategies): add zhuoyao_momentum strategy + Maotai demo screenshot
- New ZHUOYAO multi-timeframe momentum strategy (strategies/zhuoyao_momentum.py)
- Entry: SHORT>0 + TREND>0 + SHORT>MID (triple resonance)
- Exit: SHORT<0 or TREND<0 (conservative, any triggers sell)
- Add SH600519 Maotai demo screenshot (strategies/demo/4.png)
- Update README with 4th demo screenshot

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 22:59:19 +08:00
GitHub b57d8f4669 feat(backtest): add --show flag for best strategy equity curve chart
- Add --show/--show-chart flag to run_all_strategies.py
- Display dual-axis chart: normalized stock price vs strategy equity curve
- Mark buy/sell points with green/orange triangles
- Auto-detect Chinese fonts (SimHei/YaHei on Windows, PingFang on macOS)
- Fetch stock name via get_stock_quotes for chart title
- Add 3 demo screenshots to README with disclaimer
- Update README with --show usage and visual examples
2026-06-09 22:41:14 +08:00
GitHubandClaude Opus 4.8 b44636207b release: v1.8.1 - single-source version, batch backtest detail output
- Consolidate version to pyproject.toml as single source of truth
- __init__.py, cli/__init__.py, docs/conf.py all read dynamically
- run_all_strategies.py now shows best strategy full trade details
- Update README changelog for 1.8.1

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 22:12:27 +08:00
GitHubandClaude Opus 4.8 b5b5d0dc5b release: v1.8.0 - backtest engine with batch strategy comparison
- Add backtest section to README with CLI usage and run_all_strategies.py demo
- Update all version numbers to 1.8.0 (pyproject.toml, __init__.py, cli/__init__.py, docs/conf.py)
- Fix turtle_breakout strategy: TAQ returns 3 values (UP, MID, DOWN)
- Add run_all_strategies.py batch comparison script
- Update README intro to highlight backtest feature
- Add backtest to CLI command table and architecture tree

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 20:35:38 +08:00
GitHubandClaude Opus 4.8 8d68e9c094 docs: add backtest engine design spec
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 16:05:17 +08:00
Justin Gu 626d0aae44 docs: remove unused badges (readthedocs, black, isort) 2026-06-08 03:44:46 +08:00
Justin Gu 9d906c340c docs: add Sphinx + Read the Docs infrastructure
- Add .readthedocs.yaml build config (Ubuntu 22.04, Python 3.11)
- Add docs/conf.py with myst-parser for Markdown support
- Add docs/index.md toctree including README and existing docs
- Add docs/readme.md to include root README via myst directive
- Add docs/requirements.txt for Sphinx build dependencies
- Add docs/_build/ to .gitignore
2026-06-08 03:36:40 +08:00
Justin Gu 6f7f5bac16 docs: update README 2026-06-08 03:28:58 +08:00
Justin Gu 79670b7777 docs: rewrite README intro to reflect project mission and values 2026-06-08 03:26:47 +08:00
Justin Gu 112ba7849f fix: chanlun bi algorithm stuck in fractal trap during sustained trends
Fix find_bis() greedy algorithm terminating early when dense alternating
fractals cause gap=0 for every opposite-type fractal. The root cause was
blindly replacing start_fx with more extreme same-type fractals, pushing
right_kline_index forward and making subsequent gaps permanently 0.

Solution: add pending_opposite guard — when an opposite-type fractal fails
the gap check, freeze start_fx replacement until a valid bi is formed.

- Affects: sustained up/down trends with dense fractals (e.g. high-price stocks)
- 600519: 114 bi (ending 04-28) -> 142 bi (ending 05-27)
- 601088: 131 bi -> 147 bi (end date unchanged)
- New regression test: test_fractal_trap_regression
- Bump version to 1.7.1
2026-06-08 03:08:12 +08:00
Justin Gu 0175acec43 docs: rewrite README intro to reflect project mission and values 2026-06-07 23:41:21 +08:00
Justin Gu fd4a1233b4 feat: add chanlun (ChanLun) technical analysis module, bump to v1.7.0
- New chanlun/ subpackage: K-line merge, fractal, bi/xianduan/zhongshu/mmd/beichi
- New 'easy-tdx chanlun' CLI command with JSON/table output
- MACD calculation (pure numpy, no extra dependencies)
- Multi-level analysis (MultiLevelAnalyser)
- Pipeline: DataFrame -> merge -> fractal -> bi -> zhongshu -> xd -> mmd -> beichi
- 49 offline unit tests covering all calculation steps
- Detailed README docs with output explanation
- Bump version: pyproject.toml 1.6.1 -> 1.7.0, cli 1.5.0 -> 1.7.0
2026-06-07 23:29:52 +08:00
Justin Gu 4cab9aa325 fix: route index files to get_index_bars() in sync-daily/sync-all
Root cause: _fetch_all_daily_bars used get_security_bars() for all files,
but index server responses have 4 extra bytes per record. Wrong parser
produced garbage dates like '12897-50-77' for sh000001, sh000300, etc.

Fix: add _is_index_code() to detect index codes by prefix (sh: 00/88/99,
sz: 39) and route to get_index_bars() accordingly.

Bumps version to 1.6.1.
2026-06-07 21:55:26 +08:00
Justin Gu d01b11fa74 feat: add offline data write-back and sync commands, bump to v1.6.0
- Add write_daily.py: encode/append daily bars to .day files
- Add write_ex_daily.py: encode/append extended market daily bars
- Add write_min_bar.py: encode/append minute bars (.5/.lc1/.lc5)
- Add sync-daily CLI: sync single stock with pagination support
- Add sync-all CLI: one-command sync for all SH/SZ .day files
- Update README with sync commands and Python write API docs
- 50 new unit tests covering encode round-trip, append dedup, edge cases
- Bump version 1.5.0 -> 1.6.0
2026-06-07 21:13:49 +08:00
Justin Gu b17e98468b feat: add offline CLI commands and bump version to v1.5.0
- New 'offline' command group with 8 subcommands: home, daily, min,
  ex-files, ex-daily, gbbq, financial, blocks
- No network required, reads local TDX data files directly
- Updated CLI examples and README with offline documentation
- Added v1.5.0 changelog entry
2026-06-02 12:30:24 +08:00