2017-09-11 76 views
0

帖子9月6日如何從谷歌財經API後2017年9月6日獲取數據的多支股票

我工作的一個項目,我想從谷歌財經API顯示實時價格多股票有類似的信息changechange in %volumeTimestamp 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線程爲這件事情,但無法獲得太多的信息, 也雅虎停止支持印度市場,所以這個選項也被列入名單。

該項目是學術性的,所以我想要一個免費的數據源,如果可能的話。

任何有關這方面的幫助將非常感激。

回答

4

你可以做以下伎倆:

  1. 查詢標識您需要的股票(你可以做到這一次,標識似乎是永久的):

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", 
... 
}] 
... 
使用的ID
  • 查詢信息:
  • 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,北京時間,姓名,股票代碼,交易所,貨幣, 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,員工,收入,淨收入,EBITDA

    不幸的是,沒有延長會議價格e或任何最後的交易時間。 如果你知道如何獲得股票的最後交易時間,請讓我知道。

    +0

    首先非常感謝您的詳細描述,我只想確認您是否已經爲列發佈了正確的順序(第二種方法)?還有什麼方法可以驗證這一點? –

    +0

    這些列是通過比較json的數據和財務頁面上的數據得出的。我希望可以有更可靠的消息來源,但我目前還沒有發現更好的東西。 – Alex

    +0

    謝謝你,這幫了我很多。 –

    相關問題