持仓数量
- {{ 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);
},