复制链接
克隆策略

    {"description":"实验创建于2021/10/29","graph":{"edges":[{"to_node_id":"-192:features","from_node_id":"-152:data"},{"to_node_id":"-185:factors_info","from_node_id":"-192:save_data"}],"nodes":[{"node_id":"-152","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"f1 = close_0 / close_5","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-152"}],"output_ports":[{"name":"data","node_id":"-152"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-185","module_id":"BigQuantSpace.factorlens_preservation.factorlens_preservation-v2","parameters":[{"name":"factor_fields","value":"# 定义因子名称\n# {\n# \"列名\": {'name': \"因子名\", 'desc': \"因子描述\"},\n# \"列名\": {'name': \"因子名\", 'desc': \"因子描述\"},\n# ... \n# }\n{\n 'f1':{'name':'测试2','desc':'测试测试'}\n}\n","type":"Literal","bound_global_parameter":null},{"name":"table","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"factors_info","node_id":"-185"}],"output_ports":[{"name":"data","node_id":"-185"}],"cacheable":false,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-192","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":"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":"-192"},{"name":"user_factor_data","node_id":"-192"}],"output_ports":[{"name":"data","node_id":"-192"},{"name":"save_data","node_id":"-192"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-152' Position='349.8992919921875,298.1354064941406,200,200'/><node_position Node='-185' Position='341.8992919921875,507.579833984375,200,200'/><node_position Node='-192' Position='348.8992919921875,398.579833984375,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [2]:
    # 本代码由可视化策略环境自动生成 2021年12月20日 13:44
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.input_features.v1(
        features='f1 = close_0 / close_5'
    )
    
    m3 = M.factorlens.v2(
        features=m2.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,
        normalization=True,
        neutralization=['行业', '市值'],
        metrics=['因子表现概览', '因子分布', '因子行业分布', '因子市值分布', 'IC分析', '买入信号重合分析', '因子估值分析', '因子拥挤度分析', '因子值最大/最小股票', '表达式因子值', '多因子相关性分析'],
        factor_coverage=0.5,
        user_data_merge='left'
    )
    
    m1 = M.factorlens_preservation.v2(
        factors_info=m3.save_data,
        factor_fields=# 定义因子名称
    # {
    #     "列名": {'name': "因子名", 'desc': "因子描述"},
    #     "列名": {'name': "因子名", 'desc': "因子描述"},
    #     ... 
    # }
    {
        'f1':{'name':'测试2','desc':'测试测试'}
    }
    ,
        table=''
    )
    

    因子分析: f1

    { "type": "factor-track", "data": { "exprs": ["close_0 / close_5"], "options": {"BacktestInterval": ["2019-01-01", "2019-12-31"], "Benchmark": "none", "StockPool": "all", "UserDataMerge": "left", "DropSTStocks": 1, "DropPriceLimitStocks": 1, "DropNewStocks": 60, "DropSuspendedStocks": 1, "QuantileCount": 5, "CommissionRates": 0.0016, "Normalization": 1, "Neutralization": "industry,size", "DelayRebalanceDays": 0, "RebalancePeriod": 22, "RebalancePeriodsReturns": 0, "RebalancePrice": "close_0", "ReturnsCalculationMethod": "cumprod", "FactorCoverage": 0.5, "_HASH": "ffb2f8fbecb7cab66758ee29aeedc167"} } }

    因子表现概览

      累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 盈亏比 胜率 夏普比率 收益波动率
    最小分位 9.83% 9.83% -6.70% 5.65% 1.59% 0.24% 26.82% 0.78 0.58 0.38 23.45%
    最大分位 -14.77% -14.77% -6.57% 4.99% 2.02% 0.32% 34.10% 0.72 0.56 -0.77 22.72%
    多空组合 13.56% 13.56% -0.06% 0.32% -0.21% -0.04% 1.12% 1.34 0.64 3.31 2.94%

    基本特征分析

    IC分析

    -0.10

    0.10

    -0.95

    100.00%

    买入信号重合分析

    因子估值分析

    因子拥挤度分析

    因子值最小的20只股票 (2019-12-30)

    股票名称 股票代码 因子值
    正川股份 603976.SHA 0.8378
    苏奥传感 300507.SZA 0.8429
    共达电声 002655.SZA 0.8588
    泉峰汽车 603982.SHA 0.8608
    香雪制药 300147.SZA 0.8656
    飞亚达A 000026.SZA 0.8692
    金一文化 002721.SZA 0.8708
    大胜达 603687.SHA 0.8729
    新华联 000620.SZA 0.8780
    钢研纳克 300797.SZA 0.8835
    田中精机 300461.SZA 0.8869
    金宇车城 000803.SZA 0.8914
    佳禾智能 300793.SZA 0.8982
    宁波富邦 600768.SHA 0.9011
    南华仪器 300417.SZA 0.9066
    中牧股份 600195.SHA 0.9076
    光启技术 002625.SZA 0.9078
    新劲刚 300629.SZA 0.9108
    熊猫金控 600599.SHA 0.9121
    弘讯科技 603015.SHA 0.9124

    因子值最大的20只股票 (2019-12-30)

    股票名称 股票代码 因子值
    天齐锂业 002466.SZA 1.2177
    当升科技 300073.SZA 1.2220
    西部矿业 601168.SHA 1.2252
    鼎胜新材 603876.SHA 1.2258
    世运电路 603920.SHA 1.2346
    中微公司 688012.SHA 1.2374
    海能实业 300787.SZA 1.2438
    惠发食品 603536.SHA 1.2464
    朗博科技 603655.SHA 1.2486
    嘉元科技 688388.SHA 1.2522
    中广天择 603721.SHA 1.2560
    拓维信息 002261.SZA 1.2644
    中昌数据 600242.SHA 1.2687
    华扬联众 603825.SHA 1.2906
    融捷股份 002192.SZA 1.3010
    值得买 300785.SZA 1.3412
    中国宝安 000009.SZA 1.3455
    星期六 002291.SZA 1.3464
    容大感光 300576.SZA 1.3601
    一汽夏利 000927.SZA 1.4422
    In [3]:
    m1.data.read()
    
    Out[3]:
    {'f1': {'options': {'开始日期': '2019-01-01',
       '结束日期': '2019-12-31',
       '调仓周期': 22,
       '延迟建仓天数': 0,
       '股票池': '全市场',
       '分组数量': 5,
       '手续费及滑点': 0.0016,
       '收益价格': 'close_0',
       '收益计算方式': '累乘',
       '中性化风险因子': '行业,市值',
       '收益率基准': '无',
       '移除新股': 60,
       '移除涨跌停股票': '是',
       '移除ST股票': '是',
       '移除停牌股票': '是',
       '因子去极值和标准化': '是',
       '原始因子值覆盖率': 0.5,
       '用户数据合并方式': 'left'},
      'metrics': {'IC均值': -0.09986078886039713,
       'IC标准差': 0.10483072669470798,
       'IR值': -0.9525908291298553,
       '|IC| > 0.02比率': 1.0,
       '累计收益(最小分位)': 0.09832943613607559,
       '近1年收益(最小分位)': 0.09832943613607559,
       '近3月收益(最小分位)': -0.06695827658489939,
       '近1月收益(最小分位)': 0.05645133804139135,
       '近1周收益(最小分位)': 0.015935374205716446,
       '昨日收益(最小分位)': 0.002430948460924176,
       '最大回撤(最小分位)': 0.2681974331867978,
       '盈亏比(最小分位)': 0.7845910760514714,
       '胜率(最小分位)': 0.5843621399176955,
       '夏普比率(最小分位)': 0.3827667397711029,
       '收益波动率(最小分位)': 0.234537849846437,
       '累计收益(最大分位)': -0.14771767375489286,
       '近1年收益(最大分位)': -0.14771767375489286,
       '近3月收益(最大分位)': -0.06566003621715599,
       '近1月收益(最大分位)': 0.0498904572090777,
       '近1周收益(最大分位)': 0.020235723519856252,
       '昨日收益(最大分位)': 0.003163007188468958,
       '最大回撤(最大分位)': 0.34101594426514464,
       '盈亏比(最大分位)': 0.715131079791214,
       '胜率(最大分位)': 0.5555555555555556,
       '夏普比率(最大分位)': -0.7693536259931057,
       '收益波动率(最大分位)': 0.22724948850065224,
       '累计收益(多空组合)': 0.13556799771125605,
       '近1年收益(多空组合)': 0.13556799771125605,
       '近3月收益(多空组合)': -0.0006235499386134657,
       '近1月收益(多空组合)': 0.0031938887926596937,
       '近1周收益(多空组合)': -0.002113553883232422,
       '昨日收益(多空组合)': -0.00036602936377228,
       '最大回撤(多空组合)': 0.011180612482162709,
       '盈亏比(多空组合)': 1.344824734984519,
       '胜率(多空组合)': 0.6419753086419753,
       '夏普比率(多空组合)': 3.314368154797105,
       '收益波动率(多空组合)': 0.0293583116045862},
      'datasource':              date  instrument        f1
      0      2019-01-02  000001.SZA  0.975584
      1      2019-01-03  000001.SZA  0.993576
      2      2019-01-04  000001.SZA  1.048387
      3      2019-01-07  000001.SZA  1.049569
      4      2019-01-08  000001.SZA  1.029851
      ...           ...         ...       ...
      884862 2019-12-25  688399.SHA  0.938756
      884863 2019-12-26  688399.SHA  1.012443
      884864 2019-12-27  688399.SHA  0.971195
      884865 2019-12-30  688399.SHA  0.962444
      884866 2019-12-31  688399.SHA  0.985197
      
      [884867 rows x 3 columns],
      'column_name': 'f1',
      'description': '',
      'expr': 'close_0 / close_5'}}