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 @@
- +