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
a34bcb6bfc
Fix test_simnow.py imports for modules layout and config/.env.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 14:47:27 +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
dekun
b354d6c701
Document Git-only deploy workflow and reduce positions page IPC blocking.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 14:05:37 +08:00
dekun
7748a88219
Fix positions page hang from blocking CTP IPC and SSE lock wait.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 13:33:59 +08:00
dekun
5aba31f530
Fix position SSE JSON serialization for datetime fields.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 13:27:46 +08:00
dekun
95156ca595
Update docs for CTP worker split and roll breakout off-session.
...
Refresh DEPLOY, TRADING, STRATEGY, CTP_LIVE, FEATURES, INDEX, and README to document qihuo-ctp architecture, dual PM2 restarts, and休盘突破加仓.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 12:56:27 +08:00
dekun
9cd81a3ea7
Isolate CTP in worker process and improve strategy roll UX.
...
Split vn.py into qihuo-ctp worker with IPC client bridge, keep CTP connected during breaks with cached account fallback, speed up strategy page loads, and allow off-session breakout roll submissions.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 12:37:44 +08:00
dekun
08d55411aa
Simplify account_risk_state DDL for PostgreSQL compatibility.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:31:17 +08:00
dekun
cd636ff1c3
Fix account_risk_state missing on PostgreSQL: probe table before cache skip.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:29:46 +08:00
dekun
d7ea7b9e8a
Inline account_risk_state DDL in init_db; use autocommit for migration.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:26:13 +08:00
dekun
06fbff04a7
Ensure account_risk_state table exists even if schema flag was set.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:25:07 +08:00
dekun
ef790c8a80
Fix migration: per-table connections and skip non-serial setval.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:24:27 +08:00
dekun
6abe06d935
Ensure all PG tables on init; fix migration commits per table.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:22:54 +08:00
dekun
e418c2dcec
Fix SQLite migration: no app import, commit per table.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:22:21 +08:00
dekun
1bb0028402
Import rollback_if_postgres in strategy_db for PostgreSQL migrations.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:21:35 +08:00
dekun
8e1baf9a73
Commit each schema migration separately on PostgreSQL.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:20:49 +08:00
dekun
47ee9602d1
Use direct PostgreSQL connections instead of pool to fix init deploy.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:19:46 +08:00
dekun
843b68b412
Stop PM2 before PostgreSQL init to free connection pool.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:17:29 +08:00
dekun
2347276bf4
Fix PostgreSQL schema init: commit DDL before ALTER migrations.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:15:31 +08:00
dekun
008f042fcc
Fix init-only mode for PostgreSQL deploy script imports.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:14:43 +08:00
dekun
a1f22624de
Harden PostgreSQL deploy: auto-rollback on SQL errors, clean DB on migrate.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:13:51 +08:00
dekun
bc79ad308c
Fix PostgreSQL init_db: rollback after benign schema migration errors.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:13:14 +08:00
dekun
1b276b5897
Fix PostgreSQL DDL: use single-quoted DEFAULT literals.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:12:34 +08:00
dekun
52aca456e9
Add PostgreSQL production backend to eliminate SQLite lock contention.
...
Support DATABASE_URL with connection pooling, pg_dump backups, SQLite migration script, and deploy_postgres.sh with docs.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-01 08:11:42 +08:00
dekun
39eac983ff
Fix positions and records pages hanging on load.
...
Stop blocking page render on full trading live rebuild and CTP trade sync; use cached snapshot and background prime instead.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 23:31:13 +08:00
dekun
1b3a7f1bdc
Fix position flicker, drop futures cooloff, prioritize startup display.
...
Preserve trading state when CTP memory is empty, bootstrap equity/positions on page load, stabilize risk status from DB monitors, and remove app-layer manual close cooling periods.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 23:17:18 +08:00
dekun
2386eca324
Fix stats max profit/loss to use win/loss subsets only.
...
Corrects misleading breakdown rows and summary max amounts after trade log edits.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 22:28:46 +08:00
dekun
d324d30332
Schedule CTP disconnect 30 minutes after day and night session close.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 22:14:39 +08:00
dekun
32838daae0
Align trade record verify/edit UX with Binance instance single-row prompts.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 22:02:48 +08:00
dekun
b6b7bfb248
Add close price column to trade records for overnight position PnL review.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 21:51:53 +08:00
dekun
4552f4ef9c
Default equity chain baseline to 100k when live_capital unset.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 21:44:15 +08:00
dekun
0b924fca87
Fix trade log equity_after to chain from initial capital by close time.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 21:41:37 +08:00
dekun
8d2d09396b
Fix missing trade log after manual close when CTP is connected.
...
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-06-30 21:23:44 +08:00
dekun
e5f264b774
Increase trade calendar cell font sizes for readability.
2026-06-30 12:11:57 +08:00