复制链接
克隆策略

    {"description":"实验创建于2022/4/8","graph":{"edges":[{"to_node_id":"-161:input_data","from_node_id":"-505:data"},{"to_node_id":"-760:input","from_node_id":"-505:data"},{"to_node_id":"-645:input_1","from_node_id":"-512:data"},{"to_node_id":"-161:features","from_node_id":"-666:data"},{"to_node_id":"-549:input_1","from_node_id":"-161:data"},{"to_node_id":"-7412:instruments","from_node_id":"-760:instrument_list"},{"to_node_id":"-567:data2","from_node_id":"-645:data_1"},{"to_node_id":"-567:data1","from_node_id":"-549:data_1"},{"to_node_id":"-577:input_1","from_node_id":"-567:data"},{"to_node_id":"-665:input_data","from_node_id":"-577:data_1"},{"to_node_id":"-7412:options_data","from_node_id":"-665:data"}],"nodes":[{"node_id":"-505","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"market_performance_CN_CONBOND","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"2022-01-17","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-07-20","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-505"},{"name":"features","node_id":"-505"}],"output_ports":[{"name":"data","node_id":"-505"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-512","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"basic_info_CN_CONBOND","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"2022-01-17","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-07-20","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-512"},{"name":"features","node_id":"-512"}],"output_ports":[{"name":"data","node_id":"-512"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-666","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\ndouble_low = close + bond_prem_ratio # 双低价\nremain_size > 1.5 # 剩余规模\ntotal_size\nremain_size\nbond_prem_ratio\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-666"}],"output_ports":[{"name":"data","node_id":"-666"}],"cacheable":true,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-161","module_id":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","parameters":[{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"drop_na","value":"False","type":"Literal","bound_global_parameter":null},{"name":"remove_extra_columns","value":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-161"},{"name":"features","node_id":"-161"}],"output_ports":[{"name":"data","node_id":"-161"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"-760","module_id":"BigQuantSpace.trade_data_generation.trade_data_generation-v1","parameters":[{"name":"category","value":"CN_STOCK","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input","node_id":"-760"}],"output_ports":[{"name":"history_data","node_id":"-760"},{"name":"instrument_list","node_id":"-760"},{"name":"calendar","node_id":"-760"}],"cacheable":false,"seq_num":9,"comment":"","comment_collapsed":true},{"node_id":"-645","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df = input_1.read()\n df['list_date'] = df['list_date'].astype(str)\n df['delist_date'] = df['delist_date'].astype(str)\n df = df.loc[:,['instrument','list_date','delist_date']]\n \n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-645"},{"name":"input_2","node_id":"-645"},{"name":"input_3","node_id":"-645"}],"output_ports":[{"name":"data_1","node_id":"-645"},{"name":"data_2","node_id":"-645"},{"name":"data_3","node_id":"-645"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-549","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df = input_1.read()\n \n df = df.loc[:,['date','instrument','close','bond_prem_ratio','double_low','remain_size','total_size']]\n \n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-549"},{"name":"input_2","node_id":"-549"},{"name":"input_3","node_id":"-549"}],"output_ports":[{"name":"data_1","node_id":"-549"},{"name":"data_2","node_id":"-549"},{"name":"data_3","node_id":"-549"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-567","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"how","value":"inner","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"-567"},{"name":"data2","node_id":"-567"}],"output_ports":[{"name":"data","node_id":"-567"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-577","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df = input_1.read()\n \n df['date'] = pd.to_datetime(df['date'])\n df['list_date'] = pd.to_datetime(df['list_date'])\n df['delist_date'] = pd.to_datetime(df['delist_date'])\n \n #买入规则:上市满30天,并且价格小于120\n #df['can_buy'] = df['date'] > (df['list_date'] + datetime.timedelta(days=30)) and df['close']<120\n df['can_buy'] = df['close']<120\n #卖出规则:价格大于140时卖\n df['to_clean'] = df['close']>140\n \n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-577"},{"name":"input_2","node_id":"-577"},{"name":"input_3","node_id":"-577"}],"output_ports":[{"name":"data_1","node_id":"-577"},{"name":"data_2","node_id":"-577"},{"name":"data_3","node_id":"-577"}],"cacheable":true,"seq_num":10,"comment":"","comment_collapsed":true},{"node_id":"-7412","module_id":"BigQuantSpace.hftrade.hftrade-v2","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"initialize","value":"# 交易引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n # 加载股票指标数据,数据继承自m6模块\n context.indicator_data = context.options['data'].read_df()\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n \n # 设置股票数量\n context.stock_num = 20\n \n # 调仓天数,22个交易日大概就是一个月。可以理解为一个月换仓一次\n context.rebalance_days = 22\n \n # 如果策略运行中,需要将数据进行保存,可以借用extension这个对象,类型为dict\n # 比如当前运行的k线的索引,比如个股持仓天数、买入均价\n if 'index' not in context.extension:\n context.extension['index'] = 0\n ","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"# 交易引擎:每个单位时间开盘前调用一次。\ndef bigquant_run(context, data):\n context.subscribe(context.instruments)\n pass","type":"Literal","bound_global_parameter":null},{"name":"handle_tick","value":"# 交易引擎:tick数据处理函数,每个tick执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n # context.extension['index'] += 1\n # 不在换仓日就return,相当于后面的代码只会一个月运行一次,买入的股票会持有1个月\n #if context.extension['index'] % context.rebalance_days != 0:\n # return\n # 当前的日期\n date = data.current_dt.strftime('%Y-%m-%d')\n print('----------',date)\n #获取当天的股票列表\n cur_data = context.indicator_data[context.indicator_data['date'] == date]\n\n #建仓条件判断:市场双低均值达到170可进行建仓\n #if cur_data['double_low'].mean() > 170:\n # print(date,':该调仓日市场双低均值为',cur_data['double_low'].mean(),\",无需建仓\")\n # return\n # 如果价格>120,则不建仓\n #if cur_data['close'].mean() > 120:\n # #print(date,'该转债价格大于120,',cur_data['instrument'],',无需建仓')\n # return\n \n # 设定股票池\n # 条件1:满足条件的可以买\n stock_can_buy = cur_data[cur_data['can_buy'] == True]\n # 条件2:满足卖出条件的可以卖\n stock_to_clean = cur_data[cur_data['to_clean'] == True]\n \n symbols = list(set(stock_can_buy['instrument'].values).difference(set(stock_to_clean['instrument'].values)))\n cur_data = cur_data.set_index('instrument').loc[symbols,:].reset_index().sort_values('close')\n stock_to_buy = list(cur_data.instrument[:context.stock_num])\n \n # 通过positions对象,使用列表生成式的方法获取目前持仓的股票列表\n stock_hold_now = [equity for equity in context.portfolio.positions]\n # 继续持有的股票:调仓时,如果买入的股票已经存在于目前的持仓里,那么应继续持有\n no_need_to_sell = [i for i in stock_hold_now if i in stock_to_buy]\n # 需要卖出的股票\n stock_to_sell = [i for i in stock_hold_now if i not in no_need_to_sell] \n \n # 卖出\n for stock in stock_to_sell:\n context.order_target_percent(stock, 0)\n \n # 如果当天没有买入的股票,就返回\n if len(stock_to_buy) == 0:\n print(date,'当天没有买入的股票')\n return\n\n # 等权重买入 \n weight = 1 / len(stock_to_buy)\n \n # 买入\n for stock in stock_to_buy:\n context.order_target_percent(stock, weight)\n ","type":"Literal","bound_global_parameter":null},{"name":"handle_trade","value":"# 交易引擎:成交回报处理函数,每个成交发生时执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"handle_order","value":"# 交易引擎:委托回报处理函数,每个委托变化时执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"after_trading","value":"# 交易引擎:盘后处理函数,每日盘后执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":"1000001","type":"Literal","bound_global_parameter":null},{"name":"frequency","value":"daily","type":"Literal","bound_global_parameter":null},{"name":"price_type","value":"真实价格","type":"Literal","bound_global_parameter":null},{"name":"product_type","value":"可转债","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":"0","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_buy","value":"close","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_sell","value":"close","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"000300.HIX","type":"Literal","bound_global_parameter":null},{"name":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"disable_cache","value":"False","type":"Literal","bound_global_parameter":null},{"name":"replay_bdb","value":"False","type":"Literal","bound_global_parameter":null},{"name":"show_debug_info","value":"False","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-7412"},{"name":"options_data","node_id":"-7412"},{"name":"history_ds","node_id":"-7412"},{"name":"benchmark_ds","node_id":"-7412"}],"output_ports":[{"name":"raw_perf","node_id":"-7412"}],"cacheable":false,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"-665","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"date<delist_date and close<120","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-665"}],"output_ports":[{"name":"data","node_id":"-665"},{"name":"left_data","node_id":"-665"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-505' Position='139,-159,200,200'/><node_position Node='-512' Position='623,-44,200,200'/><node_position Node='-666' Position='445,-164,200,200'/><node_position Node='-161' Position='322,-49,200,200'/><node_position Node='-760' Position='5,48,200,200'/><node_position Node='-645' Position='601,48,200,200'/><node_position Node='-549' Position='302,50,200,200'/><node_position Node='-567' Position='406.4010009765625,168.5484619140625,200,200'/><node_position Node='-577' Position='404.2525634765625,280.2680358886719,200,200'/><node_position Node='-7412' Position='228.9443359375,597.65771484375,200,200'/><node_position Node='-665' Position='413.92059326171875,408.1010437011719,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [114]:
    # 本代码由可视化策略环境自动生成 2022年7月21日 17:23
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m5_run_bigquant_run(input_1, input_2, input_3):
        # 示例代码如下。在这里编写您的代码
        df = input_1.read()
        df['list_date'] = df['list_date'].astype(str)
        df['delist_date'] = df['delist_date'].astype(str)
        df = df.loc[:,['instrument','list_date','delist_date']]
        
        data_1 = DataSource.write_df(df)
        return Outputs(data_1=data_1, data_2=None, data_3=None)
    
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m5_post_run_bigquant_run(outputs):
        return outputs
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m4_run_bigquant_run(input_1, input_2, input_3):
        # 示例代码如下。在这里编写您的代码
        df = input_1.read()
        
        df = df.loc[:,['date','instrument','close','bond_prem_ratio','double_low','remain_size','total_size']]
        
        data_1 = DataSource.write_df(df)
        return Outputs(data_1=data_1, data_2=None, data_3=None)
    
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m4_post_run_bigquant_run(outputs):
        return outputs
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m10_run_bigquant_run(input_1, input_2, input_3):
        # 示例代码如下。在这里编写您的代码
        df = input_1.read()
        
        df['date'] = pd.to_datetime(df['date'])
        df['list_date'] = pd.to_datetime(df['list_date'])
        df['delist_date'] = pd.to_datetime(df['delist_date'])
        
        #买入规则:上市满30天,并且价格小于120
        #df['can_buy'] = df['date'] > (df['list_date'] + datetime.timedelta(days=30)) and df['close']<120
        df['can_buy'] = df['close']<120
        #卖出规则:价格大于140时卖
        df['to_clean'] = df['close']>140
        
        data_1 = DataSource.write_df(df)
        return Outputs(data_1=data_1, data_2=None, data_3=None)
    
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m10_post_run_bigquant_run(outputs):
        return outputs
    
    # 交易引擎:初始化函数,只执行一次
    def m8_initialize_bigquant_run(context):
           # 加载股票指标数据,数据继承自m6模块
        context.indicator_data = context.options['data'].read_df()
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        
        # 设置股票数量
        context.stock_num = 20
        
        # 调仓天数,22个交易日大概就是一个月。可以理解为一个月换仓一次
        context.rebalance_days = 22
        
        # 如果策略运行中,需要将数据进行保存,可以借用extension这个对象,类型为dict
        # 比如当前运行的k线的索引,比如个股持仓天数、买入均价
        if 'index' not in context.extension:
            context.extension['index'] = 0
     
    # 交易引擎:每个单位时间开盘前调用一次。
    def m8_before_trading_start_bigquant_run(context, data):
        context.subscribe(context.instruments)
        pass
    # 交易引擎:tick数据处理函数,每个tick执行一次
    def m8_handle_tick_bigquant_run(context, data):
        pass
    
    # 回测引擎:每日数据处理函数,每天执行一次
    def m8_handle_data_bigquant_run(context, data):
        # context.extension['index'] += 1
        # 不在换仓日就return,相当于后面的代码只会一个月运行一次,买入的股票会持有1个月
        #if  context.extension['index'] % context.rebalance_days != 0:
        #    return
        # 当前的日期
        date = data.current_dt.strftime('%Y-%m-%d')
        print('----------',date)
        #获取当天的股票列表
        cur_data = context.indicator_data[context.indicator_data['date'] == date]
    
        #建仓条件判断:市场双低均值达到170可进行建仓
        #if cur_data['double_low'].mean() > 170:
        #    print(date,':该调仓日市场双低均值为',cur_data['double_low'].mean(),",无需建仓")
        #    return
        # 如果价格>120,则不建仓
        #if cur_data['close'].mean() > 120:
        #    #print(date,'该转债价格大于120,',cur_data['instrument'],',无需建仓')
        #   return
       
        # 设定股票池
        # 条件1:满足条件的可以买
        stock_can_buy = cur_data[cur_data['can_buy'] == True]
        # 条件2:满足卖出条件的可以卖
        stock_to_clean = cur_data[cur_data['to_clean'] == True]
        
        symbols = list(set(stock_can_buy['instrument'].values).difference(set(stock_to_clean['instrument'].values)))
        cur_data = cur_data.set_index('instrument').loc[symbols,:].reset_index().sort_values('close')
        stock_to_buy = list(cur_data.instrument[:context.stock_num])
       
        # 通过positions对象,使用列表生成式的方法获取目前持仓的股票列表
        stock_hold_now = [equity for equity in context.portfolio.positions]
        # 继续持有的股票:调仓时,如果买入的股票已经存在于目前的持仓里,那么应继续持有
        no_need_to_sell = [i for i in stock_hold_now if i in stock_to_buy]
        # 需要卖出的股票
        stock_to_sell = [i for i in stock_hold_now if i not in no_need_to_sell] 
        
        # 卖出
        for stock in stock_to_sell:
            context.order_target_percent(stock, 0)
        
        # 如果当天没有买入的股票,就返回
        if len(stock_to_buy) == 0:
            print(date,'当天没有买入的股票')
            return
    
        # 等权重买入 
        weight =  1 / len(stock_to_buy)
        
        # 买入
        for stock in stock_to_buy:
            context.order_target_percent(stock, weight)
     
    # 交易引擎:成交回报处理函数,每个成交发生时执行一次
    def m8_handle_trade_bigquant_run(context, data):
        pass
    
    # 交易引擎:委托回报处理函数,每个委托变化时执行一次
    def m8_handle_order_bigquant_run(context, data):
        pass
    
    # 交易引擎:盘后处理函数,每日盘后执行一次
    def m8_after_trading_bigquant_run(context, data):
        pass
    
    
    m1 = M.use_datasource.v1(
        datasource_id='market_performance_CN_CONBOND',
        start_date='2022-01-17',
        end_date='2022-07-20'
    )
    
    m9 = M.trade_data_generation.v1(
        input=m1.data,
        category='CN_STOCK',
        m_cached=False
    )
    
    m2 = M.use_datasource.v1(
        datasource_id='basic_info_CN_CONBOND',
        start_date='2022-01-17',
        end_date='2022-07-20'
    )
    
    m5 = M.cached.v3(
        input_1=m2.data,
        run=m5_run_bigquant_run,
        post_run=m5_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    m6 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    double_low = close + bond_prem_ratio # 双低价
    remain_size > 1.5 # 剩余规模
    total_size
    remain_size
    bond_prem_ratio
    """
    )
    
    m7 = M.derived_feature_extractor.v3(
        input_data=m1.data,
        features=m6.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m4 = M.cached.v3(
        input_1=m7.data,
        run=m4_run_bigquant_run,
        post_run=m4_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    m3 = M.join.v3(
        data1=m4.data_1,
        data2=m5.data_1,
        on='instrument',
        how='inner',
        sort=False
    )
    
    m10 = M.cached.v3(
        input_1=m3.data,
        run=m10_run_bigquant_run,
        post_run=m10_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    m11 = M.filter.v3(
        input_data=m10.data_1,
        expr='date<delist_date and close<120',
        output_left_data=True
    )
    
    m8 = M.hftrade.v2(
        instruments=m9.instrument_list,
        options_data=m11.data,
        start_date='',
        end_date='',
        initialize=m8_initialize_bigquant_run,
        before_trading_start=m8_before_trading_start_bigquant_run,
        handle_tick=m8_handle_tick_bigquant_run,
        handle_data=m8_handle_data_bigquant_run,
        handle_trade=m8_handle_trade_bigquant_run,
        handle_order=m8_handle_order_bigquant_run,
        after_trading=m8_after_trading_bigquant_run,
        capital_base=1000001,
        frequency='daily',
        price_type='真实价格',
        product_type='可转债',
        before_start_days='0',
        order_price_field_buy='close',
        order_price_field_sell='close',
        benchmark='000300.HIX',
        plot_charts=True,
        disable_cache=False,
        replay_bdb=False,
        show_debug_info=False,
        backtest_only=False
    )
    
    ---------- 2022-01-17
    ---------- 2022-01-18
    ---------- 2022-01-19
    ---------- 2022-01-20
    ---------- 2022-01-21
    
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    <ipython-input-114-0f056b8e46c2> in <module>
        229 )
        230 
    --> 231 m8 = M.hftrade.v2(
        232     instruments=m9.instrument_list,
        233     options_data=m11.data,
    
    TypeError: 'NoneType' object is not iterable
    In [ ]:
    m11.data.read()
    
    In [ ]:
    m10.data_1.read()
    
    In [ ]:
    m3.data.read()