fix(trader): volume×size(A股1手=100股) — DoubleMa 真策略回放 filled=3 跑通

This commit is contained in:
2026-07-07 15:15:27 +08:00
parent 17a4801450
commit ba2138e1cf
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -30,10 +30,11 @@ class PaperCtaEngine:
def __init__(self, strategy_id: str,
match_session: MatchSession | str = MatchSession.NEXT_OPEN,
listing_days: int = 0) -> None:
listing_days: int = 0, size: int = 1) -> None:
self.strategy_id = strategy_id
self.match_session = MatchSession(match_session) if isinstance(match_session, str) else match_session
self.listing_days = listing_days
self.size = size # 合约乘数:A 股 1 手=100 股 → size=100mock 默认 1
self.strategy = None
self.pending_orders: list[PaperOrder] = []
@@ -51,7 +52,7 @@ class PaperCtaEngine:
symbol=symbol,
side=_direction_to_side(direction),
price=float(price),
volume=int(volume),
volume=int(volume) * self.size, # vnpy 策略 volume 单位=手,转股(A 股 ×100)
is_market=True,
match_session=self.match_session,
listing_days=self.listing_days,