Commit Graph

7 Commits

Author SHA1 Message Date
ObVious55
f4d9956c52 fix:backtest stock identity and daily-window correctness refactor (#2073)
* fix: unify local daily window stock code resolution

* fix: enforce authoritative daily window resolution

* add test

* fix: converge daily window resolution contract

* fix: preserve daily stock identity compatibility

* fix: rebuild legacy foreign market snapshots

* fix(backtest): preserve legacy JP/KR bare-code compatibility

* fix(backtest): disambiguate legacy offshore stock codes

* fix(backtest): prevent cross-market alias collisions
2026-07-27 21:40:38 +08:00
zhulinsen
ef9371003c feat: harden JP/KR suffix market support (#1817)
* feat: harden JP/KR suffix market support

* fix: define yfinance index quote metadata

* fix(review-feedback-1817): Handle JP 4-digit bare-code lookup in analysis paths

* fix(review-feedback-1817): Route 4-digit JP bases through API normalization

* fix(review-feedback-1817): 补齐外部 API/provider/运行时配置风险说明或证明该检测为误报
2026-06-27 22:10:08 +08:00
zhulinsen
b308e44827 fix: repair backtest empty result handling (#1779) 2026-06-24 21:52:07 +08:00
mumu
0ab94a8c3e fix: support KR stock autocomplete suggestions (#1723)
* fix: support KR stock autocomplete suggestions

* fix(review-feedback-1723): 补充自动补全 JP/KR 建议渲染截图、前后对比或无法截图说明

* fix(review-feedback-1723): 补充 Web 自动补全 JP/KR 建议渲染的截图或无法截图说明

* fix(review-feedback-1723): docs/review-evidence-kr-autocomplete-ui.md 是针对本 PR

* fix(review-feedback-1723): 修正 PR 描述与当前 head 的实际改动、验证范围不一致问题

* fix(review-feedback-1723): 修正 PR 描述与当前 diff 的实质性不一致,避免合入记录误导后续维护者

* fix(review-feedback-1723): 收敛 PR 描述与实际 diff 的契约不一致,避免用户误以为裸 005930 已会解析为 005930.KS

* fix(review-feedback-1723): 把描述、验证证据和兼容性说明收敛到当前 6 个改动文件真实范围,或补齐描述中声称的后端/历史链路实现与测试

* fix(review-feedback-1723): 收敛 PR 描述与实际 diff,避免把未实现的 bare-code/历史展示能力作为本 PR 已交付内容合入

* fix(review-feedback-1723): 补上相应真实代码与测试后再审

* fix(review-feedback-1723): 补齐所声称的后端实现与测试后再评审

* fix(review-feedback-1723): PR description 与当前完整 diff 不一致:描述声称新增 bare JP/KR code

* fix(review-feedback-1723): PR 描述与当前完整 diff 不一致

* fix(review-feedback-1723): 补充 Refs 1718,方便后续追踪

* fix(review-feedback-1723): 收敛描述与验证证据

* fix: resolve JP KR bare stock codes

* fix: backfill JP KR daily analysis context

* fix(review-feedback-1723): preserve persisted phase timing

* fix: align JP KR history lookup keys

* fix(review-feedback-1723): preserve raw code for snapshot lookups

* fix(review-feedback-1723): 收敛
2026-06-20 10:39:40 +08:00
mumu
d6e4699627 fix: 北交所股票处理差异,异常 (#1234) (#1235)
* fix(issue-1234): [bug]-北交所股票处理差异,异常
2026-05-09 21:48:37 +08:00
LouisHong
65e28e1faa fix: accept HK autocomplete codes on home analysis input. [fix #813] (#828)
* fix: accept HK autocomplete codes on home analysis input

The home page stock input accepted plain A-share codes but rejected Hong Kong stocks selected from autocomplete. The root cause was that autocomplete submits the suggestion canonicalCode (for example 00700.HK), while the backend stock code utility only recognized .SH/.SZ/.SS suffixes. As a result, 00700.HK was treated as mixed alphanumeric noise and rejected with the generic validation error before analysis dispatch.

Extend shared stock code recognition and normalization to accept .HK suffixes alongside existing A-share suffixes. This keeps the existing manual input behavior for 00700 and makes the backend consistent with the canonicalCode format already used by the web stock index and autocomplete flow.

Add regression coverage on both sides of the boundary: backend contract tests now verify that trigger_analysis accepts 00700.HK from autocomplete and HK00700 from manual input, and frontend tests now verify that highlighted HK suggestions submit the canonical .HK code and are not rejected by local store validation.

* update CHANGELOG.md

* fix: align HK code validation with existing market rules

Follow up the home page HK autocomplete fix by tightening the shared stock code validator so exchange suffixes and prefixes no longer reuse the same generic 5-6 digit rule.

This change keeps SH/SZ/SS suffixes restricted to 6-digit mainland codes, treats HK suffixes and HK prefixes as 1-5 digit Hong Kong codes with zero-padding during normalization, and rejects invalid cross-market combinations such as 600519.HK, HK600519, and 00700.SH.

Add regression coverage for valid short HK forms like 1810.HK and HK700, plus negative tests for invalid suffix and prefix lengths, so the shared backend utility stays consistent with the existing web validation and data-provider normalization rules.
2026-03-25 09:29:12 +08:00
Alfred
633bdda1e2 [feat] 2.2 智能导入 - 名称解析、图片提取、CSV/Excel 导入、预览确认 (#546)
* feat(#455): Markdown-to-image for dashboard, m2f engine, prefetch controls

- Dashboard report supports markdown-to-image (Telegram/WeChat/Custom/Email)
- MD2IMG_ENGINE=markdown-to-file for better emoji support
- PREFETCH_REALTIME_QUOTES to disable full-market quote prefetch
- Stock name prefetch with allow_realtime=False to reduce network overhead
- Email groups and Custom webhook image routing
- Enhanced failure hint (wkhtmltopdf or m2f)
- Docs: README, full-guide, CHANGELOG, .env.example
- Tests: prefetch_stock_names, pipeline notification routing, prefetch dry_run

Fixes #455

* chore: trigger CI and AI review refresh

* feat: intelligent import P1 - name resolver, image extract, CSV/Excel import, preview UI

- Extract STOCK_NAME_MAP to src/data/stock_mapping.py
- Add name_to_code_resolver (local map, pinyin, AkShare, fuzzy match)
- Add stock_code_utils for shared is_code_like/normalize_code
- Enhance image_stock_extractor: code+name+confidence prompt, multi-key, retry
- Add import_parser for CSV/Excel/clipboard with parse-import API
- Add IntelligentImport component (image+file+paste, dedup, confidence-based check)
- Fix single-column code import, preserve name when code dirty
- Deduplicate codes in parse-import response
- Add unit tests for resolver and import_parser

* fix: resolve TS2339 Property 'id' does not exist on type 'never'

In mergeItems when !existing, use fallback id directly instead of existing?.id
to avoid TypeScript narrowing existing to never in that branch.

* chore: address PR review - deps doc, file size check, json_repair, logging, tests

- docs/full-guide: document pypinyin and openpyxl for 智能导入
- api: add file size check before reading in parse-import
- image_stock_extractor: use json_repair fallback for malformed JSON
- import_parser/name_to_code_resolver: add debug logging
- CHANGELOG: add extract-from-image items field compatibility note
- tests: VISION_MODEL priority, json_repair when JSON invalid

* fix(image-extract): markdown strip bug, fake codes filter, EXTRACT_PROMPT doc, parse_import errors

- Fix markdown strip: only remove opening fence to avoid wiping JSON
- Add JSON to _FAKE_CODES; filter field names in fallback
- Add docs/image-extract-prompt.md; PR template EXTRACT_PROMPT block
- Refine parse_import errors: Excel/CSV actionable hints

* chore(parse_import): add detailed error logs, document AkShare cache

- Log file type, size, error on parse_import failures (JSON, file read, parse)
- Add AkShare name resolver 1h TTL cache note to docs/full-guide.md

* fix(import): handle space-separated pairs and confidence upgrade

* fix(import): address PR #546 review - Excel no-header, fuzzy cutoff, code prefix

- fix(import_parser): use header=None for read_excel; detect header row the same
  way as the CSV path to avoid silently consuming first data row as column names
- fix(name_to_code_resolver): raise difflib cutoff 0.6->0.8 and skip fuzzy
  matching for inputs of length <=2 to prevent false-positive short
  matches (e.g. '中国' matching arbitrary stocks in a 5000+ name pool)
- fix(stock_code_utils): normalize_code and is_code_like now recognise
  exchange-prefix formats SH600519, SZ000001, HK00700 (case-insensitive),
  aligning with data_provider/base.py normalize_stock_code behaviour
- tests: add test_parses_xlsx_without_header to TestParseImportFromBytesExcel;
  add tests/test_stock_code_utils.py covering prefix/suffix/plain/edge cases

---------

Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-09 19:21:50 +08:00