{"Description":"实验创建于2020/2/14","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-64:input_2","SourceOutputPortId":"-666:data"},{"DestinationInputPortId":"-51:input_1","SourceOutputPortId":"-269:data"},{"DestinationInputPortId":"-77:input_data","SourceOutputPortId":"-51:data_1"},{"DestinationInputPortId":"-64:input_1","SourceOutputPortId":"-77:data"}],"ModuleNodes":[{"Id":"-666","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nf12 = close/shift(close, 44) - 1\n# f13 = close/open\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-666"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-666","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":5,"Comment":"","CommentCollapsed":true},{"Id":"-269","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar1d_CN_FUTURE","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"2020-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2021-04-30","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-269"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-269"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-269","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"Comment":"","CommentCollapsed":true},{"Id":"-51","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, start_date, end_date, filter_contract, table_name):\n # 示例代码如下。在这里编写您的代码\n import re\n import time\n import bigexpr\n from bigshared.common.biglogger import BigLogger\n \n log = BigLogger('DataProcess')\n\n class DataProcess:\n def __init__(\n self, \n log, \n start_date=None,\n end_date=None,\n filter_contract=['IF', 'IC', 'IH', 'FB', 'JR', 'BB', 'AL', 'PM'],\n table_name='bar1d_CN_FUTURE'\n ):\n self.log = log\n self.start_date = start_date\n self.end_date = end_date\n self.filter_contract = filter_contract\n self.table_name = table_name\n\n def data_preprocessing(self, df):\n # 读取期货日线数据\n self.log.info(\"load_continus_instrument start ...\")\n # 向前提取120天的数据\n _start_date = (pd.Timestamp(self.start_date) - datetime.timedelta(120)).strftime('%Y-%m-%d')\n df = df[(df.date >= _start_date) & (df.date <= self.end_date)].reset_index()\n is_live_run = T.live_run_param(\"trading_date\", None) is not None\n if is_live_run:\n self.end_date = T.live_run_param(\"trading_date\", \"trading_date\")\n df = DataSource(self.table_name).read(start_date=_start_date, end_date=self.end_date)\n\n df[\"exchange\"] = df[\"instrument\"].apply(lambda x: x.split(\".\")[-1]) # 交易所\n df[\"contract\"] = df[\"instrument\"].apply(lambda x: x.split(\".\")[0]) # 合约代码\n df[\"future_name\"] = df[\"contract\"].apply(lambda x: re.sub(\"[^a-zA-Z]\", \"\", x)) # 期货品种\n df[\"contract_info\"] = df[\"contract\"].apply(lambda x: x[-4:])\n continus_contract_df = df[df[\"contract_info\"] == \"0000\"] # 将主力合约数据过滤出来\n continus_contract_df = continus_contract_df[~continus_contract_df.future_name.isin(self.filter_contract)] # 过滤对应的品种\n self.log.info(\"load_continus_instrument done\")\n return continus_contract_df\n\n def process(self, df):\n # 判断数据处理是否有传入起止日期,有则更新\n if self.start_date is None:\n self.start_date = df.date.min().strftime('%Y-%m-%d')\n if self.end_date is None:\n self.end_date = df.date.max().strftime('%Y-%m-%d')\n # 对进行因子分析的数据进行预处理\n continus_contract_df = self.data_preprocessing(df)\n return continus_contract_df\n \n df = input_1.read()\n dp = DataProcess(log, start_date, end_date, filter_contract, table_name)\n continus_contract_df = dp.process(df)\n data_1 = DataSource.write_df(continus_contract_df[['date','instrument','close','amount']])\n return Outputs(data_1=data_1, data_2=None, data_3=None)\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":"{\n \"start_date\": None,\n \"end_date\": None,\n \"filter_contract\": ['IF', 'IC', 'IH', 'FB', 'JR', 'BB', 'AL', 'PM'],\n \"table_name\": \"bar1d_CN_FUTURE\"\n}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-51"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-51"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-51"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-51","OutputType":null},{"Name":"data_2","NodeId":"-51","OutputType":null},{"Name":"data_3","NodeId":"-51","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"Comment":"","CommentCollapsed":true},{"Id":"-64","ModuleId":"BigQuantSpace.FactorA.FactorA-v1","ModuleParameters":[{"Name":"start_date","Value":"2016-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2021-04-30","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"rabalance_period","Value":22,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"buy_commission_rate","Value":0.0005,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sell_commission_rate","Value":0.0005,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"ic_method","Value":"Rank_IC","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"quantile_num","Value":5,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"is_standardlize","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"is_winsorize","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-64"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-64"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-64","OutputType":null},{"Name":"data_2","NodeId":"-64","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"Comment":"","CommentCollapsed":true},{"Id":"-77","ModuleId":"BigQuantSpace.filter.filter-v3","ModuleParameters":[{"Name":"expr","Value":"amount>3000000","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-77"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-77","OutputType":null},{"Name":"left_data","NodeId":"-77","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"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='-666' Position='-117.81468963623047,114.22203063964844,200,200'/><NodePosition Node='-269' Position='-630.1485900878906,105.55594635009766,200,200'/><NodePosition Node='-51' Position='-548.1853332519531,224.40736389160156,200,200'/><NodePosition Node='-64' Position='-324.73777770996094,441.07342529296875,200,200'/><NodePosition Node='-77' Position='-445.81468200683594,326.0367126464844,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}
[2021-05-11 17:51:45.669029] INFO: moduleinvoker: input_features.v1 开始运行..
[2021-05-11 17:51:45.766103] INFO: moduleinvoker: input_features.v1 运行完成[0.097064s].
[2021-05-11 17:51:45.770508] INFO: moduleinvoker: use_datasource.v1 开始运行..
[2021-05-11 17:51:45.832646] INFO: moduleinvoker: 命中缓存
[2021-05-11 17:51:45.835393] INFO: moduleinvoker: use_datasource.v1 运行完成[0.064882s].
[2021-05-11 17:51:45.847602] INFO: moduleinvoker: cached.v3 开始运行..
[2021-05-11 17:51:45.869321] INFO: moduleinvoker: 命中缓存
[2021-05-11 17:51:45.871919] INFO: moduleinvoker: cached.v3 运行完成[0.024334s].
[2021-05-11 17:51:45.877774] INFO: moduleinvoker: filter.v3 开始运行..
[2021-05-11 17:51:45.905375] INFO: moduleinvoker: 命中缓存
[2021-05-11 17:51:45.907391] INFO: moduleinvoker: filter.v3 运行完成[0.029652s].
[2021-05-11 17:51:45.912940] INFO: moduleinvoker: FactorA.v1 开始运行..
[2021-05-11 17:51:46.009533] INFO: FuturesPerformance: data_processing start ...
[2021-05-11 17:51:48.012443] INFO: FuturesPerformance: data_processing process 2.003s
[2021-05-11 17:51:48.014036] INFO: FuturesPerformance: ic_processing start ...
[2021-05-11 17:51:48.106489] INFO: FuturesPerformance: ic_processing process 0.092s
[2021-05-11 17:51:48.108026] INFO: FuturesPerformance: ols_stats_processing start ...
[2021-05-11 17:51:48.169813] INFO: FuturesPerformance: ols_stats_processing process 0.062s
[2021-05-11 17:51:48.172141] INFO: FuturesPerformance: group_processing start ...
[2021-05-11 17:51:51.242903] INFO: FuturesPerformance: group_processing process 3.071s
[2021-05-11 17:51:51.576118] INFO: moduleinvoker: FactorA.v1 运行完成[5.663164s].
f12: IC分析
- IC均值-0.0964
- IC标准差0.2175
- ICIR-0.4432
- IC正值次数4次
- IC负值次数8次
- IC偏度-0.9562
- IC峰度1.8658
f12: 因子收益率分析
- 因子收益均值-0.0079
- 因子收益标准差0.0128
- 因子收益为正比率33.33%
- t值绝对值的均值1.5907
- t值绝对值大于2的比率0.25
- 因子收益t检验p值小于0.05的比率0.25
f12: 因子绩效分析
-
top0_ret
top4_ret
- 收益率
0.3814
0.2872
- 近1日收益率
-0.0068
-0.0029
- 近1周收益率
0.0034
0.0272
- 近1月收益率
0.0452
0.0712
- 年化收益率
0.3417
0.2582
- 夏普比率
1.6342
1.2626
- 收益波动率
0.167
0.165
- 最大回撤
-0.1228
-0.107