2013-08-16 25 views

回答

7

是的很多,ziplinepandas甚至matplotlib可以從雅虎財經下載數據。我建議你使用熊貓:

>>> from pandas.io.data import DataReader 
>>> from datetime import datetime 

>>> goog = DataReader("GOOG", "yahoo", datetime(2000,1,1), datetime(2012,1,1)) 
>>> goog["Adj Close"] 
Date 
2004-08-19 100.34 
2004-08-20 108.31 
2004-08-23 109.40 
2004-08-24 104.87 
2004-08-25 106.00 
... 
+0

哦,我忘了熊貓可以做到這一點。 – Andrew

+0

您也可以嘗試QSTK包'http://wiki.quantsoftware.org/index.php?title=QuantSoftware_ToolKit'有一個完整的免費在線課程,使用這個,goolge,Computational Investing,Part I(coursera) – Ahdee

0

而不是用urllib2,you can use rpy2 to load the actual quantmod package through R into Python構建自己的系統。這有點令人費解,但它會爲您提供您正在尋找的確切的Quantmod數據。

+2

我嘗試過和你說發現它令人費解使用rpy2。我現在使用python編寫CSV,然後在R中加載。在這裏,OP可以做相反的處理,並在R中下載數據,寫入CSV,然後在python中使用它。 – appleLover

+0

或者只是使用熊貓:) – Andrew

+0

好像熊貓不能給你日本的交換數據。 – jason

相關問題