如何在2017年9月6日之后从多个股票的Google财经API获取数据

时间:2017-09-11 13:20:18

标签: python api google-finance stockquotes

9月6日之后

我正在开展一个项目,我希望通过Google财经API显示多个股票的实时价格,其中包含change change in % volume Timestamp of data

等信息

ROI/EROANet-profit-margin这样的比率很少 - 这是完全可选的。 (如果可用的话,如果不是那么令人惊讶,那么仍然没有太多问题。)

在效率方面,发送每个库存的一个请求是荒谬的。

我尝试了多项内容,例如

https://finance.google.com/finance?q=NSE:ABAN,NSE:ABB&output=json

这给了我股票的基本信息,但不是实时价格。

https://finance.google.com/finance?q=NSE:ABAN,ABB&output=json

此查询刚刚确认存在名称为ABAN的股票。

我对NSE(印度国家证券交易所)的数据感兴趣。 我已经为这件事情经历了2-3个主题,但无法获得更多信息, 雅虎也停止了对印度市场的支持,因此该选项也被列入了该列表。

该项目是学术性的,所以如果可能的话,我想要一个免费的数据来源。

对此的任何帮助都会非常感激。

1 个答案:

答案 0 :(得分:4)

更新:谷歌杀了它。

您可以执行以下操作:

  1. 查询您需要的股票的ID(您可以执行此操作一次,ID似乎是永久性的):
  2. https://finance.google.com/finance?output=json&q= ,, ...(每个查询最多14个股票)

    输出将包含您应该收集的“id”字段。 例如:

    {...
    "searchresults" : [
    {
    "title" : "Aban Offshore Ltd",
    "id" : "3302534",
    "ticker" : "ABAN",
    "exchange" : "NSE",
    ...
    } , {
    "title" : "ABB India Ltd",
    "id" : "5296497",
    "ticker" : "ABB",
    "exchange" : "NSE",
    ...
    }]
    ...
    
    1. 使用ID查询信息:
    2. https://finance.google.com/finance/data?dp=mra&output=json&catid=all&cid=3302534,5296497,...(不知道限制但超过14个ID)

      输出将包含有关每个ID的信息

      {...,company:{related:{cols:[...],
      rows:[
      {id:"3302534",
      values:["3302534","ABAN","Aban Offshore Ltd","ABAN","NSE","INR","178.35","+0.40","chg","0.22","","-184.19","","0.39","0.59","10.41B","","0.00","","0.63","63.15","74.78","448.77","531.41","-5.34","-32.89","-6.46","1.40","-59.21","93.14","52.77","12.88","1,275","17,579.20","-10,408.33","9,275.71"]},
      {id:"5296497",
      values:["5296497","ABB","ABB India Ltd","ABB","NSE","INR","1,365.20","+24.00","chg","1.79","","17.88","76.36","8.66","3.09","289.56B","","4.00","0.30","1.56","7.76","7.76","18.28","18.28","4.95","11.90","9.86","1.43","4.08","32.94","7.56","5.92","5,603","91,840.50","3,744.70","6,945.30"]}],
      visible_cols:[...]}}}
      

      列是:ID,Ticker,Name,Ticker,Exchange,Currency,Price,Change,Unknown,Change%,Unknown,EPS,PE,PB,PS,Cap,EntValue,Div,DivYield,CurrRatio,LtDebtToAssets, TotalDebtToAssets,LtDebtToEquity,TotalDebtToEquity,ReturnOnAvgAssets,ReturnOnAvgEquity,ReturnOnAvgInvestment,Beta,NetProfitMargin,GrossMargin,EBITDMargin,OperatingMargin,Employees,Revenue,NetIncome,EBITDA

      不幸的是,没有延长的会话价格或任何最后的交易时间。 如果您知道如何获得股票的最后交易时间,请告诉我。