2010年12月1日 星期三

Google Stock 股市API

跟據
http://googlefinanceblog.blogspot.com/2008/04/taiwan-stock-exchange-pricing-data.html
可以得知在2008Google的Stock API就已經有台灣股市的資料了使用方式就是把後面改成
TPE:代號 或是 代號.TW

查詢方式如下:(以2454聯發科)為例
http://finance.google.com/finance/info?client=ig&q=TPE:2454

得到的結果
// [ { "id": "683538" ,"t" : "2454" ,"e" : "TPE" ,"l" : "391.50" ,"l_cur" : "NT$391.50" ,"ltt":"1:30PM Taipei" ,"lt" : "Dec 1, 1:30PM Taipei" ,"c" : "+1.00" ,"cp" : "0.26" ,"ccol" : "chg" } ]

看得出來是個JSON格式的file
t就是代號
"l_cur":成交價格
"ltt":時間
"lt":日期時間
"c":漲跌
"cp":漲跌幅


其他資訊可以參考
http://stackoverflow.com/questions/527703/google-financial-api-how-get-stock-quotes

Google Finance API docs
http://code.google.com/intl/zh-TW/apis/finance/docs/2.0/reference.html

1 則留言:

small jj 提到...

http://finance.google.com/finance/info?client=ig&q=TPE:2454 是適用於上市股票,但是對於上櫃股票是沒有response 回傳值
. 例如 : http://finance.google.com/finance/info?client=ig&q=TPE:6244 (茂迪)

謝謝您