Skip to content

Feat/portfolio value helper#434

Merged
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
Unclebaffa:feat/portfolio-value-helper
Jun 23, 2026
Merged

Feat/portfolio value helper#434
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
Unclebaffa:feat/portfolio-value-helper

Conversation

@Unclebaffa

Copy link
Copy Markdown
Contributor

closes #430

Here's a summary of the 3 commits:

Commit 1 (8217b02) — ownership.utils.ts with calculateTotalPortfolioValue(entries) — pure function that sums balance × currentPrice across entries and returns a string.

Commit 2 (58f8384) — Updated ownership.schemas.ts (added HoldingItemSchema, HoldingsResponseSchema) and ownership.controllers.ts (transforms records, uses helper, wraps response with holdings + total_portfolio_value).

Commit 3 (76a74b2) — ownership.utils.test.ts with 5 test cases: single entry, multiple holdings, all zero prices, all zero balances, empty array.

Acceptance criteria verified:

  • Helper returns correct sum for multiple holdings (2650)
  • Helper returns zero when all prices are zero
  • Holdings endpoint response includes total_portfolio_value field

Pure helper that accepts an array of holding entries (balance +
currentPrice) and returns the summed total portfolio value as a
string. Designed for reuse across the holdings endpoint and any
future summary endpoints.
- Add HoldingItemSchema and HoldingsResponseSchema to ownership schemas
- Update controller to transform records, inject currentPrice, and
  include total_portfolio_value in the response
Covers single entry, multiple holdings, zero prices, zero balances,
and empty array edge cases.
@Chucks1093 Chucks1093 merged commit 898e0c6 into accesslayerorg:main Jun 23, 2026
1 check passed
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.

Add helper for computing total portfolio value from a holdings array

2 participants