Fix hub full-close double-booking trend plans.
Sync active plans after hub position close, merge final close snapshots per plan, and backfill missing trade records when ending an already-stopped plan. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1586,6 +1586,17 @@ async def api_close_position(exchange_id: str, body: ClosePositionBody):
|
||||
"payload": payload,
|
||||
"ok": bool(isinstance(payload, dict) and payload.get("ok")),
|
||||
}
|
||||
if out.get("ok") and "trend" in (ex.get("capabilities") or []):
|
||||
async with httpx.AsyncClient() as flask_client:
|
||||
sync_parsed = await _fetch_flask_json(
|
||||
flask_client,
|
||||
ex,
|
||||
"/api/hub/trend/sync-flat",
|
||||
method="POST",
|
||||
json_body={"symbol": sym, "side": side},
|
||||
)
|
||||
if isinstance(sync_parsed, dict):
|
||||
out["trend_sync"] = sync_parsed
|
||||
_schedule_board_refresh()
|
||||
return out
|
||||
|
||||
|
||||
Reference in New Issue
Block a user