复制链接
克隆策略

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-215:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"-215:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-152:input_1","from_node_id":"-215:data"},{"to_node_id":"-115:user_factor_data","from_node_id":"-152:data_1"},{"to_node_id":"-115:features","from_node_id":"-482:data"}],"nodes":[{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"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":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nclose_0\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-215","module_id":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":90,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-215"},{"name":"features","node_id":"-215"}],"output_ports":[{"name":"data","node_id":"-215"}],"cacheable":true,"seq_num":15,"comment":"","comment_collapsed":true},{"node_id":"-115","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":"False","type":"Literal","bound_global_parameter":null},{"name":"drop_st_stocks","value":"False","type":"Literal","bound_global_parameter":null},{"name":"drop_suspended_stocks","value":"False","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%3Afalse%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%3Afalse%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":"-115"},{"name":"user_factor_data","node_id":"-115"}],"output_ports":[{"name":"data","node_id":"-115"},{"name":"save_data","node_id":"-115"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-152","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\n \ndef bigquant_run(input_1):\n \n df = input_1.read() \n\n def cal_ma(tmp):\n tmp['ma'] = tmp['close_0'].rolling(44).mean()/tmp['close_0']-1\n return tmp \n\n ma_df = df.groupby('instrument').apply(cal_ma)\n ma_df.drop('close_0', axis=1, inplace=True)\n data_1 = DataSource.write_df(ma_df)\n return Outputs(data_1=data_1)\n \n \n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-152"},{"name":"input_2","node_id":"-152"},{"name":"input_3","node_id":"-152"}],"output_ports":[{"name":"data_1","node_id":"-152"},{"name":"data_2","node_id":"-152"},{"name":"data_3","node_id":"-152"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-482","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nma\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-482"}],"output_ports":[{"name":"data","node_id":"-482"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-8' Position='262,70,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='514,69,200,200'/><node_position Node='-215' Position='341,178,200,200'/><node_position Node='-115' Position='561,385,200,200'/><node_position Node='-152' Position='419,283,200,200'/><node_position Node='-482' Position='719,271,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [19]:
    # 本代码由可视化策略环境自动生成 2022年2月21日 19:24
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
     
    def m4_run_bigquant_run(input_1):
        
        df = input_1.read() 
    
        def cal_ma(tmp):
            tmp['ma'] = tmp['close_0'].rolling(44).mean()/tmp['close_0']-1
            return tmp 
    
        ma_df = df.groupby('instrument').apply(cal_ma)
        ma_df.drop('close_0', axis=1, inplace=True)
        data_1 = DataSource.write_df(ma_df)
        return Outputs(data_1=data_1)
        
        
    
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m4_post_run_bigquant_run(outputs):
        return outputs
    
    
    m1 = M.instruments.v2(
        start_date='2019-01-01',
        end_date='2019-12-31',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m3 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    close_0
    """
    )
    
    m15 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m3.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m4 = M.cached.v3(
        input_1=m15.data,
        run=m4_run_bigquant_run,
        post_run=m4_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    m5 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    ma
    """
    )
    
    m2 = M.factorlens.v2(
        features=m5.data,
        user_factor_data=m4.data_1,
        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=False,
        drop_st_stocks=False,
        drop_suspended_stocks=False,
        cutoutliers=True,
        normalization=True,
        neutralization=[],
        metrics=['因子表现概览', '因子分布', '因子行业分布', '因子市值分布', 'IC分析', '买入信号重合分析', '因子估值分析', '因子拥挤度分析', '因子值最大/最小股票', '表达式因子值', '多因子相关性分析'],
        factor_coverage=0.5,
        user_data_merge='left'
    )
    

    因子分析: ma

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

    因子表现概览

      累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 盈亏比 胜率 夏普比率 收益波动率
    最小分位 4.58% 4.58% -2.58% 6.96% 1.71% 0.09% 26.30% 0.79 0.57 0.17 24.67%
    最大分位 41.12% 41.12% -0.69% 9.51% 2.65% 0.27% 22.94% 0.79 0.63 1.41 25.06%
    多空组合 -14.09% -14.09% -0.92% -1.21% -0.46% -0.09% 15.05% 0.67 0.47 -3.46 5.52%

    基本特征分析

    IC分析

    0.13

    0.16

    0.83

    90.00%

    买入信号重合分析

    因子估值分析

    因子拥挤度分析

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

    股票名称 股票代码 因子值
    星期六 002291.SZA -0.5130
    *ST信威 600485.SHA -0.4574
    引力传媒 603598.SHA -0.4494
    欣龙控股 000955.SZA -0.4394
    南宁百货 600712.SHA -0.4211
    惠发食品 603536.SHA -0.4188
    海能实业 300787.SZA -0.3779
    一汽夏利 000927.SZA -0.3681
    航锦科技 000818.SZA -0.3595
    智慧松德 300173.SZA -0.3453
    绿庭投资 600695.SHA -0.3394
    威唐工业 300707.SZA -0.3390
    美联新材 300586.SZA -0.3379
    惠伦晶体 300460.SZA -0.3379
    亚玛顿 002623.SZA -0.3288
    *ST猛狮 002684.SZA -0.3137
    *ST鹏起 600614.SHA -0.3129
    南京证券 601990.SHA -0.3102
    拓维信息 002261.SZA -0.3087
    *ST高升 000971.SZA -0.3027

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

    股票名称 股票代码 因子值
    中牧股份 600195.SHA 0.1675
    聚龙股份 300202.SZA 0.1756
    富春环保 002479.SZA 0.1848
    文化长城 300089.SZA 0.1856
    海联金汇 002537.SZA 0.1875
    佳禾智能 300793.SZA 0.1909
    红宇新材 300345.SZA 0.1957
    众应互联 002464.SZA 0.1992
    商赢环球 600146.SHA 0.2000
    棒杰股份 002634.SZA 0.2059
    尔康制药 300267.SZA 0.2104
    新华联 000620.SZA 0.2204
    派思股份 603318.SHA 0.2501
    菲林格尔 603226.SHA 0.3314
    东旭光电 000413.SZA 0.3405
    正川股份 603976.SHA 0.3627
    国统股份 002205.SZA 0.4200
    创力集团 603012.SHA 0.5220
    神城A退 000018.SZA 1.1431
    退市华业 600240.SHA 1.1812