Merge pull request #1825 from 1122455801/convert_mod_0613

[Mod] 修复converter的bug
This commit is contained in:
vn.py 2019-06-13 12:21:33 +08:00 committed by GitHub
commit 4e237d5894
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,7 +240,7 @@ class PositionHolding:
td_available = self.long_td - self.long_td_frozen td_available = self.long_td - self.long_td_frozen
if req.volume > pos_available: if req.volume > pos_available:
return [req] return []
elif req.volume <= td_available: elif req.volume <= td_available:
req_td = copy(req) req_td = copy(req)
req_td.offset = Offset.CLOSETODAY req_td.offset = Offset.CLOSETODAY
@ -278,7 +278,7 @@ class PositionHolding:
# If no td_volume, we close opposite yd position first # If no td_volume, we close opposite yd position first
# then open new position # then open new position
else: else:
open_volume = max(0, yd_available - req.volume) open_volume = max(0, req.volume - yd_available)
req_list = [] req_list = []
if yd_available: if yd_available: