Skip to content

BUG: Fix breaking API change in yahoo options #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pandas_datareader/tests/test_google_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def test_get_options_data(self):

self.assert_option_result(options)

for typ in options.index.levels[2]:
self.assertTrue(typ in ['put', 'call'])

def test_get_options_data_yearmonth(self):
with tm.assertRaises(NotImplementedError):
self.goog.get_options_data(month=1, year=2016)
Expand Down
3 changes: 3 additions & 0 deletions pandas_datareader/tests/test_yahoo_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def test_get_call_data(self):
raise nose.SkipTest(e)

self.assert_option_result(calls)
self.assertTrue(calls.index.levels[2][0], 'call')

def test_get_put_data(self):
try:
Expand All @@ -98,6 +99,7 @@ def test_get_put_data(self):
raise nose.SkipTest(e)

self.assert_option_result(puts)
self.assertTrue(puts.index.levels[2][0], 'put')

def test_get_expiry_dates(self):
try:
Expand Down Expand Up @@ -169,6 +171,7 @@ def test_sample_page_chg_float(self):
self.assertEqual(self.data1['Chg'].dtype, 'float64')

def test_month_year(self):

try:
data = self.aapl.get_call_data(month=self.month, year=self.year)
except RemoteDataError as e: # pragma: no cover
Expand Down
4 changes: 2 additions & 2 deletions pandas_datareader/yahoo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def get_all_data(self, call=True, put=True):

def _get_data_in_date_range(self, dates, call=True, put=True):

to_ret = Series({'calls': call, 'puts': put})
to_ret = Series({'call': call, 'put': put})
to_ret = to_ret[to_ret].index

df = self._load_data(dates)
Expand Down Expand Up @@ -735,7 +735,7 @@ def _process_rows(self, jd):
rows_list.append(d)
index.append((float(option_by_strike['strike']),
dt.datetime.utcfromtimestamp(option_by_strike['expiration']),
typ,
typ.replace('s', ''),
option_by_strike['contractSymbol']))
return rows_list, index

Expand Down