From 1aa2faf4cb9e4c2abf7a4f527e15b7a04ae3214a Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 26 Apr 2019 16:52:36 +0800 Subject: [PATCH] [Mod]change is_convert_required function --- vnpy/app/cta_strategy/converter.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vnpy/app/cta_strategy/converter.py b/vnpy/app/cta_strategy/converter.py index a7f5a1b1..e12439c8 100644 --- a/vnpy/app/cta_strategy/converter.py +++ b/vnpy/app/cta_strategy/converter.py @@ -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