{"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-1763:features","from_node_id":"-331:data"},{"to_node_id":"-2294:instruments","from_node_id":"-312:data"},{"to_node_id":"-1763:instruments","from_node_id":"-312:data"},{"to_node_id":"-7278:input_1","from_node_id":"-1136:data"},{"to_node_id":"-1136:features","from_node_id":"-2149:data"},{"to_node_id":"-1763:user_functions","from_node_id":"-2016:functions"},{"to_node_id":"-2016:input_functions","from_node_id":"-584:functions"},{"to_node_id":"-2294:features","from_node_id":"-2300:data"},{"to_node_id":"-2305:data1","from_node_id":"-2294:data"},{"to_node_id":"-1136:input_data","from_node_id":"-2305:data"},{"to_node_id":"-2305:data2","from_node_id":"-1763:data"}],"nodes":[{"node_id":"-331","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"_v = volume\n_amt = amount\n_num_trd = num_trades\n_c = close\n_h = high\n_l = low\n_o = open\n_tbv = total_bid_volume\n_ret = ret_sim(_c, _o)\n\n# # 高频偏度\n# _RVar = RVar(_ret)\n# RSkew = RSkew(_ret, _RVar)\n\n# 平均单笔成交金额\nAmtPerTrd = where(_num_trd.sum()==0, 1, _amt.sum() / _num_trd.sum())\n\n# 平均单笔流入金额\nAmtPerTrd_InFlow = where((_num_trd*where(_ret>0,1,0)).sum()==0, 1, (_amt*where(_ret>0,1,0)).sum() / (_num_trd*where(_ret>0,1,0)).sum())\n\n# 平均单笔流出金额\nAmtPerTrd_OutFlow = where((_num_trd*where(_ret<0,1,0)).sum()==0, 1, (_amt*where(_ret<0,1,0)).sum() / (_num_trd*where(_ret<0,1,0)).sum())\n\n# 平均单笔流入金额占比\nAmtPerTrd_InFlow_ratio = where(AmtPerTrd==0, 1, AmtPerTrd_InFlow / AmtPerTrd)\n\n# 平均单笔流出金额占比\nAmtPerTrd_OutFlow_ratio = where(AmtPerTrd_OutFlow==0, 1, AmtPerTrd_InFlow / AmtPerTrd_OutFlow)\n\n# 大单资金净流入金额\t\n_AmtPerTrd_avg = _amt.div(_num_trd)\n_anb_1 = where(_AmtPerTrd_avg >= _AmtPerTrd_avg.sort_values(ascending=False).iloc[np.int(240*0.1-1)], _amt*where(_ret>0,1,0), 0).sum()\n_anb_2 = where(_AmtPerTrd_avg >= _AmtPerTrd_avg.sort_values(ascending=False).iloc[np.int(240*0.1-1)], _amt*where(_ret<0,1,0), 0).sum()\nApt_NetinFlow_bigorder = _anb_1 - _anb_2\n\n# 大单资金净流入率\nApt_NetinFlow_bigorder_ratio = where(_amt.sum()==0, 1, Apt_NetinFlow_bigorder / (_amt.sum()))\n\n# 大单驱动涨幅(前10%)\nmom_bigorder = np.prod(1 + _ret*where(_amt >= _amt.sort_values(ascending=False).iloc[np.int(240*0.1-1)], 1, 0))\n# 大单驱动涨幅(前20%)\nmom_bigorder = np.prod(1 + _ret*where(_amt >= _amt.sort_values(ascending=False).iloc[np.int(240*0.2-1)], 1, 0))\n# 大单驱动涨幅(前30%)\nmom_bigorder = np.prod(1 + _ret*where(_amt >= _amt.sort_values(ascending=False).iloc[np.int(240*0.3-1)], 1, 0))\n\n# 趋势强度\n_diff_close = _c.diff().fillna(0).iloc[1:].abs().sum()\ntrend_strength = where(_diff_close==0, 1, _c.iloc[-1] - _c.iloc[0] / _diff_close)\n\n# 日内时点涨幅\ntime_incre_1 = _c.loc[93500] / _c.loc[93100]\ntime_incre_2 = _c.loc[150000] / _c.loc[145100]\ntime_incre_3 = _c.loc[140000] / _c.loc[133100]\n\n# 委买变化量\n_bid_vol_chg = bid_volume1.pct_change().fillna(0)+bid_volume2.pct_change().fillna(0)+bid_volume3.pct_change().fillna(0)+bid_volume4.pct_change().fillna(0)+bid_volume5.pct_change().fillna(0)+bid_volume6.pct_change().fillna(0)+bid_volume7.pct_change().fillna(0)+bid_volume8.pct_change().fillna(0)+bid_volume9.pct_change().fillna(0)+bid_volume10.pct_change().fillna(0)\n# 委卖变化量\n_ask_vol_chg = ask_volume1.pct_change().fillna(0)+ask_volume2.pct_change().fillna(0)+ask_volume3.pct_change().fillna(0)+ask_volume4.pct_change().fillna(0)+ask_volume5.pct_change().fillna(0)+ask_volume6.pct_change().fillna(0)+ask_volume7.pct_change().fillna(0)+ask_volume8.pct_change().fillna(0)+ask_volume9.pct_change().fillna(0)+ask_volume10.pct_change().fillna(0)\n# 净委买变化量 \nnet_bid_vol_chg = _c.mul(_bid_vol_chg.sub(_ask_vol_chg).fillna(0))\n\n# 均价偏差(二次抽取)\nvolu = _v.sum()\nvwap = (_c*_v).sum() / _v.sum()\nvolu_vwap = volu * vwap\n\n# 时间加权平均的相对价格位置(二次抽取)\nhigh1 = _h.max()\nlow1 = _l.min()\ntwap = ((_c.add(_h).add(_l).add(_o)) / 4).mean()\nARPP = get_ARPP(twap, high1, low1)\n\n# 聪明钱因子lnV\n_s1 = (_ret.abs().div(np.log(_v))).sort_values(ascending=False)\n_v1 = _v[_s1.index]\n_c1 = _c[_s1.index]\n_sm1 = ((_v1.cumsum() / _v.sum()) >= 0.2)\nsmart_money1 = ((_v1[_sm1]*_c1[_sm1]).sum() / (_v1[_sm1].sum())) / ((_v*_c).sum() / (_v.sum()))\n\n# 聪明钱因子V\n_s2 = _v.sort_values(ascending=False)\n_v2 = _v[_s2.index]\n_c2 = _c[_s2.index]\n_sm2 = ((_v2.cumsum() / _v.sum()) >= 0.2)\nsmart_money2 = ((_v2[_sm2]*_c2[_sm2]).sum() / (_v2[_sm2].sum())) / ((_v*_c).sum() / (_v.sum()))\n\n# 聪明钱因子rank\n_s3 = (_ret.abs().rank().add(_v.rank())).sort_values(ascending=False)\n_v3 = _v[_s3.index]\n_c3 = _c[_s3.index]\n_sm3 = ((_v3.cumsum() / _v.sum()) >= 0.2)\nsmart_money3 = ((_v3[_sm3]*_c3[_sm3]).sum() / (_v3[_sm3].sum())) / ((_v*_c).sum() / (_v.sum()))\n\n# 18 聪明钱因子rank\n_s4 = (_ret.abs().rank().add(_v.rank())).sort_values(ascending=False)\n_v4 = _v[_s4.index]\n_c4 = _c[_s4.index]\n_sm4 = ((_v4.cumsum() / _v.sum()) >= 0.2)\nsmart_money4 = ((_v4[_sm4]*_c4[_sm4]).sum() / (_v4[_sm4].sum())) / ((_v*_c).sum() / (_v.sum()))\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-331"}],"output_ports":[{"name":"data","node_id":"-331"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-312","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2016-01-03","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2016-12-31","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":" ","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"100","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-312"}],"output_ports":[{"name":"data","node_id":"-312"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-1136","module_id":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","parameters":[{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"drop_na","value":"False","type":"Literal","bound_global_parameter":null},{"name":"remove_extra_columns","value":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"def myf_(df, s1, s2):\n x = s1 / s2\n for i in range(x.shape[0]):\n x[i][np.isinf(x[i])] = 0\n return x.apply(lambda x: x.mean(skipna=True)), x.apply(lambda x:x.std(skipna=True)), x.apply(lambda x:x.skew(skipna=True))\n \ndef nanprod(df, x_name, N):\n return df.groupby('instrument')[x_name.name].apply(lambda x: x.rolling(N,1).apply(np.prod))\n\nbigquant_run = {\n 'myf_':myf_,\n 'nanprod':nanprod\n}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-1136"},{"name":"features","node_id":"-1136"}],"output_ports":[{"name":"data","node_id":"-1136"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"-2149","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"APB = np.log(nanmean(vwap, 5) / (nansum(volu_vwap, 5) / nansum(volu, 5)))\n\n# ARPP = (twap - high1) / (high1 - low1)\n\n\n# 过去10个日内累计时点涨幅(%)\ntime_zf1 = nanprod(time_incre_1, 10) - 1 \n\n# 过去10个日内累计时点涨幅(%)\ntime_zf2 = nanprod(time_incre_2, 10) - 1 \n\n# 过去10个日内累计时点涨幅(%)\ntime_zf3 = nanprod(time_incre_3, 10) - 1\n\n# 净委买变化率均值\nnet_bid_vol_chg_mean = myf_(net_bid_vol_chg ,market_cap_float_0)[0]\n# 净委买变化率标准差\nnet_bid_vol_chg_std = myf_(net_bid_vol_chg ,market_cap_float_0)[1]\n# 净委买变化率偏度\nnet_bid_vol_chg_skew = myf_(net_bid_vol_chg ,market_cap_float_0)[2]\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-2149"}],"output_ports":[{"name":"data","node_id":"-2149"}],"cacheable":true,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"-2016","module_id":"BigQuantSpace.feature_extractor_user_function.feature_extractor_user_function-v1","parameters":[{"name":"name","value":"get_ARPP","type":"Literal","bound_global_parameter":null},{"name":"func","value":"def bigquant_run(df, twap, high, low):\n if high == low:\n result = 0\n else:\n result = (twap - high) / (high - low)\n \n return result\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_functions","node_id":"-2016"}],"output_ports":[{"name":"functions","node_id":"-2016"}],"cacheable":false,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-584","module_id":"BigQuantSpace.feature_extractor_user_function.feature_extractor_user_function-v1","parameters":[{"name":"name","value":"ret_sim","type":"Literal","bound_global_parameter":null},{"name":"func","value":"def bigquant_run(df, close, op):\n res = close.pct_change()\n res.iloc[0] = close.iloc[0] / op.iloc[0] - 1\n return res\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_functions","node_id":"-584"}],"output_ports":[{"name":"functions","node_id":"-584"}],"cacheable":false,"seq_num":9,"comment":"","comment_collapsed":true},{"node_id":"-2300","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"market_cap_float_0\n ","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-2300"}],"output_ports":[{"name":"data","node_id":"-2300"}],"cacheable":true,"seq_num":10,"comment":"","comment_collapsed":true},{"node_id":"-2294","module_id":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":"20","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-2294"},{"name":"features","node_id":"-2294"}],"output_ports":[{"name":"data","node_id":"-2294"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true},{"node_id":"-2305","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"how","value":"inner","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"-2305"},{"name":"data2","node_id":"-2305"}],"output_ports":[{"name":"data","node_id":"-2305"}],"cacheable":true,"seq_num":12,"comment":"","comment_collapsed":true},{"node_id":"-1763","module_id":"BigQuantSpace.feature_extractor_1m.feature_extractor_1m-v2","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":"20","type":"Literal","bound_global_parameter":null},{"name":"workers","value":"10","type":"Literal","bound_global_parameter":null},{"name":"parallel_mode","value":"集群","type":"Literal","bound_global_parameter":null},{"name":"table_1m","value":"level2_bar1m_CN_STOCK_A","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-1763"},{"name":"features","node_id":"-1763"},{"name":"user_functions","node_id":"-1763"}],"output_ports":[{"name":"data","node_id":"-1763"}],"cacheable":true,"seq_num":13,"comment":"","comment_collapsed":true},{"node_id":"-7278","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df = input_1.read()\n df = df.drop(['net_bid_vol_chg'], axis=1)\n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-7278"},{"name":"input_2","node_id":"-7278"},{"name":"input_3","node_id":"-7278"}],"output_ports":[{"name":"data_1","node_id":"-7278"},{"name":"data_2","node_id":"-7278"},{"name":"data_3","node_id":"-7278"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-331' Position='-124,-238,200,200'/><node_position Node='-312' Position='-363,-330,200,200'/><node_position Node='-1136' Position='-88,116,200,200'/><node_position Node='-2149' Position='61,11,200,200'/><node_position Node='-2016' Position='197,-357,200,200'/><node_position Node='-584' Position='195,-446,200,200'/><node_position Node='-2300' Position='-604,-237,200,200'/><node_position Node='-2294' Position='-545,-109,200,200'/><node_position Node='-2305' Position='-231,11,200,200'/><node_position Node='-1763' Position='-200,-108,200,200'/><node_position Node='-7278' Position='-83.97623443603516,202,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
[2022-07-01 20:55:24.374668] INFO: moduleinvoker: input_features.v1 开始运行..
[2022-07-01 20:55:24.427988] INFO: moduleinvoker: input_features.v1 运行完成[0.053351s].
[2022-07-01 20:55:24.441413] INFO: moduleinvoker: instruments.v2 开始运行..
[2022-07-01 20:55:24.567045] INFO: moduleinvoker: instruments.v2 运行完成[0.125604s].
[2022-07-01 20:55:24.575211] INFO: moduleinvoker: input_features.v1 开始运行..
[2022-07-01 20:55:24.631451] INFO: moduleinvoker: input_features.v1 运行完成[0.056241s].
[2022-07-01 20:55:24.657620] INFO: moduleinvoker: feature_extractor_user_function.v1 运行完成[0.00029s].
[2022-07-01 20:55:24.676272] INFO: moduleinvoker: feature_extractor_user_function.v1 运行完成[0.000191s].
[2022-07-01 20:55:24.998122] INFO: moduleinvoker: feature_extractor_1m.v2 开始运行..
[2022-07-01 20:55:25.085711] INFO: 高频特征抽取-分钟到日频: 【集群模式】, instruments:100, workers:10, 并发数:10
[2022-07-01 20:55:25.090893] INFO: AI: 开始并行运算, remote_run=True, workers=10 ..
[2022-07-01 20:55:25.135177] INFO: AI: [ParallelEx(n_jobs=10)]: Using backend LokyBackend with 10 concurrent workers.
[2022-07-01 20:58:24.620256] INFO: AI: [ParallelEx(n_jobs=10)]: Done 3 out of 10 | elapsed: 3.0min remaining: 7.0min
[2022-07-01 20:58:26.218074] INFO: AI: [ParallelEx(n_jobs=10)]: Done 5 out of 10 | elapsed: 3.0min remaining: 3.0min
[2022-07-01 20:58:36.437970] INFO: AI: [ParallelEx(n_jobs=10)]: Done 7 out of 10 | elapsed: 3.2min remaining: 1.4min
[2022-07-01 20:59:46.623762] INFO: AI: [ParallelEx(n_jobs=10)]: Done 10 out of 10 | elapsed: 4.4min finished
[2022-07-01 20:59:46.627094] INFO: 高频特征抽取-分钟到日频: merge result .......
[2022-07-01 21:00:26.149574] INFO: 高频特征抽取-分钟到日频: extracted 99/100 instruments, (22738, 26)
[2022-07-01 21:00:26.367744] INFO: moduleinvoker: feature_extractor_1m.v2 运行完成[301.369648s].
[2022-07-01 21:00:26.377570] INFO: moduleinvoker: input_features.v1 开始运行..
[2022-07-01 21:00:26.387329] INFO: moduleinvoker: 命中缓存
[2022-07-01 21:00:26.393227] INFO: moduleinvoker: input_features.v1 运行完成[0.0157s].
[2022-07-01 21:00:26.458684] INFO: moduleinvoker: general_feature_extractor.v7 开始运行..
[2022-07-01 21:00:54.448954] INFO: 基础特征抽取: 年份 2015, 特征行数=1213
[2022-07-01 21:00:56.354944] INFO: 基础特征抽取: 年份 2016, 特征行数=21525
[2022-07-01 21:00:56.488908] INFO: 基础特征抽取: 总行数: 22738
[2022-07-01 21:00:56.496366] INFO: moduleinvoker: general_feature_extractor.v7 运行完成[30.037697s].
[2022-07-01 21:00:56.525891] INFO: moduleinvoker: join.v3 开始运行..
[2022-07-01 21:01:07.470002] INFO: join: /y_2015, 行数=1213/1213, 耗时=0.246759s
[2022-07-01 21:01:11.649349] INFO: join: /y_2016, 行数=21525/21525, 耗时=4.176567s
[2022-07-01 21:01:11.769006] INFO: join: 最终行数: 22738
[2022-07-01 21:01:12.006930] INFO: moduleinvoker: join.v3 运行完成[15.481033s].
[2022-07-01 21:01:12.047478] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2022-07-01 21:01:22.753476] INFO: derived_feature_extractor: 提取完成 APB = np.log(nanmean(vwap, 5) / (nansum(volu_vwap, 5) / nansum(volu, 5))), 0.113s
[2022-07-01 21:01:27.285355] INFO: derived_feature_extractor: 提取完成 time_zf1 = nanprod(time_incre_1, 10) - 1, 4.529s
[2022-07-01 21:01:31.756626] INFO: derived_feature_extractor: 提取完成 time_zf2 = nanprod(time_incre_2, 10) - 1, 4.468s
[2022-07-01 21:01:36.348805] INFO: derived_feature_extractor: 提取完成 time_zf3 = nanprod(time_incre_3, 10) - 1, 4.590s
[2022-07-01 21:02:49.082814] INFO: derived_feature_extractor: 提取完成 net_bid_vol_chg_mean = myf_(net_bid_vol_chg ,market_cap_float_0)[0], 72.731s
[2022-07-01 21:03:52.981226] INFO: derived_feature_extractor: 提取完成 net_bid_vol_chg_std = myf_(net_bid_vol_chg ,market_cap_float_0)[1], 63.894s
[2022-07-01 21:05:05.143910] INFO: derived_feature_extractor: 提取完成 net_bid_vol_chg_skew = myf_(net_bid_vol_chg ,market_cap_float_0)[2], 72.159s
[2022-07-01 21:05:06.096665] INFO: derived_feature_extractor: /y_2015, 1213
[2022-07-01 21:05:17.418353] INFO: derived_feature_extractor: /y_2016, 21525
[2022-07-01 21:05:22.252405] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[250.204927s].
[2022-07-01 21:05:22.323891] INFO: moduleinvoker: cached.v3 开始运行..
[2022-07-01 21:05:27.564739] INFO: moduleinvoker: cached.v3 运行完成[5.240856s].