MACD策略运行报错“invalid load key, 'H'”

策略分享
新手专区
标签: #<Tag:0x00007fc82831a770> #<Tag:0x00007fc82831a630>

(公孙睿) #1
克隆策略

    {"Description":"实验创建于2020/1/11","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-130:instruments","SourceOutputPortId":"-121:data"},{"DestinationInputPortId":"-1442:instruments","SourceOutputPortId":"-121:data"},{"DestinationInputPortId":"-1888:instruments","SourceOutputPortId":"-130:data"},{"DestinationInputPortId":"-863:instruments","SourceOutputPortId":"-144:data"},{"DestinationInputPortId":"-619:features","SourceOutputPortId":"-240:data"},{"DestinationInputPortId":"-130:features","SourceOutputPortId":"-240:data"},{"DestinationInputPortId":"-1888:features","SourceOutputPortId":"-240:data"},{"DestinationInputPortId":"-863:features","SourceOutputPortId":"-456:data"},{"DestinationInputPortId":"-870:features","SourceOutputPortId":"-456:data"},{"DestinationInputPortId":"-627:input_data","SourceOutputPortId":"-619:data"},{"DestinationInputPortId":"-1881:data1","SourceOutputPortId":"-627:data"},{"DestinationInputPortId":"-870:input_data","SourceOutputPortId":"-863:data"},{"DestinationInputPortId":"-878:input_data","SourceOutputPortId":"-870:data"},{"DestinationInputPortId":"-1881:data2","SourceOutputPortId":"-878:data"},{"DestinationInputPortId":"-1442:options_data","SourceOutputPortId":"-1881:data"},{"DestinationInputPortId":"-619:input_data","SourceOutputPortId":"-1888:data"}],"ModuleNodes":[{"Id":"-121","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2019-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2019-12-31","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"000001.SZA","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-121"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-121","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-130","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar60m_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"2019-01-01 9:00","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2019-12-31 15:00","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-130"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-130"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-130","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-144","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2019-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2019-12-31","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"000001.SZA","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-144"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-144","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-240","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nbuy_condition=where(ta_macd_dea(close_1)<0 & ta_macd_dea(close_0)>0,1,0)\nsell_condition=where(ta_macd_dea(close_1)>0 & ta_macd_dea(close_0)<0,1,0)\n\n\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-240"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-240","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-456","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\npre_condition=where(ta_macd_dea(close_0)>0,1,0)\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-456"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-456","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-619","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-619"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-619"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-619","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-627","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-627"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-627","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":8,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-863","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":90,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-863"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-863"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-863","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-870","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-870"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-870"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-870","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":10,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-878","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-878"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-878","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":11,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1442","ModuleId":"BigQuantSpace.trade.trade-v4","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"initialize","Value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n # 设置是否是结算模式\n context.set_need_settle(False)\n context.set_commission(PerOrder(buy_cost=0.0013, sell_cost=0.0023, min_cost=5))\n # 当日分钟K线数量记录变量初始化\n context.index = 1\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"handle_data","Value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n\n instrument_symbol = context.symbol(context.instruments[0]) # 交易标的\n curr_position = context.portfolio.positions[instrument_symbol].amount # 持仓数量\n \n if context.index < 5: # 日内数据超过窗口范围后才开始交易\n context.index += 1\n return\n \n # 获取当前分钟的买卖信号\n today_date=data.current_dt.strftime('%Y-%m-%d %H:%M:%S')\n try:\n buy_condition = context.buy_condition[today_date] + context.pre_condition[today_date]\n except:\n buy_condition = 0\n \n try: \n sell_condition=context.sell_condition[today_date]\n except:\n sell_condition = 0\n \n \n # 如果当前没有仓位,且大于通道价格上限,long开仓\n if curr_position == 0 and buy_condition>1:\n context.order_target_percent(instrument_symbol, 1)\n elif curr_position >= 0 and sell_condition>0:\n context.order_target(instrument_symbol, 0)","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n df = context.options['data'].read_df()\n df['date']=df['date'].apply(lambda x:x.strftime('%Y-%m-%d %H:%M:%S'))\n df.set_index('date',inplace=True)\n context.buy_condition=df['buy_condition']\n context.sell_condition=df['sell_condition']\n\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"# 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。\ndef bigquant_run(context, data):\n pass\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"volume_limit","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_buy","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_sell","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":"50000","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"auto_cancel_non_tradable_orders","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_frequency","Value":"minute","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"price_type","Value":"后复权","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"product_type","Value":"股票","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"plot_charts","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"backtest_only","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-1442"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-1442","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":13,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1881","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"inner","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-1881"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-1881"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-1881","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1888","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":"30","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-1888"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-1888"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-1888","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":12,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-121' Position='-23,105,200,200'/><NodePosition Node='-130' Position='153,232,200,200'/><NodePosition Node='-144' Position='700,101,200,200'/><NodePosition Node='-240' Position='323,101,200,200'/><NodePosition Node='-456' Position='1011,100,200,200'/><NodePosition Node='-619' Position='347,441,200,200'/><NodePosition Node='-627' Position='393,548,200,200'/><NodePosition Node='-863' Position='809,309,200,200'/><NodePosition Node='-870' Position='815,421,200,200'/><NodePosition Node='-878' Position='776,557,200,200'/><NodePosition Node='-1442' Position='476,832,200,200'/><NodePosition Node='-1881' Position='556,697,200,200'/><NodePosition Node='-1888' Position='292,340,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
    In [24]:
    # 本代码由可视化策略环境自动生成 2020年1月13日 15:22
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # 回测引擎:初始化函数,只执行一次
    def m13_initialize_bigquant_run(context):
       # 设置是否是结算模式
        context.set_need_settle(False)
        context.set_commission(PerOrder(buy_cost=0.0013, sell_cost=0.0023, min_cost=5))
        # 当日分钟K线数量记录变量初始化
        context.index = 1
    
    # 回测引擎:每日数据处理函数,每天执行一次
    def m13_handle_data_bigquant_run(context, data):
    
        instrument_symbol = context.symbol(context.instruments[0]) # 交易标的
        curr_position = context.portfolio.positions[instrument_symbol].amount # 持仓数量
        
        if context.index < 5: # 日内数据超过窗口范围后才开始交易
            context.index += 1
            return
        
        # 获取当前分钟的买卖信号
        today_date=data.current_dt.strftime('%Y-%m-%d %H:%M:%S')
        try:
            buy_condition = context.buy_condition[today_date] + context.pre_condition[today_date]
        except:
            buy_condition = 0
        
        try:    
            sell_condition=context.sell_condition[today_date]
        except:
            sell_condition = 0
            
        
        # 如果当前没有仓位,且大于通道价格上限,long开仓
        if curr_position == 0 and buy_condition>1:
            context.order_target_percent(instrument_symbol, 1)
        elif curr_position >= 0 and sell_condition>0:
            context.order_target(instrument_symbol, 0)
    # 回测引擎:准备数据,只执行一次
    def m13_prepare_bigquant_run(context):
        df = context.options['data'].read_df()
        df['date']=df['date'].apply(lambda x:x.strftime('%Y-%m-%d %H:%M:%S'))
        df.set_index('date',inplace=True)
        context.buy_condition=df['buy_condition']
        context.sell_condition=df['sell_condition']
    
    
    # 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。
    def m13_before_trading_start_bigquant_run(context, data):
        pass
    
    
    m1 = M.instruments.v2(
        start_date='2019-01-01',
        end_date='2019-12-31',
        market='CN_STOCK_A',
        instrument_list='000001.SZA',
        max_count=0
    )
    
    m3 = M.instruments.v2(
        start_date='2019-01-01',
        end_date='2019-12-31',
        market='CN_STOCK_A',
        instrument_list='000001.SZA',
        max_count=0
    )
    
    m4 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    buy_condition=where(ta_macd_dea(close_1)<0 & ta_macd_dea(close_0)>0,1,0)
    sell_condition=where(ta_macd_dea(close_1)>0 & ta_macd_dea(close_0)<0,1,0)
    
    
    """
    )
    
    m2 = M.use_datasource.v1(
        instruments=m1.data,
        features=m4.data,
        datasource_id='bar60m_CN_STOCK_A',
        start_date='2019-01-01 9:00',
        end_date='2019-12-31 15:00'
    )
    
    m12 = M.general_feature_extractor.v7(
        instruments=m2.data,
        features=m4.data,
        start_date='',
        end_date='',
        before_start_days=30
    )
    
    m7 = M.derived_feature_extractor.v3(
        input_data=m12.data,
        features=m4.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m8 = M.dropnan.v1(
        input_data=m7.data
    )
    
    m5 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    pre_condition=where(ta_macd_dea(close_0)>0,1,0)
    """
    )
    
    m9 = M.general_feature_extractor.v7(
        instruments=m3.data,
        features=m5.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m10 = M.derived_feature_extractor.v3(
        input_data=m9.data,
        features=m5.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m11 = M.dropnan.v1(
        input_data=m10.data
    )
    
    m6 = M.join.v3(
        data1=m8.data,
        data2=m11.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m13 = M.trade.v4(
        instruments=m1.data,
        options_data=m6.data,
        start_date='',
        end_date='',
        initialize=m13_initialize_bigquant_run,
        handle_data=m13_handle_data_bigquant_run,
        prepare=m13_prepare_bigquant_run,
        before_trading_start=m13_before_trading_start_bigquant_run,
        volume_limit=0,
        order_price_field_buy='open',
        order_price_field_sell='open',
        capital_base=50000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='minute',
        price_type='后复权',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark=''
    )
    

    基础特征抽取(general_feature_extractor)使用错误,你可以:

    1.一键查看文档

    2.一键搜索答案

    ---------------------------------------------------------------------------
    UnpicklingError                           Traceback (most recent call last)
    <ipython-input-24-14c41d32cfaf> in <module>()
         35     start_date='',
         36     end_date='',
    ---> 37     before_start_days=30
         38 )
    
    UnpicklingError: invalid load key, 'H'.

    策略运行的时候报错了,请问是什么原因?谢谢!


    (iQuant) #2

    先检查一下连线是否正确呢?每个模块连线接口有提示。


    (公孙睿) #3

    连线没有看出什么错误


    (达达) #4

    这个略微复杂

    克隆策略

      {"Description":"实验创建于2020/1/11","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-130:instruments","SourceOutputPortId":"-121:data"},{"DestinationInputPortId":"-1442:instruments","SourceOutputPortId":"-121:data"},{"DestinationInputPortId":"-619:input_data","SourceOutputPortId":"-130:data"},{"DestinationInputPortId":"-863:instruments","SourceOutputPortId":"-144:data"},{"DestinationInputPortId":"-619:features","SourceOutputPortId":"-240:data"},{"DestinationInputPortId":"-130:features","SourceOutputPortId":"-240:data"},{"DestinationInputPortId":"-863:features","SourceOutputPortId":"-456:data"},{"DestinationInputPortId":"-870:features","SourceOutputPortId":"-456:data"},{"DestinationInputPortId":"-103:input_1","SourceOutputPortId":"-619:data"},{"DestinationInputPortId":"-870:input_data","SourceOutputPortId":"-863:data"},{"DestinationInputPortId":"-99:input_ds","SourceOutputPortId":"-870:data"},{"DestinationInputPortId":"-93:data1","SourceOutputPortId":"-103:data_1"},{"DestinationInputPortId":"-1442:options_data","SourceOutputPortId":"-93:data"},{"DestinationInputPortId":"-93:data2","SourceOutputPortId":"-99:data"}],"ModuleNodes":[{"Id":"-121","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2019-02-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2019-03-31","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"000001.SZA","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-121"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-121","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"Comment":"","CommentCollapsed":true},{"Id":"-130","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar60m_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"2019-01-01 9:00","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2019-12-31 15:00","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-130"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-130"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-130","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"Comment":"","CommentCollapsed":true},{"Id":"-144","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2019-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2019-03-31","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"000001.SZA","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-144"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-144","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"Comment":"","CommentCollapsed":true},{"Id":"-240","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\n\nbuy_condition=where((ta_macd_dea(shift(close,1))<0) & (ta_macd_dea(close)>0),1,0)\nsell_condition=where((ta_macd_dea(shift(close,1))>0) & (ta_macd_dea(close)<0),1,0)","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-240"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-240","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"Comment":"","CommentCollapsed":true},{"Id":"-456","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\npre_condition=where(shift(ta_macd_dea(close_0),1)>0,1,0)\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-456"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-456","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"Comment":"","CommentCollapsed":true},{"Id":"-619","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-619"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-619"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-619","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"Comment":"","CommentCollapsed":true},{"Id":"-863","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":90,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-863"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-863"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-863","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"Comment":"","CommentCollapsed":true},{"Id":"-870","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-870"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-870"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-870","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":10,"Comment":"","CommentCollapsed":true},{"Id":"-1442","ModuleId":"BigQuantSpace.trade.trade-v4","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"initialize","Value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n\n context.set_commission(PerOrder(buy_cost=0.0013, sell_cost=0.0023, min_cost=5))\n # 当日分钟K线数量记录变量初始化\n context.index = 1\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"handle_data","Value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n \n # 获取当前分钟的买卖信号\n time=data.current_dt.strftime('%Y-%m-%d %H:%M:%S')\n\n \n if time[-4:-3] !='0' : # 日内数据超过窗口范围后才开始交易\n return\n \n\n try:\n buy_condition = context.minute_df.ix[time].buy_condition + context.minute_df.ix[time].pre_condition\n except:\n buy_condition = 0\n \n try: \n sell_condition= context.minute_df.ix[time].sell_condition\n except:\n sell_condition = 0\n \n instrument_symbol = context.symbol(context.instruments[0]) # 交易标的\n curr_position = context.portfolio.positions[instrument_symbol].amount # 持仓数量 \n #print(time,instrument_symbol,curr_position,buy_condition,sell_condition)\n # 如果当前没有仓位,且大于通道价格上限,long开仓\n if curr_position == 0 and buy_condition>1:\n context.order_target_percent(instrument_symbol, 1)\n elif curr_position >= 0 and sell_condition>0:\n context.order_target(instrument_symbol, 0)","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n context.minute_df = context.options['data'].read().set_index('date')\n #print(context.buy_condition)\n #print(context.sell_condition)\n #print(context.daily_df)\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"# 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。\ndef bigquant_run(context, data):\n pass\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"volume_limit","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_buy","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_sell","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":"50000","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"auto_cancel_non_tradable_orders","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_frequency","Value":"minute","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"price_type","Value":"真实价格","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"product_type","Value":"股票","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"plot_charts","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"backtest_only","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-1442"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-1442","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":13,"Comment":"","CommentCollapsed":true},{"Id":"-103","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df1 = input_1.read()\n df1['day'] = df1['date'].apply(lambda x:np.datetime64(x.strftime('%Y-%m-%d')))\n data_1 = DataSource.write_df(df1)\n return Outputs(data_1=data_1)\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"post_run","Value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"input_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"params","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-103"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-103"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-103"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-103","OutputType":null},{"Name":"data_2","NodeId":"-103","OutputType":null},{"Name":"data_3","NodeId":"-103","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":14,"Comment":"","CommentCollapsed":true},{"Id":"-93","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"day,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"inner","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-93"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-93"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-93","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"Comment":"","CommentCollapsed":true},{"Id":"-99","ModuleId":"BigQuantSpace.rename_columns.rename_columns-v5","ModuleParameters":[{"Name":"columns","Value":"date:day","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"keep_old_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_ds","NodeId":"-99"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-99","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":12,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-121' Position='-21,101.41423034667969,200,200'/><NodePosition Node='-130' Position='149,232,200,200'/><NodePosition Node='-144' Position='636,251,200,200'/><NodePosition Node='-240' Position='319,102,200,200'/><NodePosition Node='-456' Position='947,246,200,200'/><NodePosition Node='-619' Position='340,383,200,200'/><NodePosition Node='-863' Position='763,379,200,200'/><NodePosition Node='-870' Position='769,491,200,200'/><NodePosition Node='-1442' Position='571,783,200,200'/><NodePosition Node='-103' Position='367.86273193359375,497.85009765625,200,200'/><NodePosition Node='-93' Position='586.9541625976562,681.4225463867188,200,200'/><NodePosition Node='-99' Position='777.2464599609375,597.0838012695312,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
      In [45]:
      # 本代码由可视化策略环境自动生成 2020年1月14日 10:07
      # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
      
      
      # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
      def m14_run_bigquant_run(input_1, input_2, input_3):
          # 示例代码如下。在这里编写您的代码
          df1 = input_1.read()
          df1['day'] = df1['date'].apply(lambda x:np.datetime64(x.strftime('%Y-%m-%d')))
          data_1 = DataSource.write_df(df1)
          return Outputs(data_1=data_1)
      
      # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
      def m14_post_run_bigquant_run(outputs):
          return outputs
      
      # 回测引擎:初始化函数,只执行一次
      def m13_initialize_bigquant_run(context):
      
          context.set_commission(PerOrder(buy_cost=0.0013, sell_cost=0.0023, min_cost=5))
          # 当日分钟K线数量记录变量初始化
          context.index = 1
      
      # 回测引擎:每日数据处理函数,每天执行一次
      def m13_handle_data_bigquant_run(context, data):
         
          # 获取当前分钟的买卖信号
          time=data.current_dt.strftime('%Y-%m-%d %H:%M:%S')
      
             
          if time[-4:-3] !='0' : # 日内数据超过窗口范围后才开始交易
              return
          
      
          try:
              buy_condition = context.minute_df.ix[time].buy_condition + context.minute_df.ix[time].pre_condition
          except:
              buy_condition = 0
          
          try:    
              sell_condition= context.minute_df.ix[time].sell_condition
          except:
              sell_condition = 0
              
          instrument_symbol = context.symbol(context.instruments[0]) # 交易标的
          curr_position = context.portfolio.positions[instrument_symbol].amount # 持仓数量    
          #print(time,instrument_symbol,curr_position,buy_condition,sell_condition)
          # 如果当前没有仓位,且大于通道价格上限,long开仓
          if curr_position == 0 and buy_condition>1:
              context.order_target_percent(instrument_symbol, 1)
          elif curr_position >= 0 and sell_condition>0:
              context.order_target(instrument_symbol, 0)
      # 回测引擎:准备数据,只执行一次
      def m13_prepare_bigquant_run(context):
          context.minute_df = context.options['data'].read().set_index('date')
          #print(context.buy_condition)
          #print(context.sell_condition)
          #print(context.daily_df)
      
      # 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。
      def m13_before_trading_start_bigquant_run(context, data):
          pass
      
      
      m1 = M.instruments.v2(
          start_date='2019-02-01',
          end_date='2019-03-31',
          market='CN_STOCK_A',
          instrument_list='000001.SZA',
          max_count=0
      )
      
      m3 = M.instruments.v2(
          start_date='2019-01-01',
          end_date='2019-03-31',
          market='CN_STOCK_A',
          instrument_list='000001.SZA',
          max_count=0
      )
      
      m4 = M.input_features.v1(
          features="""
      # #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      
      buy_condition=where((ta_macd_dea(shift(close,1))<0) & (ta_macd_dea(close)>0),1,0)
      sell_condition=where((ta_macd_dea(shift(close,1))>0) & (ta_macd_dea(close)<0),1,0)"""
      )
      
      m2 = M.use_datasource.v1(
          instruments=m1.data,
          features=m4.data,
          datasource_id='bar60m_CN_STOCK_A',
          start_date='2019-01-01 9:00',
          end_date='2019-12-31 15:00'
      )
      
      m7 = M.derived_feature_extractor.v3(
          input_data=m2.data,
          features=m4.data,
          date_col='date',
          instrument_col='instrument',
          drop_na=True,
          remove_extra_columns=False,
          user_functions={}
      )
      
      m14 = M.cached.v3(
          input_1=m7.data,
          run=m14_run_bigquant_run,
          post_run=m14_post_run_bigquant_run,
          input_ports='',
          params='{}',
          output_ports=''
      )
      
      m5 = M.input_features.v1(
          features="""
      # #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      pre_condition=where(shift(ta_macd_dea(close_0),1)>0,1,0)
      """
      )
      
      m9 = M.general_feature_extractor.v7(
          instruments=m3.data,
          features=m5.data,
          start_date='',
          end_date='',
          before_start_days=90
      )
      
      m10 = M.derived_feature_extractor.v3(
          input_data=m9.data,
          features=m5.data,
          date_col='date',
          instrument_col='instrument',
          drop_na=False,
          remove_extra_columns=True,
          user_functions={}
      )
      
      m12 = M.rename_columns.v5(
          input_ds=m10.data,
          columns='date:day',
          keep_old_columns=False
      )
      
      m6 = M.join.v3(
          data1=m14.data_1,
          data2=m12.data,
          on='day,instrument',
          how='inner',
          sort=False
      )
      
      m13 = M.trade.v4(
          instruments=m1.data,
          options_data=m6.data,
          start_date='',
          end_date='',
          initialize=m13_initialize_bigquant_run,
          handle_data=m13_handle_data_bigquant_run,
          prepare=m13_prepare_bigquant_run,
          before_trading_start=m13_before_trading_start_bigquant_run,
          volume_limit=0,
          order_price_field_buy='open',
          order_price_field_sell='open',
          capital_base=50000,
          auto_cancel_non_tradable_orders=True,
          data_frequency='minute',
          price_type='真实价格',
          product_type='股票',
          plot_charts=True,
          backtest_only=False,
          benchmark=''
      )
      
      • 收益率8.69%
      • 年化收益率79.15%
      • 基准收益率20.95%
      • 阿尔法-0.5
      • 贝塔0.82
      • 夏普比率1.9
      • 胜率1.0
      • 盈亏比0.0
      • 收益波动率31.7%
      • 信息比率-0.22
      • 最大回撤6.07%
      bigcharts-data-start/{"__type":"tabs","__id":"bigchart-c5cf8f94143a42d5ae964f4c5a1d1757"}/bigcharts-data-end

      (公孙睿) #5

      谢谢老师!