因子分析报错

策略分享
标签: #<Tag:0x00007fa196b46b78>

(侯) #1
克隆策略

    {"Description":"实验创建于2020/2/14","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-140:features","SourceOutputPortId":"-70:data"},{"DestinationInputPortId":"-290:input_2","SourceOutputPortId":"-70:data"},{"DestinationInputPortId":"-271:instruments","SourceOutputPortId":"-248:data"},{"DestinationInputPortId":"-278:input_data","SourceOutputPortId":"-271:data"},{"DestinationInputPortId":"-239:input","SourceOutputPortId":"-278:data"},{"DestinationInputPortId":"-140:user_factor_data","SourceOutputPortId":"-290:data_1"},{"DestinationInputPortId":"-271:features","SourceOutputPortId":"-298:data"},{"DestinationInputPortId":"-278:features","SourceOutputPortId":"-298:data"},{"DestinationInputPortId":"-290:input_1","SourceOutputPortId":"-239:data"}],"ModuleNodes":[{"Id":"-70","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nfa1\nfa2\nfa3\nfa4\nfa5","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-70"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-70","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"Comment":"","CommentCollapsed":true},{"Id":"-140","ModuleId":"BigQuantSpace.factorlens.factorlens-v1","ModuleParameters":[{"Name":"title","Value":"因子分析: {factor_name}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2020-08-17","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"rebalance_period","Value":"1","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"stock_pool","Value":"沪深300","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"quantile_count","Value":"5","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"commission_rate","Value":0.0016,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"returns_calculation_method","Value":"累乘","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"无","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_price_limit_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_st_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_new_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"normalization","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"neutralization","Value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E8%A1%8C%E4%B8%9A%22%2C%22displayValue%22%3A%22%E8%A1%8C%E4%B8%9A%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%B8%82%E5%80%BC%22%2C%22displayValue%22%3A%22%E5%B8%82%E5%80%BC%22%2C%22selected%22%3Atrue%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"metrics","Value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%A8%E7%8E%B0%E6%A6%82%E8%A7%88%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%A8%E7%8E%B0%E6%A6%82%E8%A7%88%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%88%86%E5%B8%83%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%8C%E4%B8%9A%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%8C%E4%B8%9A%E5%88%86%E5%B8%83%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%B8%82%E5%80%BC%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%B8%82%E5%80%BC%E5%88%86%E5%B8%83%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22IC%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22IC%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B9%B0%E5%85%A5%E4%BF%A1%E5%8F%B7%E9%87%8D%E5%90%88%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E4%B9%B0%E5%85%A5%E4%BF%A1%E5%8F%B7%E9%87%8D%E5%90%88%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E4%BC%B0%E5%80%BC%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E4%BC%B0%E5%80%BC%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E6%8B%A5%E6%8C%A4%E5%BA%A6%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E6%8B%A5%E6%8C%A4%E5%BA%A6%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%80%BC%E6%9C%80%E5%A4%A7%2F%E6%9C%80%E5%B0%8F%E8%82%A1%E7%A5%A8%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%80%BC%E6%9C%80%E5%A4%A7%2F%E6%9C%80%E5%B0%8F%E8%82%A1%E7%A5%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%9B%A0%E5%AD%90%E5%80%BC%22%2C%22displayValue%22%3A%22%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%9B%A0%E5%AD%90%E5%80%BC%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%A4%9A%E5%9B%A0%E5%AD%90%E7%9B%B8%E5%85%B3%E6%80%A7%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%A4%9A%E5%9B%A0%E5%AD%90%E7%9B%B8%E5%85%B3%E6%80%A7%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-140"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"user_factor_data","NodeId":"-140"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-140","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"Comment":"","CommentCollapsed":true},{"Id":"-248","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2020-08-17","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-248"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-248","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"Comment":"","CommentCollapsed":true},{"Id":"-271","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":"-271"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-271"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-271","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"Comment":"","CommentCollapsed":true},{"Id":"-278","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":"-278"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-278"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-278","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"Comment":"","CommentCollapsed":true},{"Id":"-290","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 df = input_1.read()\n list1=input_2.read_pickle()\n list1=list1+['date','instrument']\n df = df[list1]\n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1)","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":"-290"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-290"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-290"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-290","OutputType":null},{"Name":"data_2","NodeId":"-290","OutputType":null},{"Name":"data_3","NodeId":"-290","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":8,"Comment":"","CommentCollapsed":true},{"Id":"-298","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\n# factor=rank_return_0\nfa1=avg_amount_5\nfa2=avg_amount_10\nfa3=avg_amount_20\nfa4=rank_market_cap_float_0\nfa5=mf_net_amount_5\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-298"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-298","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"Comment":"","CommentCollapsed":true},{"Id":"-239","ModuleId":"BigQuantSpace.nan_inf.nan_inf-v2","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input","NodeId":"-239"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-239","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"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='-70' Position='185,266,200,200'/><NodePosition Node='-140' Position='383,425,200,200'/><NodePosition Node='-248' Position='314,89,200,200'/><NodePosition Node='-271' Position='483.40057373046875,169,200,200'/><NodePosition Node='-278' Position='632,251,200,200'/><NodePosition Node='-290' Position='603.5963134765625,352.5963134765625,200,200'/><NodePosition Node='-298' Position='671.59326171875,75,200,200'/><NodePosition Node='-239' Position='881.3639526367188,329.6054992675781,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 [ ]:
    # 本代码由可视化策略环境自动生成 2020年8月17日 16:23
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m8_run_bigquant_run(input_1, input_2, input_3):
        # 示例代码如下。在这里编写您的代码
        df = input_1.read()
        list1=input_2.read_pickle()
        list1=list1+['date','instrument']
        df = df[list1]
        data_1 = DataSource.write_df(df)
        return Outputs(data_1=data_1)
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m8_post_run_bigquant_run(outputs):
        return outputs
    
    
    m1 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    fa1
    fa2
    fa3
    fa4
    fa5"""
    )
    
    m3 = M.instruments.v2(
        start_date='2018-01-01',
        end_date='2020-08-17',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m9 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    # factor=rank_return_0
    fa1=avg_amount_5
    fa2=avg_amount_10
    fa3=avg_amount_20
    fa4=rank_market_cap_float_0
    fa5=mf_net_amount_5
    """
    )
    
    m6 = M.general_feature_extractor.v7(
        instruments=m3.data,
        features=m9.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m7 = M.derived_feature_extractor.v3(
        input_data=m6.data,
        features=m9.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m4 = M.nan_inf.v2(
        input=m7.data
    )
    
    m8 = M.cached.v3(
        input_1=m4.data,
        input_2=m1.data,
        run=m8_run_bigquant_run,
        post_run=m8_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    m2 = M.factorlens.v1(
        features=m1.data,
        user_factor_data=m8.data_1,
        title='因子分析: {factor_name}',
        start_date='2018-01-01',
        end_date='2020-08-17',
        rebalance_period=1,
        stock_pool='沪深300',
        quantile_count=5,
        commission_rate=0.0016,
        returns_calculation_method='累乘',
        benchmark='无',
        drop_price_limit_stocks=True,
        drop_st_stocks=True,
        drop_new_stocks=True,
        normalization=True,
        neutralization=['行业', '市值'],
        metrics=['因子表现概览']
    )
    

    (adhaha111) #2

    您好,这边运行您的策略没有报错

    克隆策略

      {"Description":"实验创建于2020/2/14","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-140:features","SourceOutputPortId":"-70:data"},{"DestinationInputPortId":"-290:input_2","SourceOutputPortId":"-70:data"},{"DestinationInputPortId":"-271:instruments","SourceOutputPortId":"-248:data"},{"DestinationInputPortId":"-278:input_data","SourceOutputPortId":"-271:data"},{"DestinationInputPortId":"-239:input","SourceOutputPortId":"-278:data"},{"DestinationInputPortId":"-140:user_factor_data","SourceOutputPortId":"-290:data_1"},{"DestinationInputPortId":"-271:features","SourceOutputPortId":"-298:data"},{"DestinationInputPortId":"-278:features","SourceOutputPortId":"-298:data"},{"DestinationInputPortId":"-290:input_1","SourceOutputPortId":"-239:data"}],"ModuleNodes":[{"Id":"-70","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nfa1\nfa2\nfa3\nfa4\nfa5","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-70"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-70","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"Comment":"","CommentCollapsed":true},{"Id":"-140","ModuleId":"BigQuantSpace.factorlens.factorlens-v1","ModuleParameters":[{"Name":"title","Value":"因子分析: {factor_name}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2020-08-17","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"rebalance_period","Value":"1","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"stock_pool","Value":"沪深300","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"quantile_count","Value":"5","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"commission_rate","Value":0.0016,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"returns_calculation_method","Value":"累乘","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"无","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_price_limit_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_st_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_new_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"normalization","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"neutralization","Value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E8%A1%8C%E4%B8%9A%22%2C%22displayValue%22%3A%22%E8%A1%8C%E4%B8%9A%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%B8%82%E5%80%BC%22%2C%22displayValue%22%3A%22%E5%B8%82%E5%80%BC%22%2C%22selected%22%3Atrue%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"metrics","Value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%A8%E7%8E%B0%E6%A6%82%E8%A7%88%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%A8%E7%8E%B0%E6%A6%82%E8%A7%88%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%88%86%E5%B8%83%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%8C%E4%B8%9A%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%8C%E4%B8%9A%E5%88%86%E5%B8%83%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%B8%82%E5%80%BC%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%B8%82%E5%80%BC%E5%88%86%E5%B8%83%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22IC%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22IC%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B9%B0%E5%85%A5%E4%BF%A1%E5%8F%B7%E9%87%8D%E5%90%88%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E4%B9%B0%E5%85%A5%E4%BF%A1%E5%8F%B7%E9%87%8D%E5%90%88%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E4%BC%B0%E5%80%BC%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E4%BC%B0%E5%80%BC%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E6%8B%A5%E6%8C%A4%E5%BA%A6%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E6%8B%A5%E6%8C%A4%E5%BA%A6%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%80%BC%E6%9C%80%E5%A4%A7%2F%E6%9C%80%E5%B0%8F%E8%82%A1%E7%A5%A8%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%80%BC%E6%9C%80%E5%A4%A7%2F%E6%9C%80%E5%B0%8F%E8%82%A1%E7%A5%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%9B%A0%E5%AD%90%E5%80%BC%22%2C%22displayValue%22%3A%22%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%9B%A0%E5%AD%90%E5%80%BC%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%A4%9A%E5%9B%A0%E5%AD%90%E7%9B%B8%E5%85%B3%E6%80%A7%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%A4%9A%E5%9B%A0%E5%AD%90%E7%9B%B8%E5%85%B3%E6%80%A7%E5%88%86%E6%9E%90%22%2C%22selected%22%3Afalse%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-140"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"user_factor_data","NodeId":"-140"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-140","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"Comment":"","CommentCollapsed":true},{"Id":"-248","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2020-08-17","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-248"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-248","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"Comment":"","CommentCollapsed":true},{"Id":"-271","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":"-271"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-271"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-271","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"Comment":"","CommentCollapsed":true},{"Id":"-278","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":"-278"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-278"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-278","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"Comment":"","CommentCollapsed":true},{"Id":"-290","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 df = input_1.read()\n list1=input_2.read_pickle()\n list1=list1+['date','instrument']\n df = df[list1]\n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1)","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":"-290"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-290"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-290"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-290","OutputType":null},{"Name":"data_2","NodeId":"-290","OutputType":null},{"Name":"data_3","NodeId":"-290","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":8,"Comment":"","CommentCollapsed":true},{"Id":"-298","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\n# factor=rank_return_0\nfa1=avg_amount_5\nfa2=avg_amount_10\nfa3=avg_amount_20\nfa4=rank_market_cap_float_0\nfa5=mf_net_amount_5\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-298"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-298","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"Comment":"","CommentCollapsed":true},{"Id":"-239","ModuleId":"BigQuantSpace.nan_inf.nan_inf-v2","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input","NodeId":"-239"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-239","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"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='-70' Position='184.15487670898438,264.3097229003906,200,200'/><NodePosition Node='-140' Position='385.535400390625,426.69024658203125,200,200'/><NodePosition Node='-248' Position='314,89,200,200'/><NodePosition Node='-271' Position='483,169,200,200'/><NodePosition Node='-278' Position='632,251,200,200'/><NodePosition Node='-290' Position='601.3097534179688,351.1548767089844,200,200'/><NodePosition Node='-298' Position='671,75,200,200'/><NodePosition Node='-239' Position='881,329,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 [6]:
      # 本代码由可视化策略环境自动生成 2020年8月18日 08:50
      # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
      
      
      # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
      def m8_run_bigquant_run(input_1, input_2, input_3):
          # 示例代码如下。在这里编写您的代码
          df = input_1.read()
          list1=input_2.read_pickle()
          list1=list1+['date','instrument']
          df = df[list1]
          data_1 = DataSource.write_df(df)
          return Outputs(data_1=data_1)
      # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
      def m8_post_run_bigquant_run(outputs):
          return outputs
      
      
      m1 = M.input_features.v1(
          features="""
      # #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      fa1
      fa2
      fa3
      fa4
      fa5"""
      )
      
      m3 = M.instruments.v2(
          start_date='2018-01-01',
          end_date='2020-08-17',
          market='CN_STOCK_A',
          instrument_list='',
          max_count=0
      )
      
      m9 = M.input_features.v1(
          features="""
      # #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      # factor=rank_return_0
      fa1=avg_amount_5
      fa2=avg_amount_10
      fa3=avg_amount_20
      fa4=rank_market_cap_float_0
      fa5=mf_net_amount_5
      """
      )
      
      m6 = M.general_feature_extractor.v7(
          instruments=m3.data,
          features=m9.data,
          start_date='',
          end_date='',
          before_start_days=90
      )
      
      m7 = M.derived_feature_extractor.v3(
          input_data=m6.data,
          features=m9.data,
          date_col='date',
          instrument_col='instrument',
          drop_na=False,
          remove_extra_columns=False,
          user_functions={}
      )
      
      m4 = M.nan_inf.v2(
          input=m7.data
      )
      
      m8 = M.cached.v3(
          input_1=m4.data,
          input_2=m1.data,
          run=m8_run_bigquant_run,
          post_run=m8_post_run_bigquant_run,
          input_ports='',
          params='{}',
          output_ports=''
      )
      
      m2 = M.factorlens.v1(
          features=m1.data,
          user_factor_data=m8.data_1,
          title='因子分析: {factor_name}',
          start_date='2018-01-01',
          end_date='2020-08-17',
          rebalance_period=1,
          stock_pool='沪深300',
          quantile_count=5,
          commission_rate=0.0016,
          returns_calculation_method='累乘',
          benchmark='无',
          drop_price_limit_stocks=True,
          drop_st_stocks=True,
          drop_new_stocks=True,
          normalization=True,
          neutralization=['行业', '市值'],
          metrics=['因子表现概览']
      )
      
      { "type": "factor-track", "data": { "exprs": ["fa1", "fa2", "fa3", "fa4", "fa5"], "options": {"BacktestInterval": ["2018-01-01", "2020-08-17"], "Benchmark": "none", "StockPool": "in_csi300_0", "DropSTStocks": 1, "DropPriceLimitStocks": 1, "DropNewStocks": 1, "QuantileCount": 5, "CommissionRates": 0.0016, "Normalization": 1, "Neutralization": "industry,size", "RebalancePeriod": 1, "ReturnsCalculationMethod": "cumprod", "_HASH": "61769d68173a99d639cbe5e6882e5ecc"} } }

      分析结果

      因子分析: fa1

      { "type": "factor-track", "data": { "exprs": ["fa1"], "options": {"BacktestInterval": ["2018-01-01", "2020-08-17"], "Benchmark": "none", "StockPool": "in_csi300_0", "DropSTStocks": 1, "DropPriceLimitStocks": 1, "DropNewStocks": 1, "QuantileCount": 5, "CommissionRates": 0.0016, "Normalization": 1, "Neutralization": "industry,size", "RebalancePeriod": 1, "ReturnsCalculationMethod": "cumprod", "_HASH": "61769d68173a99d639cbe5e6882e5ecc"} } }

      因子表现概览

        累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 盈亏比 胜率 夏普比率 收益波动率
      最小分位 -62.04% -20.68% 5.56% 2.54% 0.50% 1.79% 66.08% 0.91 0.45 -1.97 20.16%
      最大分位 -68.56% -19.94% 2.20% 0.65% -0.29% 2.59% 72.33% 0.92 0.45 -1.77 25.90%
      多空组合 7.72% -1.19% 1.41% 0.85% 0.38% -0.40% 5.21% 1.03 0.52 -0.09 4.87%

      因子分析: fa2

      { "type": "factor-track", "data": { "exprs": ["fa2"], "options": {"BacktestInterval": ["2018-01-01", "2020-08-17"], "Benchmark": "none", "StockPool": "in_csi300_0", "DropSTStocks": 1, "DropPriceLimitStocks": 1, "DropNewStocks": 1, "QuantileCount": 5, "CommissionRates": 0.0016, "Normalization": 1, "Neutralization": "industry,size", "RebalancePeriod": 1, "ReturnsCalculationMethod": "cumprod", "_HASH": "61769d68173a99d639cbe5e6882e5ecc"} } }

      因子表现概览

        累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 盈亏比 胜率 夏普比率 收益波动率
      最小分位 -62.68% -21.22% 5.93% 2.23% 0.60% 1.77% 66.75% 0.93 0.44 -2.02 19.98%
      最大分位 -66.00% -16.52% 3.03% 0.60% -0.37% 2.73% 70.11% 0.93 0.45 -1.64 26.00%
      多空组合 2.62% -3.59% 1.19% 0.71% 0.46% -0.48% 6.91% 1.03 0.50 -0.48 4.91%

      因子分析: fa3

      { "type": "factor-track", "data": { "exprs": ["fa3"], "options": {"BacktestInterval": ["2018-01-01", "2020-08-17"], "Benchmark": "none", "StockPool": "in_csi300_0", "DropSTStocks": 1, "DropPriceLimitStocks": 1, "DropNewStocks": 1, "QuantileCount": 5, "CommissionRates": 0.0016, "Normalization": 1, "Neutralization": "industry,size", "RebalancePeriod": 1, "ReturnsCalculationMethod": "cumprod", "_HASH": "61769d68173a99d639cbe5e6882e5ecc"} } }

      因子表现概览

        累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 盈亏比 胜率 夏普比率 收益波动率
      最小分位 -63.22% -22.46% 4.84% 1.72% 0.18% 1.67% 66.84% 0.92 0.44 -2.05 19.96%
      最大分位 -65.50% -16.23% 2.84% -0.42% -0.50% 2.46% 69.62% 0.94 0.45 -1.63 25.89%
      多空组合 1.17% -4.54% 0.74% 0.97% 0.33% -0.39% 8.09% 1.03 0.50 -0.61 4.81%

      因子分析: fa4

      { "type": "factor-track", "data": { "exprs": ["fa4"], "options": {"BacktestInterval": ["2018-01-01", "2020-08-17"], "Benchmark": "none", "StockPool": "in_csi300_0", "DropSTStocks": 1, "DropPriceLimitStocks": 1, "DropNewStocks": 1, "QuantileCount": 5, "CommissionRates": 0.0016, "Normalization": 1, "Neutralization": "industry,size", "RebalancePeriod": 1, "ReturnsCalculationMethod": "cumprod", "_HASH": "61769d68173a99d639cbe5e6882e5ecc"} } }

      因子表现概览

        累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 盈亏比 胜率 夏普比率 收益波动率
      最小分位 -67.48% -24.72% 3.58% 1.67% 0.59% 2.22% 70.72% 0.92 0.44 -2.02 22.40%
      最大分位 -62.26% -18.70% 5.44% 2.04% 2.10% 2.41% 66.79% 0.95 0.45 -1.66 23.65%
      多空组合 -7.61% -4.06% -0.94% -0.20% -0.74% -0.09% 8.75% 0.97 0.47 -2.19 3.00%

      因子分析: fa5

      { "type": "factor-track", "data": { "exprs": ["fa5"], "options": {"BacktestInterval": ["2018-01-01", "2020-08-17"], "Benchmark": "none", "StockPool": "in_csi300_0", "DropSTStocks": 1, "DropPriceLimitStocks": 1, "DropNewStocks": 1, "QuantileCount": 5, "CommissionRates": 0.0016, "Normalization": 1, "Neutralization": "industry,size", "RebalancePeriod": 1, "ReturnsCalculationMethod": "cumprod", "_HASH": "61769d68173a99d639cbe5e6882e5ecc"} } }

      因子表现概览

        累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 盈亏比 胜率 夏普比率 收益波动率
      最小分位 -66.94% -20.82% 3.05% 0.66% 0.36% 2.66% 70.60% 0.91 0.45 -1.89 23.47%
      最大分位 -60.45% -17.30% 3.90% 1.22% 1.24% 2.49% 65.33% 0.98 0.44 -1.65 22.70%
      多空组合 -8.50% -2.19% -0.43% -0.28% -0.43% 0.08% 10.09% 0.87 0.49 -2.01 3.46%
      bigcharts-data-start/{"__type":"tabs","__id":"bigchart-356d7bcbb34b499e9dada5dadc682ec0"}/bigcharts-data-end