fix卖回未完成禁止用指数提前结算,并纠正买卖VWAP回退。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-13 10:50:50 +08:00
parent 53a624633d
commit 1aa279f191
4 changed files with 60 additions and 21 deletions
+3 -5
View File
@@ -226,7 +226,6 @@ def resolve_spot_vwap_prices(
try:
from lib.options.options_spot_bridge_lib import (
BRIDGE_CLOSED,
BRIDGE_PENDING_SELL,
bridge_buy_vwap,
bridge_sell_vwap,
ensure_bridge_table,
@@ -243,14 +242,13 @@ def resolve_spot_vwap_prices(
st = str(
row["status"] if row and hasattr(row, "keys") else (row[0] if row else "") or ""
)
if st == BRIDGE_PENDING_SELL:
# 桥未关闭(=卖回流程未结束):禁止用平仓指数冒充卖回 VWAP 提前结算
if st and st != BRIDGE_CLOSED:
return open_px, None, "pending_sell"
sv = bridge_sell_vwap(conn, bid)
if sv is not None and sv > 0:
close_px = sv
elif st == BRIDGE_CLOSED and (close_px is None or close_px <= 0):
# 已关桥但无 VWAP/冻结卖回价
return open_px, None, "missing"
# 已关桥但无卖回 VWAP:允许回退 close_index_px;两者都无则 missing
except Exception:
pass
if open_px is None or open_px <= 0 or close_px is None or close_px <= 0: