复制链接
克隆策略

    {"description":"实验创建于2020/2/14","graph":{"edges":[{"to_node_id":"-8309:features","from_node_id":"-70:data"},{"to_node_id":"-2650:factors_info","from_node_id":"-8309:save_data"},{"to_node_id":"-8309:user_factor_data","from_node_id":"-298:data"}],"nodes":[{"node_id":"-70","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nopen_0\nhigh_0\nclose_0\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-70"}],"output_ports":[{"name":"data","node_id":"-70"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-8309","module_id":"BigQuantSpace.factorlens.factorlens-v2","parameters":[{"name":"title","value":"因子分析: {factor_name}","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"2019-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2019-12-31","type":"Literal","bound_global_parameter":null},{"name":"rebalance_period","value":22,"type":"Literal","bound_global_parameter":null},{"name":"delay_rebalance_days","value":0,"type":"Literal","bound_global_parameter":null},{"name":"rebalance_price","value":"close_0","type":"Literal","bound_global_parameter":null},{"name":"stock_pool","value":"全市场","type":"Literal","bound_global_parameter":null},{"name":"quantile_count","value":5,"type":"Literal","bound_global_parameter":null},{"name":"commission_rate","value":0.0016,"type":"Literal","bound_global_parameter":null},{"name":"returns_calculation_method","value":"累乘","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"无","type":"Literal","bound_global_parameter":null},{"name":"drop_new_stocks","value":60,"type":"Literal","bound_global_parameter":null},{"name":"drop_price_limit_stocks","value":"True","type":"Literal","bound_global_parameter":null},{"name":"drop_st_stocks","value":"True","type":"Literal","bound_global_parameter":null},{"name":"drop_suspended_stocks","value":"True","type":"Literal","bound_global_parameter":null},{"name":"cutoutliers","value":"True","type":"Literal","bound_global_parameter":null},{"name":"normalization","value":"True","type":"Literal","bound_global_parameter":null},{"name":"neutralization","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E8%A1%8C%E4%B8%9A%22%2C%22displayValue%22%3A%22%E8%A1%8C%E4%B8%9A%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%B8%82%E5%80%BC%22%2C%22displayValue%22%3A%22%E5%B8%82%E5%80%BC%22%2C%22selected%22%3Atrue%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"metrics","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%A8%E7%8E%B0%E6%A6%82%E8%A7%88%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%A8%E7%8E%B0%E6%A6%82%E8%A7%88%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%88%86%E5%B8%83%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%8C%E4%B8%9A%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E8%A1%8C%E4%B8%9A%E5%88%86%E5%B8%83%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%B8%82%E5%80%BC%E5%88%86%E5%B8%83%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%B8%82%E5%80%BC%E5%88%86%E5%B8%83%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22IC%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22IC%E5%88%86%E6%9E%90%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%B9%B0%E5%85%A5%E4%BF%A1%E5%8F%B7%E9%87%8D%E5%90%88%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E4%B9%B0%E5%85%A5%E4%BF%A1%E5%8F%B7%E9%87%8D%E5%90%88%E5%88%86%E6%9E%90%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E4%BC%B0%E5%80%BC%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E4%BC%B0%E5%80%BC%E5%88%86%E6%9E%90%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E6%8B%A5%E6%8C%A4%E5%BA%A6%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E6%8B%A5%E6%8C%A4%E5%BA%A6%E5%88%86%E6%9E%90%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%9B%A0%E5%AD%90%E5%80%BC%E6%9C%80%E5%A4%A7%2F%E6%9C%80%E5%B0%8F%E8%82%A1%E7%A5%A8%22%2C%22displayValue%22%3A%22%E5%9B%A0%E5%AD%90%E5%80%BC%E6%9C%80%E5%A4%A7%2F%E6%9C%80%E5%B0%8F%E8%82%A1%E7%A5%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%9B%A0%E5%AD%90%E5%80%BC%22%2C%22displayValue%22%3A%22%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%9B%A0%E5%AD%90%E5%80%BC%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%A4%9A%E5%9B%A0%E5%AD%90%E7%9B%B8%E5%85%B3%E6%80%A7%E5%88%86%E6%9E%90%22%2C%22displayValue%22%3A%22%E5%A4%9A%E5%9B%A0%E5%AD%90%E7%9B%B8%E5%85%B3%E6%80%A7%E5%88%86%E6%9E%90%22%2C%22selected%22%3Atrue%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"factor_coverage","value":0.5,"type":"Literal","bound_global_parameter":null},{"name":"user_data_merge","value":"left","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features","node_id":"-8309"},{"name":"user_factor_data","node_id":"-8309"}],"output_ports":[{"name":"data","node_id":"-8309"},{"name":"save_data","node_id":"-8309"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-2650","module_id":"BigQuantSpace.factorlens_preservation.factorlens_preservation-v2","parameters":[{"name":"factor_fields","value":"# 定义因子名称\n# {\n# \"列名\": {'name': \"因子名\", 'desc': \"因子描述\"},\n# \"列名\": {'name': \"因子名\", 'desc': \"因子描述\"},\n# ... \n# }\n{}\n","type":"Literal","bound_global_parameter":null},{"name":"table","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"factors_info","node_id":"-2650"}],"output_ports":[{"name":"data","node_id":"-2650"}],"cacheable":false,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-298","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"300014.SZA\n002202.SZA\n600236.SHA\n600884.SHA\n300037.SZA\n002266.SZA\n300073.SZA\n600732.SHA\n002340.SZA\n002129.SZA\n601908.SHA\n300316.SZA\n601012.SHA\n603806.SHA\n601985.SHA\n603659.SHA\n300724.SZA\n300751.SZA\n300763.SZA\n688005.SHA\n003816.SZA\n688116.SHA\n688599.SHA\n300919.SZA\n600032.SHA\n600905.SHA\n600900.SHA\n600438.SHA\n600674.SHA\n002459.SZA\n002506.SZA\n300070.SZA\n002074.SZA\n600886.SHA\n000883.SZA\n300274.SZA\n002709.SZA\n300450.SZA\n603568.SHA\n603026.SHA\n002812.SZA\n603218.SHA\n600025.SHA\n300750.SZA\n603185.SHA\n601615.SHA\n601865.SHA\n688408.SHA\n688390.SHA\n003035.SZA\n","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-298"}],"output_ports":[{"name":"data","node_id":"-298"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-70' Position='93.46124267578125,167.1500244140625,200,200'/><node_position Node='-8309' Position='298,309,200,200'/><node_position Node='-2650' Position='243,457,200,200'/><node_position Node='-298' Position='410.85150146484375,149.46026611328125,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [2]:
    # 本代码由可视化策略环境自动生成 2022年3月14日 18:22
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    open_0
    high_0
    close_0
    """
    )
    
    m4 = M.instruments.v2(
        start_date='',
        end_date='',
        market='CN_STOCK_A',
        instrument_list="""300014.SZA
    002202.SZA
    600236.SHA
    600884.SHA
    300037.SZA
    002266.SZA
    300073.SZA
    600732.SHA
    002340.SZA
    002129.SZA
    601908.SHA
    300316.SZA
    601012.SHA
    603806.SHA
    601985.SHA
    603659.SHA
    300724.SZA
    300751.SZA
    300763.SZA
    688005.SHA
    003816.SZA
    688116.SHA
    688599.SHA
    300919.SZA
    600032.SHA
    600905.SHA
    600900.SHA
    600438.SHA
    600674.SHA
    002459.SZA
    002506.SZA
    300070.SZA
    002074.SZA
    600886.SHA
    000883.SZA
    300274.SZA
    002709.SZA
    300450.SZA
    603568.SHA
    603026.SHA
    002812.SZA
    603218.SHA
    600025.SHA
    300750.SZA
    603185.SHA
    601615.SHA
    601865.SHA
    688408.SHA
    688390.SHA
    003035.SZA
    """,
        max_count=0
    )
    
    m2 = M.factorlens.v2(
        features=m1.data,
        user_factor_data=m4.data,
        title='因子分析: {factor_name}',
        start_date='2019-01-01',
        end_date='2019-12-31',
        rebalance_period=22,
        delay_rebalance_days=0,
        rebalance_price='close_0',
        stock_pool='全市场',
        quantile_count=5,
        commission_rate=0.0016,
        returns_calculation_method='累乘',
        benchmark='无',
        drop_new_stocks=60,
        drop_price_limit_stocks=True,
        drop_st_stocks=True,
        drop_suspended_stocks=True,
        cutoutliers=True,
        normalization=True,
        neutralization=['行业', '市值'],
        metrics=['因子表现概览', '因子分布', '因子行业分布', '因子市值分布', 'IC分析', '买入信号重合分析', '因子估值分析', '因子拥挤度分析', '因子值最大/最小股票', '表达式因子值', '多因子相关性分析'],
        factor_coverage=0.5,
        user_data_merge='left'
    )
    
    m3 = M.factorlens_preservation.v2(
        factors_info=m2.save_data,
        factor_fields=# 定义因子名称
    # {
    #     "列名": {'name': "因子名", 'desc': "因子描述"},
    #     "列名": {'name': "因子名", 'desc': "因子描述"},
    #     ... 
    # }
    {}
    ,
        table=''
    )
    
    In [3]:
    m4.data.read()
    
    Out[3]:
    {'market': 'CN_STOCK_A',
     'instruments': ['000883.SZA',
      '002074.SZA',
      '002129.SZA',
      '002202.SZA',
      '002266.SZA',
      '002340.SZA',
      '002459.SZA',
      '002506.SZA',
      '002709.SZA',
      '002812.SZA',
      '003035.SZA',
      '003816.SZA',
      '300014.SZA',
      '300037.SZA',
      '300070.SZA',
      '300073.SZA',
      '300274.SZA',
      '300316.SZA',
      '300450.SZA',
      '300724.SZA',
      '300750.SZA',
      '300751.SZA',
      '300763.SZA',
      '300919.SZA',
      '600025.SHA',
      '600032.SHA',
      '600236.SHA',
      '600438.SHA',
      '600674.SHA',
      '600732.SHA',
      '600884.SHA',
      '600886.SHA',
      '600900.SHA',
      '600905.SHA',
      '601012.SHA',
      '601615.SHA',
      '601865.SHA',
      '601908.SHA',
      '601985.SHA',
      '603026.SHA',
      '603185.SHA',
      '603218.SHA',
      '603568.SHA',
      '603659.SHA',
      '603806.SHA',
      '688005.SHA',
      '688116.SHA',
      '688390.SHA',
      '688408.SHA',
      '688599.SHA'],
     'start_date': '',
     'end_date': ''}
    In [ ]: