{"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-322:features","from_node_id":"-331:data"},{"to_node_id":"-322:instruments","from_node_id":"-312:data"},{"to_node_id":"-1136:input_data","from_node_id":"-322:data"},{"to_node_id":"-932:input_functions","from_node_id":"-1111:functions"},{"to_node_id":"-1136:features","from_node_id":"-2149:data"},{"to_node_id":"-1111:input_functions","from_node_id":"-2016:functions"},{"to_node_id":"-322:user_functions","from_node_id":"-932:functions"},{"to_node_id":"-2016:input_functions","from_node_id":"-584:functions"}],"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)\nRSkew = 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个日内累计时点涨幅\n# cum_time_incre = np.prod([time_incre_1, time_incre_2, time_incre_3]) - 1\n\n# 平均净委买变化率均值\n# avg_bid_volume_delta = (_tbv.loc[93100:145700]).pct_change().fillna(0).mean()\n\n# 平均净委买变化率波动率\n# avg_bid_volume_std = (_tbv.loc[93100:145700]).pct_change().std()\n\n# 平均净委买变化率偏度\n# avg_bid_volume_skewness = (_tbv.loc[93100:145700]).pct_change().skew()\n\n# 均价偏差(二次抽取)\nvolu = _v.sum()\nvwap = where(volu==0, 1, ((_c.add(_h).add(_l).add(_o)) / 4).mul(_v).sum() / (volu))\nvolu_vwap = volu * vwap\n\n# 时间加权平均的相对价格位置(二次抽取)\nhigh1 = _h.max()\nlow1 = _l.min()\ntwap = ((_c.add(_h).add(_l).add(_o)) / 4).mean()\n\n# 聪明钱因子\n_s = (_ret.abs().div(np.sqrt(_v))).sort_values(ascending=False)\n_v1 = _v[_s.index]\n_c1 = _c[_s.index]\n_sm = ((_v1.cumsum() / _v.sum()) >= 0.2)\nsmart_money = ((_v1[_sm]*_c1[_sm]).sum() / (_v1[_sm].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":"2014-03-03","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-12-31","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000001.SZA\n000002.SZA\n000005.SZA","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"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":"-322","module_id":"BigQuantSpace.feature_extractor_1m.feature_extractor_1m-v1","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":2,"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":"-322"},{"name":"features","node_id":"-322"},{"name":"user_functions","node_id":"-322"}],"output_ports":[{"name":"data","node_id":"-322"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-1111","module_id":"BigQuantSpace.feature_extractor_user_function.feature_extractor_user_function-v1","parameters":[{"name":"name","value":"RSkew","type":"Literal","bound_global_parameter":null},{"name":"func","value":"def bigquant_run(df, ret, RVar):\n if RVar == 0:\n result = 0\n else:\n result = (np.power(ret, 3).sum()) * np.sqrt(240) / np.power(RVar, 1.5)\n return result\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_functions","node_id":"-1111"}],"output_ports":[{"name":"functions","node_id":"-1111"}],"cacheable":false,"seq_num":6,"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 nanmean(df, x_name, N):\n return df.groupby('instrument')[x_name.name].apply(lambda x: x.rolling(N,1).mean())\n\ndef nansum(df, x_name, N):\n return df.groupby('instrument')[x_name.name].apply(lambda x: x.rolling(N,1).sum())\n\ndef nanhigh(df, x_name, N):\n return df.groupby('instrument')[x_name.name].apply(lambda x: x.rolling(N,1).max())\n\ndef nanlow(df, x_name, N):\n return df.groupby('instrument')[x_name.name].apply(lambda x: x.rolling(N,1).min())\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 'nanmean': nanmean,\n 'nansum': nansum,\n 'nanhigh': nanhigh,\n 'nanlow': nanlow,\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\nARPP = (twap - nanhigh(high1, 5)) / (nanhigh(high1, 5) - nanlow(low1, 5))\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","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":"RKurt","type":"Literal","bound_global_parameter":null},{"name":"func","value":"def bigquant_run(df, ret, RVar):\n if RVar == 0:\n result = 1\n else:\n result = (np.power(ret, 4).sum()) * (240) / np.power(RVar, 2)\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":"-932","module_id":"BigQuantSpace.feature_extractor_user_function.feature_extractor_user_function-v1","parameters":[{"name":"name","value":"RVar","type":"Literal","bound_global_parameter":null},{"name":"func","value":"def bigquant_run(df, ret):\n return np.power(ret, 2).sum()\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_functions","node_id":"-932"}],"output_ports":[{"name":"functions","node_id":"-932"}],"cacheable":false,"seq_num":5,"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_layout":"<node_postions><node_position Node='-331' Position='-120.8932580947876,-240.43328857421875,200,200'/><node_position Node='-312' Position='-439,-237,200,200'/><node_position Node='-322' Position='-119,-16,200,200'/><node_position Node='-1111' Position='198,-296,200,200'/><node_position Node='-1136' Position='21,114,200,200'/><node_position Node='-2149' Position='250,-19,200,200'/><node_position Node='-2016' Position='197,-357,200,200'/><node_position Node='-932' Position='197,-235,200,200'/><node_position Node='-584' Position='195,-446,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
[2021-07-09 10:09:41.349291] INFO: moduleinvoker: input_features.v1 开始运行..
[2021-07-09 10:09:41.418852] INFO: moduleinvoker: input_features.v1 运行完成[0.069562s].
[2021-07-09 10:09:41.420360] INFO: moduleinvoker: instruments.v2 开始运行..
[2021-07-09 10:09:41.440405] INFO: moduleinvoker: instruments.v2 运行完成[0.020042s].
[2021-07-09 10:09:41.441670] INFO: moduleinvoker: input_features.v1 开始运行..
[2021-07-09 10:09:41.477031] INFO: moduleinvoker: 命中缓存
[2021-07-09 10:09:41.477874] INFO: moduleinvoker: input_features.v1 运行完成[0.036203s].
[2021-07-09 10:09:41.479433] INFO: moduleinvoker: feature_extractor_user_function.v1 运行完成[6.6e-05s].
[2021-07-09 10:09:41.480905] INFO: moduleinvoker: feature_extractor_user_function.v1 运行完成[5.7e-05s].
[2021-07-09 10:09:41.482376] INFO: moduleinvoker: feature_extractor_user_function.v1 运行完成[4.8e-05s].
[2021-07-09 10:09:41.483829] INFO: moduleinvoker: feature_extractor_user_function.v1 运行完成[5.7e-05s].
[2021-07-09 10:09:41.487123] INFO: moduleinvoker: feature_extractor_1m.v1 开始运行..
[2021-07-09 10:09:41.500682] INFO: 高频特征抽取-分钟到日频: 测试模式运行, ['000001.SZA', '000005.SZA', '000002.SZA']
[2021-07-09 10:09:41.501347] INFO: fe1m_utils: extract chunk 3 instruments, 40 features ..
[2021-07-09 10:09:41.501973] INFO: fe1m_utils: extract chunk 3 instruments, n_jobs=18=(12+24)/2, 并行=False ..
[2021-07-09 10:09:51.808815] INFO: fe1m_utils: extracted chunk 3/3 instruments, (729, 22).
[2021-07-09 10:09:51.895465] INFO: 高频特征抽取-分钟到日频: extracted 3/3 instruments, (729, 22)
[2021-07-09 10:09:51.898802] INFO: moduleinvoker: feature_extractor_1m.v1 运行完成[10.411674s].
[2021-07-09 10:09:51.901935] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2021-07-09 10:09:51.934326] INFO: derived_feature_extractor: 提取完成 APB = np.log(nanmean(vwap, 5) / (nansum(volu_vwap, 5) / nansum(volu, 5))), 0.009s
[2021-07-09 10:09:51.942528] INFO: derived_feature_extractor: 提取完成 ARPP = (twap - nanhigh(high1, 5)) / (nanhigh(high1, 5) - nanlow(low1, 5)), 0.007s
[2021-07-09 10:09:52.001127] INFO: derived_feature_extractor: 提取完成 time_zf1 = nanprod(time_incre_1, 10) - 1, 0.058s
[2021-07-09 10:09:52.075472] INFO: derived_feature_extractor: 提取完成 time_zf2 = nanprod(time_incre_2, 10) - 1, 0.073s
[2021-07-09 10:09:52.147404] INFO: derived_feature_extractor: 提取完成 time_zf3 = nanprod(time_incre_3, 10) - 1, 0.071s
[2021-07-09 10:09:52.173689] INFO: derived_feature_extractor: /data, 729
[2021-07-09 10:09:52.211921] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[0.309983s].