Skip to content

Commit

Permalink
added spice as mana to net worth (#2877)
Browse files Browse the repository at this point in the history
* added spice as mana to net worth
  • Loading branch information
ingawei authored Sep 17, 2024
1 parent a91f50d commit ef7c603
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions web/components/portfolio/twomba-portfolio-graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,16 @@ function usePortfolioPointsFromHistory(
return balance + investment - totalDeposits - firstProfit
}

function getNetworth(balance: number, investment: number) {
return balance + investment
function getNetworth(
balance: number,
investment: number,
spiceBalance?: number
) {
return (
balance +
investment +
(spiceBalance ?? 0) * SPICE_TO_MANA_CONVERSION_RATE
)
}

portfolioHistory.forEach((p) => {
Expand All @@ -346,7 +354,7 @@ function usePortfolioPointsFromHistory(
})
networthPoints.push({
x: p.timestamp,
y: getNetworth(p.balance, p.investmentValue),
y: getNetworth(p.balance, p.investmentValue, p.spiceBalance),
obj: p,
})
cashProfitPoints.push({
Expand Down

0 comments on commit ef7c603

Please sign in to comment.