Fix option close reduceOnly flag and use position mark when quote has no bid.

OKX expects reduceOnly as the string true; target auto-close also falls back to the live position mark price on empty books.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-15 15:43:19 +08:00
parent cfc1d42c09
commit bcb229fc9d
2 changed files with 13 additions and 4 deletions
+2 -2
View File
@@ -793,7 +793,7 @@ def place_option_limit_order(
if pos_side:
body["posSide"] = pos_side
if reduce_only:
body["reduceOnly"] = True
body["reduceOnly"] = "true"
try:
resp = ex.private_post_trade_order(body)
data = (resp or {}).get("data") or []
@@ -829,7 +829,7 @@ def place_option_market_order(
if pos_side:
body["posSide"] = pos_side
if reduce_only:
body["reduceOnly"] = True
body["reduceOnly"] = "true"
try:
resp = ex.private_post_trade_order(body)
data = (resp or {}).get("data") or []