复制链接
克隆策略

    {"description":"实验创建于2023/6/16","graph":{"edges":[{"to_node_id":"-176:input_1","from_node_id":"-134:data"},{"to_node_id":"-250:options_data","from_node_id":"-176:data_1"},{"to_node_id":"-134:input_data","from_node_id":"-508:data"},{"to_node_id":"-250:instruments","from_node_id":"-81:data"}],"nodes":[{"node_id":"-134","module_id":"BigQuantSpace.chinaa_stock_filter.chinaa_stock_filter-v1","parameters":[{"name":"index_constituent_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%8150%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%8150%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B2%AA%E6%B7%B1300%22%2C%22displayValue%22%3A%22%E6%B2%AA%E6%B7%B1300%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81500%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81500%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81800%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81800%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%81180%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%81180%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81100%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81100%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B7%B1%E8%AF%81100%22%2C%22displayValue%22%3A%22%E6%B7%B1%E8%AF%81100%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%811000%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%811000%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"board_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E6%B7%B1%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22displayValue%22%3A%22%E6%B7%B1%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%88%9B%E4%B8%9A%E6%9D%BF%22%2C%22displayValue%22%3A%22%E5%88%9B%E4%B8%9A%E6%9D%BF%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E7%A7%91%E5%88%9B%E6%9D%BF%22%2C%22displayValue%22%3A%22%E7%A7%91%E5%88%9B%E6%9D%BF%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%8C%97%E4%BA%A4%E6%89%80%22%2C%22displayValue%22%3A%22%E5%8C%97%E4%BA%A4%E6%89%80%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"industry_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%BA%A4%E9%80%9A%E8%BF%90%E8%BE%93%22%2C%22displayValue%22%3A%22%E4%BA%A4%E9%80%9A%E8%BF%90%E8%BE%93%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%BC%91%E9%97%B2%E6%9C%8D%E5%8A%A1%22%2C%22displayValue%22%3A%22%E4%BC%91%E9%97%B2%E6%9C%8D%E5%8A%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%BC%A0%E5%AA%92%2F%E4%BF%A1%E6%81%AF%E6%9C%8D%E5%8A%A1%22%2C%22displayValue%22%3A%22%E4%BC%A0%E5%AA%92%2F%E4%BF%A1%E6%81%AF%E6%9C%8D%E5%8A%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%85%AC%E7%94%A8%E4%BA%8B%E4%B8%9A%22%2C%22displayValue%22%3A%22%E5%85%AC%E7%94%A8%E4%BA%8B%E4%B8%9A%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%86%9C%E6%9E%97%E7%89%A7%E6%B8%94%22%2C%22displayValue%22%3A%22%E5%86%9C%E6%9E%97%E7%89%A7%E6%B8%94%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%8C%96%E5%B7%A5%22%2C%22displayValue%22%3A%22%E5%8C%96%E5%B7%A5%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%8C%BB%E8%8D%AF%E7%94%9F%E7%89%A9%22%2C%22displayValue%22%3A%22%E5%8C%BB%E8%8D%AF%E7%94%9F%E7%89%A9%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%95%86%E4%B8%9A%E8%B4%B8%E6%98%93%22%2C%22displayValue%22%3A%22%E5%95%86%E4%B8%9A%E8%B4%B8%E6%98%93%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%BD%E9%98%B2%E5%86%9B%E5%B7%A5%22%2C%22displayValue%22%3A%22%E5%9B%BD%E9%98%B2%E5%86%9B%E5%B7%A5%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%AE%B6%E7%94%A8%E7%94%B5%E5%99%A8%22%2C%22displayValue%22%3A%22%E5%AE%B6%E7%94%A8%E7%94%B5%E5%99%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%BB%BA%E7%AD%91%E6%9D%90%E6%96%99%2F%E5%BB%BA%E7%AD%91%E5%BB%BA%E6%9D%90%22%2C%22displayValue%22%3A%22%E5%BB%BA%E7%AD%91%E6%9D%90%E6%96%99%2F%E5%BB%BA%E7%AD%91%E5%BB%BA%E6%9D%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%BB%BA%E7%AD%91%E8%A3%85%E9%A5%B0%22%2C%22displayValue%22%3A%22%E5%BB%BA%E7%AD%91%E8%A3%85%E9%A5%B0%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%88%BF%E5%9C%B0%E4%BA%A7%22%2C%22displayValue%22%3A%22%E6%88%BF%E5%9C%B0%E4%BA%A7%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9C%89%E8%89%B2%E9%87%91%E5%B1%9E%22%2C%22displayValue%22%3A%22%E6%9C%89%E8%89%B2%E9%87%91%E5%B1%9E%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9C%BA%E6%A2%B0%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E6%9C%BA%E6%A2%B0%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B1%BD%E8%BD%A6%2F%E4%BA%A4%E8%BF%90%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E6%B1%BD%E8%BD%A6%2F%E4%BA%A4%E8%BF%90%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%94%B5%E5%AD%90%22%2C%22displayValue%22%3A%22%E7%94%B5%E5%AD%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%94%B5%E6%B0%94%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E7%94%B5%E6%B0%94%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%BA%BA%E7%BB%87%E6%9C%8D%E8%A3%85%22%2C%22displayValue%22%3A%22%E7%BA%BA%E7%BB%87%E6%9C%8D%E8%A3%85%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%BB%BC%E5%90%88%22%2C%22displayValue%22%3A%22%E7%BB%BC%E5%90%88%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%AE%A1%E7%AE%97%E6%9C%BA%22%2C%22displayValue%22%3A%22%E8%AE%A1%E7%AE%97%E6%9C%BA%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%BD%BB%E5%B7%A5%E5%88%B6%E9%80%A0%22%2C%22displayValue%22%3A%22%E8%BD%BB%E5%B7%A5%E5%88%B6%E9%80%A0%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%80%9A%E4%BF%A1%22%2C%22displayValue%22%3A%22%E9%80%9A%E4%BF%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%87%87%E6%8E%98%22%2C%22displayValue%22%3A%22%E9%87%87%E6%8E%98%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%92%A2%E9%93%81%22%2C%22displayValue%22%3A%22%E9%92%A2%E9%93%81%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%93%B6%E8%A1%8C%22%2C%22displayValue%22%3A%22%E9%93%B6%E8%A1%8C%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%9D%9E%E9%93%B6%E9%87%91%E8%9E%8D%22%2C%22displayValue%22%3A%22%E9%9D%9E%E9%93%B6%E9%87%91%E8%9E%8D%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%A3%9F%E5%93%81%E9%A5%AE%E6%96%99%22%2C%22displayValue%22%3A%22%E9%A3%9F%E5%93%81%E9%A5%AE%E6%96%99%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"st_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%AD%A3%E5%B8%B8%22%2C%22displayValue%22%3A%22%E6%AD%A3%E5%B8%B8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22ST%22%2C%22displayValue%22%3A%22ST%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22*ST%22%2C%22displayValue%22%3A%22*ST%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9A%82%E5%81%9C%E4%B8%8A%E5%B8%82%22%2C%22displayValue%22%3A%22%E6%9A%82%E5%81%9C%E4%B8%8A%E5%B8%82%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"delist_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%80%80%E5%B8%82%22%2C%22displayValue%22%3A%22%E9%80%80%E5%B8%82%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%9D%9E%E9%80%80%E5%B8%82%22%2C%22displayValue%22%3A%22%E9%9D%9E%E9%80%80%E5%B8%82%22%2C%22selected%22%3Atrue%7D%5D%7D","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":"-134"}],"output_ports":[{"name":"data","node_id":"-134"},{"name":"left_data","node_id":"-134"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-176","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n df = input_1.read()\n \n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-176"},{"name":"input_2","node_id":"-176"},{"name":"input_3","node_id":"-176"}],"output_ports":[{"name":"data_1","node_id":"-176"},{"name":"data_2","node_id":"-176"},{"name":"data_3","node_id":"-176"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-508","module_id":"BigQuantSpace.datahub_load_datasource.datahub_load_datasource-v1","parameters":[{"name":"table","value":"bar1d_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"2022-06-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2023-06-15","type":"Literal","bound_global_parameter":null},{"name":"instruments","value":"# #号开始的表示注释,注释需单独一行\n# 每行一条\n","type":"Literal","bound_global_parameter":null},{"name":"fields","value":"# #号开始的表示注释,注释需单独一行\n# 每行一条\n","type":"Literal","bound_global_parameter":null}],"input_ports":[],"output_ports":[{"name":"data","node_id":"-508"}],"cacheable":false,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-81","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2022-06-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2023-06-15","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000009.SZA\n000012.SZA\n000021.SZA\n000027.SZA\n000031.SZA\n000039.SZA\n000050.SZA\n000060.SZA\n000066.SZA\n000089.SZA\n000155.SZA\n000156.SZA\n000400.SZA\n000401.SZA\n000402.SZA\n000415.SZA\n000423.SZA\n000513.SZA\n000519.SZA\n000537.SZA\n000547.SZA\n000553.SZA\n000559.SZA\n000563.SZA\n000581.SZA\n000591.SZA\n000598.SZA\n000623.SZA\n000629.SZA\n000630.SZA\n000636.SZA\n000683.SZA\n000703.SZA\n000709.SZA\n000728.SZA\n000729.SZA\n000738.SZA\n000739.SZA\n000750.SZA\n000778.SZA\n000783.SZA\n000785.SZA\n000807.SZA\n000825.SZA\n000830.SZA\n000831.SZA\n000869.SZA\n000878.SZA\n000883.SZA\n000887.SZA\n000893.SZA\n000898.SZA\n000930.SZA\n000932.SZA\n000933.SZA\n000937.SZA\n000958.SZA\n000959.SZA\n000960.SZA\n000967.SZA\n000970.SZA\n000975.SZA\n000987.SZA\n000988.SZA\n000997.SZA\n000998.SZA\n001203.SZA\n001227.SZA\n001872.SZA\n001914.SZA\n002008.SZA\n002010.SZA\n002019.SZA\n002025.SZA\n002028.SZA\n002030.SZA\n002032.SZA\n002056.SZA\n002065.SZA\n002078.SZA\n002080.SZA\n002081.SZA\n002092.SZA\n002110.SZA\n002128.SZA\n002131.SZA\n002138.SZA\n002152.SZA\n002153.SZA\n002155.SZA\n002156.SZA\n002183.SZA\n002185.SZA\n002192.SZA\n002195.SZA\n002203.SZA\n002221.SZA\n002223.SZA\n002240.SZA\n002244.SZA\n002249.SZA\n002250.SZA\n002266.SZA\n002268.SZA\n002273.SZA\n002281.SZA\n002294.SZA\n002299.SZA\n002326.SZA\n002340.SZA\n002353.SZA\n002368.SZA\n002372.SZA\n002373.SZA\n002384.SZA\n002385.SZA\n002399.SZA\n002407.SZA\n002408.SZA\n002409.SZA\n002422.SZA\n002423.SZA\n002429.SZA\n002430.SZA\n002432.SZA\n002439.SZA\n002444.SZA\n002463.SZA\n002465.SZA\n002468.SZA\n002487.SZA\n002497.SZA\n002500.SZA\n002505.SZA\n002506.SZA\n002507.SZA\n002508.SZA\n002511.SZA\n002518.SZA\n002531.SZA\n002532.SZA\n002557.SZA\n002563.SZA\n002568.SZA\n002572.SZA\n002595.SZA\n002600.SZA\n002608.SZA\n002624.SZA\n002625.SZA\n002653.SZA\n002670.SZA\n002673.SZA\n002683.SZA\n002690.SZA\n002705.SZA\n002738.SZA\n002739.SZA\n002745.SZA\n002761.SZA\n002791.SZA\n002797.SZA\n002831.SZA\n002850.SZA\n002867.SZA\n002901.SZA\n002925.SZA\n002926.SZA\n002936.SZA\n002939.SZA\n002945.SZA\n002958.SZA\n002966.SZA\n002985.SZA\n003035.SZA\n300001.SZA\n300003.SZA\n300009.SZA\n300012.SZA\n300017.SZA\n300024.SZA\n300026.SZA\n300037.SZA\n300058.SZA\n300070.SZA\n300073.SZA\n300088.SZA\n300115.SZA\n300118.SZA\n300136.SZA\n300144.SZA\n300146.SZA\n300182.SZA\n300212.SZA\n300244.SZA\n300251.SZA\n300253.SZA\n300257.SZA\n300285.SZA\n300296.SZA\n300308.SZA\n300357.SZA\n300363.SZA\n300373.SZA\n300383.SZA\n300390.SZA\n300395.SZA\n300418.SZA\n300438.SZA\n300442.SZA\n300474.SZA\n300482.SZA\n300487.SZA\n300529.SZA\n300558.SZA\n300568.SZA\n300595.SZA\n300604.SZA\n300618.SZA\n300676.SZA\n300677.SZA\n300682.SZA\n300699.SZA\n300724.SZA\n300741.SZA\n300748.SZA\n300776.SZA\n300832.SZA\n300850.SZA\n300861.SZA\n300866.SZA\n300888.SZA\n301029.SZA\n600008.SHA\n600021.SHA\n600022.SHA\n600027.SHA\n600032.SHA\n600038.SHA\n600056.SHA\n600060.SHA\n600062.SHA\n600066.SHA\n600079.SHA\n600095.SHA\n600096.SHA\n600109.SHA\n600118.SHA\n600126.SHA\n600131.SHA\n600141.SHA\n600143.SHA\n600153.SHA\n600155.SHA\n600157.SHA\n600160.SHA\n600161.SHA\n600166.SHA\n600167.SHA\n600170.SHA\n600171.SHA\n600177.SHA\n600195.SHA\n600208.SHA\n600258.SHA\n600259.SHA\n600271.SHA\n600282.SHA\n600297.SHA\n600298.SHA\n600299.SHA\n600315.SHA\n600316.SHA\n600325.SHA\n600329.SHA\n600339.SHA\n600348.SHA\n600350.SHA\n600352.SHA\n600369.SHA\n600372.SHA\n600373.SHA\n600377.SHA\n600378.SHA\n600380.SHA\n600390.SHA\n600392.SHA\n600398.SHA\n600399.SHA\n600409.SHA\n600415.SHA\n600416.SHA\n600418.SHA\n600435.SHA\n600481.SHA\n600482.SHA\n600486.SHA\n600487.SHA\n600489.SHA\n600497.SHA\n600498.SHA\n600499.SHA\n600500.SHA\n600507.SHA\n600511.SHA\n600516.SHA\n600517.SHA\n600521.SHA\n600528.SHA\n600529.SHA\n600535.SHA\n600536.SHA\n600546.SHA\n600549.SHA\n600556.SHA\n600563.SHA\n600566.SHA\n600580.SHA\n600582.SHA\n600597.SHA\n600598.SHA\n600623.SHA\n600637.SHA\n600642.SHA\n600655.SHA\n600663.SHA\n600667.SHA\n600673.SHA\n600699.SHA\n600704.SHA\n600705.SHA\n600707.SHA\n600718.SHA\n600737.SHA\n600739.SHA\n600755.SHA\n600764.SHA\n600765.SHA\n600782.SHA\n600801.SHA\n600808.SHA\n600820.SHA\n600827.SHA\n600839.SHA\n600848.SHA\n600859.SHA\n600862.SHA\n600863.SHA\n600867.SHA\n600871.SHA\n600873.SHA\n600879.SHA\n600885.SHA\n600895.SHA\n600901.SHA\n600906.SHA\n600909.SHA\n600927.SHA\n600928.SHA\n600956.SHA\n600959.SHA\n600967.SHA\n600968.SHA\n600970.SHA\n600985.SHA\n600988.SHA\n600995.SHA\n600998.SHA\n601000.SHA\n601005.SHA\n601016.SHA\n601058.SHA\n601077.SHA\n601098.SHA\n601106.SHA\n601108.SHA\n601118.SHA\n601128.SHA\n601136.SHA\n601139.SHA\n601156.SHA\n601158.SHA\n601162.SHA\n601168.SHA\n601179.SHA\n601187.SHA\n601198.SHA\n601228.SHA\n601231.SHA\n601233.SHA\n601298.SHA\n601456.SHA\n601555.SHA\n601568.SHA\n601577.SHA\n601598.SHA\n601608.SHA\n601611.SHA\n601636.SHA\n601665.SHA\n601666.SHA\n601696.SHA\n601717.SHA\n601718.SHA\n601778.SHA\n601828.SHA\n601866.SHA\n601869.SHA\n601880.SHA\n601928.SHA\n601958.SHA\n601966.SHA\n601969.SHA\n601990.SHA\n601991.SHA\n601992.SHA\n601997.SHA\n603000.SHA\n603026.SHA\n603056.SHA\n603077.SHA\n603127.SHA\n603156.SHA\n603160.SHA\n603218.SHA\n603225.SHA\n603228.SHA\n603233.SHA\n603267.SHA\n603317.SHA\n603338.SHA\n603355.SHA\n603379.SHA\n603444.SHA\n603456.SHA\n603517.SHA\n603529.SHA\n603568.SHA\n603589.SHA\n603596.SHA\n603638.SHA\n603650.SHA\n603658.SHA\n603688.SHA\n603707.SHA\n603712.SHA\n603737.SHA\n603786.SHA\n603816.SHA\n603826.SHA\n603858.SHA\n603866.SHA\n603868.SHA\n603882.SHA\n603883.SHA\n603885.SHA\n603893.SHA\n603927.SHA\n603939.SHA\n605358.SHA\n688002.SHA\n688006.SHA\n688009.SHA\n688029.SHA\n688052.SHA\n688072.SHA\n688082.SHA\n688099.SHA\n688105.SHA\n688107.SHA\n688116.SHA\n688169.SHA\n688185.SHA\n688188.SHA\n688200.SHA\n688208.SHA\n688220.SHA\n688234.SHA\n688248.SHA\n688256.SHA\n688276.SHA\n688281.SHA\n688289.SHA\n688295.SHA\n688301.SHA\n688385.SHA\n688390.SHA\n688516.SHA\n688520.SHA\n688521.SHA\n688536.SHA\n688538.SHA\n688567.SHA\n688690.SHA\n688772.SHA\n688777.SHA\n688778.SHA\n688779.SHA\n688819.SHA\n689009.SHA\n","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-81"}],"output_ports":[{"name":"data","node_id":"-81"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-250","module_id":"BigQuantSpace.trade.trade-v4","parameters":[{"name":"start_date","value":"2022-06-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2023-06-21","type":"Literal","bound_global_parameter":null},{"name":"initialize","value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\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 = 10\n # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]\n context.stock_weights = 0.1\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 0.1\n context.options['hold_days'] = 10\n","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n # 按日期过滤得到今日的预测数据\n df = context.options['data'].read_df()\n print(\"------------------\")\n cur_date = data.current_dt.strftime('%Y-%m-%d')\n df = df[df['date'] == cur_date]\n instruments = np.array(df['instrument']).tolist()\n print(instruments)\n # 读取数据 默认会返回全部证券代码数据, 通过指定参数 instruments 可以读取到指定的证券代码数据\n df = DataSource(\"market_value_CN_STOCK_A\").read(instruments=instruments,start_date=cur_date, end_date=cur_date)\n #按最后1列的值从小到大排序\n df.sort_values(by='market_cap',ascending=True,inplace=True)\n print(\"==============df2==================\")\n print(df.instrument[:20])\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 positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n\n # 2. 生成卖出订单:hold_days天之后才开始卖出;对持仓的股票,按机器学习算法预测的排序末位淘汰\n if not is_staging and cash_for_sell > 0:\n equities = {e.symbol: e for e, p in context.portfolio.positions.items()}\n instruments = list(reversed(list(df.instrument[df.instrument.apply(\n lambda x: x in equities)])))\n\n for instrument in instruments:\n context.order_target(context.symbol(instrument), 0)\n cash_for_sell -= positions[instrument]\n if cash_for_sell <= 0:\n break\n\n # 3. 生成买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票\n buy_cash_weights = context.stock_weights\n buy_instruments = list(df.instrument[:20])\n portfolio_value = context.portfolio.portfolio_value\n \n max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument\n for i, instrument in enumerate(buy_instruments):\n cash = portfolio_value - context.portfolio.positions_value # 可用资金 账户总价值 - 持仓市值\n if( cash > portfolio_value * buy_cash_weights ):\n #sid = context.symbol(instrument) # 将标的转化为equity格式\n if data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument), buy_cash_weights) # 买入\n \n #------------------------------------------止赢模块START--------------------------------------------\n positions = {e.symbol: p.cost_basis for e, p in context.portfolio.positions.items()}\n # 新建当日止赢股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断\n current_stopwin_stock = [] \n if len(positions) > 0:\n for i in positions.keys():\n stock_cost = positions[i] \n stock_market_price = data.current(context.symbol(i), 'price') \n # 赚10%就止赢\n if (stock_market_price - stock_cost ) / stock_cost>= 0.3: \n context.order_target_percent(context.symbol(i),0) \n current_stopwin_stock.append(i)\n print('日期:',cur_date,'股票:',i,'出现止盈状况')\n #-------------------------------------------止赢模块END---------------------------------------------\n\n #------------------------------------------止损模块START--------------------------------------------\n positions = {e.symbol: p.cost_basis for e, p in context.portfolio.positions.items()}\n # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断\n current_stoploss_stock = [] \n if len(positions) > 0:\n for i in positions.keys():\n stock_cost = positions[i] \n stock_market_price = data.current(context.symbol(i), 'price') \n # 亏5%就止损\n if (stock_market_price - stock_cost) / stock_cost <= -0.03: \n context.order_target_percent(context.symbol(i),0) \n current_stoploss_stock.append(i)\n print('日期:',cur_date,'股票:',i,'出现止损状况')\n #-------------------------------------------止损模块END---------------------------------------------\n \n #------------------------------------------止损模块START--------------------------------------------\n equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}\n # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断\n current_stoploss_stock = [] \n if len(equities) > 0:\n for i in equities.keys():\n stock_market_price = data.current(context.symbol(i), 'price') # 最新市场价格\n last_sale_date = equities[i].last_sale_date # 上次交易日期\n delta_days = data.current_dt - last_sale_date \n hold_days = delta_days.days # 持仓天数\n # 建仓以来的最高价\n highest_price_since_buy = data.history(context.symbol(i), 'high', hold_days, '1d').max()\n # 确定止损位置\n stoploss_line = highest_price_since_buy - highest_price_since_buy * 0.05\n record('止损位置', stoploss_line)\n # 如果价格下穿止损位置\n if stock_market_price < stoploss_line:\n context.order_target_percent(context.symbol(i), 0) \n current_stoploss_stock.append(i)\n print('日期:', cur_date , '股票:', i, '出现止损状况')\n #-------------------------------------------止损模块END--------------------------------------------------\n","type":"Literal","bound_global_parameter":null},{"name":"prepare","value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"","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":1000000,"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":"000300.HIX","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-250"},{"name":"options_data","node_id":"-250"},{"name":"history_ds","node_id":"-250"},{"name":"benchmark_ds","node_id":"-250"},{"name":"trading_calendar","node_id":"-250"}],"output_ports":[{"name":"raw_perf","node_id":"-250"}],"cacheable":false,"seq_num":7,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-134' Position='658,82,200,200'/><node_position Node='-176' Position='606,179,200,200'/><node_position Node='-508' Position='656.3333129882812,-23.333328247070312,200,200'/><node_position Node='-81' Position='318,-25,200,200'/><node_position Node='-250' Position='453,274.3333435058594,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [5]:
    # 本代码由可视化策略环境自动生成 2023年6月24日 18:48
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m5_run_bigquant_run(input_1, input_2, input_3):
        df = input_1.read()
        
        data_1 = DataSource.write_df(df)
        return Outputs(data_1=data_1, data_2=None, data_3=None)
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m5_post_run_bigquant_run(outputs):
        return outputs
    
    # 回测引擎:初始化函数,只执行一次
    def m7_initialize_bigquant_run(context):
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)
        # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只
        stock_count = 10
        # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
        context.stock_weights = 0.1
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument = 0.1
        context.options['hold_days'] = 10
    
    # 回测引擎:每日数据处理函数,每天执行一次
    def m7_handle_data_bigquant_run(context, data):
        # 按日期过滤得到今日的预测数据
        df = context.options['data'].read_df()
        print("------------------")
        cur_date = data.current_dt.strftime('%Y-%m-%d')
        df = df[df['date'] == cur_date]
        instruments = np.array(df['instrument']).tolist()
        print(instruments)
        # 读取数据  默认会返回全部证券代码数据, 通过指定参数 instruments 可以读取到指定的证券代码数据
        df = DataSource("market_value_CN_STOCK_A").read(instruments=instruments,start_date=cur_date, end_date=cur_date)
        #按最后1列的值从小到大排序
        df.sort_values(by='market_cap',ascending=True,inplace=True)
        print("==============df2==================")
        print(df.instrument[:20])
        
        
        # 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)
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.portfolio.positions.items()}
    
        # 2. 生成卖出订单:hold_days天之后才开始卖出;对持仓的股票,按机器学习算法预测的排序末位淘汰
        if not is_staging and cash_for_sell > 0:
            equities = {e.symbol: e for e, p in context.portfolio.positions.items()}
            instruments = list(reversed(list(df.instrument[df.instrument.apply(
                    lambda x: x in equities)])))
    
            for instrument in instruments:
                context.order_target(context.symbol(instrument), 0)
                cash_for_sell -= positions[instrument]
                if cash_for_sell <= 0:
                    break
    
        # 3. 生成买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票
        buy_cash_weights = context.stock_weights
        buy_instruments = list(df.instrument[:20])
        portfolio_value = context.portfolio.portfolio_value
        
        max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument
        for i, instrument in enumerate(buy_instruments):
            cash = portfolio_value - context.portfolio.positions_value  # 可用资金  账户总价值 - 持仓市值
            if( cash > portfolio_value * buy_cash_weights ):
                #sid = context.symbol(instrument) # 将标的转化为equity格式
                if  data.can_trade(context.symbol(instrument)):
                    context.order_target_percent(context.symbol(instrument), buy_cash_weights) # 买入
                    
        #------------------------------------------止赢模块START--------------------------------------------
        positions = {e.symbol: p.cost_basis  for e, p in context.portfolio.positions.items()}
        # 新建当日止赢股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断
        current_stopwin_stock = [] 
        if len(positions) > 0:
            for i in positions.keys():
                stock_cost = positions[i] 
                stock_market_price = data.current(context.symbol(i), 'price') 
                # 赚10%就止赢
                if (stock_market_price - stock_cost ) / stock_cost>= 0.3:   
                    context.order_target_percent(context.symbol(i),0)     
                    current_stopwin_stock.append(i)
                    print('日期:',cur_date,'股票:',i,'出现止盈状况')
        #-------------------------------------------止赢模块END---------------------------------------------
    
        #------------------------------------------止损模块START--------------------------------------------
        positions = {e.symbol: p.cost_basis  for e, p in context.portfolio.positions.items()}
        # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断
        current_stoploss_stock = [] 
        if len(positions) > 0:
            for i in positions.keys():
                stock_cost = positions[i] 
                stock_market_price = data.current(context.symbol(i), 'price') 
                # 亏5%就止损
                if (stock_market_price - stock_cost) / stock_cost <= -0.03:   
                    context.order_target_percent(context.symbol(i),0)     
                    current_stoploss_stock.append(i)
                    print('日期:',cur_date,'股票:',i,'出现止损状况')
        #-------------------------------------------止损模块END---------------------------------------------
        
        #------------------------------------------止损模块START--------------------------------------------
        equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}
        # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断
        current_stoploss_stock = [] 
        if len(equities) > 0:
            for i in equities.keys():
                stock_market_price = data.current(context.symbol(i), 'price')  # 最新市场价格
                last_sale_date = equities[i].last_sale_date   # 上次交易日期
                delta_days = data.current_dt - last_sale_date  
                hold_days = delta_days.days # 持仓天数
                # 建仓以来的最高价
                highest_price_since_buy = data.history(context.symbol(i), 'high', hold_days, '1d').max()
                # 确定止损位置
                stoploss_line = highest_price_since_buy - highest_price_since_buy * 0.05
                record('止损位置', stoploss_line)
                # 如果价格下穿止损位置
                if stock_market_price < stoploss_line:
                    context.order_target_percent(context.symbol(i), 0)     
                    current_stoploss_stock.append(i)
                    print('日期:', cur_date , '股票:', i, '出现止损状况')
        #-------------------------------------------止损模块END--------------------------------------------------
    
    # 回测引擎:准备数据,只执行一次
    def m7_prepare_bigquant_run(context):
        pass
    
    
    m6 = M.datahub_load_datasource.v1(
        table='bar1d_CN_STOCK_A',
        start_date='2022-06-01',
        end_date='2023-06-15',
        instruments="""# #号开始的表示注释,注释需单独一行
    # 每行一条
    """,
        fields="""# #号开始的表示注释,注释需单独一行
    # 每行一条
    """
    )
    
    m3 = M.chinaa_stock_filter.v1(
        input_data=m6.data,
        index_constituent_cond=['中证500'],
        board_cond=['全部', '上证主板', '深证主板', '创业板', '科创板'],
        industry_cond=['全部'],
        st_cond=['正常'],
        delist_cond=['非退市'],
        output_left_data=False
    )
    
    m5 = M.cached.v3(
        input_1=m3.data,
        run=m5_run_bigquant_run,
        post_run=m5_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    m2 = M.instruments.v2(
        start_date='2022-06-01',
        end_date='2023-06-15',
        market='CN_STOCK_A',
        instrument_list="""000009.SZA
    000012.SZA
    000021.SZA
    000027.SZA
    000031.SZA
    000039.SZA
    000050.SZA
    000060.SZA
    000066.SZA
    000089.SZA
    000155.SZA
    000156.SZA
    000400.SZA
    000401.SZA
    000402.SZA
    000415.SZA
    000423.SZA
    000513.SZA
    000519.SZA
    000537.SZA
    000547.SZA
    000553.SZA
    000559.SZA
    000563.SZA
    000581.SZA
    000591.SZA
    000598.SZA
    000623.SZA
    000629.SZA
    000630.SZA
    000636.SZA
    000683.SZA
    000703.SZA
    000709.SZA
    000728.SZA
    000729.SZA
    000738.SZA
    000739.SZA
    000750.SZA
    000778.SZA
    000783.SZA
    000785.SZA
    000807.SZA
    000825.SZA
    000830.SZA
    000831.SZA
    000869.SZA
    000878.SZA
    000883.SZA
    000887.SZA
    000893.SZA
    000898.SZA
    000930.SZA
    000932.SZA
    000933.SZA
    000937.SZA
    000958.SZA
    000959.SZA
    000960.SZA
    000967.SZA
    000970.SZA
    000975.SZA
    000987.SZA
    000988.SZA
    000997.SZA
    000998.SZA
    001203.SZA
    001227.SZA
    001872.SZA
    001914.SZA
    002008.SZA
    002010.SZA
    002019.SZA
    002025.SZA
    002028.SZA
    002030.SZA
    002032.SZA
    002056.SZA
    002065.SZA
    002078.SZA
    002080.SZA
    002081.SZA
    002092.SZA
    002110.SZA
    002128.SZA
    002131.SZA
    002138.SZA
    002152.SZA
    002153.SZA
    002155.SZA
    002156.SZA
    002183.SZA
    002185.SZA
    002192.SZA
    002195.SZA
    002203.SZA
    002221.SZA
    002223.SZA
    002240.SZA
    002244.SZA
    002249.SZA
    002250.SZA
    002266.SZA
    002268.SZA
    002273.SZA
    002281.SZA
    002294.SZA
    002299.SZA
    002326.SZA
    002340.SZA
    002353.SZA
    002368.SZA
    002372.SZA
    002373.SZA
    002384.SZA
    002385.SZA
    002399.SZA
    002407.SZA
    002408.SZA
    002409.SZA
    002422.SZA
    002423.SZA
    002429.SZA
    002430.SZA
    002432.SZA
    002439.SZA
    002444.SZA
    002463.SZA
    002465.SZA
    002468.SZA
    002487.SZA
    002497.SZA
    002500.SZA
    002505.SZA
    002506.SZA
    002507.SZA
    002508.SZA
    002511.SZA
    002518.SZA
    002531.SZA
    002532.SZA
    002557.SZA
    002563.SZA
    002568.SZA
    002572.SZA
    002595.SZA
    002600.SZA
    002608.SZA
    002624.SZA
    002625.SZA
    002653.SZA
    002670.SZA
    002673.SZA
    002683.SZA
    002690.SZA
    002705.SZA
    002738.SZA
    002739.SZA
    002745.SZA
    002761.SZA
    002791.SZA
    002797.SZA
    002831.SZA
    002850.SZA
    002867.SZA
    002901.SZA
    002925.SZA
    002926.SZA
    002936.SZA
    002939.SZA
    002945.SZA
    002958.SZA
    002966.SZA
    002985.SZA
    003035.SZA
    300001.SZA
    300003.SZA
    300009.SZA
    300012.SZA
    300017.SZA
    300024.SZA
    300026.SZA
    300037.SZA
    300058.SZA
    300070.SZA
    300073.SZA
    300088.SZA
    300115.SZA
    300118.SZA
    300136.SZA
    300144.SZA
    300146.SZA
    300182.SZA
    300212.SZA
    300244.SZA
    300251.SZA
    300253.SZA
    300257.SZA
    300285.SZA
    300296.SZA
    300308.SZA
    300357.SZA
    300363.SZA
    300373.SZA
    300383.SZA
    300390.SZA
    300395.SZA
    300418.SZA
    300438.SZA
    300442.SZA
    300474.SZA
    300482.SZA
    300487.SZA
    300529.SZA
    300558.SZA
    300568.SZA
    300595.SZA
    300604.SZA
    300618.SZA
    300676.SZA
    300677.SZA
    300682.SZA
    300699.SZA
    300724.SZA
    300741.SZA
    300748.SZA
    300776.SZA
    300832.SZA
    300850.SZA
    300861.SZA
    300866.SZA
    300888.SZA
    301029.SZA
    600008.SHA
    600021.SHA
    600022.SHA
    600027.SHA
    600032.SHA
    600038.SHA
    600056.SHA
    600060.SHA
    600062.SHA
    600066.SHA
    600079.SHA
    600095.SHA
    600096.SHA
    600109.SHA
    600118.SHA
    600126.SHA
    600131.SHA
    600141.SHA
    600143.SHA
    600153.SHA
    600155.SHA
    600157.SHA
    600160.SHA
    600161.SHA
    600166.SHA
    600167.SHA
    600170.SHA
    600171.SHA
    600177.SHA
    600195.SHA
    600208.SHA
    600258.SHA
    600259.SHA
    600271.SHA
    600282.SHA
    600297.SHA
    600298.SHA
    600299.SHA
    600315.SHA
    600316.SHA
    600325.SHA
    600329.SHA
    600339.SHA
    600348.SHA
    600350.SHA
    600352.SHA
    600369.SHA
    600372.SHA
    600373.SHA
    600377.SHA
    600378.SHA
    600380.SHA
    600390.SHA
    600392.SHA
    600398.SHA
    600399.SHA
    600409.SHA
    600415.SHA
    600416.SHA
    600418.SHA
    600435.SHA
    600481.SHA
    600482.SHA
    600486.SHA
    600487.SHA
    600489.SHA
    600497.SHA
    600498.SHA
    600499.SHA
    600500.SHA
    600507.SHA
    600511.SHA
    600516.SHA
    600517.SHA
    600521.SHA
    600528.SHA
    600529.SHA
    600535.SHA
    600536.SHA
    600546.SHA
    600549.SHA
    600556.SHA
    600563.SHA
    600566.SHA
    600580.SHA
    600582.SHA
    600597.SHA
    600598.SHA
    600623.SHA
    600637.SHA
    600642.SHA
    600655.SHA
    600663.SHA
    600667.SHA
    600673.SHA
    600699.SHA
    600704.SHA
    600705.SHA
    600707.SHA
    600718.SHA
    600737.SHA
    600739.SHA
    600755.SHA
    600764.SHA
    600765.SHA
    600782.SHA
    600801.SHA
    600808.SHA
    600820.SHA
    600827.SHA
    600839.SHA
    600848.SHA
    600859.SHA
    600862.SHA
    600863.SHA
    600867.SHA
    600871.SHA
    600873.SHA
    600879.SHA
    600885.SHA
    600895.SHA
    600901.SHA
    600906.SHA
    600909.SHA
    600927.SHA
    600928.SHA
    600956.SHA
    600959.SHA
    600967.SHA
    600968.SHA
    600970.SHA
    600985.SHA
    600988.SHA
    600995.SHA
    600998.SHA
    601000.SHA
    601005.SHA
    601016.SHA
    601058.SHA
    601077.SHA
    601098.SHA
    601106.SHA
    601108.SHA
    601118.SHA
    601128.SHA
    601136.SHA
    601139.SHA
    601156.SHA
    601158.SHA
    601162.SHA
    601168.SHA
    601179.SHA
    601187.SHA
    601198.SHA
    601228.SHA
    601231.SHA
    601233.SHA
    601298.SHA
    601456.SHA
    601555.SHA
    601568.SHA
    601577.SHA
    601598.SHA
    601608.SHA
    601611.SHA
    601636.SHA
    601665.SHA
    601666.SHA
    601696.SHA
    601717.SHA
    601718.SHA
    601778.SHA
    601828.SHA
    601866.SHA
    601869.SHA
    601880.SHA
    601928.SHA
    601958.SHA
    601966.SHA
    601969.SHA
    601990.SHA
    601991.SHA
    601992.SHA
    601997.SHA
    603000.SHA
    603026.SHA
    603056.SHA
    603077.SHA
    603127.SHA
    603156.SHA
    603160.SHA
    603218.SHA
    603225.SHA
    603228.SHA
    603233.SHA
    603267.SHA
    603317.SHA
    603338.SHA
    603355.SHA
    603379.SHA
    603444.SHA
    603456.SHA
    603517.SHA
    603529.SHA
    603568.SHA
    603589.SHA
    603596.SHA
    603638.SHA
    603650.SHA
    603658.SHA
    603688.SHA
    603707.SHA
    603712.SHA
    603737.SHA
    603786.SHA
    603816.SHA
    603826.SHA
    603858.SHA
    603866.SHA
    603868.SHA
    603882.SHA
    603883.SHA
    603885.SHA
    603893.SHA
    603927.SHA
    603939.SHA
    605358.SHA
    688002.SHA
    688006.SHA
    688009.SHA
    688029.SHA
    688052.SHA
    688072.SHA
    688082.SHA
    688099.SHA
    688105.SHA
    688107.SHA
    688116.SHA
    688169.SHA
    688185.SHA
    688188.SHA
    688200.SHA
    688208.SHA
    688220.SHA
    688234.SHA
    688248.SHA
    688256.SHA
    688276.SHA
    688281.SHA
    688289.SHA
    688295.SHA
    688301.SHA
    688385.SHA
    688390.SHA
    688516.SHA
    688520.SHA
    688521.SHA
    688536.SHA
    688538.SHA
    688567.SHA
    688690.SHA
    688772.SHA
    688777.SHA
    688778.SHA
    688779.SHA
    688819.SHA
    689009.SHA
    """,
        max_count=0
    )
    
    m7 = M.trade.v4(
        instruments=m2.data,
        options_data=m5.data_1,
        start_date='2022-06-01',
        end_date='2023-06-21',
        initialize=m7_initialize_bigquant_run,
        handle_data=m7_handle_data_bigquant_run,
        prepare=m7_prepare_bigquant_run,
        volume_limit=0.025,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=1000000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='真实价格',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark='000300.HIX'
    )
    

    读取数据(DataSource) 数据统计 (前 1277214 行) </font></font>

    adjust_factor amount close instrument deal_number date high low open turn volume
    count(Nan) 0 0 0 0 0 0 0 0 0 0 0
    type float32 float64 float32 object float64 datetime64[ns] float32 float32 float32 float64 float64

    读取数据(DataSource) 数据预览 (前 5 行) </font></font>

    adjust_factor amount close instrument deal_number date high low open turn volume
    0 111.921967 1.187424e+09 1575.861328 000001.SZA 59344.0 2022-06-01 1582.576660 1566.907471 1582.576660 0.435597 84529898.0
    1 162.737427 1.445560e+09 2909.745117 000002.SZA 65222.0 2022-06-01 2948.802002 2886.961914 2903.235596 0.830300 80684815.0
    2 4.063862 2.403580e+07 39.216267 000004.SZA 1683.0 2022-06-01 39.419460 38.850521 39.013077 2.146150 2496633.0
    3 9.267603 1.064445e+07 17.330418 000005.SZA 818.0 2022-06-01 17.701122 17.237741 17.423094 0.533893 5648300.0
    4 37.877560 2.233698e+08 171.964111 000006.SZA 32696.0 2022-06-01 176.509430 164.009827 165.524933 3.679298 49670344.0
    ------------------
    ['000009.SZA', '000012.SZA', '000021.SZA', '000027.SZA', '000028.SZA', '000031.SZA', '000039.SZA', '000046.SZA', '000050.SZA', '000060.SZA', '000062.SZA', '000089.SZA', '000090.SZA', '000156.SZA', '000158.SZA', '000400.SZA', '000401.SZA', '000402.SZA', '000415.SZA', '000488.SZA', '000513.SZA', '000519.SZA', '000528.SZA', '000537.SZA', '000540.SZA', '000547.SZA', '000553.SZA', '000559.SZA', '000563.SZA', '000581.SZA', '000598.SZA', '000623.SZA', '000629.SZA', '000630.SZA', '000636.SZA', '000656.SZA', '000671.SZA', '000685.SZA', '000686.SZA', '000690.SZA', '000709.SZA', '000717.SZA', '000718.SZA', '000723.SZA', '000728.SZA', '000729.SZA', '000733.SZA', '000738.SZA', '000739.SZA', '000750.SZA', '000758.SZA', '000778.SZA', '000807.SZA', '000825.SZA', '000830.SZA', '000869.SZA', '000877.SZA', '000878.SZA', '000883.SZA', '000887.SZA', '000898.SZA', '000930.SZA', '000932.SZA', '000937.SZA', '000959.SZA', '000960.SZA', '000961.SZA', '000967.SZA', '000970.SZA', '000975.SZA', '000983.SZA', '000987.SZA', '000988.SZA', '000990.SZA', '000997.SZA', '000998.SZA', '000999.SZA', '001203.SZA', '001872.SZA', '001914.SZA', '001965.SZA', '002002.SZA', '002004.SZA', '002010.SZA', '002013.SZA', '002019.SZA', '002028.SZA', '002030.SZA', '002038.SZA', '002048.SZA', '002056.SZA', '002065.SZA', '002075.SZA', '002078.SZA', '002080.SZA', '002081.SZA', '002085.SZA', '002092.SZA', '002110.SZA', '002124.SZA', '002127.SZA', '002128.SZA', '002131.SZA', '002138.SZA', '002146.SZA', '002152.SZA', '002153.SZA', '002155.SZA', '002156.SZA', '002174.SZA', '002180.SZA', '002183.SZA', '002185.SZA', '002191.SZA', '002195.SZA', '002203.SZA', '002212.SZA', '002221.SZA', '002223.SZA', '002233.SZA', '002242.SZA', '002244.SZA', '002249.SZA', '002250.SZA', '002266.SZA', '002268.SZA', '002273.SZA', '002281.SZA', '002294.SZA', '002299.SZA', '002302.SZA', '002340.SZA', '002353.SZA', '002368.SZA', '002372.SZA', '002373.SZA', '002375.SZA', '002382.SZA', '002384.SZA', '002385.SZA', '002387.SZA', '002390.SZA', '002396.SZA', '002399.SZA', '002408.SZA', '002409.SZA', '002416.SZA', '002422.SZA', '002423.SZA', '002424.SZA', '002429.SZA', '002430.SZA', '002434.SZA', '002439.SZA', '002440.SZA', '002444.SZA', '002458.SZA', '002465.SZA', '002468.SZA', '002500.SZA', '002505.SZA', '002506.SZA', '002507.SZA', '002508.SZA', '002511.SZA', '002532.SZA', '002557.SZA', '002563.SZA', '002572.SZA', '002595.SZA', '002603.SZA', '002653.SZA', '002670.SZA', '002673.SZA', '002683.SZA', '002690.SZA', '002701.SZA', '002705.SZA', '002739.SZA', '002745.SZA', '002797.SZA', '002815.SZA', '002831.SZA', '002867.SZA', '002901.SZA', '002925.SZA', '002926.SZA', '002936.SZA', '002939.SZA', '002945.SZA', '002946.SZA', '002948.SZA', '002958.SZA', '002966.SZA', '002985.SZA', '003022.SZA', '003035.SZA', '300001.SZA', '300009.SZA', '300017.SZA', '300024.SZA', '300026.SZA', '300037.SZA', '300058.SZA', '300070.SZA', '300072.SZA', '300088.SZA', '300115.SZA', '300133.SZA', '300136.SZA', '300146.SZA', '300166.SZA', '300168.SZA', '300182.SZA', '300212.SZA', '300223.SZA', '300244.SZA', '300251.SZA', '300253.SZA', '300257.SZA', '300271.SZA', '300285.SZA', '300296.SZA', '300308.SZA', '300315.SZA', '300357.SZA', '300363.SZA', '300376.SZA', '300383.SZA', '300418.SZA', '300463.SZA', '300474.SZA', '300482.SZA', '300618.SZA', '300630.SZA', '300699.SZA', '300724.SZA', '300741.SZA', '300751.SZA', '300763.SZA', '300869.SZA', '600006.SHA', '600008.SHA', '600021.SHA', '600022.SHA', '600026.SHA', '600027.SHA', '600037.SHA', '600038.SHA', '600039.SHA', '600056.SHA', '600060.SHA', '600062.SHA', '600064.SHA', '600066.SHA', '600095.SHA', '600118.SHA', '600120.SHA', '600126.SHA', '600131.SHA', '600141.SHA', '600153.SHA', '600155.SHA', '600157.SHA', '600158.SHA', '600160.SHA', '600166.SHA', '600167.SHA', '600170.SHA', '600171.SHA', '600177.SHA', '600188.SHA', '600195.SHA', '600201.SHA', '600208.SHA', '600216.SHA', '600233.SHA', '600236.SHA', '600256.SHA', '600258.SHA', '600259.SHA', '600266.SHA', '600271.SHA', '600282.SHA', '600297.SHA', '600298.SHA', '600299.SHA', '600307.SHA', '600315.SHA', '600316.SHA', '600325.SHA', '600329.SHA', '600339.SHA', '600348.SHA', '600350.SHA', '600369.SHA', '600372.SHA', '600373.SHA', '600376.SHA', '600377.SHA', '600380.SHA', '600390.SHA', '600392.SHA', '600398.SHA', '600399.SHA', '600409.SHA', '600415.SHA', '600418.SHA', '600435.SHA', '600446.SHA', '600466.SHA', '600482.SHA', '600486.SHA', '600487.SHA', '600497.SHA', '600498.SHA', '600500.SHA', '600507.SHA', '600511.SHA', '600516.SHA', '600517.SHA', '600521.SHA', '600522.SHA', '600528.SHA', '600529.SHA', '600535.SHA', '600536.SHA', '600546.SHA', '600549.SHA', '600556.SHA', '600563.SHA', '600566.SHA', '600567.SHA', '600572.SHA', '600580.SHA', '600582.SHA', '600597.SHA', '600598.SHA', '600623.SHA', '600637.SHA', '600639.SHA', '600642.SHA', '600643.SHA', '600648.SHA', '600649.SHA', '600657.SHA', '600663.SHA', '600667.SHA', '600673.SHA', '600699.SHA', '600704.SHA', '600705.SHA', '600707.SHA', '600717.SHA', '600718.SHA', '600728.SHA', '600729.SHA', '600732.SHA', '600733.SHA', '600737.SHA', '600739.SHA', '600754.SHA', '600755.SHA', '600764.SHA', '600765.SHA', '600776.SHA', '600782.SHA', '600787.SHA', '600801.SHA', '600803.SHA', '600808.SHA', '600811.SHA', '600820.SHA', '600823.SHA', '600827.SHA', '600835.SHA', '600839.SHA', '600859.SHA', '600862.SHA', '600863.SHA', '600867.SHA', '600871.SHA', '600875.SHA', '600879.SHA', '600884.SHA', '600885.SHA', '600895.SHA', '600901.SHA', '600903.SHA', '600906.SHA', '600908.SHA', '600909.SHA', '600917.SHA', '600928.SHA', '600956.SHA', '600959.SHA', '600967.SHA', '600968.SHA', '600970.SHA', '600985.SHA', '600988.SHA', '600998.SHA', '601000.SHA', '601003.SHA', '601005.SHA', '601016.SHA', '601077.SHA', '601098.SHA', '601106.SHA', '601117.SHA', '601118.SHA', '601128.SHA', '601139.SHA', '601156.SHA', '601168.SHA', '601179.SHA', '601187.SHA', '601198.SHA', '601200.SHA', '601228.SHA', '601298.SHA', '601333.SHA', '601456.SHA', '601555.SHA', '601568.SHA', '601577.SHA', '601598.SHA', '601608.SHA', '601611.SHA', '601615.SHA', '601636.SHA', '601665.SHA', '601689.SHA', '601699.SHA', '601717.SHA', '601718.SHA', '601778.SHA', '601828.SHA', '601860.SHA', '601866.SHA', '601869.SHA', '601872.SHA', '601880.SHA', '601928.SHA', '601958.SHA', '601969.SHA', '601975.SHA', '601991.SHA', '601992.SHA', '601997.SHA', '603000.SHA', '603056.SHA', '603077.SHA', '603127.SHA', '603156.SHA', '603198.SHA', '603218.SHA', '603225.SHA', '603228.SHA', '603267.SHA', '603290.SHA', '603317.SHA', '603355.SHA', '603379.SHA', '603444.SHA', '603456.SHA', '603515.SHA', '603568.SHA', '603589.SHA', '603605.SHA', '603613.SHA', '603638.SHA', '603650.SHA', '603707.SHA', '603708.SHA', '603712.SHA', '603719.SHA', '603786.SHA', '603858.SHA', '603866.SHA', '603868.SHA', '603883.SHA', '603885.SHA', '603893.SHA', '603927.SHA', '603983.SHA', '605358.SHA', '688002.SHA', '688005.SHA', '688006.SHA', '688029.SHA', '688065.SHA', '688088.SHA', '688099.SHA', '688188.SHA', '688208.SHA', '688289.SHA', '688321.SHA', '688521.SHA', '688536.SHA']
    ==============df2==================
    310    600466.SHA
    220    300271.SZA
    136    002375.SZA
    7      000046.SZA
    388    600903.SHA
    474    603708.SHA
    109    002174.SZA
    264    600158.SHA
    156    002458.SZA
    224    300315.SZA
    208    300133.SZA
    356    600729.SHA
    140    002387.SZA
    50     000758.SZA
    137    002382.SZA
    41     000717.SZA
    309    600446.SHA
    485    603983.SHA
    14     000158.SZA
    281    600266.SHA
    Name: instrument, dtype: object
    
    ---------------------------------------------------------------------------
    SymbolNotFound                            Traceback (most recent call last)
    <ipython-input-5-6c178024082d> in <module>
        675 )
        676 
    --> 677 m7 = M.trade.v4(
        678     instruments=m2.data,
        679     options_data=m5.data_1,
    
    <ipython-input-5-6c178024082d> in m7_handle_data_bigquant_run(context, data)
         76         if( cash > portfolio_value * buy_cash_weights ):
         77             #sid = context.symbol(instrument) # 将标的转化为equity格式
    ---> 78             if  data.can_trade(context.symbol(instrument)):
         79                 context.order_target_percent(context.symbol(instrument), buy_cash_weights) # 买入
         80 
    
    SymbolNotFound: Symbol '600466.SHA' was not found.