Expand options review table columns and color result tags.
Show direction, hold time, and entry logic; paint 盈利 green and 亏损 red. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -122,6 +122,19 @@
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resultStyle(tag) {
|
||||||
|
var t = String(tag || "").trim();
|
||||||
|
if (t === "盈利") return "color:#3dd68c;font-weight:600";
|
||||||
|
if (t === "亏损") return "color:#f07178;font-weight:600";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function tradeContractLabel(t) {
|
||||||
|
if (!t) return "—";
|
||||||
|
if (t.source_type === "option_spot") return t.inst_id || t.underlying || "—";
|
||||||
|
return t.underlying || "—";
|
||||||
|
}
|
||||||
|
|
||||||
function newDraftId() {
|
function newDraftId() {
|
||||||
if (global.crypto && typeof global.crypto.randomUUID === "function") {
|
if (global.crypto && typeof global.crypto.randomUUID === "function") {
|
||||||
return global.crypto.randomUUID().replace(/-/g, "");
|
return global.crypto.randomUUID().replace(/-/g, "");
|
||||||
@@ -436,7 +449,7 @@
|
|||||||
if (!tbody) return;
|
if (!tbody) return;
|
||||||
var wrap = beginListLoad("or-reviewed-wrap", soft);
|
var wrap = beginListLoad("or-reviewed-wrap", soft);
|
||||||
if (!soft) {
|
if (!soft) {
|
||||||
tbody.innerHTML = '<tr><td colspan="8" class="muted">加载中…</td></tr>';
|
tbody.innerHTML = '<tr><td colspan="11" class="muted">加载中…</td></tr>';
|
||||||
}
|
}
|
||||||
var p = baseQs();
|
var p = baseQs();
|
||||||
p.set("reviewed", "1");
|
p.set("reviewed", "1");
|
||||||
@@ -449,7 +462,7 @@
|
|||||||
})
|
})
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
if (!data.ok) {
|
if (!data.ok) {
|
||||||
tbody.innerHTML = '<tr><td colspan="8" class="muted">加载失败</td></tr>';
|
tbody.innerHTML = '<tr><td colspan="11" class="muted">加载失败</td></tr>';
|
||||||
endListLoad(wrap);
|
endListLoad(wrap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -460,13 +473,16 @@
|
|||||||
var rows = data.trades || [];
|
var rows = data.trades || [];
|
||||||
reviewedCache = {};
|
reviewedCache = {};
|
||||||
if (!rows.length) {
|
if (!rows.length) {
|
||||||
tbody.innerHTML = '<tr><td colspan="8" class="muted">暂无复盘记录</td></tr>';
|
tbody.innerHTML = '<tr><td colspan="11" class="muted">暂无复盘记录</td></tr>';
|
||||||
endListLoad(wrap);
|
endListLoad(wrap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tbody.innerHTML = rows
|
tbody.innerHTML = rows
|
||||||
.map(function (t) {
|
.map(function (t) {
|
||||||
reviewedCache[t.id] = t;
|
reviewedCache[t.id] = t;
|
||||||
|
var entry = t.entry || {};
|
||||||
|
var direction = t.direction_view || entry.direction_view || "";
|
||||||
|
var entryLogic = t.entry_logic || entry.entry_logic || "";
|
||||||
return (
|
return (
|
||||||
'<tr class="or-reviewed-row" data-id="' +
|
'<tr class="or-reviewed-row" data-id="' +
|
||||||
t.id +
|
t.id +
|
||||||
@@ -475,7 +491,10 @@
|
|||||||
escapeHtml(t.source_label || t.source_type) +
|
escapeHtml(t.source_label || t.source_type) +
|
||||||
"</span></td>" +
|
"</span></td>" +
|
||||||
"<td>" +
|
"<td>" +
|
||||||
escapeHtml(tradeTitle(t)) +
|
escapeHtml(tradeContractLabel(t)) +
|
||||||
|
"</td>" +
|
||||||
|
"<td>" +
|
||||||
|
escapeHtml(direction || "—") +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
'<td style="' +
|
'<td style="' +
|
||||||
pnlStyle(t.realized_pnl_total) +
|
pnlStyle(t.realized_pnl_total) +
|
||||||
@@ -489,9 +508,17 @@
|
|||||||
escapeHtml(t.closed_at || "—") +
|
escapeHtml(t.closed_at || "—") +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
"<td>" +
|
"<td>" +
|
||||||
|
escapeHtml(fmtHold(t.hold_seconds)) +
|
||||||
|
"</td>" +
|
||||||
|
"<td>" +
|
||||||
escapeHtml(t.strategy_tag || "—") +
|
escapeHtml(t.strategy_tag || "—") +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
"<td>" +
|
"<td>" +
|
||||||
|
escapeHtml(entryLogic || "—") +
|
||||||
|
"</td>" +
|
||||||
|
'<td style="' +
|
||||||
|
resultStyle(t.result_tag) +
|
||||||
|
'">' +
|
||||||
escapeHtml(t.result_tag || "—") +
|
escapeHtml(t.result_tag || "—") +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
'<td class="muted" style="font-size:12px;white-space:nowrap">' +
|
'<td class="muted" style="font-size:12px;white-space:nowrap">' +
|
||||||
@@ -509,7 +536,7 @@
|
|||||||
endListLoad(wrap);
|
endListLoad(wrap);
|
||||||
})
|
})
|
||||||
.catch(function () {
|
.catch(function () {
|
||||||
tbody.innerHTML = '<tr><td colspan="8" class="muted">加载失败</td></tr>';
|
tbody.innerHTML = '<tr><td colspan="11" class="muted">加载失败</td></tr>';
|
||||||
endListLoad(wrap);
|
endListLoad(wrap);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -581,11 +581,15 @@ def enrich_trade_row(row: dict[str, Any], entry: dict[str, Any] | None = None) -
|
|||||||
out["entry"] = dict(entry)
|
out["entry"] = dict(entry)
|
||||||
out["entry"]["images"] = parse_options_review_images_json(entry.get("images_json"))
|
out["entry"]["images"] = parse_options_review_images_json(entry.get("images_json"))
|
||||||
out["strategy_tag"] = entry.get("strategy_tag")
|
out["strategy_tag"] = entry.get("strategy_tag")
|
||||||
|
out["direction_view"] = entry.get("direction_view")
|
||||||
|
out["entry_logic"] = entry.get("entry_logic")
|
||||||
out["result_tag"] = entry.get("result_tag")
|
out["result_tag"] = entry.get("result_tag")
|
||||||
out["reviewed_at"] = entry.get("reviewed_at") or entry.get("updated_at")
|
out["reviewed_at"] = entry.get("reviewed_at") or entry.get("updated_at")
|
||||||
else:
|
else:
|
||||||
out["entry"] = None
|
out["entry"] = None
|
||||||
out["strategy_tag"] = None
|
out["strategy_tag"] = None
|
||||||
|
out["direction_view"] = None
|
||||||
|
out["entry_logic"] = None
|
||||||
out["result_tag"] = None
|
out["result_tag"] = None
|
||||||
out["reviewed_at"] = None
|
out["reviewed_at"] = None
|
||||||
return out
|
return out
|
||||||
|
|||||||
@@ -70,7 +70,8 @@
|
|||||||
padding-top:8px;border-top:1px dashed rgba(127,127,127,.2);font-size:.74rem;
|
padding-top:8px;border-top:1px dashed rgba(127,127,127,.2);font-size:.74rem;
|
||||||
}
|
}
|
||||||
.or-list-loading{opacity:.55;pointer-events:none;transition:opacity .12s ease}
|
.or-list-loading{opacity:.55;pointer-events:none;transition:opacity .12s ease}
|
||||||
.or-trades-table-wrap,.or-reviewed-table-wrap{min-height:9.5rem}
|
.or-trades-table-wrap,.or-reviewed-table-wrap{min-height:9.5rem;overflow-x:auto}
|
||||||
|
.or-reviewed-table{min-width:980px}
|
||||||
.or-kpi-row{
|
.or-kpi-row{
|
||||||
display:grid;grid-template-columns:repeat(6,minmax(0,1fr));
|
display:grid;grid-template-columns:repeat(6,minmax(0,1fr));
|
||||||
gap:8px;margin-bottom:12px;
|
gap:8px;margin-bottom:12px;
|
||||||
@@ -343,16 +344,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>类型</th>
|
<th>类型</th>
|
||||||
<th>标的/合约</th>
|
<th>标的/合约</th>
|
||||||
|
<th>方向</th>
|
||||||
<th>盈亏</th>
|
<th>盈亏</th>
|
||||||
<th>开仓时间</th>
|
<th>开仓时间</th>
|
||||||
<th>平仓时间</th>
|
<th>平仓时间</th>
|
||||||
|
<th>持仓时长</th>
|
||||||
<th>策略</th>
|
<th>策略</th>
|
||||||
|
<th>入场逻辑</th>
|
||||||
<th>结果</th>
|
<th>结果</th>
|
||||||
<th>复盘时间</th>
|
<th>复盘时间</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="or-reviewed-tbody">
|
<tbody id="or-reviewed-tbody">
|
||||||
<tr><td colspan="8" class="muted">加载中…</td></tr>
|
<tr><td colspan="11" class="muted">加载中…</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -394,4 +398,4 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/options_review.js?v=19"></script>
|
<script src="/static/options_review.js?v=20"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user