fix: label trend breakeven handoff as 趋势回调 across four exchanges
Set order monitor and trade record source to trend pullback after handoff; unify hub and instance display; add migration script for legacy rows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -303,6 +303,27 @@
|
||||
return side || "—";
|
||||
}
|
||||
|
||||
function monitorOrderSourceLabel(mo) {
|
||||
const o = mo || {};
|
||||
const tid = Number(o.trend_plan_id);
|
||||
if (Number.isFinite(tid) && tid > 0) return "趋势回调";
|
||||
const mt = String(o.monitor_type || "").trim();
|
||||
if (mt === "趋势回调") return "趋势回调";
|
||||
const kst = String(o.key_signal_type || "").trim();
|
||||
if (kst === "趋势回调" || kst === "趋势回调计划") return "趋势回调";
|
||||
return mt || "下单监控";
|
||||
}
|
||||
|
||||
function monitorOrderSourceHtml(mo) {
|
||||
const src = monitorOrderSourceLabel(mo);
|
||||
const kst = String((mo && mo.key_signal_type) || "").trim();
|
||||
let text = src;
|
||||
if (kst && kst !== src && !text.includes(kst)) {
|
||||
text += " · " + kst;
|
||||
}
|
||||
return `来源: ${esc(text)}`;
|
||||
}
|
||||
|
||||
function renderDirectionHtml(side) {
|
||||
const cls = sideDirCls(side);
|
||||
const label = sideDirLabel(side);
|
||||
@@ -1052,7 +1073,9 @@
|
||||
: tp.avg_entry_price;
|
||||
const entryN = entryRaw != null && entryRaw !== "" ? Number(entryRaw) : null;
|
||||
const isTrend =
|
||||
!!(trendPlan && trendPlan.id) || String(mo.monitor_type || "").trim() === "趋势回调";
|
||||
!!(trendPlan && trendPlan.id) ||
|
||||
String(mo.monitor_type || "").trim() === "趋势回调" ||
|
||||
(mo.trend_plan_id != null && Number(mo.trend_plan_id) > 0);
|
||||
|
||||
let sl = mo.stop_loss != null && mo.stop_loss !== "" ? mo.stop_loss : "";
|
||||
let takeProfit = mo.take_profit != null && mo.take_profit !== "" ? mo.take_profit : "";
|
||||
@@ -1422,10 +1445,8 @@
|
||||
pnlText += ` (${pct >= 0 ? "" : ""}${pct.toFixed(2)}%)`;
|
||||
}
|
||||
const meta = [];
|
||||
if (mo.monitor_type || mo.key_signal_type) {
|
||||
meta.push(
|
||||
`来源: ${esc(mo.monitor_type || "下单监控")}${mo.key_signal_type ? " · " + esc(mo.key_signal_type) : ""}`
|
||||
);
|
||||
if (mo.monitor_type || mo.key_signal_type || mo.trend_plan_id) {
|
||||
meta.push(monitorOrderSourceHtml(mo));
|
||||
} else {
|
||||
meta.push("来源: 交易所持仓");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user