totalsByCurrency and portfolioStructure skip CURRENCY positions: T-Bank returns the same cash both as getPositions().money and as RUB000UTSTOM/USD800UTSTOM positions. Same rule as in brokerage-accounts.service.ts.
unrealizedReturnByCurrency.percent is null for a currency with a short position (negative cost basis flipped the sign / netted with longs), consistent with instrument-position.ts.
Migration 20261028080000_reset_inflated_portfolio_value_points deletes all TbankPortfolioValuePoint rows written by the old code. They cannot be recomputed exactly (no historical compositions or FX rates); points have no public read path. TbankPortfolioValueHistory is kept. Owner-approved destructive data change; back up the SQLite file before deploy.
Verification
New regression tests fail without the fix (3) and pass with it; fixture mirrors dev.db account 2197225275 (121.49 instead of 122.74).
npm run verify green (293/293 unit, lint, typecheck, build).
Closes #140
## Changes
- `totalsByCurrency` and `portfolioStructure` skip `CURRENCY` positions: T-Bank returns the same cash both as `getPositions().money` and as `RUB000UTSTOM`/`USD800UTSTOM` positions. Same rule as in `brokerage-accounts.service.ts`.
- `unrealizedReturnByCurrency.percent` is `null` for a currency with a short position (negative cost basis flipped the sign / netted with longs), consistent with `instrument-position.ts`.
- Migration `20261028080000_reset_inflated_portfolio_value_points` deletes all `TbankPortfolioValuePoint` rows written by the old code. They cannot be recomputed exactly (no historical compositions or FX rates); points have no public read path. `TbankPortfolioValueHistory` is kept. **Owner-approved destructive data change; back up the SQLite file before deploy.**
## Verification
- New regression tests fail without the fix (3) and pass with it; fixture mirrors dev.db account 2197225275 (121.49 instead of 122.74).
- `npm run verify` green (293/293 unit, lint, typecheck, build).
- `test:sqlite tbank-value-history.e2e-spec.ts` 13/13.
- Migration applied on a copy of dev.db with a seeded point: points 1 → 0, history row kept, `migrate status` up to date.
## Follow-up
- WealthLedger/specs#60: `portfolio-view` wording should state that CURRENCY positions mirror cash (related WealthLedger/frontend#59).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #140
Changes
totalsByCurrencyandportfolioStructureskipCURRENCYpositions: T-Bank returns the same cash both asgetPositions().moneyand asRUB000UTSTOM/USD800UTSTOMpositions. Same rule as inbrokerage-accounts.service.ts.unrealizedReturnByCurrency.percentisnullfor a currency with a short position (negative cost basis flipped the sign / netted with longs), consistent withinstrument-position.ts.20261028080000_reset_inflated_portfolio_value_pointsdeletes allTbankPortfolioValuePointrows written by the old code. They cannot be recomputed exactly (no historical compositions or FX rates); points have no public read path.TbankPortfolioValueHistoryis kept. Owner-approved destructive data change; back up the SQLite file before deploy.Verification
npm run verifygreen (293/293 unit, lint, typecheck, build).test:sqlite tbank-value-history.e2e-spec.ts13/13.migrate statusup to date.Follow-up
portfolio-viewwording should state that CURRENCY positions mirror cash (related WealthLedger/frontend#59).