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:
@@ -325,7 +325,7 @@ async def _run_archive_sync_once() -> dict:
|
||||
trades = trades_resp.get("trades") or []
|
||||
for t in trades:
|
||||
if isinstance(t, dict):
|
||||
t.setdefault("exchange_key", ex_key)
|
||||
t["exchange_key"] = ex_key
|
||||
|
||||
def remote_fetch(**kwargs):
|
||||
return _fetch_instance_ohlcv_sync(
|
||||
|
||||
@@ -5757,7 +5757,7 @@ body.funds-fullscreen-open {
|
||||
}
|
||||
.archive-trades-table {
|
||||
width: 100%;
|
||||
min-width: 920px;
|
||||
min-width: 1000px;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
@@ -5768,6 +5768,10 @@ body.funds-fullscreen-open {
|
||||
.archive-trades-table .archive-hold {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.archive-trades-table .archive-symbol {
|
||||
white-space: nowrap;
|
||||
font-weight: 500;
|
||||
}
|
||||
.archive-review-mark {
|
||||
display: inline-block;
|
||||
margin-right: 4px;
|
||||
@@ -5854,6 +5858,21 @@ body.funds-fullscreen-open {
|
||||
color: var(--text);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.archive-tag-select.is-tag-sick {
|
||||
color: var(--red);
|
||||
border-color: color-mix(in srgb, var(--red) 45%, var(--border-soft));
|
||||
background: color-mix(in srgb, var(--red) 14%, var(--inset-surface));
|
||||
}
|
||||
.archive-tag-select.is-tag-emotion {
|
||||
color: #60a5fa;
|
||||
border-color: color-mix(in srgb, #60a5fa 45%, var(--border-soft));
|
||||
background: color-mix(in srgb, #60a5fa 14%, var(--inset-surface));
|
||||
}
|
||||
.archive-trade-row.archive-trade-sick .archive-tag-select.is-tag-sick {
|
||||
color: var(--red);
|
||||
border-color: color-mix(in srgb, var(--red) 50%, var(--border-soft));
|
||||
background: color-mix(in srgb, var(--red) 18%, var(--inset-surface));
|
||||
}
|
||||
.archive-empty {
|
||||
padding: 16px;
|
||||
color: var(--muted);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" media="print" onload="this.media='all'" />
|
||||
<noscript><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" /></noscript>
|
||||
<link rel="stylesheet" href="/assets/app.css?v=20260612-sick-row-red-text" />
|
||||
<link rel="stylesheet" href="/assets/app.css?v=20260612-trade-symbol-col" />
|
||||
<link rel="stylesheet" href="/assets/dashboard.css?v=20260612-dash-monitor-count" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -584,11 +584,11 @@
|
||||
<script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script>
|
||||
<script src="/assets/chart_draw.js?v=20260609-market-day-split"></script>
|
||||
<script src="/assets/chart.js?v=20260609-market-day-split"></script>
|
||||
<script src="/assets/archive.js?v=20260612-stats-table-layout"></script>
|
||||
<script src="/assets/archive.js?v=20260612-trade-symbol-col"></script>
|
||||
<script src="/assets/funds.js?v=20260609-hub-funds-fold"></script>
|
||||
<script src="/assets/dashboard.js?v=20260612-dash-monitor-count"></script>
|
||||
<script src="/assets/ai_review_render.js?v=3"></script>
|
||||
<script src="/assets/time_close_ui.js?v=1"></script>
|
||||
<script src="/assets/time_close_ui.js?v=2"></script>
|
||||
<script src="/assets/app.js?v=20260612-time-close"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -23,9 +23,16 @@
|
||||
if (!cb || !sel) return;
|
||||
function sync() {
|
||||
const on = !!cb.checked;
|
||||
sel.disabled = !on;
|
||||
sel.disabled = false;
|
||||
sel.tabIndex = 0;
|
||||
if (wrap) wrap.classList.toggle("is-disabled", !on);
|
||||
}
|
||||
sel.addEventListener("mousedown", function (ev) {
|
||||
ev.stopPropagation();
|
||||
});
|
||||
sel.addEventListener("click", function (ev) {
|
||||
ev.stopPropagation();
|
||||
});
|
||||
cb.addEventListener("change", sync);
|
||||
sync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user