进阶直播课大奖赛题目

策略分享
标签: #<Tag:0x00007fc4cb5e3f70>

(quantai) #1

本帖为进阶直播课比赛专用贴,所有参赛学员需在本帖下方回复提交自己的策略,每个学员只能提交一次最优策略结果。恭喜之前基础课的获奖小伙伴,大家再接再厉踊跃参与呦,获胜者有机会赢取培训相关优惠~

比赛要求:

0. 高阶课程报名用户

1. 利用AI可视化因子分析模版评估单因子T+1收盘价轮仓效果:

2. 参选策略必须在给定模版基础上克隆,保持因子分析模块参数不变与模版一致,仅允许修改自定义运行中因子表达式列表,回测得到因子的表现概览回测结果和因子IC结果。

3. 不要提交并行计算的完整结果,每人只能提交表现最好的一个因子表达式及对应的IC分析结果和回测概览结果截图。

4. 模板策略不得参与评选。

5. 比赛截止日期为4月2日

比赛奖励

因子测试结果IC绝对值最大的3名的优秀策略作者将获得以下奖励:

第一名:高阶课免费+会员权限1个月+深度学习花书
第二名:高阶课免费+会员权限1个月
第三名:会员权限1个月+深度学习花书

模版策略(请克隆修改因子表达式)

克隆策略

    {"Description":"实验创建于2020/3/26","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-120:features","SourceOutputPortId":"-136:data"}],"ModuleNodes":[{"Id":"-120","ModuleId":"BigQuantSpace.factorlens.factorlens-v1","ModuleParameters":[{"Name":"title","Value":"因子分析: {factor_name}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"2019-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2020-03-25","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"rebalance_period","Value":"1","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"stock_pool","Value":"全市场","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"quantile_count","Value":"50","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"commission_rate","Value":"0.0016","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_price_limit_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_st_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_new_stocks","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"normalization","Value":"True","ValueType":"Literal","LinkedGlobalParameter":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","ValueType":"Literal","LinkedGlobalParameter":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%3Afalse%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%3Afalse%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%3Afalse%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%3Afalse%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%3Afalse%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%3Afalse%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%3Afalse%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%3Afalse%7D%5D%7D","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-120"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"user_factor_data","NodeId":"-120"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-120","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-136","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nreturn_0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-136"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-136","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-37","ModuleId":"BigQuantSpace.hyper_run.hyper_run-v1","ModuleParameters":[{"Name":"run","Value":"def bigquant_run(bq_graph, inputs):\n g = bq_graph\n features = ['return_1','turn_0']\n parameters_list = []\n \n for feature in features: \n parameters = {}\n parameters['m1.features'] ='\\n'.join([feature])\n parameters_list.append({'parameters': parameters})\n \n def run(parameters):\n try:\n print(parameters)\n result = g.run(parameters)\n record = pd.DataFrame(result['m2'].data.read()['data']['factors'][0]['results'][0]['summary']['IC'],index=range(1))\n record['factor'] = result['m1'].data.read()\n try:\n xx = pd.read_csv('factors_records.csv')\n record.to_csv('factors_records.csv',header=0,mode='a')\n except:\n record.to_csv('factors_records.csv',header=1,mode='a')\n return result\n except Exception as e:\n print('ERROR --------', e)\n return None\n results = T.parallel_map(run, parameters_list, max_workers=1, remote_run=False,silent=False)\n return results\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"run_now","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bq_graph","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"bq_graph_port","NodeId":"-37"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-37"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-37"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-37"}],"OutputPortsInternal":[{"Name":"result","NodeId":"-37","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":3,"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='-120' Position='216,309,200,200'/><NodePosition Node='-136' Position='117,207,200,200'/><NodePosition Node='-37' Position='101.58795166015625,96.1762466430664,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 [58]:
    # 本代码由可视化策略环境自动生成 2020年3月28日 10:32
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    g = T.Graph({
    
        'm1': 'M.input_features.v1',
        'm1.features': """
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    return_0""",
        'm1.m_cached': False,
    
        'm2': 'M.factorlens.v1',
        'm2.features': T.Graph.OutputPort('m1.data'),
        'm2.title': '因子分析: {factor_name}',
        'm2.start_date': '2019-01-01',
        'm2.end_date': '2020-03-25',
        'm2.rebalance_period': 1,
        'm2.stock_pool': '全市场',
        'm2.quantile_count': 50,
        'm2.commission_rate': 0.0016,
        'm2.drop_price_limit_stocks': True,
        'm2.drop_st_stocks': True,
        'm2.drop_new_stocks': True,
        'm2.normalization': True,
        'm2.neutralization': ['行业', '市值'],
        'm2.metrics': ['因子表现概览', 'IC分析'],
        'm2.m_cached': False,
    })
    
    # g.run({})
    
    
    def m3_run_bigquant_run(bq_graph, inputs):
        g = bq_graph
        features = ['return_1','turn_0']
        parameters_list = []
        
        for feature in features: 
            parameters = {}
            parameters['m1.features'] ='\n'.join([feature])
            parameters_list.append({'parameters': parameters})
        
        def run(parameters):
            try:
                print(parameters)
                result = g.run(parameters)
                record = pd.DataFrame(result['m2'].data.read()['data']['factors'][0]['results'][0]['summary']['IC'],index=range(1))
                record['factor'] = result['m1'].data.read()
                try:
                    xx = pd.read_csv('factors_records.csv')
                    record.to_csv('factors_records.csv',header=0,mode='a')
                except:
                    record.to_csv('factors_records.csv',header=1,mode='a')
                return result
            except Exception as e:
                print('ERROR --------', e)
                return None
        results = T.parallel_map(run, parameters_list, max_workers=1, remote_run=False,silent=False)
        return results
    
    
    m3 = M.hyper_run.v1(
        run=m3_run_bigquant_run,
        run_now=True,
        bq_graph=g
    )
    
    [2020-03-28 10:31:31.782192] INFO: bigquant: T.parallel_map  开始并行运算..
    [Parallel(n_jobs=1)]: Using backend SequentialBackend with 1 concurrent workers.
    {'m1.features': 'return_1'}
    

    因子分析: return_1

    因子表现概览

      累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 夏普比率 收益波动率
    最小分位 -70.36% -72.04% -23.88% -27.95% -3.28% 2.64% 74.64% -3.24 31.29%
    最大分位 -87.05% -84.67% -27.90% -23.20% 0.34% 0.64% 87.68% -7.15 24.16%
    多空组合 52.01% 35.78% 3.18% -2.94% -1.76% 1.00% 5.79% 3.79 8.51%

    IC分析

    IC均值

    -0.05

    IC标准差

    0.10

    IR值

    -0.53

    |IC| > 0.02比率

    83.84%

    [Parallel(n_jobs=1)]: Done   1 out of   1 | elapsed:   20.3s remaining:    0.0s
    {'m1.features': 'turn_0'}
    

    因子分析: turn_0

    因子表现概览

      累计收益 近1年收益 近3月收益 近1月收益 近1周收益 昨日收益 最大回撤 夏普比率 收益波动率
    最小分位 2.94% -13.00% 2.31% -13.89% 1.43% 1.85% 26.66% 0.09 26.42%
    最大分位 -80.88% -80.36% -28.69% -25.33% -2.62% 2.07% 82.24% -4.98 27.93%
    多空组合 130.15% 109.04% 19.58% 7.28% 2.02% -0.11% 1.26% 11.15 6.03%

    IC分析

    IC均值

    -0.07

    IC标准差

    0.09

    IR值

    -0.79

    |IC| > 0.02比率

    87.88%

    [Parallel(n_jobs=1)]: Done   2 out of   2 | elapsed:   40.8s remaining:    0.0s
    [Parallel(n_jobs=1)]: Done   2 out of   2 | elapsed:   40.8s finished
    

    (yangziriver) #3

    因子:rank_amount_0 IC均值:-0.07879



    (woshisilvio) #4


    rank_avg_amount_1


    (luojinzh) #5



    (公孙睿) #6



    (公孙睿) #7

    请问您是怎么查到小数点后第四位的?


    (quant101) #8

    return_0 X turn_0 X swing_volatility_5_0

    乘号符显示不出来,用X代替

    IC 0.0789


    (yangziriver) #9

    是从csv文件里查的。模块中有写入csv文档的语句的。


    (公孙睿) #10

    请问具体是哪个模块,用什么语句?


    (yangziriver) #11

    不需要自己操作,运行模块时,会在同一目录下形成一个文件’factors_records’,双击查一下该文件就行了
    自定义运行模块中有
    try:
    xx = pd.read_csv(‘factors_records.csv’)
    record.to_csv(‘factors_records.csv’,header=0,mode=‘a’)
    except:
    record.to_csv(‘factors_records.csv’,header=1,mode=‘a’)


    (公孙睿) #12

    哦,我克隆的模板版本比较早,谢谢了!