diff --git a/web/src/pages/trading/components/PlanCard.vue b/web/src/pages/trading/components/PlanCard.vue
index d6a7544..9fb5f56 100644
--- a/web/src/pages/trading/components/PlanCard.vue
+++ b/web/src/pages/trading/components/PlanCard.vue
@@ -23,9 +23,12 @@ const busy = computed(() => props.requesting || props.symbol.analyzing || !!prop
const elapsed = computed(() => props.analysis ? Math.max(0, Math.round((now.value - new Date(props.analysis.started_at).getTime()) / 1000)) : 0)
const duration = computed(() => props.analysis?.finished_at ? Math.round((new Date(props.analysis.finished_at).getTime() - new Date(props.analysis.started_at).getTime()) / 1000) : null)
+/** 已成交金额(USDT),按每笔的成交均价折算;有成交的订单一定有均价 */
function filled(purpose: "entry" | "tp", leg: number) {
- const total = props.orders.filter(o => o.purpose === purpose && o.leg === leg).reduce((sum, o) => sum + Number(o.filled_qty), 0)
- return total ? String(Number(total.toFixed(8))) : "-"
+ const total = props.orders
+ .filter(o => o.purpose === purpose && o.leg === leg && Number(o.filled_qty) > 0)
+ .reduce((sum, o) => sum + Number(o.filled_qty) * Number(o.avg_price!), 0)
+ return total ? `${total.toFixed(2)} USDT` : "-"
}
function countdown(deadline: string | null) {
@@ -211,12 +214,12 @@ const ladder = computed(() => sizing.value?.entry && entryRow.value
限价{{ long ? "做多" : "做空" }}
- {{ sizing.entry.price }} × {{ sizing.entry.quantity }}
+ {{ sizing.entry.price }}
已成交 {{ filled("entry", 0) }}{{ entryRow?.avg_price ? `,均价 ${entryRow.avg_price}` : "" }}
- 名义价值
- {{ sizing.entry.notional }} USDT
+ 下单金额
+ {{ sizing.entry.notional }} USDT
{{ sizing.entry.leverage }} 倍交易资金
diff --git a/web/src/pages/trading/index.vue b/web/src/pages/trading/index.vue
index aae45f2..391c65c 100644
--- a/web/src/pages/trading/index.vue
+++ b/web/src/pages/trading/index.vue
@@ -46,14 +46,14 @@ const symbolOrders = computed(() => {
...s.orders.filter(o => o.symbol === selected.value).map(o => ({
...o,
conditional: false,
- priceText: num(o.price)
+ priceText: num(o.price),
+ amount: `${usdtValue(o.price, o.quantity)} USDT`
})),
...s.algo_orders.filter(o => o.symbol === selected.value).map(o => ({
...o,
conditional: true,
priceText: `触发 ${num(o.trigger_price)}`,
- filled: "0",
- quantity: o.close_position ? "全部持仓" : o.quantity
+ amount: o.close_position ? "全部持仓" : `${usdtValue(o.trigger_price, o.quantity)} USDT`
}))
].sort((a, b) => b.time - a.time)
})
@@ -62,6 +62,11 @@ function num(value: string) {
return String(Number(value))
}
+/** 币数量按价格折成 USDT 金额;页面上的仓位、挂单大小都用 USDT 显示 */
+function usdtValue(price: string, quantity: string) {
+ return (Number(price) * Number(quantity)).toFixed(2)
+}
+
function money(value: string | undefined) {
return value === undefined ? "-" : Number(value).toFixed(2)
}
@@ -388,9 +393,9 @@ onBeforeUnmount(() => clearInterval(timer))
-
+
- {{ num(row.amount) }}
+ {{ Math.abs(Number(row.notional)).toFixed(2) }}
@@ -471,7 +476,7 @@ onBeforeUnmount(() => clearInterval(timer))
- {{ positionOf(s.symbol)!.leverage }}x {{ positionOf(s.symbol)!.side === "LONG" ? "多" : "空" }} · {{ num(positionOf(s.symbol)!.amount) }}
+ {{ positionOf(s.symbol)!.leverage }}x {{ positionOf(s.symbol)!.side === "LONG" ? "多" : "空" }} · {{ Math.abs(Number(positionOf(s.symbol)!.notional)).toFixed(2) }} USDT
@@ -509,7 +514,7 @@ onBeforeUnmount(() => clearInterval(timer))
{{ formatTime(new Date(o.time).toISOString(), "MM-DD HH:mm:ss") }}
- {{ o.quantity === "全部持仓" ? o.quantity : num(o.quantity) }}
+ {{ o.amount }}
@ {{ o.priceText }}