fix复盘交易记录盈亏与数据统计同口径,并展示期权手续费。
列表盈亏改为币盈亏×卖回价;手续费仅计期权开/平,不含现货。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,6 +59,13 @@
|
||||
return n.toFixed(2) + "U";
|
||||
}
|
||||
|
||||
function fmtOptionFee(v) {
|
||||
if (v == null || v === "") return "—";
|
||||
var n = Number(v);
|
||||
if (Number.isNaN(n)) return "—";
|
||||
return n.toFixed(2) + "U";
|
||||
}
|
||||
|
||||
function fmtProfitRate(v) {
|
||||
if (v == null || v === "") return "—";
|
||||
var n = Number(v);
|
||||
@@ -398,7 +405,7 @@
|
||||
if (!tbody) return;
|
||||
var wrap = beginListLoad("or-trades-wrap", soft);
|
||||
if (!soft) {
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="muted">加载中…</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="10" class="muted">加载中…</td></tr>';
|
||||
}
|
||||
var p = baseQs();
|
||||
// 交易记录保留已复盘条目,不再只显示待复盘
|
||||
@@ -412,7 +419,7 @@
|
||||
.then(function (data) {
|
||||
if (doSync) setSyncStatus("本地记录已加载");
|
||||
if (!data.ok) {
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="muted">加载失败</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="10" class="muted">加载失败</td></tr>';
|
||||
endListLoad(wrap);
|
||||
return;
|
||||
}
|
||||
@@ -424,7 +431,7 @@
|
||||
tradesCache = {};
|
||||
if (!rows.length) {
|
||||
tbody.innerHTML =
|
||||
'<tr><td colspan="9" class="muted">暂无交易记录</td></tr>';
|
||||
'<tr><td colspan="10" class="muted">暂无交易记录</td></tr>';
|
||||
endListLoad(wrap);
|
||||
return;
|
||||
}
|
||||
@@ -471,6 +478,9 @@
|
||||
'">' +
|
||||
fmtProfitRate(pr) +
|
||||
"</td>" +
|
||||
"<td>" +
|
||||
fmtOptionFee(t.option_fee_usdt) +
|
||||
"</td>" +
|
||||
'<td class="muted" style="font-size:12px;white-space:nowrap">' +
|
||||
escapeHtml(t.opened_at || "—") +
|
||||
"</td>" +
|
||||
@@ -508,7 +518,7 @@
|
||||
})
|
||||
.catch(function () {
|
||||
if (doSync) setSyncStatus("加载失败");
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="muted">加载失败</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="10" class="muted">加载失败</td></tr>';
|
||||
endListLoad(wrap);
|
||||
});
|
||||
}
|
||||
@@ -885,6 +895,7 @@
|
||||
["初始权利金", fmtPremiumU(t.initial_premium_usdt)],
|
||||
["盈亏", fmtPnl(t.realized_pnl_total)],
|
||||
["盈利率", fmtProfitRate(resolveProfitRate(t))],
|
||||
["期权手续费", fmtOptionFee(t.option_fee_usdt)],
|
||||
["持有", fmtHold(t.hold_seconds)],
|
||||
["开仓时间", t.opened_at || "—"],
|
||||
["平仓时间", t.closed_at || "—"],
|
||||
@@ -1226,6 +1237,7 @@
|
||||
($("or-f-pnl") || {}).value = fmtPnl(t.realized_pnl_total);
|
||||
($("or-f-initial-prem") || {}).value = fmtPremiumU(t.initial_premium_usdt);
|
||||
($("or-f-profit-rate") || {}).value = fmtProfitRate(resolveProfitRate(t));
|
||||
($("or-f-option-fee") || {}).value = fmtOptionFee(t.option_fee_usdt);
|
||||
($("or-f-hold") || {}).value = fmtHold(t.hold_seconds);
|
||||
setSelectValue($("or-f-strategy"), e.strategy_tag || "");
|
||||
setSelectValue($("or-f-direction"), e.direction_view || autoDirection(t));
|
||||
|
||||
Reference in New Issue
Block a user