From 262594f16ec84ac23a0a8fd2a8dc7d726d7216e0 Mon Sep 17 00:00:00 2001 From: dev-worker Date: Tue, 3 Mar 2026 02:53:56 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20entry=5Fprice=E6=94=B9=E7=94=A8=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E6=88=90=E4=BA=A4=E4=BB=B7(last=5Ftrade=5Fprice)?= =?UTF-8?q?=E8=80=8C=E9=9D=9EVWAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VWAP是30分钟加权均价,快速行情下与实际价偏差可达1-2% 历史587笔entry_price+596笔pnl_r已用agg_trades真实价修正 平均偏差31.9bps, 最大189.4bps(1.9%) V5.1: 42.18R→15.32R | V5.2: 29.83R→0.76R --- backend/signal_engine.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/signal_engine.py b/backend/signal_engine.py index 126775f..21e3840 100644 --- a/backend/signal_engine.py +++ b/backend/signal_engine.py @@ -291,6 +291,7 @@ class SymbolState: self.win_vwap = TradeWindow(WINDOW_VWAP) self.atr_calc = ATRCalculator() self.last_processed_id = 0 + self.last_trade_price = 0.0 self.warmup = True self.prev_cvd_fast = 0.0 self.prev_cvd_fast_slope = 0.0 @@ -312,6 +313,7 @@ class SymbolState: self.win_day.trim(now_ms) self.win_vwap.trim(now_ms) self.last_processed_id = agg_id + self.last_trade_price = price # 最新成交价,用于entry_price def compute_p95_p99(self) -> tuple: if len(self.win_day.trades) < 100: @@ -346,7 +348,7 @@ class SymbolState: atr_pct = self.atr_calc.atr_percentile p95, p99 = self.compute_p95_p99() self.update_large_trades(now_ms, p99) - price = vwap if vwap > 0 else 0 + price = self.last_trade_price if self.last_trade_price > 0 else vwap # 用最新成交价,非VWAP cvd_fast_slope = cvd_fast - self.prev_cvd_fast cvd_fast_accel = cvd_fast_slope - self.prev_cvd_fast_slope self.prev_cvd_fast = cvd_fast