From 9f796d1efcc2922d05148137ff0ea93ebdc1be9a Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sun, 15 Feb 2026 13:29:54 +0800 Subject: [PATCH] update --- frontend/paper-trading.html | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/frontend/paper-trading.html b/frontend/paper-trading.html index 396d749..86b6e01 100644 --- a/frontend/paper-trading.html +++ b/frontend/paper-trading.html @@ -577,10 +577,10 @@
-
+
持仓数量 - {{ activeOrders.length }} + {{ openOrdersCount }}
总仓位 @@ -1051,14 +1051,24 @@ } }, computed: { - // 总仓位 - totalPosition() { - return this.activeOrders.reduce((sum, order) => sum + (order.quantity || 0), 0); + // 只计算已开仓的订单(不包括挂单) + openOrders() { + return this.activeOrders.filter(order => order.status === 'open'); }, - // 总浮动盈亏 + // 持仓数量(只计算已开仓) + openOrdersCount() { + return this.openOrders.length; + }, + + // 总仓位(只计算已开仓) + totalPosition() { + return this.openOrders.reduce((sum, order) => sum + (order.quantity || 0), 0); + }, + + // 总浮动盈亏(只计算已开仓) totalUnrealizedPnl() { - return this.activeOrders.reduce((sum, order) => { + return this.openOrders.reduce((sum, order) => { return sum + this.getUnrealizedPnl(order).pnl; }, 0); },