Add roll leg avg/TP profit display and reduce instance nav flicker
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2944,12 +2944,35 @@
|
||||
function renderRollSection(rolls, tickMap) {
|
||||
if (!rolls || !rolls.length) return "";
|
||||
return rolls
|
||||
.map(
|
||||
(g) => `<div class="hub-mini-card">
|
||||
<div class="hub-mini-title">组 #${esc(g.id)} · 监控单 #${esc(g.order_monitor_id || "—")}</div>
|
||||
<div class="hub-mini-line">腿数 ${esc(g.leg_count != null ? g.leg_count : "—")} · 止损 ${fmtSymbolPrice(g.current_stop_loss, g.symbol, tickMap)} · ${esc(g.status || "active")}</div>
|
||||
</div>`
|
||||
)
|
||||
.map((g) => {
|
||||
const sym = g.symbol || g.exchange_symbol || "";
|
||||
const avg =
|
||||
g.avg_entry_display || fmtSymbolPrice(g.avg_entry, sym, tickMap) || "—";
|
||||
const tpProfit =
|
||||
g.reward_at_tp_usdt != null && g.reward_at_tp_usdt !== ""
|
||||
? `${fmt(g.reward_at_tp_usdt, 2)}U`
|
||||
: "—";
|
||||
const legs = Array.isArray(g.recent_legs) ? g.recent_legs : [];
|
||||
const legRows = legs
|
||||
.map((leg) => {
|
||||
const legAvg =
|
||||
leg.avg_entry_display ||
|
||||
fmtSymbolPrice(leg.avg_entry_after, sym, tickMap) ||
|
||||
"—";
|
||||
const legProfit =
|
||||
leg.reward_at_tp_usdt != null && leg.reward_at_tp_usdt !== ""
|
||||
? `${fmt(leg.reward_at_tp_usdt, 2)}U`
|
||||
: "—";
|
||||
return `<div class="hub-mini-line hub-roll-leg">腿 #${esc(leg.leg_index)} ${esc(leg.add_mode || "")} · 张 ${esc(leg.amount != null ? leg.amount : "—")} · 均价 ${legAvg} · 止盈 ${legProfit}</div>`;
|
||||
})
|
||||
.join("");
|
||||
return `<div class="hub-mini-card">
|
||||
<div class="hub-mini-title">组 #${esc(g.id)} · ${esc(g.symbol || "")} ${renderDirectionHtml(g.direction)} · 监控 #${esc(g.order_monitor_id || "—")}</div>
|
||||
<div class="hub-mini-line">腿数 ${esc(g.leg_count != null ? g.leg_count : "—")} · SL ${fmtSymbolPrice(g.current_stop_loss, sym, tickMap)} · 首仓TP ${fmtSymbolPrice(g.initial_take_profit, sym, tickMap)}</div>
|
||||
<div class="hub-mini-line">当前均价 ${avg} · 止盈盈利 ${tpProfit}</div>
|
||||
${legRows}
|
||||
</div>`;
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user