[Mod] initialize LegData with position when created
This commit is contained in:
parent
70b589ed52
commit
5aadb46bef
@ -228,6 +228,14 @@ class SpreadDataEngine:
|
||||
)
|
||||
self.main_engine.subscribe(req, contract.gateway_name)
|
||||
|
||||
# Initialize leg position
|
||||
for direction in Direction:
|
||||
vt_positionid = f"{vt_symbol}.{direction.value}"
|
||||
position = self.main_engine.get_position(vt_positionid)
|
||||
|
||||
if position:
|
||||
leg.update_position(position)
|
||||
|
||||
return leg
|
||||
|
||||
def add_spread(
|
||||
|
Loading…
Reference in New Issue
Block a user