fix: 优化回测交易记录显示

- 盈亏颜色逻辑:仅盈利(>0)显示绿色,亏损(<0)显示红色,持平(=0)无颜色
- 手续费显示:确保null值显示为 $0.00
- 遵守绿涨红跌原则
This commit is contained in:
WrBug
2026-01-31 20:58:13 +08:00
parent 88cae4018a
commit ff3b24b50e
+11 -6
View File
@@ -237,18 +237,23 @@ const BacktestDetail: React.FC = () => {
dataIndex: 'fee',
key: 'fee',
width: 120,
render: (value: string) => formatUSDC(value)
render: (value: string) => formatUSDC(value || '0')
},
{
title: t('backtest.profitLoss') + ' (USDC)',
dataIndex: 'profitLoss',
key: 'profitLoss',
width: 120,
render: (value: string | null) => value ? (
<span style={{ color: parseFloat(value) >= 0 ? '#52c41a' : '#ff4d4f' }}>
{formatUSDC(value)}
</span>
) : '-'
render: (value: string | null) => {
if (!value) return '-'
const num = parseFloat(value)
const color = num > 0 ? '#52c41a' : num < 0 ? '#ff4d4f' : undefined
return (
<span style={{ color }}>
{formatUSDC(value)}
</span>
)
}
},
{
title: t('backtest.balanceAfter') + ' (USDC)',