From 41bdee2416f74ee14eb6cca75305cf49d94e17f0 Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 7 Jun 2026 23:43:21 +0800 Subject: [PATCH] fix(hub): green open arrows for long, red for short on archive chart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Explicit open marker colors and broader direction parsing (short/空/sell). Co-authored-by: Cursor --- manual_trading_hub/static/archive.js | 20 ++++++++++++++++++-- manual_trading_hub/static/index.html | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/manual_trading_hub/static/archive.js b/manual_trading_hub/static/archive.js index 6e2c7f7..277202d 100644 --- a/manual_trading_hub/static/archive.js +++ b/manual_trading_hub/static/archive.js @@ -255,9 +255,25 @@ return best; } + const OPEN_ARROW_LONG = "#22c55e"; + const OPEN_ARROW_SHORT = "#ef4444"; + const OPEN_ARROW_LONG_HI = "#4ade80"; + const OPEN_ARROW_SHORT_HI = "#f87171"; + function isLongDirection(dir) { const d = String(dir || "").trim().toLowerCase(); - return d === "long" || d === "多" || d === "buy"; + if (d === "short" || d === "空" || d === "sell" || d === "做空" || d === "shorts") { + return false; + } + if (d === "long" || d === "多" || d === "buy" || d === "做多" || d === "longs") { + return true; + } + return true; + } + + function openArrowColor(long, highlight) { + if (long) return highlight ? OPEN_ARROW_LONG_HI : OPEN_ARROW_LONG; + return highlight ? OPEN_ARROW_SHORT_HI : OPEN_ARROW_SHORT; } function buildTradeMarkers(tr, candles, tf, opts) { @@ -268,7 +284,7 @@ const long = isLongDirection(tr.direction); const openMs = tradeOpenMs(tr); const closeMs = tradeCloseMs(tr); - const openColor = highlight ? (long ? "#4ade80" : "#f87171") : long ? "#22c55e" : "#ef4444"; + const openColor = openArrowColor(long, highlight); let closeColor = highlight ? "#fbbf24" : "#f59e0b"; const pnl = Number(tr.pnl_amount); if (!highlight && Number.isFinite(pnl) && pnl < -0.0001) { diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 0d58bb8..de8f387 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -352,7 +352,7 @@
- +