如何用BigQuant查询某一公司的流动资产、流动负债等数据

新手专区
标签: #<Tag:0x00007f8c5ffd4e98>

(DDDDlx) #1

有大神知道怎么调用某上市公司的流动资产、流动负债等数据吗?


(小Q) #2

相关帖子:BigQuant数据API详解

DataSource模块帮助文档:链接

克隆策略

    {"Description":"实验创建于2017/10/17","Summary":"","Graph":{"EdgesInternal":[],"ModuleNodes":[{"Id":"-8","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n \n ins = ['000001.SZA', '600519.SHA'] # 证券列表\n start_date = '2017-10-14'#开始日期\n end_date ='2017-10-17'# 结束日期\n fields = ['fs_current_assets_0','fs_current_liabilities_0'] # 流动资产和流动负债\n df = D.features(ins,start_date,end_date,fields) # 获取数据\n ds = DataSource.write_df(df) #保存为datasource\n return Outputs(data_1=ds, data_2=None, data_3=None)\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-8"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-8"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-8"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-8","OutputType":null},{"Name":"data_2","NodeId":"-8","OutputType":null},{"Name":"data_3","NodeId":"-8","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"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='-8' Position='301.0234375,170.515625,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":false}
    In [20]:
    # 本代码由可视化策略环境自动生成 2017年10月17日 20:53
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m1_run_bigquant_run(input_1, input_2, input_3):
        
        ins =  ['000001.SZA', '600519.SHA'] # 证券列表
        start_date = '2017-10-14'#开始日期
        end_date ='2017-10-17'# 结束日期
        fields = ['fs_current_assets_0','fs_current_liabilities_0'] # 流动资产和流动负债
        df = D.features(ins,start_date,end_date,fields) # 获取数据
        ds = DataSource.write_df(df) #保存为datasource
        return Outputs(data_1=ds, data_2=None, data_3=None)
    
    m1 = M.cached.v3(
        run=m1_run_bigquant_run
    )
    
    [2017-10-17 20:52:52.004503] INFO: bigquant: cached.v3 开始运行..
    [2017-10-17 20:52:52.007241] INFO: bigquant: 命中缓存
    [2017-10-17 20:52:52.008312] INFO: bigquant: cached.v3 运行完成[0.003823s].
    
    In [21]:
    m1.data_1.read_df() # 有些公司(金融行业)没有流动资产和流动负债
    
    Out[21]:
    date fs_current_assets_0 instrument fs_current_liabilities_0
    0 2017-10-16 NaN 000001.SZA NaN
    1 2017-10-16 9.739779e+10 600519.SHA 4.130392e+10
    2 2017-10-17 NaN 000001.SZA NaN
    3 2017-10-17 9.739779e+10 600519.SHA 4.130392e+10

    策略研究常用功能