用Excel抓Yahoo Finance歷史股價 - 股票
By Skylar Davis
at 2017-11-03T23:18
at 2017-11-03T23:18
Table of Contents
※ 引述《bamboo1106 (bamboo)》之銘言:
: http://www.pythonclub.org/project/yahoo-data-api
: 請問之前有使用版上大大提供的excel 範例檔
: 可以直接下載即時的股票報價
: 可是最近檔案已經無法下載報價了,
: 按下 download data 後都會顯示執行階段錯誤 1004
: 請問這是 yahoo 方面的問題嗎?
: 有沒有其他的方法可以解決呢?
: 這個檔案幫忙非常大
: 現在只能一筆一筆查,
: 是不是有大大知道的麻煩提供如何解決的方法
: 謝謝。
可以採用 Google Spreadsheet 來處理。
開一個 Google 試算表:
A B
1 統一超 275
=GOOGLEFINANCE("TPE:2912", "price")
2 KO 46.01
=GOOGLEFINANCE("KO", "price")
只要輸入上面的 function,就會自動抓值
在檔案選單的上方選擇共用 -> 知道連結的人均可以檢視 ->
抄錄所顯示的連結,大概長得像
https://docs.google.com/spreadsheets/d/XXXXXXXXXXX/edit?usp=sharing
然後開 Excel -> 選上面的資料 -> 從 Web
輸入上面的連結
大概等一下,
就會顯示一堆文字,
往右下方找,就會看到股價
在 Google spreadsheet 改一些文字,
按全部重新整理,
會看到新的文字有順利抓下來。
這樣就能抓資料進 Excel 了
註:補充,如何自動取得最新的股利
=INDEX(SPLIT(INDEX(IMPORTHTML("https://www.google.com/finance?q="&A2,"table",3),1,2),"/"),1,1)
在 (A,2) 的位置,放股票名稱,像是 TPE:2912
主要參考來源:
https://productforums.google.com/forum/#!topic/docs/kxyWev26k3c
--
: http://www.pythonclub.org/project/yahoo-data-api
: 請問之前有使用版上大大提供的excel 範例檔
: 可以直接下載即時的股票報價
: 可是最近檔案已經無法下載報價了,
: 按下 download data 後都會顯示執行階段錯誤 1004
: 請問這是 yahoo 方面的問題嗎?
: 有沒有其他的方法可以解決呢?
: 這個檔案幫忙非常大
: 現在只能一筆一筆查,
: 是不是有大大知道的麻煩提供如何解決的方法
: 謝謝。
可以採用 Google Spreadsheet 來處理。
開一個 Google 試算表:
A B
1 統一超 275
=GOOGLEFINANCE("TPE:2912", "price")
2 KO 46.01
=GOOGLEFINANCE("KO", "price")
只要輸入上面的 function,就會自動抓值
在檔案選單的上方選擇共用 -> 知道連結的人均可以檢視 ->
抄錄所顯示的連結,大概長得像
https://docs.google.com/spreadsheets/d/XXXXXXXXXXX/edit?usp=sharing
然後開 Excel -> 選上面的資料 -> 從 Web
輸入上面的連結
大概等一下,
就會顯示一堆文字,
往右下方找,就會看到股價
在 Google spreadsheet 改一些文字,
按全部重新整理,
會看到新的文字有順利抓下來。
這樣就能抓資料進 Excel 了
註:補充,如何自動取得最新的股利
=INDEX(SPLIT(INDEX(IMPORTHTML("https://www.google.com/finance?q="&A2,"table",3),1,2),"/"),1,1)
在 (A,2) 的位置,放股票名稱,像是 TPE:2912
主要參考來源:
https://productforums.google.com/forum/#!topic/docs/kxyWev26k3c
--
Tags:
股票
All Comments
By Thomas
at 2017-11-06T01:15
at 2017-11-06T01:15
By Adele
at 2017-11-08T20:11
at 2017-11-08T20:11
By Mason
at 2017-11-13T18:05
at 2017-11-13T18:05
By Michael
at 2017-11-14T11:06
at 2017-11-14T11:06
By John
at 2017-11-14T16:07
at 2017-11-14T16:07
By Tracy
at 2017-11-15T23:18
at 2017-11-15T23:18
By Hedy
at 2017-11-16T09:52
at 2017-11-16T09:52
By Necoo
at 2017-11-18T06:27
at 2017-11-18T06:27
By Edwina
at 2017-11-20T02:08
at 2017-11-20T02:08
By Kumar
at 2017-11-24T02:29
at 2017-11-24T02:29
By Megan
at 2017-11-25T01:15
at 2017-11-25T01:15
By Delia
at 2017-11-26T21:32
at 2017-11-26T21:32
By Todd Johnson
at 2017-11-29T06:53
at 2017-11-29T06:53
By Dorothy
at 2017-12-02T10:51
at 2017-12-02T10:51
By Jacky
at 2017-12-07T03:50
at 2017-12-07T03:50
By Ingrid
at 2017-12-10T16:38
at 2017-12-10T16:38
By Hamiltion
at 2017-12-14T06:59
at 2017-12-14T06:59
By Bethany
at 2017-12-18T07:26
at 2017-12-18T07:26
By Zenobia
at 2017-12-18T22:50
at 2017-12-18T22:50
By Sarah
at 2017-12-23T04:53
at 2017-12-23T04:53
By Iris
at 2017-12-24T03:57
at 2017-12-24T03:57
By Jacob
at 2017-12-27T12:03
at 2017-12-27T12:03
By Queena
at 2017-12-28T02:23
at 2017-12-28T02:23
By Anthony
at 2017-12-28T12:11
at 2017-12-28T12:11
By Selena
at 2018-01-01T15:23
at 2018-01-01T15:23
By Wallis
at 2018-01-06T11:02
at 2018-01-06T11:02
By Christine
at 2018-01-09T03:33
at 2018-01-09T03:33
By Olivia
at 2018-01-10T04:33
at 2018-01-10T04:33
By Hedwig
at 2018-01-11T11:19
at 2018-01-11T11:19
By Quintina
at 2018-01-13T21:28
at 2018-01-13T21:28
Related Posts
創意3443 多
By Leila
at 2017-11-03T23:03
at 2017-11-03T23:03
台船面臨16年來最大虧損 將減資再增資
By Anonymous
at 2017-11-03T22:35
at 2017-11-03T22:35
蔡慶年黯然下台 成敗都在第一金
By Harry
at 2017-11-03T22:12
at 2017-11-03T22:12
第一金踩慶富案地雷 潛在最大損失45.5億
By Tristan Cohan
at 2017-11-03T21:56
at 2017-11-03T21:56
康普第三季合併財報,前3季每股盈餘3.92
By Zenobia
at 2017-11-03T21:44
at 2017-11-03T21:44