fix(trend): use money RR, track DCA fills, snapshot before close
Align running-plan header and DCA table with risk-budget RR, record actual fill prices after each leg, and save pre-close snapshots on stop/TP/handoff across hub and exchanges. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1082,6 +1082,10 @@
|
||||
|
||||
function resolveTrendPlanRr(trendPlan, side, entry, sl, tp) {
|
||||
const t = trendPlan || {};
|
||||
if (t.money_rr != null && t.money_rr !== "") {
|
||||
const n = Number(t.money_rr);
|
||||
if (Number.isFinite(n) && n > 0) return n;
|
||||
}
|
||||
if (t.planned_rr != null && t.planned_rr !== "") {
|
||||
const n = Number(t.planned_rr);
|
||||
if (Number.isFinite(n) && n > 0) return n;
|
||||
@@ -1839,12 +1843,24 @@
|
||||
: "—";
|
||||
const amt =
|
||||
lv.contracts != null && lv.contracts !== "" ? esc(String(lv.contracts)) : "—";
|
||||
const avg =
|
||||
lv.avg_entry != null && lv.avg_entry !== ""
|
||||
? fmtSymbolPrice(lv.avg_entry, sym, tickMap)
|
||||
: "—";
|
||||
const profitU =
|
||||
lv.profit_u != null && lv.profit_u !== "" ? fmt(lv.profit_u, 2) : "—";
|
||||
const riskU = lv.risk_u != null && lv.risk_u !== "" ? fmt(lv.risk_u, 2) : "—";
|
||||
const rr = lv.rr != null && lv.rr !== "" ? `${fmt(lv.rr, 2)}:1` : "—";
|
||||
const stCls = lv.status === "done" ? "st-done" : "st-pending";
|
||||
const label = lv.status_label || (lv.status === "done" ? "已补仓" : "待补仓");
|
||||
return `<tr>
|
||||
<td>${esc(lv.label || lv.leg_key || "—")}</td>
|
||||
<td>${esc(price)}</td>
|
||||
<td>${amt}</td>
|
||||
<td>${esc(avg)}</td>
|
||||
<td>${esc(profitU)}</td>
|
||||
<td>${esc(riskU)}</td>
|
||||
<td>${esc(rr)}</td>
|
||||
<td class="${stCls}">${esc(label)}</td>
|
||||
</tr>`;
|
||||
})
|
||||
@@ -1852,7 +1868,7 @@
|
||||
return `<div class="plan-dca-block plan-dca-block--side">
|
||||
<div class="plan-dca-title">补仓计划明细</div>
|
||||
<table class="plan-dca-table">
|
||||
<tr><th>档位</th><th>触发价</th><th>张数</th><th>状态</th></tr>
|
||||
<tr><th>档位</th><th>触发价</th><th>张数</th><th>加仓后均价</th><th>止盈盈利(U)</th><th>止损(U)</th><th>盈亏比</th><th>状态</th></tr>
|
||||
${rows}
|
||||
</table>
|
||||
</div>`;
|
||||
|
||||
Reference in New Issue
Block a user