Skip to content

fix(portfolio-import): Price/成本列优先与货币符号数值解析 - #358

Closed
wannT-1 wants to merge 2 commits into
helsome:mainfrom
wannT-1:cursor/portfolio-import-price-currency-22ff
Closed

wannT-1 wants to merge 2 commits into
helsome:mainfrom
wannT-1:cursor/portfolio-import-price-currency-22ff

Conversation

@wannT-1

@wannT-1 wannT-1 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

改动说明

What: 当表头同时存在 Price 与成本类列时优先选用更具体的成本列;数值解析识别 HK$/US$/人民币等货币符号前缀。

Why: 导入时常见「Price + 成本」双列与带币种符号的数字,原先会选错列或解析失败。

关联 Issue

Related to portfolio import robustness (Jul slice). Does not close an issue.

测试

  • Bun 1.4.3;portfolio-import + validator:111 pass;@finagent/shared typecheck exit 0。

wannT-1 added 2 commits July 14, 2026 15:20
左侧的 Price/价格列不再抢走同一行里的 Cost、Avg Cost 或成本。只有没有更具体的成本列时,Price 才继续作为成本兜底。
券商导出把 HK$、US$、¥ 或 USD 粘在数量和成本上时,不再整格判成无效数字。只剩货币符号、没有数字的格子仍然保持无效。
@wannT-1

wannT-1 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of #356.

I measured the overlap between the four open portfolio-import PRs after rebasing them onto current main: this branch's added lines are 95% contained in #356 (38 of 40), which composes the same helpers (stripInvisible → foldNumericWidth → takeAccountingSign → stripCurrencyAffixes) in one pass. #356 is now updated against main (including #413's trailing-% confirmation and #414's semicolon CSV) with packages/shared/src/portfolio-import at 125 pass / 0 fail, so the currency-symbol and Price-vs-cost handling here lands there rather than in a second competing PR.

Thanks — no action needed on your side; reopening is trivial if #356 stalls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant