feat(frontend): add FIFO cost-basis tax report with CSV export (Closes #605) - #937
Open
waterWang wants to merge 1 commit into
Open
feat(frontend): add FIFO cost-basis tax report with CSV export (Closes #605)#937waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
Closes FinChippay#605 Signed-off-by: waterWang <water.wang@users.noreply.github.com>
🤖 Greptile AI Code ReviewGreptile will automatically review this PR (12 file(s) changed). Review gates:
|
4 tasks
Contributor
|
FIX THESE CONFLICTS |
Contributor
|
resolve conflicts |
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
Adds a FIFO cost-basis tax report to the portfolio UI (issue #605):
lib/portfolio.ts— newcomputeFIFOTaxReport()FIFO engine: received events open acquisition lots priced at historical CoinGecko prices; sent events dispose against the oldest lot first and contribute realized gains/losses; remaining lots are valued at the latest event price for unrealized gains. Missing historical prices flag the position asunpricedinstead of producing wrong numbers.lib/portfolio.ts—fetchHistoricalPrices()(CoinGeckomarket_chart) andhistoricalPriceLookup()(back-fill ~5 days for weekend/holiday gaps, live-price fallback).components/TaxReport.tsx(new) — loads payment history + historical prices, renders a summary card (realized / unrealized / assets), a per-asset table (remaining qty, cost basis, unrealized, lots, priced flag), and a CSV export of the report.pages/portfolio.tsx— Portfolio ⇄ Tax Report tab switcher.portfolio.tabOverview/portfolio.tabTaxReport/taxReport.*keys added to all 7 locale files.Implementation notes
sent(out) +received(in) events and are taxed naturally by the engine.XLM/USDC(existingCOINGECKO_ID_MAP); other assets are flagged as unpriced rather than guessed.Verification
NODE_ENV=test npx jest __tests__/portfolio.test.ts __tests__/TaxReport.test.tsx __tests__/PortfolioOverview.test.tsx __tests__/PortfolioAllocation.test.tsx→ 39/39 pass.tsc --noEmit— only pre-existinglib/sdk-instance.tserrors (TS1127/TS1160, introduced by PR#918 on main, unrelated to this change).require()in portfolio.test.ts mock untouched).Closes #605
Signed-off-by: waterWang water.wang@users.noreply.github.com