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>
This commit is contained in:
dekun
2026-07-03 09:30:38 +08:00
parent 0bade8a01f
commit 2ec534c547
2 changed files with 137 additions and 92 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ CTP_LIVE_ENV=实盘
|--------|------|
| **大商所(DCE** 等 | 使用通用 **CLOSE** |
| **上期所(SHFE)、能源(INE)、郑商所(CZCE)、中金所(CFFEX)** | 区分 **平今 CLOSETODAY** / **平昨 CLOSEYESTERDAY** |
| 选择依据 | 查询持仓的今仓 `td_volume`、昨仓 `yd_volume`,优先平今再平昨 |
| 选择依据 | CTP `OnRspQryInvestorPosition`**PositionDate**(1=今仓、2=昨仓);上期所今昨为**两条独立回报**,与同花顺/快期一致 |
这与国内期货公司 CTP 客户端、快期等 **标准投机平仓逻辑** 一致。