Skip to content

Commit 70baac7

Browse files
committed
Merge pull request #5602 from dstephens99/master
ENH: Added method to pandas.data.Options to download all option data for...
2 parents 7a2db77 + 2ba5ead commit 70baac7

File tree

7 files changed

+1154
-104
lines changed

7 files changed

+1154
-104
lines changed

doc/source/release.rst

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ performance improvements along with a large number of bug fixes.
5555

5656
Highlights include:
5757

58+
Experimental Features
59+
~~~~~~~~~~~~~~~~~~~~~
60+
- ``pandas.io.data.Options`` has a get_all_data method and now consistently returns a multi-indexed ''DataFrame'' (:issue:`5602`)
61+
5862
See the :ref:`v0.14.1 Whatsnew <whatsnew_0141>` overview or the issue tracker on GitHub for an extensive list
5963
of all API changes, enhancements and bugs that have been fixed in 0.14.1.
6064

doc/source/remote_data.rst

+37
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,43 @@ Yahoo! Finance
5252
f=web.DataReader("F", 'yahoo', start, end)
5353
f.ix['2010-01-04']
5454
55+
.. _remote_data.yahoo_Options:
56+
57+
Yahoo! Finance Options
58+
----------------------
59+
***Experimental***
60+
61+
The Options class allows the download of options data from Yahoo! Finance.
62+
63+
The ''get_all_data'' method downloads and caches option data for all expiry months
64+
and provides a formatted ''DataFrame'' with a hierarchical index, so its easy to get
65+
to the specific option you want.
66+
67+
.. ipython:: python
68+
69+
from pandas.io.data import Options
70+
aapl = Options('aapl', 'yahoo')
71+
data = aapl.get_all_data()
72+
data.head()
73+
74+
#Show the $600 strike puts at all expiry dates:
75+
data.loc[(600, slice(None), 'put'),:].head()
76+
77+
#Show the volume traded of $600 strike puts at all expiry dates:
78+
data.loc[(600, slice(None), 'put'),'Vol'].head()
79+
80+
If you don't want to download all the data, more specific requests can be made.
81+
82+
.. ipython:: python
83+
84+
import datetime
85+
expiry = datetime.date(2016, 1, 1)
86+
data = aapl.get_call_data(expiry=expiry)
87+
data.head()
88+
89+
Note that if you call ''get_all_data'' first, this second call will happen much faster, as the data is cached.
90+
91+
5592
.. _remote_data.google:
5693

5794
Google Finance

doc/source/v0.14.1.txt

+17-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,23 @@ Performance
148148
Experimental
149149
~~~~~~~~~~~~
150150

151-
There are no experimental changes in 0.14.1
151+
``pandas.io.data.Options`` has a get_all_data method and now consistently returns a multi-indexed ''DataFrame'' (PR `#5602`)
152+
See :ref:`the docs<remote_data.yahoo_Options>` ***Experimental***
153+
154+
.. ipython:: python
155+
156+
from pandas.io.data import Options
157+
aapl = Options('aapl', 'yahoo')
158+
data = aapl.get_all_data()
159+
data.head()
160+
161+
.. ipython:: python
162+
163+
from pandas.io.data import Options
164+
aapl = Options('aapl', 'yahoo')
165+
data = aapl.get_all_data()
166+
data.head()
167+
152168

153169
.. _whatsnew_0141.bug_fixes:
154170

0 commit comments

Comments
 (0)