fix卖回VWAP必须落库并覆盖指数占位价,禁止预算反推开仓价。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-13 11:55:42 +08:00
parent dd979d9dd0
commit 11a083470d
7 changed files with 378 additions and 37 deletions
+10 -8
View File
@@ -511,6 +511,16 @@ def open_coin_option_buy_full(
except Exception:
pass
# 开仓价必须在缩减 coin_bought 之前按买币 VWAP 冻住
# (buy_usdt_spent/buy_coin_accum;禁止事后 budget/缩水权利金量反推)
open_px_freeze = idx_open
try:
bv = _spot_bridge.bridge_buy_vwap(conn, bridge_id)
if bv is not None and float(bv) > 0:
open_px_freeze = float(bv)
except Exception:
pass
_spot_bridge.update_bridge(
conn,
bridge_id,
@@ -520,14 +530,6 @@ def open_coin_option_buy_full(
message="期权持仓中",
)
# 开仓价一次冻结:优先买币 VWAP(之后不再改);权利金币量 premium_paid 固定
open_px_freeze = idx_open
try:
bv = _spot_bridge.bridge_buy_vwap(conn, bridge_id)
if bv is not None and float(bv) > 0:
open_px_freeze = float(bv)
except Exception:
pass
trade_id = _insert_coin_trade(
conn,
inst_id=inst_id,