From 5c394b89b40b4a776ae372dcb92d2780d738c4ec Mon Sep 17 00:00:00 2001 From: msincenselee Date: Wed, 13 Jan 2021 15:27:30 +0800 Subject: [PATCH] =?UTF-8?q?[bug=20fix]=20=E4=B8=AD=E9=87=91=E6=89=80?= =?UTF-8?q?=E8=82=A1=E6=8C=87=E4=B8=BB=E5=8A=9B=E5=90=88=E7=BA=A6=E6=8F=90?= =?UTF-8?q?=E5=89=8D=E4=B8=A4=E5=A4=A9=E6=8D=A2=E6=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/data/tdx/tdx_future_data.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vnpy/data/tdx/tdx_future_data.py b/vnpy/data/tdx/tdx_future_data.py index c327b859..af977759 100644 --- a/vnpy/data/tdx/tdx_future_data.py +++ b/vnpy/data/tdx/tdx_future_data.py @@ -937,6 +937,7 @@ class TdxFutureData(object): if underlying_symbol in ['IC', 'IF', 'IH']: mi_symbol = convert_cffex_symbol(mi_symbol) + full_symbol = get_full_symbol(mi_symbol) # 更新登记 短合约:真实主力合约 self.write_log( @@ -944,8 +945,9 @@ class TdxFutureData(object): if underlying_symbol in self.future_contracts: info = self.future_contracts.get(underlying_symbol) cur_mi_symbol = info.get('mi_symbol', None) + cur_full_symbol = info.get('full_symbol', None) - if cur_mi_symbol is None or mi_symbol > cur_mi_symbol: + if cur_mi_symbol is None or mi_symbol > cur_mi_symbol or cur_full_symbol is None or full_symbol > cur_full_symbol: self.write_log(u'主力合约变化:{} =>{}'.format(info.get('mi_symbol'), mi_symbol)) info.update({'mi_symbol': mi_symbol, 'full_symbol': full_symbol}) self.future_contracts.update({underlying_symbol: info})