{"Description":"实验创建于2017/8/26","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-51:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-35:input_1","SourceOutputPortId":"-51:data"},{"DestinationInputPortId":"-85:input_2","SourceOutputPortId":"-51:data"},{"DestinationInputPortId":"-85:input_1","SourceOutputPortId":"-35:data"}],"ModuleNodes":[{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2015-01-01","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"Name":"end_date","Value":"2017-01-01","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"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":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"Comment":"预测数据,用于回测和模拟","CommentCollapsed":true},{"Id":"-51","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar1d_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-51"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-51"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-51","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"Comment":"","CommentCollapsed":true},{"Id":"-35","ModuleId":"BigQuantSpace.resample_df.resample_df-v15","ModuleParameters":[{"Name":"columns","Value":"[\"open\", \"high\", \"low\", \"close\",\"amount\",\"volume\"]","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"resample_period","Value":"W-FRI","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how_key","Value":"{'date': 'last', \n'volume': 'sum',\n 'amount': 'sum',\n 'close': 'last',\n'high': 'max',\n'low': 'min',\n'open': 'first'}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-35"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-35","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"Comment":"","CommentCollapsed":true},{"Id":"-85","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, col_name):\n # 示例代码如下。在这里编写您的代码\n df_resample = input_1.read()\n df_origin = input_2.read()\n \n new_column = 'rolling_'+col_name\n def cal(x):\n return pd.Series([[x.values[j-i-1] for i in range(5) if j-i >0 ] for j in range(len(x))],index=x.index)\n df_resample[new_column] = df_resample.groupby('instrument', group_keys=False)[col_name].apply(lambda x: cal(x))\n \n start_ = df_resample.date.min()\n \n df_merge = df_origin[df_origin.date>=start_].merge(df_resample[['date','instrument',new_column]], \n on=['date','instrument'], how='left')\n \n df_merge[new_column] = df_merge.groupby('instrument')[new_column].ffill()\n \n df_merge[new_column] = df_merge[col_name].apply(lambda x:[x]) + df_merge[new_column]\n df_merge['bolling_up'] = df_merge[new_column].apply(lambda x:np.mean(x)+np.std(x))\n data_1 = DataSource.write_df(df_merge)\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":"input_1,input_2","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"params","Value":"{'col_name':'close'}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"data_1","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-85"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-85"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-85"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-85","OutputType":null},{"Name":"data_2","NodeId":"-85","OutputType":null},{"Name":"data_3","NodeId":"-85","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"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='287d2cb0-f53c-4101-bdf8-104b137c8601-62' Position='608,49,200,200'/><NodePosition Node='-51' Position='758,149,200,200'/><NodePosition Node='-35' Position='546.1370849609375,239.86294555664062,200,200'/><NodePosition Node='-85' Position='737,327,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}
[2020-07-30 17:42:36.545035] INFO: moduleinvoker: instruments.v2 开始运行..
[2020-07-30 17:42:36.549692] INFO: moduleinvoker: 命中缓存
[2020-07-30 17:42:36.550654] INFO: moduleinvoker: instruments.v2 运行完成[0.005631s].
[2020-07-30 17:42:36.552044] INFO: moduleinvoker: use_datasource.v1 开始运行..
[2020-07-30 17:42:36.556503] INFO: moduleinvoker: 命中缓存
[2020-07-30 17:42:36.557318] INFO: moduleinvoker: use_datasource.v1 运行完成[0.005274s].
[2020-07-30 17:42:36.559921] INFO: moduleinvoker: resample_df.v15 开始运行..
[2020-07-30 17:42:36.565337] INFO: moduleinvoker: 命中缓存
[2020-07-30 17:42:36.566106] INFO: moduleinvoker: resample_df.v15 运行完成[0.006185s].
[2020-07-30 17:42:36.570604] INFO: moduleinvoker: cached.v3 开始运行..
[2020-07-30 17:43:42.238851] INFO: moduleinvoker: cached.v3 运行完成[65.66822s].