修复okx止盈止损

This commit is contained in:
dekun
2026-05-25 11:25:14 +08:00
parent 436d2aef6c
commit 1e36086465
7 changed files with 211 additions and 16 deletions
+7 -2
View File
@@ -550,12 +550,14 @@ def _status_inner(x_control_token: str | None) -> Any:
}
)
orders_fetch_error: str | None = None
try:
attach_orders_to_positions(
positions_out,
list_open_orders(ex, EXCHANGE_KIND, None),
)
except Exception:
except Exception as e:
orders_fetch_error = str(e)
for p in positions_out:
p.setdefault("conditional_orders", [])
p.setdefault("regular_orders", [])
@@ -564,7 +566,7 @@ def _status_inner(x_control_token: str | None) -> Any:
pm = _position_mode_label()
except Exception:
pm = EXCHANGE_KIND
return {
out = {
"ok": True,
"exchange": EXCHANGE_KIND,
"balance_usdt": balance_usdt,
@@ -572,6 +574,9 @@ def _status_inner(x_control_token: str | None) -> Any:
"total_unrealized_pnl": _finite_or_none(total_upnl),
"position_mode": pm,
}
if orders_fetch_error:
out["orders_fetch_error"] = orders_fetch_error
return out
@app.get("/open-orders")