2018年8月3日 星期五

Google Finance 財務函數 BND、00679B 報價錯誤

在Google 試算表中有個相當不錯的Finance財務函數可以使用,例如:

=GoogleFinance("VTI","PRICE") 可以查詢 Vanguard total bond market 的報價

=GoogleFinance("TPE:0050","PRICE") 可以查詢台灣交易所ETF0050 的報價

https://support.google.com/docs/answer/3093281

在上方連結有相當清楚的說明,但是最近似乎有些奇怪的錯誤,可能是最近加入了其他國家的股市代號資料的關係,在google engine 上也可以看到,當輸入 bnd時,查到的並不是 Vanguard Total Bond Market的資料,可見資料庫也因此錯誤。

正因為如此,在Google討論版上有人也想到了一些替代的方案,例如用import html or xml data select table column number or id name 的方式,利用其他網站的資料來擷取收盤價格,例如:

EX1:
=Index(ImportHtml("http://bigcharts.marketwatch.com/advchart/frames/frames.asp?symb=BND","table"),3,1)


Ex2:
=importxml("http://etfs.morningstar.com/quote-banner?t=BND","//div[@id='lastPrice'] ")

Ex2:(去掉不要的字串)
=VALUE(Substitute(Index(ImportHtml("http://bigcharts.marketwatch.com/advchart/frames/frames.asp?symb="&A17, "table"),3,1),"Last:",""))


這樣都可以擷取到 BND Last price。這是目前取代google finance 無法使用的替代方案。


3 則留言:

Unknown 提到...

感謝你這篇文章,最近在查詢BNDW即時報價,用GOOGLEFINANCE卻顯示error message #N/A,讓我很苦惱。

Unknown 提到...

感謝你這篇文章,最近在查詢BNDW即時報價,用GOOGLEFINANCE卻顯示error message #N/A,讓我很苦惱。

huang 提到...

很高興有幫助到你!

熱門文章