From 2916cb439141114ec75743438e03d6c550f693d2 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Thu, 31 Oct 2019 12:15:32 +0800 Subject: [PATCH] [Mod] lock mode close order volume reset --- vnpy/trader/converter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vnpy/trader/converter.py b/vnpy/trader/converter.py index d42a39eb..b181bdbe 100644 --- a/vnpy/trader/converter.py +++ b/vnpy/trader/converter.py @@ -278,6 +278,7 @@ class PositionHolding: # If no td_volume, we close opposite yd position first # then open new position else: + close_volume = min(req.volume, yd_available) open_volume = max(0, req.volume - yd_available) req_list = [] @@ -287,6 +288,7 @@ class PositionHolding: req_yd.offset = Offset.CLOSEYESTERDAY else: req_yd.offset = Offset.CLOSE + req_yd.volume = close_volume req_list.append(req_yd) if open_volume: