BUG: Fix pandas.io.data.Options for change in format of Yahoo Option page by davidastephens · Pull Request #8631 · pandas-dev/pandas (original) (raw)
Yes, it shows a deprecation warning now.
It defaults to the next expiry if no date arguments are given. If you give a date, it gives the you next expiry after that date. If you give a month and year, it gives you the 'standard' third saturday expiry.
Here is an example:
from pandas.io.data import Options
aapl = Options('aapl', 'yahoo')
aapl.get_call_data(month=11,year=2014).iloc[0:5,0:5]
pandas/io/data.py:939: FutureWarning: month, year arguments are deprecated, use expiry instead
" instead", FutureWarning)
Out[4]:
Last Bid Ask Chg PctChg
Strike Expiry Type Symbol
47.5 2014-11-22 call AAPL141122C00047500 58.65 58.85 60.90 0 0.00%
50.0 2014-11-22 call AAPL141122C00050000 53.90 56.35 58.40 0 0.00%
55.0 2014-11-22 call AAPL141122C00055000 44.50 51.35 53.05 0 0.00%
60.0 2014-11-22 call AAPL141122C00060000 36.85 46.35 48.05 0 0.00%
65.0 2014-11-22 call AAPL141122C00065000 34.95 41.35 43.05 0 0.00%
aapl.get_call_data().iloc[0:5,0:5]
Out[6]:
Last Bid Ask Chg PctChg
Strike Expiry Type Symbol
75 2014-10-31 call AAPL141031C00075000 31.15 32.15 32.55 0.00 0.00%
80 2014-10-31 call AAPL141031C00080000 26.25 27.15 27.50 0.00 0.00%
85 2014-10-31 call AAPL141031C00085000 22.20 22.20 22.45 0.63 +2.92%
86 2014-10-31 call AAPL141031C00086000 19.00 20.35 22.40 0.00 0.00%
87 2014-10-31 call AAPL141031C00087000 20.15 20.15 20.45 1.95 +10.71%
import datetime expiry = datetime.date(2014,11,10)
aapl.get_call_data(expiry=expiry).iloc[0:5,0:5]
Out[8]:
Last Bid Ask Chg PctChg
Strike Expiry Type Symbol
80 2014-11-14 call AAPL141114C00080000 22.75 26.35 28.40 0 0.00%
84 2014-11-14 call AAPL141114C00084000 20.99 22.35 24.40 0 0.00%
85 2014-11-14 call AAPL141114C00085000 21.30 21.35 23.40 0 0.00%
86 2014-11-14 call AAPL141114C00086000 16.08 20.35 22.45 0 0.00%
87 2014-11-14 call AAPL141114C00087000 18.10 19.35 21.45 0 0.00%