Skip to content

Commit

Permalink
[Mod] 修改价差腿的持仓初始化逻辑,适配3.6.0版本框架
Browse files Browse the repository at this point in the history
  • Loading branch information
vnpy committed Feb 16, 2023
1 parent 6e72017 commit b6bde99
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions vnpy_spreadtrading/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,9 @@ def get_leg(self, vt_symbol: str) -> LegData:
self.main_engine.subscribe(req, contract.gateway_name)

# Initialize leg position
for direction in Direction:
vt_positionid: str = f"{vt_symbol}.{direction.value}"
position: Optional[PositionData] = self.main_engine.get_position(vt_positionid)

if position:
positions: List[PositionData] = self.main_engine.get_all_positions()
for position in positions:
if position.vt_symbol == vt_symbol:
leg.update_position(position)

return leg
Expand Down

0 comments on commit b6bde99

Please sign in to comment.