From cc041a0dc557b9a00535e0ea509ea0f3acc4a6bf Mon Sep 17 00:00:00 2001 From: dekun Date: Tue, 2 Jun 2026 12:01:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E6=83=85=E5=8C=BA=EF=BC=9A=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E4=BB=B7=E5=A2=9E=E5=8A=A0=E8=99=9A=E7=BA=BF=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E7=BA=BF=EF=BC=88=E4=B8=8E=E9=AB=98=E4=BD=8E=E7=82=B9?= =?UTF-8?q?=E4=B8=80=E8=87=B4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- manual_trading_hub/static/chart.js | 27 +++++++++++++++++++++++++++ manual_trading_hub/static/index.html | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/manual_trading_hub/static/chart.js b/manual_trading_hub/static/chart.js index 053c077..5614b41 100644 --- a/manual_trading_hub/static/chart.js +++ b/manual_trading_hub/static/chart.js @@ -46,6 +46,7 @@ let priceTick = null; let priceAutoScale = true; let rangeMarkers = []; + let currentPriceLine = null; let lastCandles = []; let candleByTime = {}; let chartMeta = null; @@ -159,9 +160,35 @@ function showLatestOhlcv() { paintOhlcv(latestCandle()); + updateCurrentPriceLine(); updatePriceTag(); } + function clearCurrentPriceLine() { + if (currentPriceLine && candleSeries) { + try { + candleSeries.removePriceLine(currentPriceLine); + } catch (e) {} + } + currentPriceLine = null; + } + + function updateCurrentPriceLine() { + clearCurrentPriceLine(); + if (!candleSeries) return; + const bar = latestCandle(); + if (!bar || bar.close == null) return; + const up = Number(bar.close) >= Number(bar.open); + currentPriceLine = candleSeries.createPriceLine({ + price: Number(bar.close), + color: up ? "#00ff9d" : "#ff4d6d", + lineWidth: 1, + lineStyle: 2, + axisLabelVisible: true, + title: "现价", + }); + } + function tickLiveClock() { const cd = fmtBarCountdown(barRemainMs(currentTf)); if (elPriceTagTime && elPriceTag && !elPriceTag.classList.contains("hidden")) { diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 617e001..f3db086 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -192,7 +192,7 @@
- - + +