From 53eb0a49399e641d5e50a64effec76dd9ce8055c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=98=89=E4=BF=8A?= <654181984@qq.com> Date: Mon, 15 Aug 2022 11:07:41 +0800 Subject: [PATCH] fix gen_future_info --- rqalpha/data/bundle.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rqalpha/data/bundle.py b/rqalpha/data/bundle.py index 65b5fdf8f..cdd53ef26 100644 --- a/rqalpha/data/bundle.py +++ b/rqalpha/data/bundle.py @@ -183,15 +183,18 @@ def gen_future_info(d): symbol_list = [] param = ['close_commission_ratio', 'close_commission_today_ratio', 'commission_type', 'open_commission_ratio'] - # 当修改了hard_code以后,避免用户需要手动删除future_info.json文件 - all_futures_info.extend(filter(lambda x: x["underlying_symbol"] not in symbol_list, hard_code)) - for i in all_futures_info: if i.get('order_book_id'): future_list.append(i.get('order_book_id')) else: symbol_list.append(i.get('underlying_symbol')) + # 当修改了hard_code以后,避免用户需要手动删除future_info.json文件 + for info in hard_code: + if info["underlying_symbol"] not in symbol_list: + all_futures_info.append(info) + symbol_list.append(info["underlying_symbol"]) + futures_order_book_id = rqdatac.all_instruments(type='Future')['order_book_id'].unique() for future in futures_order_book_id: underlying_symbol = re.match(r'^[a-zA-Z]*', future).group()