Commit Graph

27 Commits

Author SHA1 Message Date
dekun 2ec534c547 Use CTP PositionDate from investor position query for SHFE close offset.
Parse official today/history legs in onRspQryInvestorPosition instead of guessing or retrying alternate offsets.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 09:30:38 +08:00
dekun 0bade8a01f Fix SHFE close by retrying alternate today/yesterday offset on CTP reject.
Split mixed positions and auto-fallback when vnpy td/yd volumes disagree with the exchange.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 09:26:38 +08:00
dekun 1cd3039605 Fix roll margin validation and SHFE close offset for night positions.
Use CTP account margin for roll cap checks and prefer close-today on SHFE when yesterday close is rejected.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 09:22:17 +08:00
dekun 50bb04e2bb Fix stop-loss close loop spamming WeChat and blocking manual close.
Throttle close retries, skip monitor revive while pending, and dedupe notifications when CTP already has a close order.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 09:12:27 +08:00
dekun 6b2c7ade95 Use sina quote fallback for recommend list when CTP tick missing.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 06:55:14 +08:00
dekun 16d90814a1 Fix empty recommend list when CTP ticks unavailable off-hours.
Fall back to daily prev_close for margin estimates; keep previous cache when refresh gets all no_price; stop re-fetching only for missing turnover.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 06:43:20 +08:00
dekun 125cc60a3d Fix positions 500 when recommend row lacks turnover field.
Use Jinja defined check in trade template and always set turnover key (or null) when enriching recommend rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 06:34:12 +08:00
dekun c5b822a92e Speed up strategy page by removing blocking CTP sync on load.
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>
2026-07-02 23:16:53 +08:00
dekun ae28bc6273 Count roll groups as one position slot and protect monitors during roll.
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>
2026-07-02 23:04:34 +08:00
dekun 93bdce3568 Prefer monitor slots for position limit and fix dashboard sticky count.
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>
2026-07-02 23:01:50 +08:00
dekun 6710692dfb Fix position limit to count distinct slots and speed up strategy page.
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>
2026-07-02 22:49:32 +08:00
dekun 530738ae93 Fix roll first-lots display and make market add use pending orders.
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>
2026-07-02 22:12:04 +08:00
dekun 3c53b2063f Sync CTP monitors on strategy page load for roll trading.
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>
2026-07-02 21:55:50 +08:00
dekun 4657d26f5e Fix strategy roll page JS broken by Jinja in static file.
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>
2026-07-02 21:46:08 +08:00
dekun 075fae37ec Fix float P/L when using OpenCost entry and clear CTP hint on connect.
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>
2026-07-02 21:24:48 +08:00
dekun dca773d6be Fix CTP open average price direction mapping and resolution order.
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>
2026-07-02 21:13:28 +08:00
dekun 870dfb3bc0 Fix CTP position average price using OpenCost instead of PositionCost.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 20:53:15 +08:00
dekun b0afff53af Ensure scheduled auto backups explicitly include .env in backup archives.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 16:38:51 +08:00
dekun 8ebe1a3c77 Remove PostgreSQL support and standardize on SQLite only.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 16:21:27 +08:00
dekun 9379bc4f4f Add frontend backup upload and list-based restore with validation.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 16:03:18 +08:00
dekun 481086eddc Collapse dashboard server status into top bar and include .env in backup restore.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 15:43:48 +08:00
dekun aae897b7eb Add server status card to dashboard with public and private IP display.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 15:36:55 +08:00
dekun 5328673ce8 Add separate kline.db and pre-seed small-account four-product K-lines on startup.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 15:22:52 +08:00
dekun 972ab5d08b Route business quotes and K-lines to CTP; keep Sina only for market chart page.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 15:14:13 +08:00
dekun 98d63f38bf Fix dashboard position limit flicker by unifying active count across APIs.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 14:53:04 +08:00
dekun 658982d2b9 Speed up CTP account display: refresh equity on fast snapshot without waiting for full position sync.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 15:02:37 +08:00
dekun e5a586f903 Restructure into modules/ with single-process CTP and config/ layout.
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>
2026-07-01 14:42:16 +08:00