Commit Graph

8 Commits

Author SHA1 Message Date
dekun 2081bf2da9 Add daily loss force-flatten at configurable equity limit
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 12:42:13 +08:00
dekun d46cd7c3e1 Use VeighNa OffsetConverter for SHFE close today/yesterday split.
Feed CTP PositionDate-corrected positions to converter like CTA engine sell/cover.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 09:35:20 +08:00
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 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 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