Skip to content

Commit

Permalink
Portfolio value change calculation is broken when using Mina values (#…
Browse files Browse the repository at this point in the history
…204)

* Portfolio value change calculation

* format code
  • Loading branch information
aliraza556 authored Aug 31, 2024
1 parent ee3f2ee commit bbe3ec7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
32 changes: 8 additions & 24 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"files": [
"README.md"
],
"files": ["README.md"],
"imageSize": 100,
"commit": false,
"commitType": "docs",
Expand All @@ -12,63 +10,49 @@
"name": "Tomek Marciniak",
"avatar_url": "https://avatars.githubusercontent.com/u/16132011?v=4",
"profile": "https://github.com/mrcnk",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "teddyjfpender",
"name": "Teddy Pender",
"avatar_url": "https://avatars.githubusercontent.com/u/92999717?v=4",
"profile": "https://github.com/teddyjfpender",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "rago4",
"name": "Rafał Goławski",
"avatar_url": "https://avatars.githubusercontent.com/u/19167236?v=4",
"profile": "https://dev.to/rgolawski",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "mich3lang3lo",
"name": "Mariusz",
"avatar_url": "https://avatars.githubusercontent.com/u/164676295?v=4",
"profile": "https://github.com/mich3lang3lo",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "aliraza556",
"name": "Ali Raza",
"avatar_url": "https://avatars.githubusercontent.com/u/87068339?v=4",
"profile": "https://github.com/aliraza556",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "yaodingyd",
"name": "Yao Ding",
"avatar_url": "https://avatars.githubusercontent.com/u/11392695?v=4",
"profile": "https://yaodingyd.github.io/",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "Myestery",
"name": "Chiwetelu Johnpaul Chidera",
"avatar_url": "https://avatars.githubusercontent.com/u/49923152?v=4",
"profile": "https://www.myestery.com",
"contributions": [
"code"
]
"contributions": ["code"]
}
],
"contributorsPerLine": 7,
Expand Down
10 changes: 6 additions & 4 deletions packages/features/src/wallet/routes/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ export const OverviewRoute = () => {
const priceYesterday =
lastMonthPrices?.[lastMonthPrices?.length - 2]?.[1] ?? 0
const dailyPriceDiff = (priceToday - priceYesterday) / priceYesterday
const dailyPriceDiffFiat = Math.abs(
Number(account.minaBalance) * dailyPriceDiff,
const dailyPriceDiffFiat = (
Number(account.minaBalance) * dailyPriceDiff
).toFixed(2)
const dailyPriceDiffMina = (
Number(dailyPriceDiffFiat) / (minaPrice ?? 1)
).toFixed(2)
const dailyPriceDiffMina = Math.abs(dailyPriceDiff).toFixed(2)
const chartLabel =
typeof currentPriceIndex === "undefined"
? `${dailyPriceDiff >= 0 ? "+" : "-"}${
? `${dailyPriceDiff >= 0 ? "+" : ""}${
useFiatBalance ? dailyPriceDiffFiat : dailyPriceDiffMina
} (24h)`
: dayjs(lastMonthPrices[currentPriceIndex]?.[0]).format("MMM D")
Expand Down

0 comments on commit bbe3ec7

Please sign in to comment.