统计已实现盈亏扣手续费,并按平仓时指数冻结为 U。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-08 22:50:21 +08:00
parent e8f8a76753
commit 5e8b578f75
12 changed files with 726 additions and 54 deletions
+5
View File
@@ -1147,6 +1147,8 @@ def fetch_option_order(ex: ccxt.okx, *, inst_id: str, ord_id: str) -> dict[str,
if avg is None or avg <= 0:
avg = fill_px
state = str(o.get("state") or "").strip().lower()
fee = _safe_float(o.get("fee"))
fee_ccy = str(o.get("feeCcy") or o.get("fee_ccy") or "").strip().upper()
return {
"ok": True,
"ord_id": str(o.get("ordId") or ord_id),
@@ -1157,6 +1159,9 @@ def fetch_option_order(ex: ccxt.okx, *, inst_id: str, ord_id: str) -> dict[str,
"avg_px": avg,
"side": str(o.get("side") or "").lower(),
"ord_type": str(o.get("ordType") or ""),
# OKX fee 扣费多为负;此处保留原始值,结算侧取绝对值
"fee": fee,
"fee_ccy": fee_ccy,
"raw": o,
}
except Exception as e: