Repository navigation
feat: add portfolio performance chart with range selectors - #1068
Merged
Chucks1093 merged 1 commit intoSep 29, 2026
Merged
Chucks1093 merged 1 commit into
Chucks1093 merged 1 commit into
Conversation
|
@sksneh 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.
Overview
Adds a portfolio performance line chart to the holdings overview on the landing ("portfolio") page. It plots the total value of every held creator key over time with 7d/30d/90d/all range selectors, an optional benchmark comparison line, a value+date tooltip, and the percentage return between the first and last visible data point. The series is fetched through a new portfolio-history service and React Query hook; the chart itself is presentational so it can be driven with fixtures in tests.
Related Issue
Implements the acceptance criteria for #1052.
Changes
[ADD]
src/utils/portfolioHistory.utils.tsPortfolioHistoryPointtype plus the four range options (7d/30d/90d/all) with their windows.normalizeHistory(drops malformed samples, sorts ascending),filterHistoryByRange,computePortfolioReturnPercentandcomputeBenchmarkReturnPercent(first-to-last, null when undefined), andbuildPortfolioChartSeries, which rebases the benchmark index onto the portfolio's opening value so both lines are comparable while the portfolio line keeps its real XLM values.formatPortfolioValueXlm,formatPortfolioHistoryDate,formatPortfolioReturnPercent).[ADD]
src/services/portfolioHistory.service.tsGET /users/:wallet/portfolio-history?range=via the sharedBaseApiService, with the same short-lived cache pattern as the trade-history service. Responses are normalized before they reach the chart.[ADD]
src/hooks/usePortfolioHistory.tsqueryKeys.wallet.portfolioHistory. Fetches the full series once so range switching is instant and offline.[ADD]
src/components/common/PortfolioPerformanceChart.tsxPriceHistoryChart— no new dependency).[MODIFY]
src/lib/queryKeys.tswallet.portfolioHistory(address, range).[MODIFY]
src/pages/LandingPage.tsxusePortfolioHistory(activeWalletAddress)and rendersPortfolioPerformanceChartunder the unrealised-P&L summary, wiring loading and error states.[ADD]
src/utils/__tests__/portfolioHistory.utils.test.ts[ADD]
src/components/common/__tests__/PortfolioPerformanceChart.test.tsx[ADD]
src/pages/__tests__/LandingPage.portfolioHistory.integration.test.tsxVerification Results
The repo could not be installed or its test suite executed in this environment (no clone / no
pnpm install), so the new vitest files were not run. What was actually verified:formatPortfolioValueXlm/formatPortfolioHistoryDateused by the tooltip and covered by testscomputePortfolioReturnPercentunit-tested for gains, ranges and degenerate seriesCloses #1052