Add helper for displaying total portfolio value across all held keys#393
Merged
Conversation
…lio-value Add total portfolio value to holdings overview
|
@sochima2 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Description
Adds a new helper calculatePortfolioValue with formatPortfolioValueDisplay and getPortfolioValueHelperText under src/utils/portfolioValue.utils.ts that aggregates held key positions and returns ready | loading | unavailable status along with counts and total stroops.
Integrates the helper into the marketplace (src/pages/LandingPage.tsx) via heldKeyPositions/portfolioValue memos and renders a new "Holdings overview" card that shows the formatted total, per-position price states, and an accessible loading/unavailable indicator.
Handles edge cases: zero holdings resolve to a zero total, any isPriceLoading yields a loading state, and missing or stale prices result in an unavailable state so partial totals are never shown as final.
Adds unit tests covering summed totals, zero holdings, loading state, missing price data, and stale price data at src/utils/tests/portfolioValue.utils.test.ts.
Testing
Testing
Ran unit tests with pnpm exec vitest run src/utils/tests/portfolioValue.utils.test.ts and all new tests passed (5 passed).
Performed type checking with pnpm exec tsc -b which completed successfully.
Ran lint via pnpm lint which completed with no new errors.
Built the app with pnpm build; the production build succeeded (build warnings about chunk size / injected comments are unchanged existing warnings).
pnpm lintpnpm buildChecklist
close #376