Skip to content

Commit 5a58f04

Browse files
committed
Merge pull request #8631 from dstephens99/issue8612
BUG: Fix pandas.io.data.Options for change in format of Yahoo Option page
2 parents c3dd032 + 90edae6 commit 5a58f04

File tree

6 files changed

+12100
-914
lines changed

6 files changed

+12100
-914
lines changed

doc/source/remote_data.rst

+22-1
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,29 @@ If you don't want to download all the data, more specific requests can be made.
8686
data = aapl.get_call_data(expiry=expiry)
8787
data.iloc[0:5:, 0:5]
8888
89-
Note that if you call ``get_all_data`` first, this second call will happen much faster, as the data is cached.
89+
Note that if you call ``get_all_data`` first, this second call will happen much faster,
90+
as the data is cached.
9091

92+
If a given expiry date is not available, data for the next available expiry will be
93+
returned (January 15, 2015 in the above example).
94+
95+
Available expiry dates can be accessed from the ``expiry_dates`` property.
96+
97+
.. ipython:: python
98+
99+
aapl.expiry_dates
100+
data = aapl.get_call_data(expiry=aapl.expiry_dates[0])
101+
data.iloc[0:5:, 0:5]
102+
103+
A list-like object containing dates can also be passed to the expiry parameter,
104+
returning options data for all expiry dates in the list.
105+
106+
.. ipython:: python
107+
108+
data = aapl.get_near_stock_price(expiry=aapl.expiry_dates[0:3])
109+
data.iloc[0:5:, 0:5]
110+
111+
The ``month`` and ``year`` parameters can be used to get all options data for a given month.
91112

92113
.. _remote_data.google:
93114

doc/source/whatsnew/v0.15.1.txt

+33
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,39 @@ API changes
169169

170170
- added Index properties `is_monotonic_increasing` and `is_monotonic_decreasing` (:issue:`8680`).
171171

172+
.. note:: io.data.Options has been fixed for a change in the format of the Yahoo Options page (:issue:`8612`)
173+
174+
As a result of a change in Yahoo's option page layout, when an expiry date is given,
175+
``Options`` methods now return data for a single expiry date. Previously, methods returned all
176+
data for the selected month.
177+
178+
The ``month`` and ``year`` parameters have been undeprecated and can be used to get all
179+
options data for a given month.
180+
181+
If an expiry date that is not valid is given, data for the next expiry after the given
182+
date is returned.
183+
184+
Option data frames are now saved on the instance as ``callsYYMMDD`` or ``putsYYMMDD``. Previously
185+
they were saved as ``callsMMYY`` and ``putsMMYY``. The next expiry is saved as ``calls`` and ``puts``.
186+
187+
New features:
188+
189+
The expiry parameter can now be a single date or a list-like object containing dates.
190+
191+
A new property ``expiry_dates`` was added, which returns all available expiry dates.
192+
193+
current behavior:
194+
195+
.. ipython:: python
196+
197+
from pandas.io.data import Options
198+
aapl = Options('aapl','yahoo')
199+
aapl.get_call_data().iloc[0:5,0:1]
200+
aapl.expiry_dates
201+
aapl.get_near_stock_price(expiry=aapl.expiry_dates[0:3]).iloc[0:5,0:1]
202+
203+
See the Options documentation in :ref:`Remote Data <remote_data.yahoo_options>`
204+
172205
.. _whatsnew_0151.enhancements:
173206

174207
Enhancements

0 commit comments

Comments
 (0)