克隆策略

AI策略比赛--参赛作品-- 作者:woshisilvio

meetup综合案例运用 采用 大盘相对收益率因子+综合大盘风控止盈止损 模拟中证150指数增强

训练集:10年-18年

测试集:18年-21年10月

因子数:3

算法:stockraner

标注:未来5日收益率

止盈止损:60%/5%

大盘风控:指数的macd死叉

策略逻辑:找到中证150中成长最快的一组股票池交由AI做训练,找出强趋势股,月线金叉以上的开仓做多

寻找在牛市中可以做波段增强的一类股票,对其进行排名打分

策略改进方向:股票池,因子池,回归分析,pca主成分分析降维,减少损失

算法改进方向:训练深度降低,或采用lightgbm

强势:牛市中拥有较为稳定的成长风格收益

劣势:在熊市和震荡风格中表现不佳

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-215:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"-3201:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"-11425:features_ds","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-236:input_1","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:model","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43:model"},{"to_node_id":"-11430:input_data","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data"},{"to_node_id":"-329:data1","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:predictions"},{"to_node_id":"-231:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-175:input_1","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-224:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-1918:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43:training_ds","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43:test_ds","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:data","from_node_id":"-86:data"},{"to_node_id":"-323:input_ds","from_node_id":"-86:data"},{"to_node_id":"-222:input_data","from_node_id":"-215:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data2","from_node_id":"-222:data"},{"to_node_id":"-238:input_data","from_node_id":"-231:data"},{"to_node_id":"-3234:data1","from_node_id":"-238:data"},{"to_node_id":"-9894:instruments","from_node_id":"-184:data"},{"to_node_id":"-9894:features","from_node_id":"-150:data"},{"to_node_id":"-242:columns_ds","from_node_id":"-150:data"},{"to_node_id":"-204:instruments","from_node_id":"-154:data"},{"to_node_id":"-266:columns_ds","from_node_id":"-131:data"},{"to_node_id":"-204:features","from_node_id":"-131:data"},{"to_node_id":"-228:input_data","from_node_id":"-9894:data"},{"to_node_id":"-228:features","from_node_id":"-271:data"},{"to_node_id":"-242:input_ds","from_node_id":"-228:data"},{"to_node_id":"-197:data1","from_node_id":"-242:data"},{"to_node_id":"-528:input_data","from_node_id":"-197:data"},{"to_node_id":"-6195:input_data","from_node_id":"-528:data"},{"to_node_id":"-528:features","from_node_id":"-546:data"},{"to_node_id":"-197:data2","from_node_id":"-266:data"},{"to_node_id":"-266:input_ds","from_node_id":"-248:data"},{"to_node_id":"-248:input_data","from_node_id":"-204:data"},{"to_node_id":"-248:features","from_node_id":"-256:data"},{"to_node_id":"-1162:input_ds","from_node_id":"-6195:data"},{"to_node_id":"-3194:data2","from_node_id":"-1162:data"},{"to_node_id":"-3325:input_data","from_node_id":"-3194:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data1","from_node_id":"-3325:data"},{"to_node_id":"-3194:data1","from_node_id":"-3201:data"},{"to_node_id":"-9978:instruments","from_node_id":"-9965:data"},{"to_node_id":"-9978:features","from_node_id":"-9973:data"},{"to_node_id":"-9998:columns_ds","from_node_id":"-9973:data"},{"to_node_id":"-9989:input_data","from_node_id":"-9978:data"},{"to_node_id":"-10019:instruments","from_node_id":"-10010:data"},{"to_node_id":"-9989:features","from_node_id":"-9984:data"},{"to_node_id":"-9998:input_ds","from_node_id":"-9989:data"},{"to_node_id":"-10004:data1","from_node_id":"-9998:data"},{"to_node_id":"-10053:input_data","from_node_id":"-10004:data"},{"to_node_id":"-10034:input_data","from_node_id":"-10019:data"},{"to_node_id":"-10019:features","from_node_id":"-10025:data"},{"to_node_id":"-10043:columns_ds","from_node_id":"-10025:data"},{"to_node_id":"-10034:features","from_node_id":"-10029:data"},{"to_node_id":"-10043:input_ds","from_node_id":"-10034:data"},{"to_node_id":"-10004:data2","from_node_id":"-10043:data"},{"to_node_id":"-10053:features","from_node_id":"-10048:data"},{"to_node_id":"-6189:input_data","from_node_id":"-10053:data"},{"to_node_id":"-3228:input_ds","from_node_id":"-6189:data"},{"to_node_id":"-3234:data2","from_node_id":"-3228:data"},{"to_node_id":"-11436:input_data","from_node_id":"-3234:data"},{"to_node_id":"-215:features","from_node_id":"-11425:data"},{"to_node_id":"-222:features","from_node_id":"-11425:data"},{"to_node_id":"-231:features","from_node_id":"-11425:data"},{"to_node_id":"-238:features","from_node_id":"-11425:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84:input_data","from_node_id":"-11430:data"},{"to_node_id":"-86:input_data","from_node_id":"-11436:data"},{"to_node_id":"-175:input_2","from_node_id":"-12762:data"},{"to_node_id":"-196:input_ds","from_node_id":"-175:data_1"},{"to_node_id":"-189:data2","from_node_id":"-196:data"},{"to_node_id":"-202:data2","from_node_id":"-189:data"},{"to_node_id":"-189:data1","from_node_id":"-224:data"},{"to_node_id":"-224:features","from_node_id":"-148:data"},{"to_node_id":"-490:input_ds","from_node_id":"-202:data"},{"to_node_id":"-1918:options_data","from_node_id":"-490:sorted_data"},{"to_node_id":"-329:data2","from_node_id":"-323:data"},{"to_node_id":"-202:data1","from_node_id":"-329:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43:features","from_node_id":"-236:data_1"}],"nodes":[{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2010-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2018-01-01","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"002714.SZA\n000620.SZA\n600066.SHA\n600887.SHA\n002415.SZA\n300450.SZA\n000622.SZA\n002690.SZA\n300601.SZA\n000776.SZA\n600519.SHA\n000333.SZA\n002035.SZA\n002236.SZA\n300015.SZA\n600436.SHA\n600566.SHA\n600201.SHA\n600705.SHA\n000156.SZA\n002677.SZA\n002032.SZA\n600681.SHA\n603601.SHA\n002372.SZA\n603019.SHA\n300571.SZA\n002475.SZA\n300033.SZA\n600346.SHA\n601888.SHA\n600763.SHA\n603799.SHA\n603690.SHA\n002044.SZA\n300253.SZA\n000651.SZA\n002085.SZA\n600903.SHA\n600340.SHA\n300296.SZA\n002572.SZA\n300176.SZA\n000963.SZA\n000403.SZA\n002747.SZA\n000789.SZA\n002508.SZA\n300347.SZA\n300401.SZA\n300666.SZA\n000732.SZA\n\t\n000049.SZA\n300451.SZA\n603986.SHA\n300684.SZA\n000681.SZA\n000671.SZA\n002230.SZA\n600867.SHA\n300059.SZA\n002020.SZA\n300457.SZA\n300136.SZA\n300308.SZA\n000661.SZA\n002304.SZA\n600276.SHA\n600563.SHA\n601012.SHA\n000703.SZA\n002410.SZA\n002358.SZA\n300725.SZA\n300226.SZA\n300675.SZA\n300324.SZA\n600801.SHA\n000048.SZA\n300383.SZA\n300285.SZA\n300459.SZA\n002008.SZA\n603288.SHA\n002049.SZA\n002311.SZA\n600305.SHA\n300377.SZA\n002746.SZA\n603638.SHA\n002507.SZA\n002252.SZA\n002271.SZA\n300482.SZA\n000002.SZA\n600612.SHA\n002081.SZA\n002013.SZA\n300357.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":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\n\n\navg_turn_15/turn_0\nmf_net_amount_xl_0\n\nalpha4=close_0*avg_turn_0+close_1*avg_turn_1+close_2*avg_turn_2\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43","module_id":"BigQuantSpace.stock_ranker_train.stock_ranker_train-v5","parameters":[{"name":"learning_algorithm","value":"排序","type":"Literal","bound_global_parameter":null},{"name":"number_of_leaves","value":"20","type":"Literal","bound_global_parameter":null},{"name":"minimum_docs_per_leaf","value":1000,"type":"Literal","bound_global_parameter":null},{"name":"number_of_trees","value":"70","type":"Literal","bound_global_parameter":null},{"name":"learning_rate","value":0.1,"type":"Literal","bound_global_parameter":null},{"name":"max_bins","value":1023,"type":"Literal","bound_global_parameter":null},{"name":"feature_fraction","value":1,"type":"Literal","bound_global_parameter":null},{"name":"m_lazy_run","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"training_ds","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"features","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"test_ds","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"base_model","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"}],"output_ports":[{"name":"model","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"feature_gains","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"m_lazy_run","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"}],"cacheable":true,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","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":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"},{"name":"data2","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","module_id":"BigQuantSpace.stock_ranker_predict.stock_ranker_predict-v5","parameters":[{"name":"m_lazy_run","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"model","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"},{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"}],"output_ports":[{"name":"predictions","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"},{"name":"m_lazy_run","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"}],"cacheable":true,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2018-01-01","type":"Literal","bound_global_parameter":"交易日期"},{"name":"end_date","value":"2021-10-30","type":"Literal","bound_global_parameter":"交易日期"},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"300782.SZA\n605358.SHA\n603290.SHA\n603392.SHA\n601865.SHA\n300759.SZA\n300750.SZA\n300677.SZA\n002607.SZA\n603259.SHA\n300751.SZA\n603613.SHA\n601100.SHA\n300763.SZA\n002568.SZA\n300724.SZA\n603345.SHA\n600763.SHA\n603713.SHA\n300595.SZA\n300014.SZA\n603712.SHA\n300760.SZA\n603317.SHA\n002791.SZA\n601066.SHA\n002985.SZA\n300661.SZA\n300347.SZA\n300777.SZA\n603129.SHA\n300454.SZA\n601888.SHA\n605111.SHA\n603638.SHA\n300850.SZA\n600809.SHA\n002414.SZA\n603893.SHA\n002967.SZA\n600132.SHA\n603605.SHA\n300015.SZA\n603267.SHA\n300012.SZA\n600882.SHA\n300684.SZA\n300390.SZA\n300769.SZA\n\t\n300748.SZA\n000799.SZA\n300767.SZA\n300775.SZA\n603737.SHA\n300601.SZA\n601698.SHA\n300841.SZA\n002975.SZA\n603501.SHA\n300122.SZA\n300677.SZA\n603392.SHA\n002791.SZA\n601865.SHA\n300759.SZA\n002568.SZA\n603613.SHA\n300014.SZA\n601100.SHA\n300763.SZA\n300274.SZA\n601633.SHA\n603501.SHA\n002709.SZA\n603317.SHA\n300661.SZA\n002985.SZA\n600882.SHA\n300598.SZA\n300777.SZA\n300552.SZA\n300346.SZA\n002475.SZA\n605111.SHA\n300850.SZA\n300526.SZA\n601012.SHA\n603893.SHA\n002967.SZA\n000858.SZA\n603267.SHA\n000568.SZA\n603638.SHA\n000708.SZA\n603456.SHA\n000995.SZA\n600399.SHA\n300767.SZA\n300595.SZA\n300347.SZA\n600763.SHA\n300751.SZA\n600316.SHA\n300775.SZA\n603208.SHA\n600862.SHA\n002241.SZA\n002706.SZA\n300390.SZA\n601698.SHA\n002541.SZA\n002607.SZA\n000733.SZA\n000596.SZA\n603345.SHA\n300151.SZA\n300496.SZA\n002705.SZA\n002756.SZA\n603185.SHA\n002850.SZA\n000661.SZA\n002600.SZA\n300724.SZA\n600584.SHA\n002414.SZA\n300223.SZA\n002920.SZA\n603906.SHA\n002714.SZA\n600966.SHA\n300083.SZA\n300601.SZA\n600438.SHA\n002812.SZA\n002459.SZA\n603027.SHA\n300015.SZA\n300763.SZA\n002709.SZA\n688202.SHA\n000422.SZA\n300769.SZA\n300751.SZA\n300343.SZA\n605117.SHA\n300827.SZA\n601633.SHA\n603026.SHA\n002240.SZA\n002326.SZA\n002487.SZA\n000762.SZA\n300432.SZA\n603396.SHA\n300363.SZA\n603985.SHA\n000155.SZA\n002594.SZA\n600399.SHA\n600702.SHA\n300171.SZA\n002176.SZA\n000733.SZA\n300750.SZA\n601127.SHA\n002812.SZA\n603260.SHA\n600610.SHA\n601012.SHA\n003022.SZA\n603127.SHA\n000301.SZA\n002585.SZA\n688198.SHA\n002245.SZA\n300693.SZA\n600096.SHA\n300568.SZA\n300382.SZA\n300443.SZA\n003031.SZA\n605376.SHA\n603806.SHA\n603223.SHA\n688116.SHA\n002529.SZA\n600141.SHA\n600956.SHA\n300035.SZA\n300316.SZA\n002460.SZA\n600110.SHA\n300671.SZA\n002407.SZA\n600532.SHA\n688599.SHA\n002472.SZA\n600499.SHA\n600111.SHA\n600884.SHA\n300696.SZA\n603267.SHA","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"cacheable":true,"seq_num":9,"comment":"预测数据,用于回测和模拟","comment_collapsed":false},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84","module_id":"BigQuantSpace.dropnan.dropnan-v1","parameters":[],"input_ports":[{"name":"input_data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84"}],"cacheable":true,"seq_num":13,"comment":"","comment_collapsed":true},{"node_id":"-86","module_id":"BigQuantSpace.dropnan.dropnan-v1","parameters":[],"input_ports":[{"name":"input_data","node_id":"-86"}],"output_ports":[{"name":"data","node_id":"-86"}],"cacheable":true,"seq_num":14,"comment":"","comment_collapsed":true},{"node_id":"-215","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":90,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-215"},{"name":"features","node_id":"-215"}],"output_ports":[{"name":"data","node_id":"-215"}],"cacheable":true,"seq_num":15,"comment":"","comment_collapsed":true},{"node_id":"-222","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":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-222"},{"name":"features","node_id":"-222"}],"output_ports":[{"name":"data","node_id":"-222"}],"cacheable":true,"seq_num":16,"comment":"","comment_collapsed":true},{"node_id":"-231","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":90,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-231"},{"name":"features","node_id":"-231"}],"output_ports":[{"name":"data","node_id":"-231"}],"cacheable":true,"seq_num":17,"comment":"","comment_collapsed":true},{"node_id":"-238","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":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-238"},{"name":"features","node_id":"-238"}],"output_ports":[{"name":"data","node_id":"-238"}],"cacheable":true,"seq_num":18,"comment":"","comment_collapsed":true},{"node_id":"-184","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2010-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2019-01-01","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000300.HIX","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-184"}],"output_ports":[{"name":"data","node_id":"-184"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-150","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nclose\ninstrument\n\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-150"}],"output_ports":[{"name":"data","node_id":"-150"}],"cacheable":true,"seq_num":10,"comment":"","comment_collapsed":true},{"node_id":"-154","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2010-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2019-01-01","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":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-154"}],"output_ports":[{"name":"data","node_id":"-154"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true},{"node_id":"-131","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nclose\nopen\nlow\nhigh\nadjust_factor","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-131"}],"output_ports":[{"name":"data","node_id":"-131"}],"cacheable":true,"seq_num":12,"comment":"","comment_collapsed":true},{"node_id":"-9894","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_index_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-9894"},{"name":"features","node_id":"-9894"}],"output_ports":[{"name":"data","node_id":"-9894"}],"cacheable":false,"seq_num":20,"comment":"bar1d_index_CN_STOCK_A表中抽取指数close数据","comment_collapsed":true},{"node_id":"-271","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nbmret=close/shift(close,1)-1\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-271"}],"output_ports":[{"name":"data","node_id":"-271"}],"cacheable":true,"seq_num":21,"comment":"表达式引擎因子计算5日收益率","comment_collapsed":true},{"node_id":"-228","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":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-228"},{"name":"features","node_id":"-228"}],"output_ports":[{"name":"data","node_id":"-228"}],"cacheable":true,"seq_num":22,"comment":"计算指数5日收益率","comment_collapsed":true},{"node_id":"-242","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-242"},{"name":"columns_ds","node_id":"-242"}],"output_ports":[{"name":"data","node_id":"-242"}],"cacheable":true,"seq_num":23,"comment":"过滤指定的列","comment_collapsed":true},{"node_id":"-197","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date","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":"-197"},{"name":"data2","node_id":"-197"}],"output_ports":[{"name":"data","node_id":"-197"}],"cacheable":true,"seq_num":24,"comment":"合并股票真实价格和大盘5日收益率","comment_collapsed":true},{"node_id":"-528","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":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-528"},{"name":"features","node_id":"-528"}],"output_ports":[{"name":"data","node_id":"-528"}],"cacheable":true,"seq_num":25,"comment":"抽取相对收益率","comment_collapsed":true},{"node_id":"-546","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nrelative_ret=stockret-bmret\nrelative_ret_5=sum(relative_ret,5)\nrelative_ret_30=sum(relative_ret,30)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-546"}],"output_ports":[{"name":"data","node_id":"-546"}],"cacheable":true,"seq_num":26,"comment":"","comment_collapsed":true},{"node_id":"-266","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-266"},{"name":"columns_ds","node_id":"-266"}],"output_ports":[{"name":"data","node_id":"-266"}],"cacheable":true,"seq_num":27,"comment":"过滤指定的列","comment_collapsed":true},{"node_id":"-248","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":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-248"},{"name":"features","node_id":"-248"}],"output_ports":[{"name":"data","node_id":"-248"}],"cacheable":true,"seq_num":28,"comment":"抽取真实价格","comment_collapsed":true},{"node_id":"-204","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-204"},{"name":"features","node_id":"-204"}],"output_ports":[{"name":"data","node_id":"-204"}],"cacheable":true,"seq_num":29,"comment":"bar1d_CN_STOCK_A表中抽取全市场股票的基础行情数据","comment_collapsed":true},{"node_id":"-256","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nstockret=close/shift(close,1)-1","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-256"}],"output_ports":[{"name":"data","node_id":"-256"}],"cacheable":true,"seq_num":30,"comment":"表达式引擎计算个股过去5日收益率","comment_collapsed":true},{"node_id":"-6195","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"(relative_ret_5>0)&(relative_ret_30>0)&(rank(relative_ret_30)>0.8)","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-6195"}],"output_ports":[{"name":"data","node_id":"-6195"},{"name":"left_data","node_id":"-6195"}],"cacheable":true,"seq_num":31,"comment":"","comment_collapsed":true},{"node_id":"-1162","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-1162"},{"name":"columns_ds","node_id":"-1162"}],"output_ports":[{"name":"data","node_id":"-1162"}],"cacheable":true,"seq_num":32,"comment":"","comment_collapsed":true},{"node_id":"-3194","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":"-3194"},{"name":"data2","node_id":"-3194"}],"output_ports":[{"name":"data","node_id":"-3194"}],"cacheable":true,"seq_num":33,"comment":"","comment_collapsed":true},{"node_id":"-3325","module_id":"BigQuantSpace.auto_labeler_on_datasource.auto_labeler_on_datasource-v1","parameters":[{"name":"label_expr","value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 https://bigquant.com/docs/develop/datasource/deprecated/history_data.html\n# 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/develop/bigexpr/usage.html>`_\n\n# 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)\n#shift(close, -5) / shift(open, -1)\n\n# 极值处理:用1%和99%分位的值做clip\n#clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))\n\n# 将分数映射到分类,这里使用20个分类\n#all_wbins(label, 20)\n\n# 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)\n#where(shift(high, -1) == shift(low, -1), NaN, label)\n# 计算收益:2日开盘价(作为卖出价格)除以明日开盘价(作为买入价格)\n(shift(close, -5) / shift(open, -1)-1)\n\n# 极值处理:用1%和99%分位的值做clip\nclip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))\nall_wbins(label, 20)\n# 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)\nwhere(shift(high, -1) == shift(low, -1), NaN, label)\n#where(label>0.5, NaN, label)\n#where(label<-0.5, NaN, label)\n","type":"Literal","bound_global_parameter":null},{"name":"drop_na_label","value":"True","type":"Literal","bound_global_parameter":null},{"name":"cast_label_int","value":"False","type":"Literal","bound_global_parameter":null},{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-3325"}],"output_ports":[{"name":"data","node_id":"-3325"}],"cacheable":true,"seq_num":34,"comment":"","comment_collapsed":true},{"node_id":"-3201","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-3201"},{"name":"features","node_id":"-3201"}],"output_ports":[{"name":"data","node_id":"-3201"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-9965","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2018-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-10-30","type":"Literal","bound_global_parameter":"交易日期"},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000300.HIX","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-9965"}],"output_ports":[{"name":"data","node_id":"-9965"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-9973","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nclose\ninstrument\n\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-9973"}],"output_ports":[{"name":"data","node_id":"-9973"}],"cacheable":true,"seq_num":35,"comment":"","comment_collapsed":true},{"node_id":"-9978","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_index_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-9978"},{"name":"features","node_id":"-9978"}],"output_ports":[{"name":"data","node_id":"-9978"}],"cacheable":false,"seq_num":36,"comment":"bar1d_index_CN_STOCK_A表中抽取指数close数据","comment_collapsed":true},{"node_id":"-10010","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2018-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-10-30","type":"Literal","bound_global_parameter":"交易日期"},{"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":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-10010"}],"output_ports":[{"name":"data","node_id":"-10010"}],"cacheable":true,"seq_num":37,"comment":"","comment_collapsed":true},{"node_id":"-9984","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nbmret=close/shift(close,1)-1\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-9984"}],"output_ports":[{"name":"data","node_id":"-9984"}],"cacheable":true,"seq_num":38,"comment":"表达式引擎因子计算5日收益率","comment_collapsed":true},{"node_id":"-9989","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":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-9989"},{"name":"features","node_id":"-9989"}],"output_ports":[{"name":"data","node_id":"-9989"}],"cacheable":true,"seq_num":39,"comment":"计算指数5日收益率","comment_collapsed":true},{"node_id":"-9998","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-9998"},{"name":"columns_ds","node_id":"-9998"}],"output_ports":[{"name":"data","node_id":"-9998"}],"cacheable":true,"seq_num":40,"comment":"过滤指定的列","comment_collapsed":true},{"node_id":"-10004","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date","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":"-10004"},{"name":"data2","node_id":"-10004"}],"output_ports":[{"name":"data","node_id":"-10004"}],"cacheable":true,"seq_num":41,"comment":"合并股票真实价格和大盘5日收益率","comment_collapsed":true},{"node_id":"-10019","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-10019"},{"name":"features","node_id":"-10019"}],"output_ports":[{"name":"data","node_id":"-10019"}],"cacheable":true,"seq_num":42,"comment":"bar1d_CN_STOCK_A表中抽取全市场股票的基础行情数据","comment_collapsed":true},{"node_id":"-10025","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nclose\nopen\nlow\nhigh\nadjust_factor","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-10025"}],"output_ports":[{"name":"data","node_id":"-10025"}],"cacheable":true,"seq_num":43,"comment":"","comment_collapsed":true},{"node_id":"-10029","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nstockret=close/shift(close,1)-1","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-10029"}],"output_ports":[{"name":"data","node_id":"-10029"}],"cacheable":true,"seq_num":44,"comment":"表达式引擎计算个股过去5日收益率","comment_collapsed":true},{"node_id":"-10034","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":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-10034"},{"name":"features","node_id":"-10034"}],"output_ports":[{"name":"data","node_id":"-10034"}],"cacheable":true,"seq_num":45,"comment":"抽取真实价格","comment_collapsed":true},{"node_id":"-10043","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-10043"},{"name":"columns_ds","node_id":"-10043"}],"output_ports":[{"name":"data","node_id":"-10043"}],"cacheable":true,"seq_num":46,"comment":"过滤指定的列","comment_collapsed":true},{"node_id":"-10048","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nrelative_ret=stockret-bmret\nrelative_ret_5=sum(relative_ret,5)\nrelative_ret_30=sum(relative_ret,30)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-10048"}],"output_ports":[{"name":"data","node_id":"-10048"}],"cacheable":true,"seq_num":47,"comment":"","comment_collapsed":true},{"node_id":"-10053","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":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-10053"},{"name":"features","node_id":"-10053"}],"output_ports":[{"name":"data","node_id":"-10053"}],"cacheable":true,"seq_num":48,"comment":"抽取相对收益率","comment_collapsed":true},{"node_id":"-6189","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"(relative_ret_5>0)&(relative_ret_30>0)&(rank(relative_ret_30)>0.8)","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-6189"}],"output_ports":[{"name":"data","node_id":"-6189"},{"name":"left_data","node_id":"-6189"}],"cacheable":true,"seq_num":49,"comment":"","comment_collapsed":true},{"node_id":"-3228","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-3228"},{"name":"columns_ds","node_id":"-3228"}],"output_ports":[{"name":"data","node_id":"-3228"}],"cacheable":true,"seq_num":50,"comment":"","comment_collapsed":true},{"node_id":"-3234","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":"-3234"},{"name":"data2","node_id":"-3234"}],"output_ports":[{"name":"data","node_id":"-3234"}],"cacheable":true,"seq_num":51,"comment":"","comment_collapsed":true},{"node_id":"-11425","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\n#周线金叉\ncond1=sum(ta_macd_dif(close_0,2,4,4),5)>sum(ta_macd_dea(close_0,2,4,4),5)\ncond2=close_0>mean(close_0, 25)\ncond3=sum(ta_macd_dea(close_0,2,4,4),5)>0.2\nprice_limit_status_0\ncond4=st_status_0<1","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-11425"}],"output_ports":[{"name":"data","node_id":"-11425"}],"cacheable":true,"seq_num":52,"comment":"","comment_collapsed":true},{"node_id":"-11430","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"cond1&cond2&cond3","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-11430"}],"output_ports":[{"name":"data","node_id":"-11430"},{"name":"left_data","node_id":"-11430"}],"cacheable":true,"seq_num":53,"comment":"","comment_collapsed":true},{"node_id":"-11436","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"cond1&cond2&cond3&cond4","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-11436"}],"output_ports":[{"name":"data","node_id":"-11436"},{"name":"left_data","node_id":"-11436"}],"cacheable":true,"seq_num":54,"comment":"","comment_collapsed":true},{"node_id":"-12762","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\n#bm_0 = where(close/shift(close,5)-1<-0.05,1,0)\n\nbm_0=where(ta_macd_dif(close,2,4,4)-ta_macd_dea(close,2,4,4)<0,1,0)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-12762"}],"output_ports":[{"name":"data","node_id":"-12762"}],"cacheable":true,"seq_num":55,"comment":"","comment_collapsed":true},{"node_id":"-175","module_id":"BigQuantSpace.index_feature_extract.index_feature_extract-v3","parameters":[{"name":"before_days","value":100,"type":"Literal","bound_global_parameter":null},{"name":"index","value":"000300.HIX","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-175"},{"name":"input_2","node_id":"-175"}],"output_ports":[{"name":"data_1","node_id":"-175"},{"name":"data_2","node_id":"-175"}],"cacheable":true,"seq_num":56,"comment":"","comment_collapsed":true},{"node_id":"-196","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"date,bm_0","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-196"},{"name":"columns_ds","node_id":"-196"}],"output_ports":[{"name":"data","node_id":"-196"}],"cacheable":true,"seq_num":57,"comment":"","comment_collapsed":true},{"node_id":"-189","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date","type":"Literal","bound_global_parameter":null},{"name":"how","value":"left","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"-189"},{"name":"data2","node_id":"-189"}],"output_ports":[{"name":"data","node_id":"-189"}],"cacheable":true,"seq_num":58,"comment":"","comment_collapsed":true},{"node_id":"-224","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"instruments_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-224"},{"name":"features","node_id":"-224"}],"output_ports":[{"name":"data","node_id":"-224"}],"cacheable":true,"seq_num":59,"comment":"","comment_collapsed":true},{"node_id":"-148","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nname","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-148"}],"output_ports":[{"name":"data","node_id":"-148"}],"cacheable":true,"seq_num":60,"comment":"","comment_collapsed":true},{"node_id":"-202","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"how","value":"left","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"-202"},{"name":"data2","node_id":"-202"}],"output_ports":[{"name":"data","node_id":"-202"}],"cacheable":true,"seq_num":61,"comment":"","comment_collapsed":true},{"node_id":"-490","module_id":"BigQuantSpace.sort.sort-v4","parameters":[{"name":"sort_by","value":"score","type":"Literal","bound_global_parameter":null},{"name":"group_by","value":"date","type":"Literal","bound_global_parameter":null},{"name":"keep_columns","value":"--","type":"Literal","bound_global_parameter":null},{"name":"ascending","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-490"},{"name":"sort_by_ds","node_id":"-490"}],"output_ports":[{"name":"sorted_data","node_id":"-490"}],"cacheable":true,"seq_num":62,"comment":"","comment_collapsed":true},{"node_id":"-1918","module_id":"BigQuantSpace.trade.trade-v4","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"initialize","value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n # 加载预测数据\n context.ranker_prediction = context.options['data'].read_df()\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)\n # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只\n stock_count = 5\n # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]\n context.stock_weights = T.norm([1 / math.log(i + 2) for i in range(0, stock_count)])\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument =0.1\n context.options['hold_days'] = 5\n\n from zipline.finance.slippage import SlippageModel\n class FixedPriceSlippage(SlippageModel):\n def process_order(self, data, order, bar_volume=0, trigger_check_price=0):\n if order.limit is None:\n price_field = self._price_field_buy if order.amount > 0 else self._price_field_sell\n price = data.current(order.asset, price_field)\n else:\n price = data.current(order.asset, self._price_field_buy)\n # 返回希望成交的价格和数量\n return (price, order.amount)\n # 设置price_field,默认是开盘买入,收盘卖出\n context.fix_slippage = FixedPriceSlippage(price_field_buy='open', price_field_sell='close')\n context.set_slippage(us_equities=context.fix_slippage)","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n # 获取当前持仓\n positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n \n today = data.current_dt.strftime('%Y-%m-%d')\n # 按日期过滤得到今日的预测数据\n ranker_prediction = context.ranker_prediction[\n context.ranker_prediction.date == today]\n try:\n #大盘风控模块,读取风控数据 \n benckmark_risk=ranker_prediction['bm_0'].values[0]\n if benckmark_risk > 0:\n for instrument in positions.keys():\n context.order_target(context.symbol(instrument), 0)\n print(today,'大盘风控止损触发,全仓卖出')\n return\n except:\n print('缺失风控数据!')\n \n #当risk为1时,市场有风险,全部平仓,不再执行其它操作\n \n \n # 1. 资金分配\n # 平均持仓时间是hold_days,每日都将买入股票,每日预期使用 1/hold_days 的资金\n # 实际操作中,会存在一定的买入误差,所以在前hold_days天,等量使用资金;之后,尽量使用剩余资金(这里设置最多用等量的1.5倍)\n is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天)\n cash_avg = context.portfolio.portfolio_value / context.options['hold_days']\n cash_for_buy = min(context.portfolio.cash, (1 if is_staging else 1.5) * cash_avg)\n cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)\n \n \n # 2. 根据需要加入移动止赢止损模块、固定天数卖出模块、ST或退市股卖出模块\n stock_sold = [] # 记录卖出的股票,防止多次卖出出现空单\n \n #------------------------START:止赢止损模块(含建仓期)---------------\n current_stopwin_stock=[]\n current_stoploss_stock = [] \n positions_cost={e.symbol:p.cost_basis for e,p in context.portfolio.positions.items()}\n if len(positions)>0:\n for instrument in positions.keys():\n stock_cost=positions_cost[instrument] \n stock_market_price=data.current(context.symbol(instrument),'price') \n volume_since_buy = data.history(context.symbol(instrument), 'volume', 6, '1d')\n # 赚9%且为可交易状态就止盈\n if stock_market_price/stock_cost-1>=0.6 and data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument),0)\n cash_for_sell -= positions[instrument]\n current_stopwin_stock.append(instrument)\n # 亏5%并且为可交易状态就止损\n if stock_market_price/stock_cost-1 <= -0.05 and data.can_trade(context.symbol(instrument)): \n context.order_target_percent(context.symbol(instrument),0)\n cash_for_sell -= positions[instrument]\n current_stoploss_stock.append(instrument)\n # 放天量 止损:\n# if (volume_since_buy[0]>1.5*volume_since_buy[1]) |(volume_since_buy[0]>1.5*(volume_since_buy[1]+volume_since_buy[2]+volume_since_buy[3]+volume_since_buy[4]+volume_since_buy[5])/5):\n# context.order_target_percent(context.symbol(instrument),0)\n# cash_for_sell -= positions[instrument]\n# current_stoploss_stock.append(instrument)\n if len(current_stopwin_stock)>0:\n print(today,'止盈股票列表',current_stopwin_stock)\n stock_sold += current_stopwin_stock\n if len(current_stoploss_stock)>0:\n print(today,'止损股票列表',current_stoploss_stock)\n stock_sold += current_stoploss_stock\n #--------------------------END: 止赢止损模块--------------------------\n \n #--------------------------START:持有固定天数卖出(不含建仓期)-----------\n current_stopdays_stock = []\n positions_lastdate = {e.symbol:p.last_sale_date for e,p in context.portfolio.positions.items()}\n # 不是建仓期(在前hold_days属于建仓期)\n if not is_staging:\n for instrument in positions.keys():\n #如果上面的止盈止损已经卖出过了,就不要重复卖出以防止产生空单\n if instrument in stock_sold:\n continue\n # 今天和上次交易的时间相隔hold_days就全部卖出 datetime.timedelta(context.options['hold_days'])也可以换成自己需要的天数,比如datetime.timedelta(5)\n if data.current_dt - positions_lastdate[instrument]>=datetime.timedelta(22) and data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument), 0)\n current_stopdays_stock.append(instrument)\n cash_for_sell -= positions[instrument]\n if len(current_stopdays_stock)>0: \n print(today,'固定天数卖出列表',current_stopdays_stock)\n stock_sold += current_stopdays_stock\n #------------------------- END:持有固定天数卖出-----------------------\n \n #-------------------------- START: ST和退市股卖出 --------------------- \n st_stock_list = []\n for instrument in positions.keys():\n try:\n instrument_name = ranker_prediction[ranker_prediction.instrument==instrument].name.values[0]\n # 如果股票状态变为了st或者退市 则卖出\n if 'ST' in instrument_name or '退' in instrument_name:\n if instrument in stock_sold:\n continue\n if data.can_trade(context.symbol(instrument)):\n context.order_target(context.symbol(instrument), 0)\n st_stock_list.append(instrument)\n cash_for_sell -= positions[instrument]\n except:\n continue\n if st_stock_list!=[]:\n print(today,'持仓出现st股/退市股',st_stock_list,'进行卖出处理') \n stock_sold += st_stock_list\n\n #-------------------------- END: ST和退市股卖出 --------------------- \n \n \n # 3. 生成轮仓卖出订单:hold_days天之后才开始卖出;对持仓的股票,按机器学习算法预测的排序末位淘汰\n if not is_staging and cash_for_sell > 0:\n instruments = list(reversed(list(ranker_prediction.instrument[ranker_prediction.instrument.apply(\n lambda x: x in positions)])))\n for instrument in instruments:\n # 如果资金够了就不卖出了\n if cash_for_sell <= 0:\n break\n #防止多个止损条件同时满足,出现多次卖出产生空单\n if instrument in stock_sold:\n continue\n context.order_target(context.symbol(instrument), 0)\n cash_for_sell -= positions[instrument]\n stock_sold.append(instrument)\n\n # 4. 生成轮仓买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票\n # 计算今日跌停的股票\n dt_list = list(ranker_prediction[ranker_prediction.price_limit_status_0==1].instrument)\n # 计算今日ST/退市的股票\n st_list = list(ranker_prediction[ranker_prediction.name.str.contains('ST')|ranker_prediction.name.str.contains('退')].instrument)\n # 计算所有禁止买入的股票池\n banned_list = stock_sold+dt_list+st_list\n buy_cash_weights = context.stock_weights\n buy_instruments=[k for k in list(ranker_prediction.instrument) if k not in banned_list][:len(buy_cash_weights)]\n max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument\n for i, instrument in enumerate(buy_instruments):\n cash = cash_for_buy * buy_cash_weights[i]\n if cash > max_cash_per_instrument - positions.get(instrument, 0):\n # 确保股票持仓量不会超过每次股票最大的占用资金量\n cash = max_cash_per_instrument - positions.get(instrument, 0)\n if cash > 0:\n context.order_value(context.symbol(instrument), cash)\n \n\n","type":"Literal","bound_global_parameter":null},{"name":"prepare","value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n context.status_df = D.features(instruments =context.instruments,start_date = context.start_date, end_date = context.end_date, \n fields=['st_status_0','price_limit_status_0','price_limit_status_1'])\n","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"def bigquant_run(context, data):\n # 获取涨跌停状态数据\n df_price_limit_status = context.ranker_prediction.set_index('date')\n today=data.current_dt.strftime('%Y-%m-%d')\n # 得到当前未完成订单\n for orders in get_open_orders().values():\n # 循环,撤销订单\n for _order in orders:\n ins=str(_order.sid.symbol)\n try:\n #判断一下如果当日涨停,则取消卖单\n if df_price_limit_status[df_price_limit_status.instrument==ins].price_limit_status_0.ix[today]>2 and _order.amount<0:\n cancel_order(_order)\n print(today,'尾盘涨停取消卖单',ins) \n except:\n continue","type":"Literal","bound_global_parameter":null},{"name":"volume_limit","value":0.025,"type":"Literal","bound_global_parameter":null},{"name":"order_price_field_buy","value":"open","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_sell","value":"close","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":"1000001","type":"Literal","bound_global_parameter":null},{"name":"auto_cancel_non_tradable_orders","value":"True","type":"Literal","bound_global_parameter":null},{"name":"data_frequency","value":"daily","type":"Literal","bound_global_parameter":null},{"name":"price_type","value":"后复权","type":"Literal","bound_global_parameter":null},{"name":"product_type","value":"股票","type":"Literal","bound_global_parameter":null},{"name":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-1918"},{"name":"options_data","node_id":"-1918"},{"name":"history_ds","node_id":"-1918"},{"name":"benchmark_ds","node_id":"-1918"},{"name":"trading_calendar","node_id":"-1918"}],"output_ports":[{"name":"raw_perf","node_id":"-1918"}],"cacheable":false,"seq_num":63,"comment":"","comment_collapsed":true},{"node_id":"-323","module_id":"BigQuantSpace.select_columns.select_columns-v3","parameters":[{"name":"columns","value":"date,instrument,price_limit_status_0","type":"Literal","bound_global_parameter":null},{"name":"reverse_select","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-323"},{"name":"columns_ds","node_id":"-323"}],"output_ports":[{"name":"data","node_id":"-323"}],"cacheable":true,"seq_num":64,"comment":"","comment_collapsed":true},{"node_id":"-329","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":"-329"},{"name":"data2","node_id":"-329"}],"output_ports":[{"name":"data","node_id":"-329"}],"cacheable":true,"seq_num":65,"comment":"","comment_collapsed":true},{"node_id":"-236","module_id":"BigQuantSpace.features_short.features_short-v1","parameters":[],"input_ports":[{"name":"input_1","node_id":"-236"}],"output_ports":[{"name":"data_1","node_id":"-236"}],"cacheable":true,"seq_num":67,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-8' Position='121,-20,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='663,29,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-43' Position='675,530,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-53' Position='249,375,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-60' Position='794,637,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-62' Position='1159,117,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-84' Position='508,457,200,200'/><node_position Node='-86' Position='1091,546,200,200'/><node_position Node='-215' Position='381,188,200,200'/><node_position Node='-222' Position='385,280,200,200'/><node_position Node='-231' Position='1078,236,200,200'/><node_position Node='-238' Position='1081,327,200,200'/><node_position Node='-184' Position='-1462,-1098,200,200'/><node_position Node='-150' Position='-1119,-1100,200,200'/><node_position Node='-154' Position='-810,-1096,200,200'/><node_position Node='-131' Position='-467,-1087,200,200'/><node_position Node='-9894' Position='-1312,-992,200,200'/><node_position Node='-271' Position='-988,-953,200,200'/><node_position Node='-228' Position='-1096,-853,200,200'/><node_position Node='-242' Position='-1052,-740,200,200'/><node_position Node='-197' Position='-741,-616,200,200'/><node_position Node='-528' Position='-511,-563,200,200'/><node_position Node='-546' Position='-339,-628,200,200'/><node_position Node='-266' Position='-375,-742,200,200'/><node_position Node='-248' Position='-524,-856,200,200'/><node_position Node='-204' Position='-661,-971,200,200'/><node_position Node='-256' Position='-361,-974,200,200'/><node_position Node='-6195' Position='-498,-200,200,200'/><node_position Node='-1162' Position='-454,-103,200,200'/><node_position Node='-3194' Position='-82,196,200,200'/><node_position Node='-3325' Position='-42,290,200,200'/><node_position Node='-3201' Position='46,114,200,200'/><node_position Node='-9965' Position='665,-942,200,200'/><node_position Node='-9973' Position='894,-890,200,200'/><node_position Node='-9978' Position='801,-776,200,200'/><node_position Node='-10010' Position='1221,-864,200,200'/><node_position Node='-9984' Position='1028,-743,200,200'/><node_position Node='-9989' Position='918,-643,200,200'/><node_position Node='-9998' Position='963,-528,200,200'/><node_position Node='-10004' Position='1266,-402,200,200'/><node_position Node='-10019' Position='1355,-761,200,200'/><node_position Node='-10025' Position='1550,-877,200,200'/><node_position Node='-10029' Position='1656,-762,200,200'/><node_position Node='-10034' Position='1492,-644,200,200'/><node_position Node='-10043' Position='1641,-530,200,200'/><node_position Node='-10048' Position='1679,-415,200,200'/><node_position Node='-10053' Position='1490,-325,200,200'/><node_position Node='-6189' Position='1373,-50,200,200'/><node_position Node='-3228' Position='1944,331,200,200'/><node_position Node='-3234' Position='1415,337,200,200'/><node_position Node='-11425' Position='719,145,200,200'/><node_position Node='-11430' Position='673,380,200,200'/><node_position Node='-11436' Position='1309,479,200,200'/><node_position Node='-12762' Position='1927,435,200,200'/><node_position Node='-175' Position='1928,542,200,200'/><node_position Node='-196' Position='1909,642,200,200'/><node_position Node='-189' Position='1725,760,200,200'/><node_position Node='-224' Position='1615,640,200,200'/><node_position Node='-148' Position='1618,542,200,200'/><node_position Node='-202' Position='1459,876,200,200'/><node_position Node='-490' Position='1566,979,200,200'/><node_position Node='-1918' Position='1478,1087,200,200'/><node_position Node='-323' Position='1342,676,200,200'/><node_position Node='-329' Position='1346,782,200,200'/><node_position Node='-236' Position='844,340,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [18]:
    # 本代码由可视化策略环境自动生成 2021年11月1日 21:45
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # 回测引擎:初始化函数,只执行一次
    def m63_initialize_bigquant_run(context):
        # 加载预测数据
        context.ranker_prediction = context.options['data'].read_df()
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)
        # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只
        stock_count = 5
        # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
        context.stock_weights = T.norm([1 / math.log(i + 2) for i in range(0, stock_count)])
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument =0.1
        context.options['hold_days'] = 5
    
        from zipline.finance.slippage import SlippageModel
        class FixedPriceSlippage(SlippageModel):
            def process_order(self, data, order, bar_volume=0, trigger_check_price=0):
                if order.limit is None:
                    price_field = self._price_field_buy if order.amount > 0 else self._price_field_sell
                    price = data.current(order.asset, price_field)
                else:
                    price = data.current(order.asset, self._price_field_buy)
                # 返回希望成交的价格和数量
                return (price, order.amount)
        # 设置price_field,默认是开盘买入,收盘卖出
        context.fix_slippage = FixedPriceSlippage(price_field_buy='open', price_field_sell='close')
        context.set_slippage(us_equities=context.fix_slippage)
    # 回测引擎:每日数据处理函数,每天执行一次
    def m63_handle_data_bigquant_run(context, data):
        # 获取当前持仓
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.portfolio.positions.items()}
        
        today = data.current_dt.strftime('%Y-%m-%d')
        # 按日期过滤得到今日的预测数据
        ranker_prediction = context.ranker_prediction[
            context.ranker_prediction.date == today]
        try:
        #大盘风控模块,读取风控数据    
            benckmark_risk=ranker_prediction['bm_0'].values[0]
            if benckmark_risk > 0:
                for instrument in positions.keys():
                    context.order_target(context.symbol(instrument), 0)
                    print(today,'大盘风控止损触发,全仓卖出')
                    return
        except:
            print('缺失风控数据!')
            
        #当risk为1时,市场有风险,全部平仓,不再执行其它操作
         
        
        # 1. 资金分配
        # 平均持仓时间是hold_days,每日都将买入股票,每日预期使用 1/hold_days 的资金
        # 实际操作中,会存在一定的买入误差,所以在前hold_days天,等量使用资金;之后,尽量使用剩余资金(这里设置最多用等量的1.5倍)
        is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天)
        cash_avg = context.portfolio.portfolio_value / context.options['hold_days']
        cash_for_buy = min(context.portfolio.cash, (1 if is_staging else 1.5) * cash_avg)
        cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)
       
        
        # 2. 根据需要加入移动止赢止损模块、固定天数卖出模块、ST或退市股卖出模块
        stock_sold = [] # 记录卖出的股票,防止多次卖出出现空单
        
        #------------------------START:止赢止损模块(含建仓期)---------------
        current_stopwin_stock=[]
        current_stoploss_stock = []   
        positions_cost={e.symbol:p.cost_basis for e,p in context.portfolio.positions.items()}
        if len(positions)>0:
            for instrument in positions.keys():
                stock_cost=positions_cost[instrument]  
                stock_market_price=data.current(context.symbol(instrument),'price')  
                volume_since_buy = data.history(context.symbol(instrument), 'volume', 6, '1d')
                # 赚9%且为可交易状态就止盈
                if stock_market_price/stock_cost-1>=0.6 and data.can_trade(context.symbol(instrument)):
                    context.order_target_percent(context.symbol(instrument),0)
                    cash_for_sell -= positions[instrument]
                    current_stopwin_stock.append(instrument)
                # 亏5%并且为可交易状态就止损
                if stock_market_price/stock_cost-1 <= -0.05 and data.can_trade(context.symbol(instrument)):   
                    context.order_target_percent(context.symbol(instrument),0)
                    cash_for_sell -= positions[instrument]
                    current_stoploss_stock.append(instrument)
                # 放天量  止损:
    #             if  (volume_since_buy[0]>1.5*volume_since_buy[1]) |(volume_since_buy[0]>1.5*(volume_since_buy[1]+volume_since_buy[2]+volume_since_buy[3]+volume_since_buy[4]+volume_since_buy[5])/5):
    #                 context.order_target_percent(context.symbol(instrument),0)
    #                 cash_for_sell -= positions[instrument]
    #                 current_stoploss_stock.append(instrument)
            if len(current_stopwin_stock)>0:
                print(today,'止盈股票列表',current_stopwin_stock)
                stock_sold += current_stopwin_stock
            if len(current_stoploss_stock)>0:
                print(today,'止损股票列表',current_stoploss_stock)
                stock_sold += current_stoploss_stock
        #--------------------------END: 止赢止损模块--------------------------
        
        #--------------------------START:持有固定天数卖出(不含建仓期)-----------
        current_stopdays_stock = []
        positions_lastdate = {e.symbol:p.last_sale_date for e,p in context.portfolio.positions.items()}
        # 不是建仓期(在前hold_days属于建仓期)
        if not is_staging:
            for instrument in positions.keys():
                #如果上面的止盈止损已经卖出过了,就不要重复卖出以防止产生空单
                if instrument in stock_sold:
                    continue
                # 今天和上次交易的时间相隔hold_days就全部卖出 datetime.timedelta(context.options['hold_days'])也可以换成自己需要的天数,比如datetime.timedelta(5)
                if data.current_dt - positions_lastdate[instrument]>=datetime.timedelta(22) and data.can_trade(context.symbol(instrument)):
                    context.order_target_percent(context.symbol(instrument), 0)
                    current_stopdays_stock.append(instrument)
                    cash_for_sell -= positions[instrument]
            if len(current_stopdays_stock)>0:        
                print(today,'固定天数卖出列表',current_stopdays_stock)
                stock_sold += current_stopdays_stock
        #-------------------------  END:持有固定天数卖出-----------------------
        
        #-------------------------- START: ST和退市股卖出 ---------------------  
        st_stock_list = []
        for instrument in positions.keys():
            try:
                instrument_name = ranker_prediction[ranker_prediction.instrument==instrument].name.values[0]
                # 如果股票状态变为了st或者退市 则卖出
                if 'ST' in instrument_name or '退' in instrument_name:
                    if instrument in stock_sold:
                        continue
                    if data.can_trade(context.symbol(instrument)):
                        context.order_target(context.symbol(instrument), 0)
                        st_stock_list.append(instrument)
                        cash_for_sell -= positions[instrument]
            except:
                continue
        if st_stock_list!=[]:
            print(today,'持仓出现st股/退市股',st_stock_list,'进行卖出处理')    
            stock_sold += st_stock_list
    
        #-------------------------- END: ST和退市股卖出 --------------------- 
        
        
        # 3. 生成轮仓卖出订单:hold_days天之后才开始卖出;对持仓的股票,按机器学习算法预测的排序末位淘汰
        if not is_staging and cash_for_sell > 0:
            instruments = list(reversed(list(ranker_prediction.instrument[ranker_prediction.instrument.apply(
                    lambda x: x in positions)])))
            for instrument in instruments:
                # 如果资金够了就不卖出了
                if cash_for_sell <= 0:
                    break
                #防止多个止损条件同时满足,出现多次卖出产生空单
                if instrument in stock_sold:
                    continue
                context.order_target(context.symbol(instrument), 0)
                cash_for_sell -= positions[instrument]
                stock_sold.append(instrument)
    
        # 4. 生成轮仓买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票
        # 计算今日跌停的股票
        dt_list = list(ranker_prediction[ranker_prediction.price_limit_status_0==1].instrument)
        # 计算今日ST/退市的股票
        st_list = list(ranker_prediction[ranker_prediction.name.str.contains('ST')|ranker_prediction.name.str.contains('退')].instrument)
        # 计算所有禁止买入的股票池
        banned_list = stock_sold+dt_list+st_list
        buy_cash_weights = context.stock_weights
        buy_instruments=[k for k in list(ranker_prediction.instrument) if k not in banned_list][:len(buy_cash_weights)]
        max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument
        for i, instrument in enumerate(buy_instruments):
            cash = cash_for_buy * buy_cash_weights[i]
            if cash > max_cash_per_instrument - positions.get(instrument, 0):
                # 确保股票持仓量不会超过每次股票最大的占用资金量
                cash = max_cash_per_instrument - positions.get(instrument, 0)
            if cash > 0:
                context.order_value(context.symbol(instrument), cash)
        
    
    
    # 回测引擎:准备数据,只执行一次
    def m63_prepare_bigquant_run(context):
        context.status_df = D.features(instruments =context.instruments,start_date = context.start_date, end_date = context.end_date, 
                               fields=['st_status_0','price_limit_status_0','price_limit_status_1'])
    
    def m63_before_trading_start_bigquant_run(context, data):
        # 获取涨跌停状态数据
        df_price_limit_status = context.ranker_prediction.set_index('date')
        today=data.current_dt.strftime('%Y-%m-%d')
        # 得到当前未完成订单
        for orders in get_open_orders().values():
            # 循环,撤销订单
            for _order in orders:
                ins=str(_order.sid.symbol)
                try:
                    #判断一下如果当日涨停,则取消卖单
                    if  df_price_limit_status[df_price_limit_status.instrument==ins].price_limit_status_0.ix[today]>2 and _order.amount<0:
                        cancel_order(_order)
                        print(today,'尾盘涨停取消卖单',ins) 
                except:
                    continue
    
    m1 = M.instruments.v2(
        start_date='2010-01-01',
        end_date='2018-01-01',
        market='CN_STOCK_A',
        instrument_list="""002714.SZA
    000620.SZA
    600066.SHA
    600887.SHA
    002415.SZA
    300450.SZA
    000622.SZA
    002690.SZA
    300601.SZA
    000776.SZA
    600519.SHA
    000333.SZA
    002035.SZA
    002236.SZA
    300015.SZA
    600436.SHA
    600566.SHA
    600201.SHA
    600705.SHA
    000156.SZA
    002677.SZA
    002032.SZA
    600681.SHA
    603601.SHA
    002372.SZA
    603019.SHA
    300571.SZA
    002475.SZA
    300033.SZA
    600346.SHA
    601888.SHA
    600763.SHA
    603799.SHA
    603690.SHA
    002044.SZA
    300253.SZA
    000651.SZA
    002085.SZA
    600903.SHA
    600340.SHA
    300296.SZA
    002572.SZA
    300176.SZA
    000963.SZA
    000403.SZA
    002747.SZA
    000789.SZA
    002508.SZA
    300347.SZA
    300401.SZA
    300666.SZA
    000732.SZA
    	
    000049.SZA
    300451.SZA
    603986.SHA
    300684.SZA
    000681.SZA
    000671.SZA
    002230.SZA
    600867.SHA
    300059.SZA
    002020.SZA
    300457.SZA
    300136.SZA
    300308.SZA
    000661.SZA
    002304.SZA
    600276.SHA
    600563.SHA
    601012.SHA
    000703.SZA
    002410.SZA
    002358.SZA
    300725.SZA
    300226.SZA
    300675.SZA
    300324.SZA
    600801.SHA
    000048.SZA
    300383.SZA
    300285.SZA
    300459.SZA
    002008.SZA
    603288.SHA
    002049.SZA
    002311.SZA
    600305.SHA
    300377.SZA
    002746.SZA
    603638.SHA
    002507.SZA
    002252.SZA
    002271.SZA
    300482.SZA
    000002.SZA
    600612.SHA
    002081.SZA
    002013.SZA
    300357.SZA""",
        max_count=0
    )
    
    m2 = M.use_datasource.v1(
        instruments=m1.data,
        datasource_id='bar1d_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m3 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    
    
    avg_turn_15/turn_0
    mf_net_amount_xl_0
    
    alpha4=close_0*avg_turn_0+close_1*avg_turn_1+close_2*avg_turn_2
    """
    )
    
    m52 = M.input_features.v1(
        features_ds=m3.data,
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    #周线金叉
    cond1=sum(ta_macd_dif(close_0,2,4,4),5)>sum(ta_macd_dea(close_0,2,4,4),5)
    cond2=close_0>mean(close_0, 25)
    cond3=sum(ta_macd_dea(close_0,2,4,4),5)>0.2
    price_limit_status_0
    cond4=st_status_0<1"""
    )
    
    m15 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m52.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m16 = M.derived_feature_extractor.v3(
        input_data=m15.data,
        features=m52.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m67 = M.features_short.v1(
        input_1=m3.data
    )
    
    m9 = M.instruments.v2(
        start_date=T.live_run_param('trading_date', '2018-01-01'),
        end_date=T.live_run_param('trading_date', '2021-10-30'),
        market='CN_STOCK_A',
        instrument_list="""300782.SZA
    605358.SHA
    603290.SHA
    603392.SHA
    601865.SHA
    300759.SZA
    300750.SZA
    300677.SZA
    002607.SZA
    603259.SHA
    300751.SZA
    603613.SHA
    601100.SHA
    300763.SZA
    002568.SZA
    300724.SZA
    603345.SHA
    600763.SHA
    603713.SHA
    300595.SZA
    300014.SZA
    603712.SHA
    300760.SZA
    603317.SHA
    002791.SZA
    601066.SHA
    002985.SZA
    300661.SZA
    300347.SZA
    300777.SZA
    603129.SHA
    300454.SZA
    601888.SHA
    605111.SHA
    603638.SHA
    300850.SZA
    600809.SHA
    002414.SZA
    603893.SHA
    002967.SZA
    600132.SHA
    603605.SHA
    300015.SZA
    603267.SHA
    300012.SZA
    600882.SHA
    300684.SZA
    300390.SZA
    300769.SZA
    	
    300748.SZA
    000799.SZA
    300767.SZA
    300775.SZA
    603737.SHA
    300601.SZA
    601698.SHA
    300841.SZA
    002975.SZA
    603501.SHA
    300122.SZA
    300677.SZA
    603392.SHA
    002791.SZA
    601865.SHA
    300759.SZA
    002568.SZA
    603613.SHA
    300014.SZA
    601100.SHA
    300763.SZA
    300274.SZA
    601633.SHA
    603501.SHA
    002709.SZA
    603317.SHA
    300661.SZA
    002985.SZA
    600882.SHA
    300598.SZA
    300777.SZA
    300552.SZA
    300346.SZA
    002475.SZA
    605111.SHA
    300850.SZA
    300526.SZA
    601012.SHA
    603893.SHA
    002967.SZA
    000858.SZA
    603267.SHA
    000568.SZA
    603638.SHA
    000708.SZA
    603456.SHA
    000995.SZA
    600399.SHA
    300767.SZA
    300595.SZA
    300347.SZA
    600763.SHA
    300751.SZA
    600316.SHA
    300775.SZA
    603208.SHA
    600862.SHA
    002241.SZA
    002706.SZA
    300390.SZA
    601698.SHA
    002541.SZA
    002607.SZA
    000733.SZA
    000596.SZA
    603345.SHA
    300151.SZA
    300496.SZA
    002705.SZA
    002756.SZA
    603185.SHA
    002850.SZA
    000661.SZA
    002600.SZA
    300724.SZA
    600584.SHA
    002414.SZA
    300223.SZA
    002920.SZA
    603906.SHA
    002714.SZA
    600966.SHA
    300083.SZA
    300601.SZA
    600438.SHA
    002812.SZA
    002459.SZA
    603027.SHA
    300015.SZA
    300763.SZA
    002709.SZA
    688202.SHA
    000422.SZA
    300769.SZA
    300751.SZA
    300343.SZA
    605117.SHA
    300827.SZA
    601633.SHA
    603026.SHA
    002240.SZA
    002326.SZA
    002487.SZA
    000762.SZA
    300432.SZA
    603396.SHA
    300363.SZA
    603985.SHA
    000155.SZA
    002594.SZA
    600399.SHA
    600702.SHA
    300171.SZA
    002176.SZA
    000733.SZA
    300750.SZA
    601127.SHA
    002812.SZA
    603260.SHA
    600610.SHA
    601012.SHA
    003022.SZA
    603127.SHA
    000301.SZA
    002585.SZA
    688198.SHA
    002245.SZA
    300693.SZA
    600096.SHA
    300568.SZA
    300382.SZA
    300443.SZA
    003031.SZA
    605376.SHA
    603806.SHA
    603223.SHA
    688116.SHA
    002529.SZA
    600141.SHA
    600956.SHA
    300035.SZA
    300316.SZA
    002460.SZA
    600110.SHA
    300671.SZA
    002407.SZA
    600532.SHA
    688599.SHA
    002472.SZA
    600499.SHA
    600111.SHA
    600884.SHA
    300696.SZA
    603267.SHA""",
        max_count=0
    )
    
    m17 = M.general_feature_extractor.v7(
        instruments=m9.data,
        features=m52.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m18 = M.derived_feature_extractor.v3(
        input_data=m17.data,
        features=m52.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m5 = M.instruments.v2(
        start_date='2010-01-01',
        end_date='2019-01-01',
        market='CN_STOCK_A',
        instrument_list='000300.HIX',
        max_count=0
    )
    
    m10 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    close
    instrument
    
    """
    )
    
    m20 = M.use_datasource.v1(
        instruments=m5.data,
        features=m10.data,
        datasource_id='bar1d_index_CN_STOCK_A',
        start_date='',
        end_date='',
        m_cached=False
    )
    
    m11 = M.instruments.v2(
        start_date='2010-01-01',
        end_date='2019-01-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m12 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    close
    open
    low
    high
    adjust_factor"""
    )
    
    m29 = M.use_datasource.v1(
        instruments=m11.data,
        features=m12.data,
        datasource_id='bar1d_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m21 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    bmret=close/shift(close,1)-1
    """
    )
    
    m22 = M.derived_feature_extractor.v3(
        input_data=m20.data,
        features=m21.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m23 = M.select_columns.v3(
        input_ds=m22.data,
        columns_ds=m10.data,
        columns='',
        reverse_select=True
    )
    
    m26 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    relative_ret=stockret-bmret
    relative_ret_5=sum(relative_ret,5)
    relative_ret_30=sum(relative_ret,30)"""
    )
    
    m30 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    stockret=close/shift(close,1)-1"""
    )
    
    m28 = M.derived_feature_extractor.v3(
        input_data=m29.data,
        features=m30.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m27 = M.select_columns.v3(
        input_ds=m28.data,
        columns_ds=m12.data,
        columns='',
        reverse_select=True
    )
    
    m24 = M.join.v3(
        data1=m23.data,
        data2=m27.data,
        on='date',
        how='inner',
        sort=False
    )
    
    m25 = M.derived_feature_extractor.v3(
        input_data=m24.data,
        features=m26.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m31 = M.filter.v3(
        input_data=m25.data,
        expr='(relative_ret_5>0)&(relative_ret_30>0)&(rank(relative_ret_30)>0.8)',
        output_left_data=False
    )
    
    m32 = M.select_columns.v3(
        input_ds=m31.data,
        columns='date,instrument',
        reverse_select=False
    )
    
    m33 = M.join.v3(
        data1=m2.data,
        data2=m32.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m34 = M.auto_labeler_on_datasource.v1(
        input_data=m33.data,
        label_expr="""# #号开始的表示注释
    # 0. 每行一个,顺序执行,从第二个开始,可以使用label字段
    # 1. 可用数据字段见 https://bigquant.com/docs/develop/datasource/deprecated/history_data.html
    # 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/develop/bigexpr/usage.html>`_
    
    # 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)
    #shift(close, -5) / shift(open, -1)
    
    # 极值处理:用1%和99%分位的值做clip
    #clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))
    
    # 将分数映射到分类,这里使用20个分类
    #all_wbins(label, 20)
    
    # 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)
    #where(shift(high, -1) == shift(low, -1), NaN, label)
    # 计算收益:2日开盘价(作为卖出价格)除以明日开盘价(作为买入价格)
    (shift(close, -5) / shift(open, -1)-1)
    
    # 极值处理:用1%和99%分位的值做clip
    clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))
    all_wbins(label, 20)
    # 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)
    where(shift(high, -1) == shift(low, -1), NaN, label)
    #where(label>0.5, NaN, label)
    #where(label<-0.5, NaN, label)
    """,
        drop_na_label=True,
        cast_label_int=False,
        date_col='date',
        instrument_col='instrument'
    )
    
    m7 = M.join.v3(
        data1=m34.data,
        data2=m16.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m53 = M.filter.v3(
        input_data=m7.data,
        expr='cond1&cond2&cond3',
        output_left_data=False
    )
    
    m13 = M.dropnan.v1(
        input_data=m53.data
    )
    
    m6 = M.stock_ranker_train.v5(
        training_ds=m13.data,
        features=m67.data_1,
        test_ds=m13.data,
        learning_algorithm='排序',
        number_of_leaves=20,
        minimum_docs_per_leaf=1000,
        number_of_trees=70,
        learning_rate=0.1,
        max_bins=1023,
        feature_fraction=1,
        m_lazy_run=False
    )
    
    m4 = M.instruments.v2(
        start_date='2018-01-01',
        end_date=T.live_run_param('trading_date', '2021-10-30'),
        market='CN_STOCK_A',
        instrument_list='000300.HIX',
        max_count=0
    )
    
    m35 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    close
    instrument
    
    """
    )
    
    m36 = M.use_datasource.v1(
        instruments=m4.data,
        features=m35.data,
        datasource_id='bar1d_index_CN_STOCK_A',
        start_date='',
        end_date='',
        m_cached=False
    )
    
    m37 = M.instruments.v2(
        start_date='2018-01-01',
        end_date=T.live_run_param('trading_date', '2021-10-30'),
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m38 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    bmret=close/shift(close,1)-1
    """
    )
    
    m39 = M.derived_feature_extractor.v3(
        input_data=m36.data,
        features=m38.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m40 = M.select_columns.v3(
        input_ds=m39.data,
        columns_ds=m35.data,
        columns='',
        reverse_select=True
    )
    
    m43 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    close
    open
    low
    high
    adjust_factor"""
    )
    
    m42 = M.use_datasource.v1(
        instruments=m37.data,
        features=m43.data,
        datasource_id='bar1d_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m44 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    stockret=close/shift(close,1)-1"""
    )
    
    m45 = M.derived_feature_extractor.v3(
        input_data=m42.data,
        features=m44.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m46 = M.select_columns.v3(
        input_ds=m45.data,
        columns_ds=m43.data,
        columns='',
        reverse_select=True
    )
    
    m41 = M.join.v3(
        data1=m40.data,
        data2=m46.data,
        on='date',
        how='inner',
        sort=False
    )
    
    m47 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    relative_ret=stockret-bmret
    relative_ret_5=sum(relative_ret,5)
    relative_ret_30=sum(relative_ret,30)"""
    )
    
    m48 = M.derived_feature_extractor.v3(
        input_data=m41.data,
        features=m47.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m49 = M.filter.v3(
        input_data=m48.data,
        expr='(relative_ret_5>0)&(relative_ret_30>0)&(rank(relative_ret_30)>0.8)',
        output_left_data=False
    )
    
    m50 = M.select_columns.v3(
        input_ds=m49.data,
        columns='date,instrument',
        reverse_select=False
    )
    
    m51 = M.join.v3(
        data1=m18.data,
        data2=m50.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m54 = M.filter.v3(
        input_data=m51.data,
        expr='cond1&cond2&cond3&cond4',
        output_left_data=False
    )
    
    m14 = M.dropnan.v1(
        input_data=m54.data
    )
    
    m8 = M.stock_ranker_predict.v5(
        model=m6.model,
        data=m14.data,
        m_lazy_run=False
    )
    
    m64 = M.select_columns.v3(
        input_ds=m14.data,
        columns='date,instrument,price_limit_status_0',
        reverse_select=False
    )
    
    m65 = M.join.v3(
        data1=m8.predictions,
        data2=m64.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m55 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    #bm_0 = where(close/shift(close,5)-1<-0.05,1,0)
    
    bm_0=where(ta_macd_dif(close,2,4,4)-ta_macd_dea(close,2,4,4)<0,1,0)"""
    )
    
    m56 = M.index_feature_extract.v3(
        input_1=m9.data,
        input_2=m55.data,
        before_days=100,
        index='000300.HIX'
    )
    
    m57 = M.select_columns.v3(
        input_ds=m56.data_1,
        columns='date,bm_0',
        reverse_select=False
    )
    
    m60 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    name"""
    )
    
    m59 = M.use_datasource.v1(
        instruments=m9.data,
        features=m60.data,
        datasource_id='instruments_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m58 = M.join.v3(
        data1=m59.data,
        data2=m57.data,
        on='date',
        how='left',
        sort=True
    )
    
    m61 = M.join.v3(
        data1=m65.data,
        data2=m58.data,
        on='date,instrument',
        how='left',
        sort=False
    )
    
    m62 = M.sort.v4(
        input_ds=m61.data,
        sort_by='score',
        group_by='date',
        keep_columns='--',
        ascending=False
    )
    
    m63 = M.trade.v4(
        instruments=m9.data,
        options_data=m62.sorted_data,
        start_date='',
        end_date='',
        initialize=m63_initialize_bigquant_run,
        handle_data=m63_handle_data_bigquant_run,
        prepare=m63_prepare_bigquant_run,
        before_trading_start=m63_before_trading_start_bigquant_run,
        volume_limit=0.025,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=1000001,
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='后复权',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark=''
    )
    
    列: ['close', 'instrument']
    /data: 2187
    
    列: ['date', 'instrument']
    /data: 739045
    
    bigcharts-data-start/{"__type":"tabs","__id":"bigchart-f756758bc9a44e67a995b5f029083815"}/bigcharts-data-end
    列: ['close', 'instrument']
    /data: 928
    
    列: ['date', 'instrument']
    /data: 441944
    
    列: ['date', 'instrument', 'price_limit_status_0']
    /y_2018: 1920
    /y_2019: 4204
    /y_2020: 6424
    /y_2021: 5061
    
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    缺失风控数据!
    2018-02-27 大盘风控止损触发,全仓卖出
    2018-02-28 大盘风控止损触发,全仓卖出
    2018-03-01 大盘风控止损触发,全仓卖出
    2018-03-02 大盘风控止损触发,全仓卖出
    2018-03-05 大盘风控止损触发,全仓卖出
    2018-03-07 大盘风控止损触发,全仓卖出
    2018-03-13 大盘风控止损触发,全仓卖出
    2018-03-14 大盘风控止损触发,全仓卖出
    2018-03-15 大盘风控止损触发,全仓卖出
    2018-03-16 大盘风控止损触发,全仓卖出
    2018-03-19 大盘风控止损触发,全仓卖出
    2018-03-21 大盘风控止损触发,全仓卖出
    2018-03-22 大盘风控止损触发,全仓卖出
    2018-03-23 大盘风控止损触发,全仓卖出
    2018-03-26 大盘风控止损触发,全仓卖出
    2018-03-28 大盘风控止损触发,全仓卖出
    2018-04-03 止损股票列表 ['603605.SHA']
    2018-04-04 大盘风控止损触发,全仓卖出
    2018-04-09 止损股票列表 ['603223.SHA']
    2018-04-10 止损股票列表 ['300661.SZA']
    2018-04-12 大盘风控止损触发,全仓卖出
    2018-04-13 大盘风控止损触发,全仓卖出
    2018-04-16 大盘风控止损触发,全仓卖出
    2018-04-17 大盘风控止损触发,全仓卖出
    2018-04-18 大盘风控止损触发,全仓卖出
    2018-04-19 止损股票列表 ['603985.SHA', '603712.SHA', '300598.SZA']
    2018-04-20 止损股票列表 ['603129.SHA', '603260.SHA']
    2018-04-23 止损股票列表 ['300568.SZA', '603501.SHA']
    2018-04-26 大盘风控止损触发,全仓卖出
    2018-04-27 大盘风控止损触发,全仓卖出
    2018-05-02 大盘风控止损触发,全仓卖出
    2018-05-04 止损股票列表 ['300671.SZA']
    2018-05-11 大盘风控止损触发,全仓卖出
    2018-05-14 止损股票列表 ['300347.SZA', '603605.SHA', '300595.SZA']
    2018-05-16 大盘风控止损触发,全仓卖出
    2018-05-17 大盘风控止损触发,全仓卖出
    2018-05-18 大盘风控止损触发,全仓卖出
    2018-05-21 止损股票列表 ['600438.SHA']
    2018-05-22 大盘风控止损触发,全仓卖出
    2018-05-23 大盘风控止损触发,全仓卖出
    2018-05-24 大盘风控止损触发,全仓卖出
    2018-05-25 大盘风控止损触发,全仓卖出
    2018-05-28 止损股票列表 ['300014.SZA', '601012.SHA']
    2018-05-29 大盘风控止损触发,全仓卖出
    2018-05-30 大盘风控止损触发,全仓卖出
    2018-06-01 止损股票列表 ['600763.SHA', '601100.SHA']
    2018-06-07 大盘风控止损触发,全仓卖出
    2018-06-08 大盘风控止损触发,全仓卖出
    2018-06-11 大盘风控止损触发,全仓卖出
    2018-06-12 止损股票列表 ['300363.SZA']
    2018-06-13 大盘风控止损触发,全仓卖出
    2018-06-14 大盘风控止损触发,全仓卖出
    2018-06-15 大盘风控止损触发,全仓卖出
    2018-06-19 大盘风控止损触发,全仓卖出
    2018-06-20 大盘风控止损触发,全仓卖出
    2018-06-21 大盘风控止损触发,全仓卖出
    2018-06-22 止损股票列表 ['002475.SZA', '603605.SHA', '603027.SHA', '002706.SZA', '002756.SZA']
    2018-06-26 大盘风控止损触发,全仓卖出
    2018-06-27 大盘风控止损触发,全仓卖出
    2018-06-28 大盘风控止损触发,全仓卖出
    2018-07-02 大盘风控止损触发,全仓卖出
    2018-07-03 止损股票列表 ['300347.SZA']
    2018-07-04 大盘风控止损触发,全仓卖出
    2018-07-05 大盘风控止损触发,全仓卖出
    2018-07-06 止损股票列表 ['300015.SZA', '300568.SZA']
    2018-07-11 大盘风控止损触发,全仓卖出
    2018-07-16 大盘风控止损触发,全仓卖出
    2018-07-17 大盘风控止损触发,全仓卖出
    2018-07-18 大盘风控止损触发,全仓卖出
    2018-07-19 大盘风控止损触发,全仓卖出
    2018-07-20 止损股票列表 ['300454.SZA']
    2018-07-23 止损股票列表 ['600763.SHA', '000596.SZA']
    2018-07-25 止损股票列表 ['300750.SZA']
    2018-07-26 大盘风控止损触发,全仓卖出
    2018-07-27 大盘风控止损触发,全仓卖出
    2018-07-30 大盘风控止损触发,全仓卖出
    2018-07-31 大盘风控止损触发,全仓卖出
    2018-08-01 大盘风控止损触发,全仓卖出
    缺失风控数据!
    2018-08-02 止损股票列表 ['600132.SHA', '002176.SZA']
    缺失风控数据!
    缺失风控数据!
    2018-08-06 止损股票列表 ['600882.SHA']
    缺失风控数据!
    2018-08-14 大盘风控止损触发,全仓卖出
    2018-08-15 大盘风控止损触发,全仓卖出
    2018-08-16 大盘风控止损触发,全仓卖出
    2018-08-17 大盘风控止损触发,全仓卖出
    2018-08-22 止损股票列表 ['002326.SZA']
    2018-08-29 大盘风控止损触发,全仓卖出
    2018-08-30 大盘风控止损触发,全仓卖出
    2018-08-31 大盘风控止损触发,全仓卖出
    2018-09-03 大盘风控止损触发,全仓卖出
    2018-09-04 止损股票列表 ['601127.SHA', '300684.SZA']
    2018-09-05 大盘风控止损触发,全仓卖出
    2018-09-06 大盘风控止损触发,全仓卖出
    2018-09-07 大盘风控止损触发,全仓卖出
    2018-09-10 大盘风控止损触发,全仓卖出
    2018-09-11 大盘风控止损触发,全仓卖出
    2018-09-12 大盘风控止损触发,全仓卖出
    2018-09-14 止损股票列表 ['603501.SHA']
    2018-09-17 大盘风控止损触发,全仓卖出
    2018-09-18 止损股票列表 ['002585.SZA']
    2018-09-27 大盘风控止损触发,全仓卖出
    2018-09-28 大盘风控止损触发,全仓卖出
    2018-10-08 大盘风控止损触发,全仓卖出
    2018-10-09 大盘风控止损触发,全仓卖出
    2018-10-10 大盘风控止损触发,全仓卖出
    2018-10-11 大盘风控止损触发,全仓卖出
    2018-10-12 大盘风控止损触发,全仓卖出
    2018-10-15 大盘风控止损触发,全仓卖出
    2018-10-16 止损股票列表 ['601633.SHA', '002594.SZA', '603737.SHA', '000708.SZA']
    缺失风控数据!
    缺失风控数据!
    2018-10-18 止损股票列表 ['603223.SHA']
    2018-10-24 大盘风控止损触发,全仓卖出
    2018-10-25 大盘风控止损触发,全仓卖出
    2018-10-26 大盘风控止损触发,全仓卖出
    2018-10-29 大盘风控止损触发,全仓卖出
    2018-10-30 大盘风控止损触发,全仓卖出
    2018-10-31 止损股票列表 ['300552.SZA']
    2018-11-01 止损股票列表 ['002594.SZA']
    2018-11-05 止损股票列表 ['002475.SZA']
    2018-11-06 大盘风控止损触发,全仓卖出
    2018-11-07 大盘风控止损触发,全仓卖出
    2018-11-08 大盘风控止损触发,全仓卖出
    2018-11-09 大盘风控止损触发,全仓卖出
    2018-11-12 大盘风控止损触发,全仓卖出
    2018-11-14 大盘风控止损触发,全仓卖出
    2018-11-20 大盘风控止损触发,全仓卖出
    2018-11-21 大盘风控止损触发,全仓卖出
    2018-11-22 大盘风控止损触发,全仓卖出
    2018-11-23 大盘风控止损触发,全仓卖出
    2018-11-26 大盘风控止损触发,全仓卖出
    2018-11-27 大盘风控止损触发,全仓卖出
    2018-11-28 止损股票列表 ['300316.SZA']
    2018-11-29 止损股票列表 ['300677.SZA', '603456.SHA', '002326.SZA']
    2018-12-05 大盘风控止损触发,全仓卖出
    2018-12-06 大盘风控止损触发,全仓卖出
    2018-12-07 大盘风控止损触发,全仓卖出
    2018-12-10 大盘风控止损触发,全仓卖出
    2018-12-11 大盘风控止损触发,全仓卖出
    2018-12-14 大盘风控止损触发,全仓卖出
    2018-12-17 大盘风控止损触发,全仓卖出
    2018-12-18 大盘风控止损触发,全仓卖出
    2018-12-19 大盘风控止损触发,全仓卖出
    2018-12-20 大盘风控止损触发,全仓卖出
    2018-12-21 大盘风控止损触发,全仓卖出
    2018-12-24 止损股票列表 ['002407.SZA', '002594.SZA']
    2018-12-27 止损股票列表 ['300274.SZA']
    2019-01-02 大盘风控止损触发,全仓卖出
    2019-01-03 止损股票列表 ['600132.SHA']
    2019-01-08 止损股票列表 ['300035.SZA']
    2019-01-14 大盘风控止损触发,全仓卖出
    2019-01-15 止损股票列表 ['300595.SZA']
    2019-01-17 大盘风控止损触发,全仓卖出
    2019-01-18 止损股票列表 ['002850.SZA']
    2019-01-22 大盘风控止损触发,全仓卖出
    2019-01-23 大盘风控止损触发,全仓卖出
    2019-01-24 大盘风控止损触发,全仓卖出
    2019-01-25 止损股票列表 ['601888.SHA']
    2019-01-28 止损股票列表 ['300035.SZA']
    2019-01-29 止损股票列表 ['300274.SZA']
    2019-01-30 大盘风控止损触发,全仓卖出
    2019-01-31 止损股票列表 ['002850.SZA']
    2019-02-15 大盘风控止损触发,全仓卖出
    2019-02-19 大盘风控止损触发,全仓卖出
    2019-02-20 大盘风控止损触发,全仓卖出
    2019-02-21 大盘风控止损触发,全仓卖出
    2019-02-27 大盘风控止损触发,全仓卖出
    2019-02-28 大盘风控止损触发,全仓卖出
    2019-03-01 大盘风控止损触发,全仓卖出
    2019-03-04 止损股票列表 ['600438.SHA']
    2019-03-05 大盘风控止损触发,全仓卖出
    2019-03-06 大盘风控止损触发,全仓卖出
    2019-03-07 大盘风控止损触发,全仓卖出
    2019-03-08 大盘风控止损触发,全仓卖出
    2019-03-11 大盘风控止损触发,全仓卖出
    2019-03-13 大盘风控止损触发,全仓卖出
    2019-03-14 大盘风控止损触发,全仓卖出
    2019-03-15 止损股票列表 ['002920.SZA', '002487.SZA', '603985.SHA', '603396.SHA', '600499.SHA']
    2019-03-18 止损股票列表 ['300083.SZA']
    2019-03-21 大盘风控止损触发,全仓卖出
    2019-03-22 大盘风控止损触发,全仓卖出
    2019-03-25 大盘风控止损触发,全仓卖出
    2019-03-26 大盘风控止损触发,全仓卖出
    2019-03-27 大盘风控止损触发,全仓卖出
    2019-03-28 止损股票列表 ['601100.SHA']
    2019-04-08 大盘风控止损触发,全仓卖出
    2019-04-09 大盘风控止损触发,全仓卖出
    2019-04-10 大盘风控止损触发,全仓卖出
    2019-04-11 大盘风控止损触发,全仓卖出
    缺失风控数据!
    2019-04-12 止损股票列表 ['601066.SHA', '603208.SHA']
    2019-04-15 大盘风控止损触发,全仓卖出
    2019-04-17 止损股票列表 ['300598.SZA']
    2019-04-18 止损股票列表 ['300598.SZA', '603906.SHA']
    2019-04-22 大盘风控止损触发,全仓卖出
    2019-04-23 大盘风控止损触发,全仓卖出
    2019-04-24 大盘风控止损触发,全仓卖出
    2019-04-25 大盘风控止损触发,全仓卖出
    2019-04-26 大盘风控止损触发,全仓卖出
    2019-04-29 大盘风控止损触发,全仓卖出
    2019-04-30 止损股票列表 ['002529.SZA', '601012.SHA', '600141.SHA']
    2019-05-06 大盘风控止损触发,全仓卖出
    2019-05-07 大盘风控止损触发,全仓卖出
    2019-05-08 大盘风控止损触发,全仓卖出
    2019-05-09 大盘风控止损触发,全仓卖出
    2019-05-17 大盘风控止损触发,全仓卖出
    2019-05-20 大盘风控止损触发,全仓卖出
    2019-05-21 止损股票列表 ['600966.SHA']
    2019-05-22 止损股票列表 ['000708.SZA']
    2019-05-23 大盘风控止损触发,全仓卖出
    2019-05-24 大盘风控止损触发,全仓卖出
    2019-05-29 止损股票列表 ['603026.SHA']
    2019-05-30 大盘风控止损触发,全仓卖出
    2019-05-31 大盘风控止损触发,全仓卖出
    2019-06-03 大盘风控止损触发,全仓卖出
    2019-06-04 大盘风控止损触发,全仓卖出
    2019-06-05 大盘风控止损触发,全仓卖出
    2019-06-06 大盘风控止损触发,全仓卖出
    2019-06-10 止损股票列表 ['603712.SHA', '603605.SHA', '300601.SZA']
    2019-06-12 止损股票列表 ['603317.SHA']
    2019-06-13 大盘风控止损触发,全仓卖出
    2019-06-14 大盘风控止损触发,全仓卖出
    2019-06-17 大盘风控止损触发,全仓卖出
    2019-06-18 大盘风控止损触发,全仓卖出
    2019-06-19 止损股票列表 ['601633.SHA']
    2019-06-25 大盘风控止损触发,全仓卖出
    2019-06-26 大盘风控止损触发,全仓卖出
    2019-06-27 大盘风控止损触发,全仓卖出
    2019-06-28 大盘风控止损触发,全仓卖出
    2019-07-03 大盘风控止损触发,全仓卖出
    2019-07-04 大盘风控止损触发,全仓卖出
    2019-07-05 大盘风控止损触发,全仓卖出
    2019-07-08 大盘风控止损触发,全仓卖出
    2019-07-09 大盘风控止损触发,全仓卖出
    2019-07-10 大盘风控止损触发,全仓卖出
    2019-07-11 止损股票列表 ['002705.SZA', '002475.SZA']
    2019-07-15 止损股票列表 ['002709.SZA']
    2019-07-18 大盘风控止损触发,全仓卖出
    2019-07-22 大盘风控止损触发,全仓卖出
    2019-07-23 止损股票列表 ['300677.SZA', '300363.SZA']
    2019-07-25 止损股票列表 ['600141.SHA']
    2019-07-29 大盘风控止损触发,全仓卖出
    2019-07-31 大盘风控止损触发,全仓卖出
    2019-08-01 大盘风控止损触发,全仓卖出
    2019-08-02 大盘风控止损触发,全仓卖出
    2019-08-05 大盘风控止损触发,全仓卖出
    2019-08-06 大盘风控止损触发,全仓卖出
    2019-08-07 大盘风控止损触发,全仓卖出
    2019-08-08 止损股票列表 ['300568.SZA', '600966.SHA']
    2019-08-16 止损股票列表 ['603345.SHA']
    2019-08-21 大盘风控止损触发,全仓卖出
    2019-08-22 大盘风控止损触发,全仓卖出
    2019-08-26 大盘风控止损触发,全仓卖出
    2019-08-27 大盘风控止损触发,全仓卖出
    2019-08-28 大盘风控止损触发,全仓卖出
    2019-08-29 大盘风控止损触发,全仓卖出
    2019-08-30 大盘风控止损触发,全仓卖出
    2019-09-05 止损股票列表 ['300601.SZA']
    2019-09-10 大盘风控止损触发,全仓卖出
    2019-09-11 大盘风控止损触发,全仓卖出
    2019-09-12 大盘风控止损触发,全仓卖出
    2019-09-16 大盘风控止损触发,全仓卖出
    2019-09-17 大盘风控止损触发,全仓卖出
    2019-09-18 大盘风控止损触发,全仓卖出
    2019-09-19 止损股票列表 ['600882.SHA']
    2019-09-23 大盘风控止损触发,全仓卖出
    2019-09-24 大盘风控止损触发,全仓卖出
    2019-09-25 大盘风控止损触发,全仓卖出
    2019-09-26 大盘风控止损触发,全仓卖出
    2019-09-27 止损股票列表 ['300363.SZA']
    2019-09-30 大盘风控止损触发,全仓卖出
    2019-10-11 止损股票列表 ['300751.SZA', '300526.SZA']
    2019-10-15 固定天数卖出列表 ['000799.SZA']
    2019-10-16 大盘风控止损触发,全仓卖出
    2019-10-17 大盘风控止损触发,全仓卖出
    2019-10-18 大盘风控止损触发,全仓卖出
    2019-10-21 大盘风控止损触发,全仓卖出
    2019-10-22 止损股票列表 ['002326.SZA', '300363.SZA']
    2019-10-23 大盘风控止损触发,全仓卖出
    2019-10-24 大盘风控止损触发,全仓卖出
    2019-10-25 止损股票列表 ['300595.SZA', '603027.SHA', '603345.SHA']
    2019-10-29 止损股票列表 ['300012.SZA', '300496.SZA']
    2019-10-30 大盘风控止损触发,全仓卖出
    2019-10-31 大盘风控止损触发,全仓卖出
    2019-11-06 大盘风控止损触发,全仓卖出
    2019-11-07 大盘风控止损触发,全仓卖出
    2019-11-08 大盘风控止损触发,全仓卖出
    2019-11-11 大盘风控止损触发,全仓卖出
    2019-11-12 大盘风控止损触发,全仓卖出
    2019-11-13 大盘风控止损触发,全仓卖出
    2019-11-15 大盘风控止损触发,全仓卖出
    2019-11-18 止损股票列表 ['002791.SZA']
    2019-11-21 大盘风控止损触发,全仓卖出
    2019-11-22 大盘风控止损触发,全仓卖出
    2019-11-26 止损股票列表 ['603713.SHA']
    2019-11-28 大盘风控止损触发,全仓卖出
    2019-11-29 大盘风控止损触发,全仓卖出
    2019-12-02 大盘风控止损触发,全仓卖出
    2019-12-11 大盘风控止损触发,全仓卖出
    2019-12-12 大盘风控止损触发,全仓卖出
    2019-12-16 止损股票列表 ['600132.SHA']
    2019-12-19 大盘风控止损触发,全仓卖出
    2019-12-20 大盘风控止损触发,全仓卖出
    2019-12-23 大盘风控止损触发,全仓卖出
    2019-12-24 大盘风控止损触发,全仓卖出
    2019-12-25 大盘风控止损触发,全仓卖出
    2019-12-27 止损股票列表 ['300151.SZA', '600110.SHA']
    2019-12-30 止损股票列表 ['603501.SHA']
    2020-01-03 止损股票列表 ['300767.SZA']
    2020-01-06 大盘风控止损触发,全仓卖出
    2020-01-07 大盘风控止损触发,全仓卖出
    2020-01-08 大盘风控止损触发,全仓卖出
    2020-01-10 大盘风控止损触发,全仓卖出
    2020-01-14 大盘风控止损触发,全仓卖出
    2020-01-15 大盘风控止损触发,全仓卖出
    2020-01-16 大盘风控止损触发,全仓卖出
    2020-01-17 大盘风控止损触发,全仓卖出
    2020-01-21 大盘风控止损触发,全仓卖出
    2020-01-22 大盘风控止损触发,全仓卖出
    2020-01-23 大盘风控止损触发,全仓卖出
    2020-02-03 大盘风控止损触发,全仓卖出
    2020-02-04 大盘风控止损触发,全仓卖出
    2020-02-05 止损股票列表 ['002920.SZA', '002245.SZA', '000155.SZA', '603605.SHA']
    2020-02-05 固定天数卖出列表 ['300363.SZA', '600882.SHA']
    2020-02-07 止损股票列表 ['300760.SZA', '002812.SZA']
    2020-02-10 止损股票列表 ['603501.SHA']
    2020-02-13 大盘风控止损触发,全仓卖出
    2020-02-19 大盘风控止损触发,全仓卖出
    2020-02-20 止损股票列表 ['300122.SZA', '002459.SZA']
    2020-02-24 大盘风控止损触发,全仓卖出
    2020-02-25 大盘风控止损触发,全仓卖出
    2020-02-26 大盘风控止损触发,全仓卖出
    2020-02-27 大盘风控止损触发,全仓卖出
    2020-02-28 大盘风控止损触发,全仓卖出
    2020-03-02 止损股票列表 ['600882.SHA', '600966.SHA']
    2020-03-03 止损股票列表 ['300382.SZA']
    2020-03-04 止损股票列表 ['300363.SZA']
    2020-03-05 止损股票列表 ['300454.SZA']
    2020-03-06 大盘风控止损触发,全仓卖出
    2020-03-09 大盘风控止损触发,全仓卖出
    2020-03-10 大盘风控止损触发,全仓卖出
    2020-03-11 大盘风控止损触发,全仓卖出
    2020-03-12 大盘风控止损触发,全仓卖出
    2020-03-13 大盘风控止损触发,全仓卖出
    2020-03-16 大盘风控止损触发,全仓卖出
    2020-03-17 大盘风控止损触发,全仓卖出
    2020-03-18 大盘风控止损触发,全仓卖出
    2020-03-19 大盘风控止损触发,全仓卖出
    2020-03-20 止损股票列表 ['002568.SZA']
    2020-03-23 止损股票列表 ['300316.SZA', '002541.SZA', '300346.SZA']
    2020-03-24 止损股票列表 ['603712.SHA']
    2020-03-25 止损股票列表 ['002585.SZA']
    2020-03-30 大盘风控止损触发,全仓卖出
    2020-03-31 大盘风控止损触发,全仓卖出
    2020-04-01 大盘风控止损触发,全仓卖出
    2020-04-02 止损股票列表 ['300696.SZA']
    2020-04-09 大盘风控止损触发,全仓卖出
    2020-04-10 大盘风控止损触发,全仓卖出
    2020-04-13 大盘风控止损触发,全仓卖出
    2020-04-14 止损股票列表 ['300363.SZA']
    2020-04-15 大盘风控止损触发,全仓卖出
    2020-04-16 大盘风控止损触发,全仓卖出
    2020-04-21 大盘风控止损触发,全仓卖出
    2020-04-22 大盘风控止损触发,全仓卖出
    2020-04-23 大盘风控止损触发,全仓卖出
    2020-04-24 大盘风控止损触发,全仓卖出
    2020-04-27 大盘风控止损触发,全仓卖出
    2020-04-28 止损股票列表 ['603712.SHA']
    2020-05-07 大盘风控止损触发,全仓卖出
    2020-05-08 止损股票列表 ['603456.SHA']
    2020-05-11 大盘风控止损触发,全仓卖出
    2020-05-12 大盘风控止损触发,全仓卖出
    2020-05-13 大盘风控止损触发,全仓卖出
    2020-05-14 大盘风控止损触发,全仓卖出
    2020-05-15 大盘风控止损触发,全仓卖出
    2020-05-18 大盘风控止损触发,全仓卖出
    2020-05-20 止损股票列表 ['002709.SZA']
    2020-05-21 大盘风控止损触发,全仓卖出
    2020-05-22 大盘风控止损触发,全仓卖出
    2020-05-25 大盘风控止损触发,全仓卖出
    2020-05-26 止损股票列表 ['688116.SHA']
    2020-05-27 止损股票列表 ['300454.SZA']
    2020-05-28 止损股票列表 ['600966.SHA']
    2020-05-29 止损股票列表 ['600532.SHA']
    2020-06-02 止损股票列表 ['002568.SZA', '603129.SHA']
    2020-06-03 止损股票列表 ['603345.SHA', '603208.SHA']
    2020-06-04 大盘风控止损触发,全仓卖出
    2020-06-05 大盘风控止损触发,全仓卖出
    2020-06-08 大盘风控止损触发,全仓卖出
    2020-06-09 止损股票列表 ['600882.SHA', '300677.SZA']
    2020-06-10 大盘风控止损触发,全仓卖出
    2020-06-11 大盘风控止损触发,全仓卖出
    2020-06-12 大盘风控止损触发,全仓卖出
    2020-06-15 大盘风控止损触发,全仓卖出
    2020-06-16 止损股票列表 ['600966.SHA', '002812.SZA']
    2020-06-22 止损股票列表 ['603208.SHA']
    2020-06-29 大盘风控止损触发,全仓卖出
    2020-07-02 止损股票列表 ['002541.SZA']
    2020-07-03 止损股票列表 ['002705.SZA']
    2020-07-06 止损股票列表 ['600763.SHA']
    2020-07-08 止损股票列表 ['300151.SZA']
    2020-07-09 大盘风控止损触发,全仓卖出
    2020-07-10 大盘风控止损触发,全仓卖出
    2020-07-13 大盘风控止损触发,全仓卖出
    2020-07-14 大盘风控止损触发,全仓卖出
    2020-07-15 大盘风控止损触发,全仓卖出
    2020-07-16 大盘风控止损触发,全仓卖出
    2020-07-17 大盘风控止损触发,全仓卖出
    2020-07-20 止损股票列表 ['002850.SZA']
    2020-07-21 止损股票列表 ['600862.SHA']
    2020-07-24 大盘风控止损触发,全仓卖出
    2020-07-27 大盘风控止损触发,全仓卖出
    2020-07-28 止损股票列表 ['603260.SHA', '300552.SZA']
    2020-07-30 止损股票列表 ['603456.SHA']
    2020-07-31 固定天数卖出列表 ['002240.SZA', '002594.SZA']
    2020-08-04 止损股票列表 ['000708.SZA']
    2020-08-05 大盘风控止损触发,全仓卖出
    2020-08-06 大盘风控止损触发,全仓卖出
    2020-08-07 大盘风控止损触发,全仓卖出
    2020-08-10 大盘风控止损触发,全仓卖出
    2020-08-11 大盘风控止损触发,全仓卖出
    2020-08-12 大盘风控止损触发,全仓卖出
    2020-08-13 大盘风控止损触发,全仓卖出
    2020-08-17 止损股票列表 ['600316.SHA']
    2020-08-19 大盘风控止损触发,全仓卖出
    2020-08-20 大盘风控止损触发,全仓卖出
    2020-08-21 大盘风控止损触发,全仓卖出
    2020-08-24 止损股票列表 ['603806.SHA', '300671.SZA']
    2020-08-25 止损股票列表 ['600966.SHA']
    2020-08-26 大盘风控止损触发,全仓卖出
    2020-08-27 大盘风控止损触发,全仓卖出
    2020-08-28 止损股票列表 ['600096.SHA']
    2020-08-31 止损股票列表 ['002791.SZA']
    2020-09-01 止损股票列表 ['603906.SHA']
    2020-09-02 大盘风控止损触发,全仓卖出
    2020-09-03 大盘风控止损触发,全仓卖出
    2020-09-04 大盘风控止损触发,全仓卖出
    2020-09-07 大盘风控止损触发,全仓卖出
    2020-09-08 大盘风控止损触发,全仓卖出
    2020-09-09 大盘风控止损触发,全仓卖出
    2020-09-10 大盘风控止损触发,全仓卖出
    2020-09-11 止损股票列表 ['000596.SZA', '300767.SZA', '002967.SZA', '688202.SHA', '603267.SHA']
    2020-09-17 大盘风控止损触发,全仓卖出
    2020-09-21 止损股票列表 ['300432.SZA', '002487.SZA']
    2020-09-22 大盘风控止损触发,全仓卖出
    2020-09-23 大盘风控止损触发,全仓卖出
    2020-09-24 大盘风控止损触发,全仓卖出
    2020-09-25 大盘风控止损触发,全仓卖出
    2020-09-28 止损股票列表 ['600110.SHA', '300763.SZA', '300035.SZA']
    2020-09-29 止损股票列表 ['603129.SHA']
    2020-10-09 止损股票列表 ['601888.SHA']
    2020-10-14 大盘风控止损触发,全仓卖出
    2020-10-15 大盘风控止损触发,全仓卖出
    2020-10-16 大盘风控止损触发,全仓卖出
    2020-10-19 大盘风控止损触发,全仓卖出
    2020-10-20 大盘风控止损触发,全仓卖出
    2020-10-21 大盘风控止损触发,全仓卖出
    2020-10-22 大盘风控止损触发,全仓卖出
    2020-10-23 大盘风控止损触发,全仓卖出
    2020-10-26 大盘风控止损触发,全仓卖出
    2020-10-27 大盘风控止损触发,全仓卖出
    2020-10-28 止损股票列表 ['600316.SHA']
    2020-10-30 大盘风控止损触发,全仓卖出
    2020-11-02 大盘风控止损触发,全仓卖出
    2020-11-04 止损股票列表 ['300763.SZA', '002459.SZA']
    2020-11-06 止损股票列表 ['688198.SHA']
    2020-11-09 止损股票列表 ['300696.SZA', '600532.SHA']
    2020-11-10 大盘风控止损触发,全仓卖出
    2020-11-11 大盘风控止损触发,全仓卖出
    2020-11-12 大盘风控止损触发,全仓卖出
    2020-11-13 大盘风控止损触发,全仓卖出
    2020-11-16 大盘风控止损触发,全仓卖出
    2020-11-17 大盘风控止损触发,全仓卖出
    2020-11-18 大盘风控止损触发,全仓卖出
    2020-11-19 止损股票列表 ['300693.SZA']
    2020-11-23 止盈股票列表 ['601127.SHA']
    2020-11-24 大盘风控止损触发,全仓卖出
    2020-11-25 大盘风控止损触发,全仓卖出
    2020-11-26 大盘风控止损触发,全仓卖出
    2020-11-27 止损股票列表 ['300432.SZA', '002568.SZA']
    2020-12-01 止损股票列表 ['603223.SHA', '002709.SZA']
    2020-12-02 止损股票列表 ['002245.SZA', '601633.SHA']
    2020-12-03 大盘风控止损触发,全仓卖出
    2020-12-04 大盘风控止损触发,全仓卖出
    2020-12-07 大盘风控止损触发,全仓卖出
    2020-12-08 大盘风控止损触发,全仓卖出
    2020-12-09 大盘风控止损触发,全仓卖出
    2020-12-10 大盘风控止损触发,全仓卖出
    2020-12-11 大盘风控止损触发,全仓卖出
    2020-12-14 止损股票列表 ['600111.SHA', '300661.SZA']
    2020-12-16 止损股票列表 ['002600.SZA']
    2020-12-21 止损股票列表 ['603713.SHA']
    2020-12-22 大盘风控止损触发,全仓卖出
    2020-12-23 大盘风控止损触发,全仓卖出
    2020-12-24 大盘风控止损触发,全仓卖出
    2020-12-25 止损股票列表 ['603906.SHA']
    2020-12-28 止损股票列表 ['300568.SZA']
    2020-12-29 大盘风控止损触发,全仓卖出
    2020-12-30 止损股票列表 ['688599.SHA', '002240.SZA']
    2021-01-06 止损股票列表 ['688116.SHA', '603906.SHA']
    2021-01-07 止损股票列表 ['600096.SHA']
    2021-01-08 大盘风控止损触发,全仓卖出
    2021-01-11 大盘风控止损触发,全仓卖出
    2021-01-12 止损股票列表 ['603713.SHA', '600532.SHA', '601865.SHA', '002985.SZA']
    2021-01-13 大盘风控止损触发,全仓卖出
    2021-01-14 大盘风控止损触发,全仓卖出
    2021-01-15 大盘风控止损触发,全仓卖出
    2021-01-18 大盘风控止损触发,全仓卖出
    2021-01-19 大盘风控止损触发,全仓卖出
    2021-01-20 大盘风控止损触发,全仓卖出
    2021-01-26 大盘风控止损触发,全仓卖出
    2021-01-27 大盘风控止损触发,全仓卖出
    2021-01-28 大盘风控止损触发,全仓卖出
    2021-01-29 大盘风控止损触发,全仓卖出
    2021-02-01 止损股票列表 ['000301.SZA', '002705.SZA', '300750.SZA']
    2021-02-03 止损股票列表 ['600532.SHA']
    2021-02-05 止损股票列表 ['603906.SHA', '300382.SZA']
    2021-02-08 止损股票列表 ['688202.SHA']
    2021-02-18 止损股票列表 ['002607.SZA', '600763.SHA', '688202.SHA', '300750.SZA']
    2021-02-18 固定天数卖出列表 ['688116.SHA']
    2021-02-19 大盘风控止损触发,全仓卖出
    2021-02-22 大盘风控止损触发,全仓卖出
    2021-02-23 大盘风控止损触发,全仓卖出
    2021-02-24 大盘风控止损触发,全仓卖出
    2021-02-25 大盘风控止损触发,全仓卖出
    2021-02-26 大盘风控止损触发,全仓卖出
    2021-03-01 止损股票列表 ['002568.SZA', '003022.SZA', '603638.SHA', '601888.SHA']
    2021-03-02 止损股票列表 ['002967.SZA', '600141.SHA']
    2021-03-04 大盘风控止损触发,全仓卖出
    2021-03-05 大盘风控止损触发,全仓卖出
    2021-03-08 大盘风控止损触发,全仓卖出
    2021-03-09 大盘风控止损触发,全仓卖出
    2021-03-10 止损股票列表 ['300083.SZA', '002472.SZA', '300363.SZA', '300390.SZA']
    2021-03-19 大盘风控止损触发,全仓卖出
    2021-03-22 大盘风控止损触发,全仓卖出
    2021-03-23 大盘风控止损触发,全仓卖出
    2021-03-24 大盘风控止损触发,全仓卖出
    2021-03-25 大盘风控止损触发,全仓卖出
    2021-03-31 大盘风控止损触发,全仓卖出
    2021-04-01 止损股票列表 ['000995.SZA', '300390.SZA']
    2021-04-06 大盘风控止损触发,全仓卖出
    2021-04-07 大盘风控止损触发,全仓卖出
    2021-04-08 大盘风控止损触发,全仓卖出
    2021-04-09 大盘风控止损触发,全仓卖出
    2021-04-12 大盘风控止损触发,全仓卖出
    2021-04-13 大盘风控止损触发,全仓卖出
    2021-04-21 止损股票列表 ['600399.SHA']
    2021-04-22 大盘风控止损触发,全仓卖出
    2021-04-26 大盘风控止损触发,全仓卖出
    2021-04-27 大盘风控止损触发,全仓卖出
    2021-04-30 大盘风控止损触发,全仓卖出
    2021-05-06 大盘风控止损触发,全仓卖出
    2021-05-07 大盘风控止损触发,全仓卖出
    2021-05-10 大盘风控止损触发,全仓卖出
    2021-05-11 止损股票列表 ['300724.SZA', '300496.SZA', '300035.SZA', '603208.SHA', '603345.SHA', '300671.SZA']
    2021-05-13 大盘风控止损触发,全仓卖出
    2021-05-18 止损股票列表 ['600532.SHA', '300601.SZA']
    2021-05-19 大盘风控止损触发,全仓卖出
    2021-05-20 大盘风控止损触发,全仓卖出
    2021-05-21 大盘风控止损触发,全仓卖出
    2021-05-24 大盘风控止损触发,全仓卖出
    2021-05-26 止损股票列表 ['002568.SZA', '002920.SZA']
    2021-05-28 大盘风控止损触发,全仓卖出
    2021-05-31 大盘风控止损触发,全仓卖出
    2021-06-01 大盘风控止损触发,全仓卖出
    2021-06-02 大盘风控止损触发,全仓卖出
    2021-06-03 大盘风控止损触发,全仓卖出
    2021-06-04 大盘风控止损触发,全仓卖出
    2021-06-07 大盘风控止损触发,全仓卖出
    2021-06-08 大盘风控止损触发,全仓卖出
    2021-06-09 大盘风控止损触发,全仓卖出
    2021-06-10 止损股票列表 ['601066.SHA']
    2021-06-11 大盘风控止损触发,全仓卖出
    2021-06-15 大盘风控止损触发,全仓卖出
    2021-06-16 大盘风控止损触发,全仓卖出
    2021-06-17 大盘风控止损触发,全仓卖出
    2021-06-24 止损股票列表 ['603456.SHA']
    2021-06-29 大盘风控止损触发,全仓卖出
    2021-06-30 大盘风控止损触发,全仓卖出
    2021-07-01 大盘风控止损触发,全仓卖出
    2021-07-02 大盘风控止损触发,全仓卖出
    2021-07-05 大盘风控止损触发,全仓卖出
    2021-07-06 大盘风控止损触发,全仓卖出
    2021-07-07 止损股票列表 ['300777.SZA', '600763.SHA', '600862.SHA', '300684.SZA']
    2021-07-08 止盈股票列表 ['300432.SZA']
    2021-07-08 止损股票列表 ['600096.SHA']
    2021-07-09 大盘风控止损触发,全仓卖出
    2021-07-13 止损股票列表 ['300526.SZA']
    2021-07-14 大盘风控止损触发,全仓卖出
    2021-07-15 止损股票列表 ['600584.SHA', '601633.SHA', '002594.SZA']
    2021-07-16 大盘风控止损触发,全仓卖出
    2021-07-19 大盘风控止损触发,全仓卖出
    2021-07-20 大盘风控止损触发,全仓卖出
    2021-07-23 大盘风控止损触发,全仓卖出
    2021-07-26 大盘风控止损触发,全仓卖出
    2021-07-27 大盘风控止损触发,全仓卖出
    2021-07-28 大盘风控止损触发,全仓卖出
    2021-07-29 止损股票列表 ['002791.SZA', '688198.SHA', '300748.SZA']
    2021-08-02 止损股票列表 ['300432.SZA']
    2021-08-03 止损股票列表 ['603806.SHA', '300850.SZA']
    2021-08-06 大盘风控止损触发,全仓卖出
    2021-08-10 止损股票列表 ['603127.SHA']
    2021-08-11 大盘风控止损触发,全仓卖出
    2021-08-12 大盘风控止损触发,全仓卖出
    2021-08-13 大盘风控止损触发,全仓卖出
    2021-08-16 大盘风控止损触发,全仓卖出
    2021-08-17 大盘风控止损触发,全仓卖出
    2021-08-18 止损股票列表 ['603906.SHA', '002985.SZA', '002459.SZA']
    2021-08-20 大盘风控止损触发,全仓卖出
    2021-08-25 止盈股票列表 ['603260.SHA']
    2021-08-26 大盘风控止损触发,全仓卖出
    2021-08-27 大盘风控止损触发,全仓卖出
    2021-08-30 大盘风控止损触发,全仓卖出
    2021-08-31 大盘风控止损触发,全仓卖出
    2021-09-01 止损股票列表 ['603712.SHA', '300724.SZA', '002985.SZA', '002529.SZA']
    2021-09-02 止损股票列表 ['002472.SZA', '300696.SZA', '300171.SZA']
    2021-09-03 大盘风控止损触发,全仓卖出
    2021-09-06 止损股票列表 ['601865.SHA', '600141.SHA']
    2021-09-08 止损股票列表 ['300850.SZA']
    2021-09-09 大盘风控止损触发,全仓卖出
    2021-09-10 止损股票列表 ['601633.SHA', '603985.SHA', '002487.SZA']
    2021-09-13 大盘风控止损触发,全仓卖出
    2021-09-14 大盘风控止损触发,全仓卖出
    2021-09-15 大盘风控止损触发,全仓卖出
    2021-09-16 大盘风控止损触发,全仓卖出
    2021-09-17 止损股票列表 ['000708.SZA']
    2021-09-23 止损股票列表 ['300568.SZA', '688116.SHA', '300432.SZA']
    2021-09-24 止损股票列表 ['300850.SZA']
    2021-09-27 止损股票列表 ['300382.SZA', '002487.SZA', '300443.SZA']
    2021-09-29 大盘风控止损触发,全仓卖出
    2021-09-30 止损股票列表 ['603127.SHA']
    2021-10-08 止损股票列表 ['603985.SHA', '000733.SZA']
    2021-10-11 止损股票列表 ['688202.SHA', '601066.SHA', '603345.SHA', '300274.SZA']
    2021-10-12 大盘风控止损触发,全仓卖出
    2021-10-13 止损股票列表 ['600956.SHA', '300598.SZA', '603906.SHA']
    2021-10-14 大盘风控止损触发,全仓卖出
    2021-10-15 大盘风控止损触发,全仓卖出
    2021-10-18 大盘风控止损触发,全仓卖出
    2021-10-19 止损股票列表 ['000858.SZA']
    2021-10-20 大盘风控止损触发,全仓卖出
    2021-10-22 止损股票列表 ['002529.SZA']
    2021-10-26 大盘风控止损触发,全仓卖出
    2021-10-27 大盘风控止损触发,全仓卖出
    2021-10-28 大盘风控止损触发,全仓卖出
    
    • 收益率848.15%
    • 年化收益率84.19%
    • 基准收益率21.78%
    • 阿尔法0.79
    • 贝塔0.5
    • 夏普比率2.9
    • 胜率0.57
    • 盈亏比1.65
    • 收益波动率20.8%
    • 信息比率0.17
    • 最大回撤18.99%
    bigcharts-data-start/{"__type":"tabs","__id":"bigchart-4ff87c7edcd54acfa9994b5363fa28af"}/bigcharts-data-end
    In [ ]:
     
    
    In [ ]:
    #coding=utf-8