fix多笔买/卖回用VWAP计入真盈亏,卖完再结算并标记待卖回。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-13 10:38:46 +08:00
parent 42a7ee9961
commit 53a624633d
11 changed files with 451 additions and 28 deletions
+14
View File
@@ -306,6 +306,20 @@ def open_coin_option_buy_full(
"budget": budget_info,
}
_spot_bridge.update_bridge(conn, bridge_id, coin_bought=float(coin_bought))
# 买侧 VWAP 累加(多笔买同理);USDT 优先成交回报,否则用计划买额
try:
usdt_spent = float(buy.get("usdt_spent") or buy_usdt)
except (TypeError, ValueError):
usdt_spent = float(buy_usdt)
try:
_spot_bridge.add_bridge_buy_fill(
conn,
bridge_id,
usdt_spent=usdt_spent,
coin_bought=float(coin_bought),
)
except Exception:
pass
try:
conn.commit()
except Exception: