diff --git a/ft-app/app/templates/trades.html b/ft-app/app/templates/trades.html index c1bda20..f05f52a 100644 --- a/ft-app/app/templates/trades.html +++ b/ft-app/app/templates/trades.html @@ -373,7 +373,9 @@ function showPnlDrawer(title, direction, openPrice, closePrice, openFee, closeFe var fees = openFee + closeFee; var html = '项目计算金额'; html += '价差' + (direction === 'short' ? openPrice + ' - ' + closePrice : closePrice + ' - ' + openPrice) + '' + diff.toFixed(2) + ' 点'; - html += '毛利' + diff.toFixed(2) + ' × ' + pointValue + '' + gross.toFixed(2) + ''; + var grossColor = gross > 0 ? 'var(--danger-fg)' : gross < 0 ? 'var(--success-fg)' : 'var(--danger-fg)'; + var grossPrefix = gross > 0 ? '+' : gross < 0 ? '' : ''; + html += '毛利' + diff.toFixed(2) + ' × ' + pointValue + '' + grossPrefix + gross.toFixed(2) + ''; html += '开仓手续费-' + openFee.toFixed(2) + ''; html += '平仓手续费-' + closeFee.toFixed(2) + ''; document.getElementById('pnlTable').innerHTML = html;