diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index a888e27..4c4453a 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -57,7 +57,7 @@ function formatPnl(value: string, percent: string, baseCurrency: string): { text const symbol = getCurrencySymbol(baseCurrency); const absValue = new Big(value).abs().toFixed(2); const absPercent = new Big(percent).abs().toFixed(2); - const text = `${symbol}${absValue} (${absPercent}%)`; + const text = `${symbol}${isPositive ? '' : '-'}${absValue} (${isPositive ? '' : '-'}${absPercent}%)`; const className = isPositive ? 'text-red-500' : 'text-green-500'; return { text, className }; } diff --git a/src/actions/portfolio.ts b/src/actions/portfolio.ts index a8337e5..118a5e2 100644 --- a/src/actions/portfolio.ts +++ b/src/actions/portfolio.ts @@ -37,6 +37,7 @@ interface Position { floatingPnlPercent: string; cumulativePnlNative: string; cumulativePnlPercent: string; + latestPrice: string; transactions: TransactionRecord[]; } @@ -399,6 +400,7 @@ export async function getPortfolioPositions(): Promise { floatingPnlPercent: floatingPnlPercent.toString(), cumulativePnlNative: cumulativePnlNative.toString(), cumulativePnlPercent: cumulativePnlPercent.toString(), + latestPrice: holding.latestPrice, transactions: holding.transactions, }); }