Does Python has a similar library like quantmod in R that can download financial statement data? I want to download the historical revenue of each stock in Python. Can someone give me a hint? Thanks.
Asked
Active
Viewed 1.2k times
10
-
With urrlib2 you can download anything – Denis Aug 16 '13 at 14:17
2 Answers
16
Yes a lot of them, zipline, pandas and even matplotlib can download data from Yahoo Finance. I recommend you use pandas:
>>> from pandas_datareader.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 49.982655
2004-08-20 53.952770
2004-08-23 54.495735
2004-08-24 52.239197
2004-08-25 52.802086
...

Arkadii Kuznetsov
- 479
- 5
- 13

elyase
- 39,479
- 12
- 112
- 119
-
-
You can also try QSTK package `http://wiki.quantsoftware.org/index.php?title=QuantSoftware_ToolKit` There was a entire free online course using this, goolge, Computational Investing, Part I (coursera) – Ahdee Oct 28 '13 at 14:09
3
Rather than build your own system with urllib2, you can use rpy2
to load the actual quantmod package through R into Python. It's somewhat convoluted, but it'll get you the exact quantmod data you're looking for.
-
2I tried using rpy2 before and as you say found it convoluted. I now use python to write a CSV, then load that in R. OP here can do the opposite and download the data in R, write to a CSV, and then use it from python. – appleLover Aug 16 '13 at 17:43
-
-