证券代码列表和数据源模块的使用问题


(jijingling777) #1

将证券代码列表作为输入链接数据源模块,执行后报错:

[2019-11-01 10:12:53.153870] INFO: bigquant: instruments.v2 开始运行..

[2019-11-01 10:12:53.229164] INFO: bigquant: 命中缓存

[2019-11-01 10:12:53.232112] INFO: bigquant: instruments.v2 运行完成[0.078245s].

[2019-11-01 10:12:53.236057] INFO: bigquant: use_datasource.v1 开始运行..

[2019-11-01 10:12:53.351633] ERROR: bigquant: module name: use_datasource, module version: v1, trackeback: Traceback (most recent call last): AttributeError: 'NoneType' object has no attribute 'to_hdf'

m2 = M.instruments.v2(
    start_date='2015-01-01',
    end_date='2018-01-01',
    market='CN_STOCK_A',
    instrument_list='000300.HIX',
    max_count=0
)

m11 = M.use_datasource.v1(
    instruments=m2.data,
    datasource_id='test',
    start_date='2015-01-01',
    end_date='2018-01-01',
    m_cached=False

(jijingling777) #2
克隆策略

    {"Description":"实验创建于2019/1/21","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-251:instruments","SourceOutputPortId":"-184:data"}],"ModuleNodes":[{"Id":"-184","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2015-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"000300.HIX","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-184"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-184","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"Comment":"","CommentCollapsed":true},{"Id":"-251","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"test","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"2015-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-251"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-251"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-251","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":11,"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='-184' Position='424,-41,200,200'/><NodePosition Node='-251' Position='419.4427490234375,103.55715942382812,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 [53]:
    # 本代码由可视化策略环境自动生成 2019年11月1日 10:14
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.instruments.v2(
        start_date='2015-01-01',
        end_date='2018-01-01',
        market='CN_STOCK_A',
        instrument_list='000300.HIX',
        max_count=0
    )
    
    m11 = M.use_datasource.v1(
        instruments=m2.data,
        datasource_id='test',
        start_date='2015-01-01',
        end_date='2018-01-01',
        m_cached=False
    )
    
    err msg: test is not found.
    

    数据源(use_datasource)使用错误,你可以:

    1.一键查看文档

    2.一键搜索答案

    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-53-3280f1f47ae7> in <module>()
         16     start_date='2015-01-01',
         17     end_date='2018-01-01',
    ---> 18     m_cached=False
         19 )
    
    AttributeError: 'NoneType' object has no attribute 'to_hdf'

    查看结果

    大盘的5日收益率计算值与其余抽取的因子合并在一张表中,如下所示

    In [ ]:
    m8.data.read_df()
    

    (达达) #3

    数据源模块的id填入test有什么根据么,我们并没有这个表名


    (jijingling777) #4

    这个字段应该填写什么名字?没有在教程中看到相关限定的介绍和描述


    (达达) #5

    您在宽客学院仔细阅读一下数据API模块相关内容,起码数据的获取,AI模型的构建和回测引擎的四个函数和两个全局变量搞熟悉了才能说你了解了平台使用。只是上手了一个模版策略构建还不足以驾驭,多看看教程。

    这么大的版面介绍数据的。。。。

    您在学习中还会看不懂回测模块可能还会提问题,那么请仔细阅读网站提供的文档

    我们的内容较多请耐心通览