fix(ui): 修复现价变量映射错误,修正负收益绿色显示丢失负号的 Bug
This commit is contained in:
parent
1b947d563a
commit
7c2f464f2c
@ -57,7 +57,7 @@ function formatPnl(value: string, percent: string, baseCurrency: string): { text
|
|||||||
const symbol = getCurrencySymbol(baseCurrency);
|
const symbol = getCurrencySymbol(baseCurrency);
|
||||||
const absValue = new Big(value).abs().toFixed(2);
|
const absValue = new Big(value).abs().toFixed(2);
|
||||||
const absPercent = new Big(percent).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';
|
const className = isPositive ? 'text-red-500' : 'text-green-500';
|
||||||
return { text, className };
|
return { text, className };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ interface Position {
|
|||||||
floatingPnlPercent: string;
|
floatingPnlPercent: string;
|
||||||
cumulativePnlNative: string;
|
cumulativePnlNative: string;
|
||||||
cumulativePnlPercent: string;
|
cumulativePnlPercent: string;
|
||||||
|
latestPrice: string;
|
||||||
transactions: TransactionRecord[];
|
transactions: TransactionRecord[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,6 +400,7 @@ export async function getPortfolioPositions(): Promise<Position[]> {
|
|||||||
floatingPnlPercent: floatingPnlPercent.toString(),
|
floatingPnlPercent: floatingPnlPercent.toString(),
|
||||||
cumulativePnlNative: cumulativePnlNative.toString(),
|
cumulativePnlNative: cumulativePnlNative.toString(),
|
||||||
cumulativePnlPercent: cumulativePnlPercent.toString(),
|
cumulativePnlPercent: cumulativePnlPercent.toString(),
|
||||||
|
latestPrice: holding.latestPrice,
|
||||||
transactions: holding.transactions,
|
transactions: holding.transactions,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user