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>
This commit is contained in:
+3
-3
@@ -113,13 +113,13 @@ CTP_LIVE_ENV=实盘
|
||||
| `offset=close_long` + 持多 | Direction.**SHORT**(卖平) | 见下表 |
|
||||
| `offset=close_short` + 持空 | Direction.**LONG**(买平) | 见下表 |
|
||||
|
||||
**开平标志** 由 `_resolve_close_offset()` 按 **交易所规则** 自动选择(与 SimNow/实盘 CTP 规范一致):
|
||||
**开平标志** 由 VeighNa **`OffsetConverter`**(`vnpy/trader/converter.py`)自动转换:策略层发 `Offset.CLOSE`,框架按今/昨仓拆单为 `CLOSETODAY` / `CLOSEYESTERDAY`(与 CTA 引擎 `sell()`/`cover()` 一致)。持仓今昨数据来自 CTP `OnRspQryInvestorPosition` 的 **PositionDate** 字段,修正 vnpy 网关合并误差后喂给 OffsetConverter。
|
||||
|
||||
| 交易所 | 规则 |
|
||||
|--------|------|
|
||||
| **大商所(DCE)** 等 | 使用通用 **CLOSE** |
|
||||
| **上期所(SHFE)、能源(INE)、郑商所(CZCE)、中金所(CFFEX)** | 区分 **平今 CLOSETODAY** / **平昨 CLOSEYESTERDAY** |
|
||||
| 选择依据 | CTP `OnRspQryInvestorPosition` 的 **PositionDate**(1=今仓、2=昨仓);上期所今昨为**两条独立回报**,与同花顺/快期一致 |
|
||||
| **上期所(SHFE)、能源(INE)** | OffsetConverter 按今/昨可平量自动拆单 |
|
||||
| 持仓来源 | CTP **PositionDate**(1=今仓、2=昨仓)缓存,修正 `PositionData.yd_volume` |
|
||||
|
||||
这与国内期货公司 CTP 客户端、快期等 **标准投机平仓逻辑** 一致。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user