修复okx止盈止损
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user