Skip to content

ENH: Added notes about changes in Options class to what's new for 0.11 #2869

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

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 6 additions & 0 deletions doc/source/v0.11.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ New features
**Enhancements**

- In ``HDFStore``, provide dotted attribute access to ``get`` from stores (e.g. store.df == store['df'])
- In ``pd.io.data.Options``,
+ Fix bug when trying to fetch data for the current month when already past expiry.
+ Now using lxml to scrape html instead of BeautifulSoup (lxml was faster).
+ New instance variables for calls and puts are automatically created when a method that creates them is called. This works for current month where the instance variables are simply ``calls`` and ``puts``. Also works for future expiry months and save the instance variable as ``callsMMYY`` or ``putsMMYY``, where ``MMYY`` are, respectively, the month and year of the option's expiry.
+ ``Options.get_near_stock_price`` now allows the user to specify the month for which to get relevant options data.
+ ``Options.get_forward_data`` now has optional kwargs ``near`` and ``above_below``. This allows the user to specify if they would like to only return forward looking data for options near the current stock price. This just obtains the data from Options.get_near_stock_price instead of Options.get_xxx_data().

**Bug Fixes**

Expand Down
8 changes: 4 additions & 4 deletions pandas/io/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ def _parse_options_data(table):
rows = table.findall('.//tr')
header = _unpack(rows[0], kind='th')
data = [_unpack(r) for r in rows[1:]]
# Use ',' as a thousands separator as we're pulling from the US site.
return TextParser(data, names=header, na_values=['N/A'],
thousands=',').get_chunk()

Expand Down Expand Up @@ -857,11 +856,11 @@ def get_forward_data(self, months, call=True, put=False, near=False,
if put:
all_puts = DataFrame()
for mon in range(months):
m2 = in_months[mon]
y2 = in_years[mon]
try: # This catches cases when there isn't data for a month
if not near:
try: # Try to access the ivar if already instantiated
m2 = in_months[mon]
y2 = in_years[mon]

m1 = m2 if len(str(m2)) == 2 else '0' + str(m2)
name = 'puts' + str(m1) + str(y2)[2:]
Expand All @@ -873,7 +872,8 @@ def get_forward_data(self, months, call=True, put=False, near=False,
else:
put_frame = self.get_near_stock_price(call=False,
put=True,
above_below=above_below)
above_below=above_below,
month=m2, year=y2)

# Add column with expiry data to this frame.
tick = str(put_frame.Symbol[0])
Expand Down