Replace per-request CTP monitor sync with a lightweight roll-monitor revive; skip mark-price enrichment on pending legs during HTML render.
Co-authored-by: Cursor <cursoragent@cursor.com>
Include active roll groups in deduped position slots; normalize CTP position keys in reconcile; skip closing monitors tied to active roll groups.
Co-authored-by: Cursor <cursoragent@cursor.com>
When active monitors exist, use their deduped symbol+direction slots so roll does not inflate the limit; only hold previous active_count on SSE when incoming drops to zero during sync.
Co-authored-by: Cursor <cursoragent@cursor.com>
Roll/add-on shares one monitor per symbol+direction so it no longer inflates the active position count; strategy page skips full CTP sync when monitors already exist.
Co-authored-by: Cursor <cursoragent@cursor.com>
Store initial_lots on roll groups, submit market roll as CTP pending legs with cancel closing empty groups, and backfill first-lots for existing active groups.
Co-authored-by: Cursor <cursoragent@cursor.com>
Revive and sync active monitors from live positions before listing roll candidates, show ineligible monitors with reasons, and validate eligibility on preview.
Co-authored-by: Cursor <cursoragent@cursor.com>
Pass trading_session via inline page config, restore roll preview/execute handlers, and validate new stop-loss before preview.
Co-authored-by: Cursor <cursoragent@cursor.com>
Recalculate position quotes from resolved entry instead of stale CTP PositionProfit, and hide the auto-connect disabled banner once CTP is connected.
Co-authored-by: Cursor <cursoragent@cursor.com>
Correct PosiDirection 2=long/3=short so OpenCost caches under the right key, prefer open_cost over PositionCost for entry and float P/L, and refresh the cache when incomplete.
Co-authored-by: Cursor <cursoragent@cursor.com>
Move business code under modules/, env template to config/, PM2 single qihuo process, and _legacy shims for old imports.
Co-authored-by: Cursor <cursoragent@cursor.com>