Skip to content

Commit f883c65

Browse files
committed
Merge pull request #181 from gliptak/chopdata
ENH: Set chopdata to private in Yahoo options
2 parents a288756 + 24e6b01 commit f883c65

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ __pycache__
44
.coverage
55
build
66
dist
7-
docs/build
7+
docs/build
8+
.tox/

pandas_datareader/tests/test_yahoo_options.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,18 @@ def test_sample_page_price_quote_time1(self):
124124

125125
def test_chop(self):
126126
# regression test for #7625
127-
self.aapl.chop_data(self.data1, above_below=2, underlying_price=np.nan)
128-
chopped = self.aapl.chop_data(self.data1, above_below=2, underlying_price=100)
127+
self.aapl._chop_data(self.data1, above_below=2, underlying_price=np.nan)
128+
chopped = self.aapl._chop_data(self.data1, above_below=2, underlying_price=100)
129129
self.assertTrue(isinstance(chopped, DataFrame))
130130
self.assertTrue(len(chopped) > 1)
131-
chopped2 = self.aapl.chop_data(self.data1, above_below=2, underlying_price=None)
131+
chopped2 = self.aapl._chop_data(self.data1, above_below=2, underlying_price=None)
132132
self.assertTrue(isinstance(chopped2, DataFrame))
133133
self.assertTrue(len(chopped2) > 1)
134134

135135
def test_chop_out_of_strike_range(self):
136136
# regression test for #7625
137-
self.aapl.chop_data(self.data1, above_below=2, underlying_price=np.nan)
138-
chopped = self.aapl.chop_data(self.data1, above_below=2, underlying_price=100000)
137+
self.aapl._chop_data(self.data1, above_below=2, underlying_price=np.nan)
138+
chopped = self.aapl._chop_data(self.data1, above_below=2, underlying_price=100000)
139139
self.assertTrue(isinstance(chopped, DataFrame))
140140
self.assertTrue(len(chopped) > 1)
141141

pandas_datareader/yahoo/options.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ def get_near_stock_price(self, above_below=2, call=True, put=False,
406406
"""
407407
expiry = self._try_parse_dates(year, month, expiry)
408408
data = self._get_data_in_date_range(expiry, call=call, put=put)
409-
return self.chop_data(data, above_below, self.underlying_price)
409+
return self._chop_data(data, above_below, self.underlying_price)
410410

411-
def chop_data(self, df, above_below=2, underlying_price=None):
411+
def _chop_data(self, df, above_below=2, underlying_price=None):
412412
"""Returns a data frame only options that are near the current stock price."""
413413

414414
if not underlying_price:
@@ -552,7 +552,7 @@ def get_forward_data(self, months, call=True, put=False, near=False,
552552
dates = (date for date in self.expiry_dates if date <= end_date.date())
553553
data = self._get_data_in_date_range(dates, call=call, put=put)
554554
if near:
555-
data = self.chop_data(data, above_below=above_below)
555+
data = self._chop_data(data, above_below=above_below)
556556
return data
557557

558558
def get_all_data(self, call=True, put=True):

0 commit comments

Comments
 (0)