[Mod]change is_convert_required function

This commit is contained in:
vn.py 2019-04-26 16:52:36 +08:00
parent be3850fe3c
commit 1aa2faf4cb

View File

@ -1,6 +1,5 @@
""""""
from copy import copy
from functools import lru_cache
from vnpy.trader.engine import MainEngine
from vnpy.trader.object import (
@ -76,7 +75,6 @@ class OffsetConverter:
else:
return [req]
@lru_cache()
def is_convert_required(self, vt_symbol: str):
"""
Check if the contract needs offset convert.
@ -84,7 +82,7 @@ class OffsetConverter:
contract = self.main_engine.get_contract(vt_symbol)
# Only contracts with long-short position mode requires convert
if not contract.net_position:
if not contract or not contract.net_position:
return True
else:
return False