【宽客学院】如何选出符合一定条件的股票(改)

新手专区
标签: #<Tag:0x00007f608f02b880>

(iQuant) #1

导语:在开发股票量化投资策略的时候,其中非常重要的一步就是选股。因此本文的目的是希望大家阅读以后,能够更为快速、高效、便捷地在BigQuant平台上选出符合一定条件的股票。


作者: bigquant
阅读时间:15分钟
本文由BigQuant宽客学院推出,难度标签:☆☆☆

符合一定条件的股票可以这样理解,这类股票具有同样的特征、属性,比如属于同一个板块,或者相似的财务指标,或者是存在相似的图表形态。

那么,怎样快速地选出符合一定条件的股票呢。主要因素为下面两点:

  • BigQuant数据以及数据API的了解
  • Pandas数据分析技巧

扩展阅读

1.BigQuant数据API详解
2.10分钟学会Pandas
3.Pandas使用小技巧
4.Pandas基础操作技能get!强烈推荐!

一、可视化模块流程实现案例

克隆策略

1、基本信息层面筛选可视化模块实现案例

    {"Description":"实验创建于2017/8/26","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-336:instruments","SourceOutputPortId":"-327:data"},{"DestinationInputPortId":"-411:input_data","SourceOutputPortId":"-336:data"},{"DestinationInputPortId":"-435:input_data","SourceOutputPortId":"-336:data"},{"DestinationInputPortId":"-451:input_data","SourceOutputPortId":"-336:data"},{"DestinationInputPortId":"-467:input_data","SourceOutputPortId":"-336:data"},{"DestinationInputPortId":"-393:input_1","SourceOutputPortId":"-460:data"},{"DestinationInputPortId":"-460:instruments","SourceOutputPortId":"-475:data"},{"DestinationInputPortId":"-460:features","SourceOutputPortId":"-483:data"}],"ModuleNodes":[{"Id":"-327","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2016-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2017-09-14","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-327"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-327","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-336","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar1d_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-336"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-336"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-336","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"获取指数成份股列表","CommentCollapsed":false},{"Id":"-411","ModuleId":"BigQuantSpace.chinaa_stock_filter.chinaa_stock_filter-v1","ModuleParameters":[{"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%3Atrue%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%3Afalse%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%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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%3Afalse%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%3Afalse%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%3Afalse%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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","ValueType":"Literal","LinkedGlobalParameter":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%3Atrue%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%3Afalse%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","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-411"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-411","OutputType":null},{"Name":"left_data","NodeId":"-411","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-393","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df = input_1.read_df()\n df['is_ai'] = df['concept'].map(lambda x: '人工智能' in x) # 以人工智能为例,找到相关概念股票\n st = list(df[df['is_ai'] == True]['instrument'])\n data_1 = DataSource.write_pickle(st)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"post_run","Value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"input_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"params","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-393"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-393"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-393"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-393","OutputType":null},{"Name":"data_2","NodeId":"-393","OutputType":null},{"Name":"data_3","NodeId":"-393","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-435","ModuleId":"BigQuantSpace.chinaa_stock_filter.chinaa_stock_filter-v1","ModuleParameters":[{"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%3Atrue%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%3Afalse%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%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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%3Afalse%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%3Afalse%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%3Afalse%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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%3Afalse%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%3Atrue%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","ValueType":"Literal","LinkedGlobalParameter":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%3Atrue%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%3Afalse%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","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-435"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-435","OutputType":null},{"Name":"left_data","NodeId":"-435","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-451","ModuleId":"BigQuantSpace.chinaa_stock_filter.chinaa_stock_filter-v1","ModuleParameters":[{"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%3Atrue%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%3Afalse%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%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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%3Afalse%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%3Afalse%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%3Afalse%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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","ValueType":"Literal","LinkedGlobalParameter":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","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-451"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-451","OutputType":null},{"Name":"left_data","NodeId":"-451","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-460","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"industry_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-460"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-460"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-460","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":10,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-467","ModuleId":"BigQuantSpace.chinaa_stock_filter.chinaa_stock_filter-v1","ModuleParameters":[{"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%3Atrue%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%3Afalse%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%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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%3Afalse%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%3Afalse%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%3Afalse%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%5D%7D","ValueType":"Literal","LinkedGlobalParameter":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","ValueType":"Literal","LinkedGlobalParameter":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%3Atrue%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%3Afalse%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","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-467"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-467","OutputType":null},{"Name":"left_data","NodeId":"-467","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-475","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2016-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2017-09-14","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-475"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-475","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":11,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-483","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nconcept\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-483"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-483","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":12,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-327' Position='-24,256,200,200'/><NodePosition Node='-336' Position='-22,338,200,200'/><NodePosition Node='-411' Position='-493,506,200,200'/><NodePosition Node='-393' Position='-2,949,200,200'/><NodePosition Node='-435' Position='-162,505,200,200'/><NodePosition Node='-451' Position='130,502,200,200'/><NodePosition Node='-460' Position='-23,843,200,200'/><NodePosition Node='-467' Position='425,501,200,200'/><NodePosition Node='-475' Position='-179,738,200,200'/><NodePosition Node='-483' Position='140,734,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
    In [79]:
    # 本代码由可视化策略环境自动生成 2019年1月17日 14:43
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m9_run_bigquant_run(input_1, input_2, input_3):
        # 示例代码如下。在这里编写您的代码
        df = input_1.read_df()
        df['is_ai'] = df['concept'].map(lambda x: '人工智能' in x)  # 以人工智能为例,找到相关概念股票
        st = list(df[df['is_ai'] == True]['instrument'])
        data_1 = DataSource.write_pickle(st)
        return Outputs(data_1=data_1, data_2=None, data_3=None)
    
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m9_post_run_bigquant_run(outputs):
        return outputs
    
    
    m1 = M.instruments.v2(
        start_date='2016-01-01',
        end_date='2017-09-14',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m2 = M.use_datasource.v1(
        instruments=m1.data,
        datasource_id='bar1d_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m3 = M.chinaa_stock_filter.v1(
        input_data=m2.data,
        index_constituent_cond=['沪深300'],
        board_cond=['全部'],
        industry_cond=['全部'],
        st_cond=['全部'],
        output_left_data=False
    )
    
    m4 = M.chinaa_stock_filter.v1(
        input_data=m2.data,
        index_constituent_cond=['全部'],
        board_cond=['全部'],
        industry_cond=['交通运输'],
        st_cond=['全部'],
        output_left_data=False
    )
    
    m5 = M.chinaa_stock_filter.v1(
        input_data=m2.data,
        index_constituent_cond=['全部'],
        board_cond=['全部'],
        industry_cond=['全部'],
        st_cond=['正常'],
        output_left_data=False
    )
    
    m6 = M.chinaa_stock_filter.v1(
        input_data=m2.data,
        index_constituent_cond=['全部'],
        board_cond=['创业板'],
        industry_cond=['全部'],
        st_cond=['全部'],
        output_left_data=False
    )
    
    m11 = M.instruments.v2(
        start_date='2016-01-01',
        end_date='2017-09-14',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m12 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    concept
    """
    )
    
    m10 = M.use_datasource.v1(
        instruments=m11.data,
        features=m12.data,
        datasource_id='industry_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m9 = M.cached.v3(
        input_1=m10.data,
        run=m9_run_bigquant_run,
        post_run=m9_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    [2019-01-17 14:32:22.773687] INFO: bigquant: instruments.v2 开始运行..
    [2019-01-17 14:32:22.780129] INFO: bigquant: 命中缓存
    [2019-01-17 14:32:22.781399] INFO: bigquant: instruments.v2 运行完成[0.007741s].
    [2019-01-17 14:32:22.784252] INFO: bigquant: input_features.v1 开始运行..
    [2019-01-17 14:32:22.791428] INFO: bigquant: 命中缓存
    [2019-01-17 14:32:22.792919] INFO: bigquant: input_features.v1 运行完成[0.008663s].
    [2019-01-17 14:32:22.795311] INFO: bigquant: use_datasource.v1 开始运行..
    [2019-01-17 14:32:29.698426] INFO: bigquant: use_datasource.v1 运行完成[6.903075s].
    [2019-01-17 14:32:29.703193] INFO: bigquant: cached.v3 开始运行..
    [2019-01-17 14:32:33.049578] INFO: bigquant: cached.v3 运行完成[3.346356s].
    

    获取指定时间段指数成分股列表

    In [65]:
    # 获取沪深300指数成份股
    df = m10.data.read_df()
    instruments = list(set(df.instrument))
    print('沪深300指数成份股预览10只股票:', instruments[:10])
    
    沪深300指数成份股预览10只股票: ['002475.SZA', '600867.SHA', '000413.SZA', '000338.SZA', '600100.SHA', '002410.SZA', '600498.SHA', '600118.SHA', '601992.SHA', '600674.SHA']
    

    获取指定时间段某个行业股票列表

    In [71]:
    # 交通运输行业为例
    df = m4.data.read_df()
    instruments = list(set(df.instrument))
    print('交通运输行业成份股预览10只股票:',instruments[:10])
    
    交通运输行业成份股预览10只股票: ['002468.SZA', '600834.SHA', '000900.SZA', '600033.SHA', '000828.SZA', '600018.SHA', '600242.SHA', '002769.SZA', '002889.SZA', '600548.SHA']
    

    获取指定时间段正常的股票

    In [74]:
    df = m5.data.read_df()
    instruments = list(set(df.instrument))
    print('正常股票池预览10只股票:',instruments[:10])
    
    正常股票池预览10只股票: ['000958.SZA', '002475.SZA', '000413.SZA', '002237.SZA', '600299.SHA', '002892.SZA', '603566.SHA', '002410.SZA', '603601.SHA', '002554.SZA']
    

    获取创业板股票

    In [77]:
    df = m6.data.read_df()
    instruments = list(set(df.instrument))
    print('创业板股票预览10只股票:',instruments[:10])
    
    创业板股票预览10只股票: ['300229.SZA', '300598.SZA', '300639.SZA', '300001.SZA', '300421.SZA', '300369.SZA', '300542.SZA', '300474.SZA', '300446.SZA', '300505.SZA']
    

    获取指定时间段某个概念的股票列表

    In [80]:
    # 以人工智能为例,找到相关概念股票
    st = m9.data_1.read()
    print('人工智能概念股预览10只股票:',st[:10])
    
    人工智能概念股预览10只股票: ['002184.SZA', '002253.SZA', '002230.SZA', '002073.SZA', '002415.SZA', '002362.SZA', '002348.SZA', '000977.SZA', '603019.SHA', '300367.SZA']
    
    克隆策略

    2、财务信息层面筛选可视化模块实现案例

    例1、选出满足以下条件的股票

    • 市盈率小于15倍
    • 市净率小于1.5倍

      {"Description":"实验创建于2019/1/17","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-163:input_data","SourceOutputPortId":"-489:data"},{"DestinationInputPortId":"-489:instruments","SourceOutputPortId":"-495:data"},{"DestinationInputPortId":"-489:features","SourceOutputPortId":"-135:data"},{"DestinationInputPortId":"-192:input_data","SourceOutputPortId":"-163:data"},{"DestinationInputPortId":"-163:features","SourceOutputPortId":"-175:data"}],"ModuleNodes":[{"Id":"-489","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"market_value_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-489"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-489"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-489","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"获取每股收益、每股净资产","CommentCollapsed":false},{"Id":"-495","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2016-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2016-09-14","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-495"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-495","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-135","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\npe_ttm\npb_lf","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-135"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-135","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-163","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-163"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-163"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-163","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-175","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\n# 默认的close是后复权价格,使用close/adjust_factor获取真实价格\ncond1=pe_ttm<15\ncond2=pb_lf<1.5\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-175"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-175","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"IsPartOfPartialRun":null,"Comment":"计算过滤条件","CommentCollapsed":false},{"Id":"-192","ModuleId":"BigQuantSpace.filter.filter-v3","ModuleParameters":[{"Name":"expr","Value":"cond1==True and cond2==True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-192"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-192","OutputType":null},{"Name":"left_data","NodeId":"-192","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":11,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-489' Position='-98,349,200,200'/><NodePosition Node='-495' Position='-274,222,200,200'/><NodePosition Node='-135' Position='94,217,200,200'/><NodePosition Node='-163' Position='-93,483,200,200'/><NodePosition Node='-175' Position='207,358,200,200'/><NodePosition Node='-192' Position='-94,578,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
      In [8]:
      # 本代码由可视化策略环境自动生成 2019年1月18日 14:06
      # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
      
      
      m2 = M.instruments.v2(
          start_date='2016-01-01',
          end_date='2016-09-14',
          market='CN_STOCK_A',
          instrument_list='',
          max_count=0
      )
      
      m3 = M.input_features.v1(
          features="""
      # #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      pe_ttm
      pb_lf"""
      )
      
      m1 = M.use_datasource.v1(
          instruments=m2.data,
          features=m3.data,
          datasource_id='market_value_CN_STOCK_A',
          start_date='',
          end_date=''
      )
      
      m9 = M.input_features.v1(
          features="""
      # #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      # 默认的close是后复权价格,使用close/adjust_factor获取真实价格
      cond1=pe_ttm<15
      cond2=pb_lf<1.5
      """
      )
      
      m7 = M.derived_feature_extractor.v3(
          input_data=m1.data,
          features=m9.data,
          date_col='date',
          instrument_col='instrument',
          drop_na=False,
          remove_extra_columns=False,
          user_functions={}
      )
      
      m11 = M.filter.v3(
          input_data=m7.data,
          expr='cond1==True and cond2==True',
          output_left_data=False
      )
      
      [2019-01-17 16:30:30.693769] INFO: bigquant: instruments.v2 开始运行..
      [2019-01-17 16:30:30.700561] INFO: bigquant: 命中缓存
      [2019-01-17 16:30:30.701808] INFO: bigquant: instruments.v2 运行完成[0.008038s].
      [2019-01-17 16:30:30.705138] INFO: bigquant: input_features.v1 开始运行..
      [2019-01-17 16:30:30.711073] INFO: bigquant: 命中缓存
      [2019-01-17 16:30:30.712216] INFO: bigquant: input_features.v1 运行完成[0.007057s].
      [2019-01-17 16:30:30.714921] INFO: bigquant: use_datasource.v1 开始运行..
      [2019-01-17 16:30:30.719121] INFO: bigquant: 命中缓存
      [2019-01-17 16:30:30.719871] INFO: bigquant: use_datasource.v1 运行完成[0.004978s].
      [2019-01-17 16:30:30.721746] INFO: bigquant: input_features.v1 开始运行..
      [2019-01-17 16:30:30.725143] INFO: bigquant: 命中缓存
      [2019-01-17 16:30:30.725824] INFO: bigquant: input_features.v1 运行完成[0.004089s].
      [2019-01-17 16:30:30.728115] INFO: bigquant: derived_feature_extractor.v3 开始运行..
      [2019-01-17 16:30:30.886490] INFO: derived_feature_extractor: 提取完成 cond1=pe_ttm<15, 0.003s
      [2019-01-17 16:30:30.889671] INFO: derived_feature_extractor: 提取完成 cond2=pb_lf<1.5, 0.002s
      [2019-01-17 16:30:31.053829] INFO: derived_feature_extractor: /data, 508776
      [2019-01-17 16:30:31.385502] INFO: bigquant: derived_feature_extractor.v3 运行完成[0.65738s].
      [2019-01-17 16:30:31.388301] INFO: bigquant: filter.v3 开始运行..
      [2019-01-17 16:30:31.394390] INFO: filter: 使用表达式 cond1==True and cond2==True 过滤
      [2019-01-17 16:30:31.559341] INFO: filter: 过滤 /data, 19392/0/508776
      [2019-01-17 16:30:31.576971] INFO: bigquant: filter.v3 运行完成[0.188657s].
      
      In [9]:
      # 查看满足条件的股票数据(取前5行)
      m11.data.read_df().head(5)
      
      Out[9]:
      date instrument pe_ttm pb_lf cond1 cond2
      12 2016-01-04 600005.SHA -63.387985 0.937746 True True
      15 2016-01-04 601117.SHA 12.646578 1.245304 True True
      16 2016-01-04 000677.SZA -12.219185 -160.884872 True True
      26 2016-01-04 000898.SZA -37.607891 0.706894 True True
      44 2016-01-04 600720.SHA -602.651428 1.298286 True True
      克隆策略

      例2、 选出满足以下条件的股票

      • 股价创60日最高点
      • 3日线大于5日均线,5日均线大于10日均线
      • 当日成交额是昨日成交额的1.4倍
      • macd柱状图处于红色区域

        {"Description":"实验创建于2019/1/17","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-105:input_1","SourceOutputPortId":"-489:data"},{"DestinationInputPortId":"-489:instruments","SourceOutputPortId":"-495:data"},{"DestinationInputPortId":"-489:features","SourceOutputPortId":"-19:data"},{"DestinationInputPortId":"-114:input_data","SourceOutputPortId":"-24:data"},{"DestinationInputPortId":"-24:features","SourceOutputPortId":"-32:data"},{"DestinationInputPortId":"-24:input_data","SourceOutputPortId":"-105:data_1"}],"ModuleNodes":[{"Id":"-489","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar1d_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-489"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-489"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-489","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-495","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2016-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2016-09-14","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-495"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-495","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-19","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nhigh\nopen\nlow\nclose\namount\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-19"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-19","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-24","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-24"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-24"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-24","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-32","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\ncond1=close==ts_max(high,60)\ncond2=(mean(close,3)>mean(close,5)) & (mean(close,5)>mean(close,10))\ncond3=amount/shift(amount,1)>1.4\ncond4=hist>0\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-32"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-32","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-105","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df = input_1.read_df()\n prices = df['close'].map(np.float) # 转化成float格式\n import talib\n # macd:diff线 信号线:dea 柱状图:diff-dea\n df['macd'], df['signal'], df['hist'] = talib.MACD(np.array(prices), 12, 26, 9) # 计算macd各个指标 \n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"post_run","Value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"input_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"params","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-105"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-105"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-105"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-105","OutputType":null},{"Name":"data_2","NodeId":"-105","OutputType":null},{"Name":"data_3","NodeId":"-105","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"计算MACD指标","CommentCollapsed":false},{"Id":"-114","ModuleId":"BigQuantSpace.filter.filter-v3","ModuleParameters":[{"Name":"expr","Value":"cond1==True and cond2==True and cond3==True and cond4==True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-114"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-114","OutputType":null},{"Name":"left_data","NodeId":"-114","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-489' Position='97,221,200,200'/><NodePosition Node='-495' Position='-69,101,200,200'/><NodePosition Node='-19' Position='271,107,200,200'/><NodePosition Node='-24' Position='162,439,200,200'/><NodePosition Node='-32' Position='426,319,200,200'/><NodePosition Node='-105' Position='105,312,200,200'/><NodePosition Node='-114' Position='159,530,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
        In [12]:
        # 本代码由可视化策略环境自动生成 2019年1月18日 15:52
        # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
        
        
        # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
        def m6_run_bigquant_run(input_1, input_2, input_3):
            # 示例代码如下。在这里编写您的代码
            df = input_1.read_df()
            prices = df['close'].map(np.float)  # 转化成float格式
            import talib
            # macd:diff线 信号线:dea 柱状图:diff-dea
            df['macd'], df['signal'], df['hist'] = talib.MACD(np.array(prices), 12, 26, 9)  # 计算macd各个指标    
            data_1 = DataSource.write_df(df)
            return Outputs(data_1=data_1, data_2=None, data_3=None)
        
        # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
        def m6_post_run_bigquant_run(outputs):
            return outputs
        
        
        m2 = M.instruments.v2(
            start_date='2016-01-01',
            end_date='2016-09-14',
            market='CN_STOCK_A',
            instrument_list='',
            max_count=0
        )
        
        m3 = M.input_features.v1(
            features="""
        # #号开始的表示注释,注释需单独一行
        # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
        high
        open
        low
        close
        amount
        """
        )
        
        m1 = M.use_datasource.v1(
            instruments=m2.data,
            features=m3.data,
            datasource_id='bar1d_CN_STOCK_A',
            start_date='',
            end_date=''
        )
        
        m6 = M.cached.v3(
            input_1=m1.data,
            run=m6_run_bigquant_run,
            post_run=m6_post_run_bigquant_run,
            input_ports='',
            params='{}',
            output_ports=''
        )
        
        m5 = M.input_features.v1(
            features="""
        # #号开始的表示注释,注释需单独一行
        # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
        cond1=close==ts_max(high,60)
        cond2=(mean(close,3)>mean(close,5)) & (mean(close,5)>mean(close,10))
        cond3=amount/shift(amount,1)>1.4
        cond4=hist>0
        """
        )
        
        m4 = M.derived_feature_extractor.v3(
            input_data=m6.data_1,
            features=m5.data,
            date_col='date',
            instrument_col='instrument',
            drop_na=False,
            remove_extra_columns=False,
            user_functions={}
        )
        
        m7 = M.filter.v3(
            input_data=m4.data,
            expr='cond1==True and cond2==True and cond3==True and cond4==True',
            output_left_data=False
        )
        
        [2019-01-17 15:45:04.503363] INFO: bigquant: instruments.v2 开始运行..
        [2019-01-17 15:45:04.508398] INFO: bigquant: 命中缓存
        [2019-01-17 15:45:04.509233] INFO: bigquant: instruments.v2 运行完成[0.00589s].
        [2019-01-17 15:45:04.511906] INFO: bigquant: input_features.v1 开始运行..
        [2019-01-17 15:45:04.515841] INFO: bigquant: 命中缓存
        [2019-01-17 15:45:04.516559] INFO: bigquant: input_features.v1 运行完成[0.004657s].
        [2019-01-17 15:45:04.519004] INFO: bigquant: use_datasource.v1 开始运行..
        [2019-01-17 15:45:04.523030] INFO: bigquant: 命中缓存
        [2019-01-17 15:45:04.523756] INFO: bigquant: use_datasource.v1 运行完成[0.004762s].
        [2019-01-17 15:45:04.527184] INFO: bigquant: cached.v3 开始运行..
        [2019-01-17 15:45:04.530734] INFO: bigquant: 命中缓存
        [2019-01-17 15:45:04.531486] INFO: bigquant: cached.v3 运行完成[0.004321s].
        [2019-01-17 15:45:04.534004] INFO: bigquant: input_features.v1 开始运行..
        [2019-01-17 15:45:04.537812] INFO: bigquant: 命中缓存
        [2019-01-17 15:45:04.538578] INFO: bigquant: input_features.v1 运行完成[0.004555s].
        [2019-01-17 15:45:04.540621] INFO: bigquant: derived_feature_extractor.v3 开始运行..
        [2019-01-17 15:45:04.544889] INFO: bigquant: 命中缓存
        [2019-01-17 15:45:04.545588] INFO: bigquant: derived_feature_extractor.v3 运行完成[0.004965s].
        [2019-01-17 15:45:04.551590] INFO: bigquant: filter.v3 开始运行..
        [2019-01-17 15:45:04.559250] INFO: filter: 使用表达式 cond1==True and cond2==True and cond3==True and cond4==True 过滤
        [2019-01-17 15:45:04.721399] INFO: filter: 过滤 /data, 471/0/496218
        [2019-01-17 15:45:04.743047] INFO: bigquant: filter.v3 运行完成[0.191395s].
        
        In [14]:
        # 查看满足条件的股票数据(取前5条数据)
        m7.data.read_df().head()
        
        Out[14]:
        date instrument open amount low high close macd signal hist cond1 cond2 cond3 cond4
        168544 2016-04-01 000059.SZA 12.034111 2.984961e+08 11.896491 12.477554 12.477554 -48.320044 -53.333582 5.013538 True True True True
        168662 2016-04-01 300419.SZA 189.657669 1.020422e+09 188.136398 195.942886 195.942886 9.017935 -11.521898 20.539833 True True True True
        169722 2016-04-05 600759.SHA 38.470238 1.029454e+08 38.470238 38.470238 38.470238 14.142388 7.490748 6.651640 True True True True
        169961 2016-04-05 002516.SZA 45.381012 4.654453e+08 44.480064 47.416481 47.416481 -20.892731 -30.765202 9.872471 True True True True
        169991 2016-04-05 002518.SZA 90.514511 3.663198e+08 90.514511 98.378456 98.378456 -4.516370 -9.212715 4.696346 True True True True
        克隆策略

        3、技术指标层面筛选可视化模块实现案例

        例1、选出满足以下条件的股票

        • 7日均线上穿63日均线
        • 收盘价突破ATR上轨

          {"Description":"实验创建于2019/1/17","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-24:input_data","SourceOutputPortId":"-489:data"},{"DestinationInputPortId":"-489:instruments","SourceOutputPortId":"-495:data"},{"DestinationInputPortId":"-489:features","SourceOutputPortId":"-19:data"},{"DestinationInputPortId":"-37:input_data","SourceOutputPortId":"-24:data"},{"DestinationInputPortId":"-24:features","SourceOutputPortId":"-32:data"},{"DestinationInputPortId":"-50:input_data","SourceOutputPortId":"-37:data"},{"DestinationInputPortId":"-37:features","SourceOutputPortId":"-45:data"}],"ModuleNodes":[{"Id":"-489","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar1d_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-489"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-489"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-489","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-495","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2016-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2016-09-14","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-495"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-495","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-19","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nhigh\nopen\nlow\nclose\n\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-19"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-19","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-24","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-24"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-24"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-24","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-32","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nma7=mean(close,7)\nma63=mean(close,63)\nmid=mean(close,14)\natr=ta_atr(high, low, close, 14)\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-32"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-32","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-37","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-37"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-37"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-37","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-45","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\ncond1=(ma7>ma63) & (shift(ma7,1)<shift(ma63,1))\ncond2=(close>atr+mid) & (shift(close, 1) < shift(atr+mid, 1))\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-45"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-45","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-50","ModuleId":"BigQuantSpace.filter.filter-v3","ModuleParameters":[{"Name":"expr","Value":"cond1==True and cond2==True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-50"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-50","OutputType":null},{"Name":"left_data","NodeId":"-50","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":8,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-489' Position='97,221,200,200'/><NodePosition Node='-495' Position='-69,101,200,200'/><NodePosition Node='-19' Position='271,107,200,200'/><NodePosition Node='-24' Position='183,344,200,200'/><NodePosition Node='-32' Position='413,225,200,200'/><NodePosition Node='-37' Position='255,442,200,200'/><NodePosition Node='-45' Position='489,342,200,200'/><NodePosition Node='-50' Position='253,512,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
          In [4]:
          # 本代码由可视化策略环境自动生成 2019年1月18日 15:46
          # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
          
          
          m2 = M.instruments.v2(
              start_date='2016-01-01',
              end_date='2016-09-14',
              market='CN_STOCK_A',
              instrument_list='',
              max_count=0
          )
          
          m3 = M.input_features.v1(
              features="""
          # #号开始的表示注释,注释需单独一行
          # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
          high
          open
          low
          close
          
          """
          )
          
          m1 = M.use_datasource.v1(
              instruments=m2.data,
              features=m3.data,
              datasource_id='bar1d_CN_STOCK_A',
              start_date='',
              end_date=''
          )
          
          m5 = M.input_features.v1(
              features="""
          # #号开始的表示注释,注释需单独一行
          # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
          ma7=mean(close,7)
          ma63=mean(close,63)
          mid=mean(close,14)
          atr=ta_atr(high, low, close, 14)
          """
          )
          
          m4 = M.derived_feature_extractor.v3(
              input_data=m1.data,
              features=m5.data,
              date_col='date',
              instrument_col='instrument',
              drop_na=False,
              remove_extra_columns=False,
              user_functions={}
          )
          
          m7 = M.input_features.v1(
              features="""
          # #号开始的表示注释,注释需单独一行
          # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
          cond1=(ma7>ma63) & (shift(ma7,1)<shift(ma63,1))
          cond2=(close>atr+mid) & (shift(close, 1) < shift(atr+mid, 1))
          """
          )
          
          m6 = M.derived_feature_extractor.v3(
              input_data=m4.data,
              features=m7.data,
              date_col='date',
              instrument_col='instrument',
              drop_na=False,
              remove_extra_columns=False,
              user_functions={}
          )
          
          m8 = M.filter.v3(
              input_data=m6.data,
              expr='cond1==True and cond2==True',
              output_left_data=False
          )
          
          [2019-01-18 15:46:43.373608] INFO: bigquant: instruments.v2 开始运行..
          [2019-01-18 15:46:43.378821] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.379997] INFO: bigquant: instruments.v2 运行完成[0.006411s].
          [2019-01-18 15:46:43.381884] INFO: bigquant: input_features.v1 开始运行..
          [2019-01-18 15:46:43.385957] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.387259] INFO: bigquant: input_features.v1 运行完成[0.005366s].
          [2019-01-18 15:46:43.389442] INFO: bigquant: use_datasource.v1 开始运行..
          [2019-01-18 15:46:43.393021] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.393827] INFO: bigquant: use_datasource.v1 运行完成[0.004381s].
          [2019-01-18 15:46:43.395420] INFO: bigquant: input_features.v1 开始运行..
          [2019-01-18 15:46:43.401887] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.402655] INFO: bigquant: input_features.v1 运行完成[0.007218s].
          [2019-01-18 15:46:43.404495] INFO: bigquant: derived_feature_extractor.v3 开始运行..
          [2019-01-18 15:46:43.408061] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.408743] INFO: bigquant: derived_feature_extractor.v3 运行完成[0.004237s].
          [2019-01-18 15:46:43.410596] INFO: bigquant: input_features.v1 开始运行..
          [2019-01-18 15:46:43.414049] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.414744] INFO: bigquant: input_features.v1 运行完成[0.004138s].
          [2019-01-18 15:46:43.416813] INFO: bigquant: derived_feature_extractor.v3 开始运行..
          [2019-01-18 15:46:43.420432] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.421243] INFO: bigquant: derived_feature_extractor.v3 运行完成[0.004417s].
          [2019-01-18 15:46:43.423238] INFO: bigquant: filter.v3 开始运行..
          [2019-01-18 15:46:43.426716] INFO: bigquant: 命中缓存
          [2019-01-18 15:46:43.427652] INFO: bigquant: filter.v3 运行完成[0.004456s].
          
          In [5]:
          # 查看满足条件的股票数据(取前5条数据)
          m8.data.read_df().head()
          
          Out[5]:
          date instrument open low high close ma7 ma63 mid atr cond1 cond2
          178243 2016-04-08 300175.SZA 38.923302 38.568649 42.159523 41.671875 38.992967 38.697422 38.248827 1.764222 True True
          178516 2016-04-08 600971.SHA 35.961372 35.895390 37.544994 37.479008 35.933093 35.522525 35.485344 1.243462 True True
          180135 2016-04-08 002171.SZA 40.385658 40.385658 43.524063 43.524063 39.780916 38.985406 39.304768 2.031968 True True
          180196 2016-04-08 600019.SHA 11.017536 10.976194 11.637660 11.389611 11.047066 11.039520 10.974718 0.318106 True True
          180240 2016-04-08 300279.SZA 70.101822 69.733948 73.923706 73.923706 67.868261 67.859826 66.079948 4.061996 True True
          克隆策略

          例2、 选出满足以下条件的股票

          • 股价创60日最高点
          • 3日线大于5日均线,5日均线大于10日均线
          • 当日成交额是昨日成交额的1.4倍
          • macd柱状图处于红色区域

            {"Description":"实验创建于2019/1/17","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-105:input_1","SourceOutputPortId":"-489:data"},{"DestinationInputPortId":"-489:instruments","SourceOutputPortId":"-495:data"},{"DestinationInputPortId":"-489:features","SourceOutputPortId":"-19:data"},{"DestinationInputPortId":"-114:input_data","SourceOutputPortId":"-24:data"},{"DestinationInputPortId":"-24:features","SourceOutputPortId":"-32:data"},{"DestinationInputPortId":"-24:input_data","SourceOutputPortId":"-105:data_1"}],"ModuleNodes":[{"Id":"-489","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bar1d_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-489"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-489"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-489","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-495","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2016-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2016-09-14","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-495"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-495","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-19","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nhigh\nopen\nlow\nclose\namount\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-19"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-19","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-24","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-24"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-24"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-24","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-32","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\ncond1=close==ts_max(high,60)\ncond2=(mean(close,3)>mean(close,5)) & (mean(close,5)>mean(close,10))\ncond3=amount/shift(amount,1)>1.4\ncond4=hist>0\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-32"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-32","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-105","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n df = input_1.read_df()\n prices = df['close'].map(np.float) # 转化成float格式\n import talib\n # macd:diff线 信号线:dea 柱状图:diff-dea\n df['macd'], df['signal'], df['hist'] = talib.MACD(np.array(prices), 12, 26, 9) # 计算macd各个指标 \n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"post_run","Value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"input_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"params","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-105"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-105"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-105"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-105","OutputType":null},{"Name":"data_2","NodeId":"-105","OutputType":null},{"Name":"data_3","NodeId":"-105","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"计算MACD指标","CommentCollapsed":false},{"Id":"-114","ModuleId":"BigQuantSpace.filter.filter-v3","ModuleParameters":[{"Name":"expr","Value":"cond1==True and cond2==True and cond3==True and cond4==True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-114"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-114","OutputType":null},{"Name":"left_data","NodeId":"-114","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-489' Position='97,221,200,200'/><NodePosition Node='-495' Position='-69,101,200,200'/><NodePosition Node='-19' Position='271,107,200,200'/><NodePosition Node='-24' Position='162,439,200,200'/><NodePosition Node='-32' Position='426,319,200,200'/><NodePosition Node='-105' Position='105,312,200,200'/><NodePosition Node='-114' Position='159,530,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
            In [12]:
            # 本代码由可视化策略环境自动生成 2019年1月18日 14:11
            # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
            
            
            # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
            def m6_run_bigquant_run(input_1, input_2, input_3):
                # 示例代码如下。在这里编写您的代码
                df = input_1.read_df()
                prices = df['close'].map(np.float)  # 转化成float格式
                import talib
                # macd:diff线 信号线:dea 柱状图:diff-dea
                df['macd'], df['signal'], df['hist'] = talib.MACD(np.array(prices), 12, 26, 9)  # 计算macd各个指标    
                data_1 = DataSource.write_df(df)
                return Outputs(data_1=data_1, data_2=None, data_3=None)
            
            # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
            def m6_post_run_bigquant_run(outputs):
                return outputs
            
            
            m2 = M.instruments.v2(
                start_date='2016-01-01',
                end_date='2016-09-14',
                market='CN_STOCK_A',
                instrument_list='',
                max_count=0
            )
            
            m3 = M.input_features.v1(
                features="""
            # #号开始的表示注释,注释需单独一行
            # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
            high
            open
            low
            close
            amount
            """
            )
            
            m1 = M.use_datasource.v1(
                instruments=m2.data,
                features=m3.data,
                datasource_id='bar1d_CN_STOCK_A',
                start_date='',
                end_date=''
            )
            
            m6 = M.cached.v3(
                input_1=m1.data,
                run=m6_run_bigquant_run,
                post_run=m6_post_run_bigquant_run,
                input_ports='',
                params='{}',
                output_ports=''
            )
            
            m5 = M.input_features.v1(
                features="""
            # #号开始的表示注释,注释需单独一行
            # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
            cond1=close==ts_max(high,60)
            cond2=(mean(close,3)>mean(close,5)) & (mean(close,5)>mean(close,10))
            cond3=amount/shift(amount,1)>1.4
            cond4=hist>0
            """
            )
            
            m4 = M.derived_feature_extractor.v3(
                input_data=m6.data_1,
                features=m5.data,
                date_col='date',
                instrument_col='instrument',
                drop_na=False,
                remove_extra_columns=False,
                user_functions={}
            )
            
            m7 = M.filter.v3(
                input_data=m4.data,
                expr='cond1==True and cond2==True and cond3==True and cond4==True',
                output_left_data=False
            )
            
            [2019-01-17 15:45:04.503363] INFO: bigquant: instruments.v2 开始运行..
            [2019-01-17 15:45:04.508398] INFO: bigquant: 命中缓存
            [2019-01-17 15:45:04.509233] INFO: bigquant: instruments.v2 运行完成[0.00589s].
            [2019-01-17 15:45:04.511906] INFO: bigquant: input_features.v1 开始运行..
            [2019-01-17 15:45:04.515841] INFO: bigquant: 命中缓存
            [2019-01-17 15:45:04.516559] INFO: bigquant: input_features.v1 运行完成[0.004657s].
            [2019-01-17 15:45:04.519004] INFO: bigquant: use_datasource.v1 开始运行..
            [2019-01-17 15:45:04.523030] INFO: bigquant: 命中缓存
            [2019-01-17 15:45:04.523756] INFO: bigquant: use_datasource.v1 运行完成[0.004762s].
            [2019-01-17 15:45:04.527184] INFO: bigquant: cached.v3 开始运行..
            [2019-01-17 15:45:04.530734] INFO: bigquant: 命中缓存
            [2019-01-17 15:45:04.531486] INFO: bigquant: cached.v3 运行完成[0.004321s].
            [2019-01-17 15:45:04.534004] INFO: bigquant: input_features.v1 开始运行..
            [2019-01-17 15:45:04.537812] INFO: bigquant: 命中缓存
            [2019-01-17 15:45:04.538578] INFO: bigquant: input_features.v1 运行完成[0.004555s].
            [2019-01-17 15:45:04.540621] INFO: bigquant: derived_feature_extractor.v3 开始运行..
            [2019-01-17 15:45:04.544889] INFO: bigquant: 命中缓存
            [2019-01-17 15:45:04.545588] INFO: bigquant: derived_feature_extractor.v3 运行完成[0.004965s].
            [2019-01-17 15:45:04.551590] INFO: bigquant: filter.v3 开始运行..
            [2019-01-17 15:45:04.559250] INFO: filter: 使用表达式 cond1==True and cond2==True and cond3==True and cond4==True 过滤
            [2019-01-17 15:45:04.721399] INFO: filter: 过滤 /data, 471/0/496218
            [2019-01-17 15:45:04.743047] INFO: bigquant: filter.v3 运行完成[0.191395s].
            
            In [14]:
            # 查看满足条件的股票数据(取前5条数据)
            m7.data.read_df().head()
            
            Out[14]:
            date instrument open amount low high close macd signal hist cond1 cond2 cond3 cond4
            168544 2016-04-01 000059.SZA 12.034111 2.984961e+08 11.896491 12.477554 12.477554 -48.320044 -53.333582 5.013538 True True True True
            168662 2016-04-01 300419.SZA 189.657669 1.020422e+09 188.136398 195.942886 195.942886 9.017935 -11.521898 20.539833 True True True True
            169722 2016-04-05 600759.SHA 38.470238 1.029454e+08 38.470238 38.470238 38.470238 14.142388 7.490748 6.651640 True True True True
            169961 2016-04-05 002516.SZA 45.381012 4.654453e+08 44.480064 47.416481 47.416481 -20.892731 -30.765202 9.872471 True True True True
            169991 2016-04-05 002518.SZA 90.514511 3.663198e+08 90.514511 98.378456 98.378456 -4.516370 -9.212715 4.696346 True True True True

            二、代码方式实现案例

            克隆策略

            参数

            In [2]:
            start_date = '2016-01-01'
            end_date = '2017-09-14'
            instrument = D.instruments(start_date=start_date, end_date=end_date)
            

            1.基本信息层面

            获取指数成分股列表

            In [3]:
            # 沪深300指数成分
            df = D.history_data(instrument, start_date, end_date, ['in_csi300'])
            instruments = list(set(df[df['in_csi300']==1]['instrument']))
            print('沪深300指数成分股预览10只股票:', instruments[:10])
            
            沪深300指数成分股预览10只股票: ['600098.SHA', '000555.SZA', '000826.SZA', '600111.SHA', '600271.SHA', '601899.SHA', '002736.SZA', '600871.SHA', '000738.SZA', '601127.SHA']
            

            获取某个行业股票列表

            In [4]:
            # (举例)获取国防军工行业股票列表
            df = D.history_data(instrument, start_date, end_date, ['industry_sw_level1'])
            instruments = list(set(df[df['industry_sw_level1'] == 650000]['instrument']))
            D.history_data(instruments, '2017-07-27', '2017-07-27', ['company_name']).head() 
            
            Out[4]:
            date company_name instrument
            441666 2017-07-27 中兵红箭股份有限公司 000519.SZA
            441690 2017-07-27 航天工业发展股份有限公司 000547.SZA
            441833 2017-07-27 中国航发动力控制股份有限公司 000738.SZA
            441849 2017-07-27 中航飞机股份有限公司 000768.SZA
            442030 2017-07-27 中航工业机电系统股份有限公司 002013.SZA

            返回特定时间段某个指数的股票

            In [15]:
            start_date='2017-05-23'
            end_date = '2018-01-01'
            df = D.history_data(D.instruments(start_date, end_date),start_date,end_date,fields=['in_csi300'])
            # 获取沪深300的成分股股票列表  中证500:in_csi500,中证800:in_csi800  参考文档说明
            instruments = list(set(df[df['in_csi300']==1]['instrument'])) 
            print('特定时间段内沪深300指数成分股预览10只股票:',instruments[:10])
            
            特定时间段内沪深300指数成分股预览10只股票: ['000555.SZA', '000826.SZA', '600111.SHA', '600271.SHA', '601899.SHA', '002736.SZA', '600871.SHA', '000738.SZA', '601127.SHA', '601211.SHA']
            

            获取某个概念、板块的股票列表

            In [6]:
            df = D.history_data(instrument, '2017-08-23', '2017-08-23', ['concept']).dropna()   # 'concept' 是股票的概念字段
            df['is_ai'] = df['concept'].map(lambda x: '人工智能' in x)  # 以人工智能为例,找到相关概念股票
            st = list(df[df['is_ai'] == True]['instrument'])
            D.history_data(st,'2017-08-23','2017-08-23',['name', 'concept']).head()
            
            Out[6]:
            date instrument name concept
            0 2017-08-23 000977.SZA 浪潮信息 云计算;IPV6;大数据;网络安全;去IOE;人工智能;雄安新区;融资融券;融资融券标的
            1 2017-08-23 002049.SZA 紫光国芯 物联网;重组;智能IC卡;芯片国产化;国家队;高校;人工智能;融资融券;融资融券标的
            2 2017-08-23 002073.SZA 软控股份 机器人;工业4.0;国家队;人工智能;融资融券;融资融券标的
            3 2017-08-23 002184.SZA 海得控制 智能电网;浦东新区;机器人;工业4.0;军民融合;人工智能
            4 2017-08-23 002226.SZA 江南化工 重组;人工智能;预增;并购阶段(需定增)

            获取每日创业板次新股股票列表

            次新股的定义为上市90天以内

            In [7]:
            df = D.history_data(instrument, start_date, end_date, ['list_date', 'list_board'])
            from datetime import timedelta
            df[(df['list_board']=='创业板')&(df['date']<=df['list_date']+timedelta(days=20))].head(10)
            
            Out[7]:
            date list_date instrument list_board
            294534 2017-05-23 2017-05-05 300643.SZA 创业板
            294536 2017-05-23 2017-05-03 300647.SZA 创业板
            294538 2017-05-23 2017-05-05 300649.SZA 创业板
            294539 2017-05-23 2017-05-03 300650.SZA 创业板
            294540 2017-05-23 2017-05-09 300651.SZA 创业板
            294541 2017-05-23 2017-05-16 300652.SZA 创业板
            294542 2017-05-23 2017-05-16 300653.SZA 创业板
            294543 2017-05-23 2017-05-23 300655.SZA 创业板
            294544 2017-05-23 2017-05-19 300656.SZA 创业板
            294545 2017-05-23 2017-05-23 300657.SZA 创业板

            2.财务信息层面

            选出满足以下条件的股票

            • 市盈率小于15倍
            • 市净率小于1.5倍
            In [8]:
             # 获取市盈率、市净率、成交额数据
            history_data = D.history_data(instrument, start_date=start_date, end_date= end_date, fields=[ 'pb_lf', 'pe_ttm','amount'])
            result = history_data[(history_data['pb_lf'] < 1.5)
                                                   & (history_data['pe_ttm'] < 15) 
                                                   & (history_data['amount'] > 0) 
                                                   & (history_data['pb_lf'] > 0)
                                                   & (history_data['pe_ttm'] > 0)]
            daily_buy_stock = result.groupby('date').apply(lambda df:list(df.sort_values(['pe_ttm','pb_lf']).instrument)[:30])
            daily_buy_stock.head()
            
            Out[8]:
            date
            2017-05-23    [600015.SHA, 600016.SHA, 601818.SHA, 601166.SH...
            2017-05-24    [600015.SHA, 600016.SHA, 601818.SHA, 601166.SH...
            2017-05-25    [600015.SHA, 601818.SHA, 601288.SHA, 600016.SH...
            2017-05-26    [600015.SHA, 600016.SHA, 601818.SHA, 601288.SH...
            2017-05-31    [600015.SHA, 600016.SHA, 601818.SHA, 601288.SH...
            dtype: object

            选出满足以下条件的股票

            • 市净率小于8
            • 市销率大于0.4
            • 资产周转率大于0.4
            • 市值最小的10只股票
            In [9]:
            stock_num = 10
            # 通过history_data接口获取历史数据
            history_data = D.history_data(instrument, start_date, end_date, ['pb_lf', 'ps_ttm', 'market_cap', 'amount'])
            # 通过feature接口获取财务数据
            financial = D.features(instrument, start_date=start_date, end_date=end_date,
                                    fields=['fs_operating_revenue_ttm_0','fs_current_assets_0','fs_non_current_assets_0']) 
            # 总资产=流动资产+非流动资产
            financial['total_assets'] = financial['fs_current_assets_0'] + financial['fs_non_current_assets_0']
            # 资产周转率=营业收入/总资产
            financial['asset_turnover'] = financial['fs_operating_revenue_ttm_0'] / financial['total_assets']
            financial_data = financial[['date','instrument','asset_turnover']] 
            # 两个DataFrame:历史数据、财务数据 合并
            result = history_data.merge(financial_data, on=['date','instrument'], how='outer')  
            # 按照选股法则选出股票
            daily_buy_stock = result.groupby('date').apply(lambda df:list(df[(df['ps_ttm']>0.4) & (df['pb_lf']<8) & (df['asset_turnover']>0.4)
                                                     & (df['amount']>100)].sort_values('market_cap')['instrument'])[:stock_num])
            daily_buy_stock.head()
            
            Out[9]:
            date
            2017-05-23    [300321.SZA, 300483.SZA, 300417.SZA, 300243.SZ...
            2017-05-24    [300321.SZA, 300483.SZA, 300417.SZA, 600847.SH...
            2017-05-25    [300321.SZA, 300483.SZA, 300417.SZA, 600847.SH...
            2017-05-26    [300321.SZA, 300483.SZA, 300417.SZA, 300243.SZ...
            2017-05-31    [300321.SZA, 300483.SZA, 300417.SZA, 300243.SZ...
            dtype: object

            3.技术指标层面

            选出满足以下条件的股票

            • 7日均线上穿63日均线
            • 收盘价突破ATR上轨
            In [10]:
            df= D.history_data(instrument, start_date, end_date, ['open', 'high', 'low', 'close'])
            
            import talib as ta
            from numpy import float as f
            
            def seek_stocks(df):
                df['ma_7'] = ta.SMA(df.close.map(f).values, 7)
                df['ma_63'] = ta.SMA(df.close.map(f).values, 63)
                try:
                    df['atr'] = ta.ATR(df.high.map(f).values, df.low.map(f).values, df.close.map(f).values, 14)
                except Exception as e:
                    df['atr'] = np.nan
                df['upperline'] = df.close.rolling(14).mean() + df['atr'] 
                return df[(df['ma_7']>df['ma_63'])&(df['close']>=df['upperline'])].drop('instrument', axis=1)
            
            result = df.groupby('instrument').apply(seek_stocks).reset_index()
            daily_buy_stock = result.groupby('date').apply(lambda df:list(df['instrument']))
            daily_buy_stock.head()
            
            Out[10]:
            date
            2017-08-21    [000008.SZA, 000016.SZA, 000018.SZA, 000021.SZ...
            2017-08-22    [000008.SZA, 000018.SZA, 000021.SZA, 000040.SZ...
            2017-08-23    [000001.SZA, 000021.SZA, 000040.SZA, 000410.SZ...
            2017-08-24    [000001.SZA, 000040.SZA, 000402.SZA, 000408.SZ...
            2017-08-25    [000001.SZA, 000016.SZA, 000020.SZA, 000040.SZ...
            dtype: object

            选出满足以下条件的股票

            • 股价创60日最高点
            • 3日线上穿5日均线,5日均线上穿10日均线
            • 当日成交额是昨日成交额的1.4倍
            • macd柱状图处于红色区域
            In [11]:
            df =D.history_data(instrument, start_date, end_date, ['close', 'amount','high'])
            
            def seek_stocks(df):
                df['highest_60'] = df['high'].rolling(60).max()  # 计算60天最高点
                df['ma3_cross_ma5'] = df['close'].rolling(3).mean() - df['close'].rolling(5).mean()  > 0  # 3日均线上穿5日均线
                df['ma5_cross_ma10'] = df['close'].rolling(5).mean() - df['close'].rolling(10).mean()  > 0  # 5日均线上穿10日均线
                df['amount_cond'] = df['amount'] / df['amount'].shift(1) - 1 >= 0.4   # 当日成交量比前一日成交量大40%
                prices = df['close'].map(np.float)  # 转化成float格式
                # macd:diff线 信号线:dea 柱状图:diff-dea
                macd, signal, hist = ta.MACD(np.array(prices), 12, 26, 9)  # 计算macd各个指标
                df['is_highest'] = df['close'] == df['highest_60']  # 该列是布尔型变量,表明是否是60日最高点
                df['hist_is_red'] =  hist > 0   # macd柱状图是否在红色区域
                return df
              
            managed_df = df.groupby('instrument').apply(seek_stocks).reset_index()
            result= managed_df[
                (managed_df['hist_is_red'])&   # macd在红色区域
                (managed_df['is_highest'])&   # 是60日最高点
                (managed_df['ma3_cross_ma5'])&  # 3日均线上穿5日均线
                (managed_df['ma5_cross_ma10'])&   # 5日均线上穿10日均线
                (managed_df['amount_cond'])]   # 满足成交量条件
                
            # 整理出每日符合买入条件的列表               
            daily_buy_stock = result.groupby('date').apply(lambda df:list(df.instrument)).reset_index().rename(columns={0:'stocks'})
            daily_buy_stock.head()
            
            Out[11]:
            date stocks
            0 2017-08-16 [002128.SZA, 300377.SZA, 600797.SHA]
            1 2017-08-17 [000922.SZA, 000990.SZA, 002128.SZA, 002380.SZ...
            2 2017-08-18 [000554.SZA, 002545.SZA, 300295.SZA, 600275.SH...
            3 2017-08-21 [000720.SZA, 002298.SZA, 300310.SZA, 300353.SZ...
            4 2017-08-22 [000593.SZA, 000595.SZA, 002037.SZA, 300229.SZ...

            小结:之所以将“如何选出符合条件的股票”单独作为一篇帖子,是因为选股在开发量化策略的过程中是及其重要的一步,尤其是当大家在开发基于一些逻辑、想法的量化选股策略。我们希望您能在BigQuant平台快速实现您的选股思想。


               本文由BigQuant宽客学院推出,版权归BigQuant所有,转载请注明出处。
            



            001-草稿
            BigQuant常见问题和经验整理合计(1.0版本)
            有什么办法获取所有的创业板