FAQ > 金融建模 > 数据提取 > 基本面数据

Q: 天软如何得到上市公司的企业性质?比如:国企/央企/私企等等?    

  • A:天软目前没有该数据。

    若需要通过中证一些相关指数(如中证国有企业综合指数等)的成份股来判断,我们可以实现如下:
    注:该种方式依赖指数权重数据,不能判断出所有股票的企业性质,仅供参考使用

    第一步:封装 getstockOwnership(stockid,endt)函数如下:
    做了缓存处理,提高运行效率。
    Function getstockOwnership(stockid,endt);
    begin
     t1:=static getIndexWet('SH000955',endt) name "_getIndexOwnership_"$'SH000955'$endt;//国企
     if stockid in t1 then return "国企";
     t2:=static getIndexWet('SH000926',endt) name "_getIndexOwnership_"$'SH000926'$endt;//央企
     if stockid in t2 then return "央企";
     t3:=static getIndexWet('SH000953',endt) name "_getIndexOwnership_"$'SH000953'$endt;//地企
     if stockid in t3 then return "地企";
     t4:=static getIndexWet('SH000938',endt) name "_getIndexOwnership_"$'SH000938'$endt;//民企
     if stockid in t4 then return "民企";
     return "未知";
    end
    Function getIndexWet(Index,endt);
    begin
     GetBkWeightbydate(Index,endt,t);
     if istable(t) then
      return t[:,"代码"];
     else return array();
    end

    第二步:调用取数
    示例1:取个股
    return getstockOwnership("SH600519",20260617T); //国企

    示例2:取指定日所有A股
    endt:=20260617T;
    stocks:=getAbkbydate('A股',endt);
    t:= select thisrow as "sid",stockname(thisrow) as "sname",getstockOwnership(thisrow,endt) as "企业性质"
    from stocks end;
    return t;

    返回:其中,企业性质为“未知”的即为无法判断的。