fix(hub): archive labels, symbol column, and time-close dropdown
Force exchange_key on archive sync; add contract column and tag select styles on inner-light-mind; serve time_close_ui.js on instances so order/key time-close duration can be selected. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -223,10 +223,17 @@
|
||||
|
||||
function tradeRowExchange(tr) {
|
||||
if (!tr) return "—";
|
||||
const exKey = tr.exchange_key || tr.account_exchange_key || "";
|
||||
if (exKey) return exchangeLabel(exKey);
|
||||
const name = tr.account_name || tr.exchange_name || "";
|
||||
return name || "—";
|
||||
const exKey = String(tr.exchange_key || "").toLowerCase();
|
||||
return exKey ? exchangeLabel(exKey) : "—";
|
||||
}
|
||||
|
||||
function applyTagSelectStyle(sel) {
|
||||
if (!sel) return;
|
||||
const v = sel.value || "";
|
||||
sel.classList.remove("is-tag-empty", "is-tag-sick", "is-tag-emotion");
|
||||
if (v === "sick") sel.classList.add("is-tag-sick");
|
||||
else if (v === "emotion") sel.classList.add("is-tag-emotion");
|
||||
else sel.classList.add("is-tag-empty");
|
||||
}
|
||||
|
||||
function exchangeLabel(exKey) {
|
||||
@@ -898,7 +905,7 @@
|
||||
|
||||
async function openTradeChart(tr) {
|
||||
if (!tr) return;
|
||||
const exKey = tr.exchange_key || tr.account_exchange_key || "";
|
||||
const exKey = String(tr.exchange_key || "").toLowerCase();
|
||||
const sym = tr.symbol || "";
|
||||
if (!exKey || !sym) {
|
||||
setStatus("该笔交易缺少交易所或合约,无法加载图表");
|
||||
@@ -920,13 +927,13 @@
|
||||
}
|
||||
elTrades.innerHTML =
|
||||
'<table class="archive-trades-table"><thead><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>" +
|
||||
"</tr></thead><tbody>" +
|
||||
dailyTrades
|
||||
.map(function (t) {
|
||||
const tid = t.trade_id || t.id;
|
||||
const exKey = t.exchange_key || t.account_exchange_key || "";
|
||||
const exKey = String(t.exchange_key || "").toLowerCase();
|
||||
const tag = t.behavior_tag || "";
|
||||
const sick = tag === "sick";
|
||||
const active = String(tid) === String(selectedTradeId) ? " is-active" : "";
|
||||
@@ -945,6 +952,9 @@
|
||||
"<td>" +
|
||||
esc(tradeRowExchange(t)) +
|
||||
"</td>" +
|
||||
'<td class="archive-symbol">' +
|
||||
esc(t.symbol || "—") +
|
||||
"</td>" +
|
||||
"<td>" +
|
||||
(rev ? '<span class="archive-review-mark">' + rev + "</span>" : "") +
|
||||
esc(fmtEntryType(t)) +
|
||||
@@ -1027,7 +1037,9 @@
|
||||
});
|
||||
});
|
||||
elTrades.querySelectorAll(".archive-tag-select").forEach(function (sel) {
|
||||
applyTagSelectStyle(sel);
|
||||
sel.addEventListener("change", function () {
|
||||
applyTagSelectStyle(sel);
|
||||
saveOverlay(sel.getAttribute("data-id"), sel.getAttribute("data-ex"), sel.value, null);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user