克隆策略

    {"description":"实验创建于2021/9/4","graph":{"edges":[{"to_node_id":"-2916:instruments","from_node_id":"-1118:data"},{"to_node_id":"-2916:features","from_node_id":"-2574:data"},{"to_node_id":"-168:features","from_node_id":"-2574:data"},{"to_node_id":"-168:input_data","from_node_id":"-2916:data"},{"to_node_id":"-35:input_data","from_node_id":"-168:data"}],"nodes":[{"node_id":"-1118","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2021-08-02","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-09-02","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_FUTURE","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"RM2201.CZC","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-1118"}],"output_ports":[{"name":"data","node_id":"-1118"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-2574","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nopen=open_0/adjust_factor_0\nhigh=high_0/adjust_factor_0\nlow=low_0/adjust_factor_0\nclose=close_0/adjust_factor_0\namount=amount_0/adjust_factor_0\nma5=mean(close,5)\nvolume=volume_0/adjust_factor_0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-2574"}],"output_ports":[{"name":"data","node_id":"-2574"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-2916","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":"10","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-2916"},{"name":"features","node_id":"-2916"}],"output_ports":[{"name":"data","node_id":"-2916"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-168","module_id":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","parameters":[{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"drop_na","value":"False","type":"Literal","bound_global_parameter":null},{"name":"remove_extra_columns","value":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-168"},{"name":"features","node_id":"-168"}],"output_ports":[{"name":"data","node_id":"-168"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-35","module_id":"BigQuantSpace.plot_dataframe.plot_dataframe-v1","parameters":[{"name":"title","value":"时间序列图","type":"Literal","bound_global_parameter":null},{"name":"chart_type","value":"candlestick","type":"Literal","bound_global_parameter":null},{"name":"x","value":"date","type":"Literal","bound_global_parameter":null},{"name":"y","value":"open ,high ,low,close,amount,ma5","type":"Literal","bound_global_parameter":null},{"name":"options","value":"{\n \"chart\": {\"height\": 600},\n \"yAxis\": [\n {\"tilte\": {\"text\": \"价格\"}},\n {\"tilte\": {\"text\": \"成交额\"},\"top\": \"45%\", \"height\": \"50%\",\"offset\":0}\n ],\n 'series': [\n {'yAxis': 0},\n {'type': 'column','yAxis':1},\n {'data':[m5.data.read()[['date']],m5.data.read()[['ma5']]],'type':'spline','yAxis':0}]\n}","type":"Literal","bound_global_parameter":null},{"name":"candlestick","value":"True","type":"Literal","bound_global_parameter":null},{"name":"pane_1","value":"","type":"Literal","bound_global_parameter":null},{"name":"pane_2","value":"","type":"Literal","bound_global_parameter":null},{"name":"pane_3","value":"","type":"Literal","bound_global_parameter":null},{"name":"pane_4","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-35"}],"output_ports":[],"cacheable":false,"seq_num":6,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-1118' Position='251,-2,200,200'/><node_position Node='-2574' Position='545,-6,200,200'/><node_position Node='-2916' Position='443,164,200,200'/><node_position Node='-168' Position='651.1368408203125,279.4560241699219,200,200'/><node_position Node='-35' Position='625.0488891601562,401.114013671875,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [1]:
    # 本代码由可视化策略环境自动生成 2021年9月14日 15:45
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.instruments.v2(
        start_date='2021-08-02',
        end_date='2021-09-02',
        market='CN_FUTURE',
        instrument_list='RM2201.CZC',
        max_count=0
    )
    
    m3 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    open=open_0/adjust_factor_0
    high=high_0/adjust_factor_0
    low=low_0/adjust_factor_0
    close=close_0/adjust_factor_0
    amount=amount_0/adjust_factor_0
    ma5=mean(close,5)
    volume=volume_0/adjust_factor_0"""
    )
    
    m4 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m3.data,
        start_date='',
        end_date='',
        before_start_days=10
    )
    
    m5 = M.derived_feature_extractor.v3(
        input_data=m4.data,
        features=m3.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m6 = M.plot_dataframe.v1(
        input_data=m5.data,
        title='时间序列图',
        chart_type='candlestick',
        x='date',
        y='open ,high ,low,close,amount,ma5',
        options={
        "chart": {"height": 600},
        "yAxis": [
                  {"tilte": {"text": "价格"}},
                  {"tilte": {"text": "成交额"},"top": "45%", "height": "50%","offset":0}
                 ],
        'series': [
                   {'yAxis': 0},
                   {'type': 'column','yAxis':1},
                   {'data':[m5.data.read()[['date']],m5.data.read()[['ma5']]],'type':'spline','yAxis':0}]
    },
        candlestick=True,
        pane_1='',
        pane_2='',
        pane_3='',
        pane_4=''
    )
    
    ---------------------------------------------------------------------------
    Exception                                 Traceback (most recent call last)
    <ipython-input-1-0ac6347dbbba> in <module>
         24 )
         25 
    ---> 26 m4 = M.general_feature_extractor.v7(
         27     instruments=m1.data,
         28     features=m3.data,
    
    Exception: no features extracted.
    In [ ]: