From 2ba5ead1e3e713fec59458ab2165959e8886e70b Mon Sep 17 00:00:00 2001 From: David Stephens Date: Wed, 27 Nov 2013 11:24:27 -0800 Subject: [PATCH] ENH: Added method to pandas.data.Options to download all option data for a ticker. Also added a few helper functions. These functions could be applied to refactor some of the other methods. ENH: In Options.get_all_data: Now checking for any option tag (instead of just mini) Changed expiry to datetime from string. Added tests for tick functions. BUG: Fixed no sign in change column of option download. BUG: Fix bugs in Options class Dealt with situation of calculating expiry when symbol contains a hyphen Fixed bug in finding current expiry month. BUG: Fixed Options.get_forward_data expiry date Method assumed expiry date is the same for all option in a given month. Not the case for options with weekly's. Also breaks with options that have tags. BUG: Fixed Option bug that didn't allow LEAP DL in January. Option class was checking only the month to determine if the requested month was the current month. Changed to check year and month. Now allows downloads of next years LEAPS's in January. ENH: Added option tag and underlying price to option data output. Factored out URL parsing and error checking from individual methods. ENH: Refactor of Option class in io.data. Consistently returns multi-index data frame. Improves speed of downloading combination of calls and puts by only accessing yahoo once per expiry month. CLN: Fix out of date docstrings in io.data.Options Moved _parse_row_values definition into _unpack. CLN: Consistent capitalization in output data. CLN: Remove Tag, leave Root in data frame output. CLN: Remove unnecessary _tag_from_root method. BUG: Fix different capitalizations of Rootexp in _process_data. TST: Update tests for pandas.data.Options TST: Remove test for helper function that no longer exists. TST: Fix option test for change in output TST: Changes io.data.Options tests to self.assertTrue TST: Change tests raise nose.SkipTests on remote data errors TST: Change nose.SkipTest on RemoteDataError instead of IndexError ENH: Added quote time to outputs of data.Options. DOC: Added documentation for io.data.Options DOC: Added documentation of data.Options output. DOC: Updated docstrings on data.io.Options DOC: Added experimental tags to io.data.Options docstrings/documentation. BUG: Bug fixes, added tests, cleanups on documentation TST: Fix test_data Options tests. TST: Add test yahoo finance option pages. DOC: Update example to show slicing. TST: Remove test for long for python 3 compatibility. BUG: Fix quote time scraper TST: Changed the error raised by no tables in data.Options Tests were failing if the scraper got the webpage but there weren't any tables in it. Changed from IndexError to RemoteDataError so that nose would skip it on failure. DOC: Moved reference to new Options method to v0.14.1.txt DOC: Updated release at 0.14.1.txt for io.data.Options --- doc/source/release.rst | 4 + doc/source/remote_data.rst | 37 ++ doc/source/v0.14.1.txt | 18 +- pandas/io/data.py | 464 ++++++++++++++++++----- pandas/io/tests/data/yahoo_options1.html | 329 ++++++++++++++++ pandas/io/tests/data/yahoo_options2.html | 329 ++++++++++++++++ pandas/io/tests/test_data.py | 77 +++- 7 files changed, 1154 insertions(+), 104 deletions(-) create mode 100644 pandas/io/tests/data/yahoo_options1.html create mode 100644 pandas/io/tests/data/yahoo_options2.html diff --git a/doc/source/release.rst b/doc/source/release.rst index fb2c24acff30d..da6c46ce37a94 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -55,6 +55,10 @@ performance improvements along with a large number of bug fixes. Highlights include: +Experimental Features +~~~~~~~~~~~~~~~~~~~~~ +- ``pandas.io.data.Options`` has a get_all_data method and now consistently returns a multi-indexed ''DataFrame'' (:issue:`5602`) + See the :ref:`v0.14.1 Whatsnew ` overview or the issue tracker on GitHub for an extensive list of all API changes, enhancements and bugs that have been fixed in 0.14.1. diff --git a/doc/source/remote_data.rst b/doc/source/remote_data.rst index b0cd96cac6f5f..aae36ee1d54b3 100644 --- a/doc/source/remote_data.rst +++ b/doc/source/remote_data.rst @@ -52,6 +52,43 @@ Yahoo! Finance f=web.DataReader("F", 'yahoo', start, end) f.ix['2010-01-04'] +.. _remote_data.yahoo_Options: + +Yahoo! Finance Options +---------------------- +***Experimental*** + +The Options class allows the download of options data from Yahoo! Finance. + +The ''get_all_data'' method downloads and caches option data for all expiry months +and provides a formatted ''DataFrame'' with a hierarchical index, so its easy to get +to the specific option you want. + +.. ipython:: python + + from pandas.io.data import Options + aapl = Options('aapl', 'yahoo') + data = aapl.get_all_data() + data.head() + + #Show the $600 strike puts at all expiry dates: + data.loc[(600, slice(None), 'put'),:].head() + + #Show the volume traded of $600 strike puts at all expiry dates: + data.loc[(600, slice(None), 'put'),'Vol'].head() + +If you don't want to download all the data, more specific requests can be made. + +.. ipython:: python + + import datetime + expiry = datetime.date(2016, 1, 1) + data = aapl.get_call_data(expiry=expiry) + data.head() + +Note that if you call ''get_all_data'' first, this second call will happen much faster, as the data is cached. + + .. _remote_data.google: Google Finance diff --git a/doc/source/v0.14.1.txt b/doc/source/v0.14.1.txt index 4959f52183a92..b72d48735d39a 100644 --- a/doc/source/v0.14.1.txt +++ b/doc/source/v0.14.1.txt @@ -148,7 +148,23 @@ Performance Experimental ~~~~~~~~~~~~ -There are no experimental changes in 0.14.1 +``pandas.io.data.Options`` has a get_all_data method and now consistently returns a multi-indexed ''DataFrame'' (PR `#5602`) + See :ref:`the docs` ***Experimental*** + + .. ipython:: python + + from pandas.io.data import Options + aapl = Options('aapl', 'yahoo') + data = aapl.get_all_data() + data.head() + + .. ipython:: python + + from pandas.io.data import Options + aapl = Options('aapl', 'yahoo') + data = aapl.get_all_data() + data.head() + .. _whatsnew_0141.bug_fixes: diff --git a/pandas/io/data.py b/pandas/io/data.py index 525a7ce64f0c2..fe87c0d9fb5e7 100644 --- a/pandas/io/data.py +++ b/pandas/io/data.py @@ -16,10 +16,11 @@ StringIO, bytes_to_str, range, lrange, lmap, zip ) import pandas.compat as compat -from pandas import Panel, DataFrame, Series, read_csv, concat +from pandas import Panel, DataFrame, Series, read_csv, concat, to_datetime from pandas.core.common import is_list_like, PandasError from pandas.io.parsers import TextParser from pandas.io.common import urlopen, ZipFile, urlencode +from pandas.tseries.offsets import MonthBegin from pandas.util.testing import _network_error_classes @@ -518,12 +519,21 @@ def get_data_famafrench(name): # Items needed for options class CUR_MONTH = dt.datetime.now().month CUR_YEAR = dt.datetime.now().year - +CUR_DAY = dt.datetime.now().day def _unpack(row, kind): - els = row.xpath('.//%s' % kind) - return [val.text_content() for val in els] + def _parse_row_values(val): + ret = val.text_content() + if 'neg_arrow' in val.xpath('.//@class'): + try: + ret = float(ret.replace(',', ''))*(-1.0) + except ValueError: + ret = np.nan + + return ret + els = row.xpath('.//%s' % kind) + return [_parse_row_values(val) for val in els] def _parse_options_data(table): rows = table.xpath('.//tr') @@ -540,42 +550,49 @@ def _two_char_month(s): class Options(object): """ + ***Experimental*** This class fetches call/put data for a given stock/expiry month. It is instantiated with a string representing the ticker symbol. The class has the following methods: - get_options:(month, year) - get_calls:(month, year) - get_puts: (month, year) + get_options_data:(month, year, expiry) + get_call_data:(month, year, expiry) + get_put_data: (month, year, expiry) get_near_stock_price(opt_frame, above_below) - get_forward(months, call, put) + get_all_data(call, put) + get_forward_data(months, call, put) (deprecated) Examples -------- # Instantiate object with ticker >>> aapl = Options('aapl', 'yahoo') - # Fetch September 2012 call data - >>> calls = aapl.get_calls(9, 2012) + # Fetch May 2014 call data + >>> expiry = datetime.date(2014, 5, 1) + >>> calls = aapl.get_call_data(expiry=expiry) # Can now access aapl.calls instance variable >>> aapl.calls - # Fetch September 2012 put data - >>> puts = aapl.get_puts(9, 2012) + # Fetch May 2014 put data + >>> puts = aapl.get_put_data(expiry=expiry) # Can now access aapl.puts instance variable >>> aapl.puts # cut down the call data to be 3 below and 3 above the stock price. - >>> cut_calls = aapl.get_near_stock_price(calls, above_below=3) + >>> cut_calls = aapl.get_near_stock_price(call=True, above_below=3) # Fetch call and put data with expiry from now to 8 months out - >>> forward_calls, forward_puts = aapl.get_forward_data(8, - ... call=True, put=True) + >>> forward_data = aapl.get_forward_data(8, call=True, put=True) + # Fetch all call and put data + >>> all_data = aapl.get_all_data() """ + + _TABLE_LOC = {'calls': 9, 'puts': 13} + def __init__(self, symbol, data_source=None): """ Instantiates options_data with a ticker saved as symbol """ self.symbol = symbol.upper() @@ -588,6 +605,7 @@ def __init__(self, symbol, data_source=None): def get_options_data(self, month=None, year=None, expiry=None): """ + ***Experimental*** Gets call/put data for the stock with the expiration data in the given month and year @@ -598,15 +616,30 @@ def get_options_data(self, month=None, year=None, expiry=None): Returns ------- - call_data: pandas.DataFrame - A DataFrame with call options data. - - put_data: pandas.DataFrame - A DataFrame with call options data. - + pandas.DataFrame + A DataFrame with requested options data. + + Index: + Strike: Option strike, int + Expiry: Option expiry, datetime.date + Type: Call or Put, string + Symbol: Option symbol as reported on Yahoo, string + Columns: + Last: Last option price, float + Chg: Change from prior day, float + Bid: Bid price, float + Ask: Ask price, float + Vol: Volume traded, int64 + Open_Int: Open interest, int64 + IsNonstandard: True if the the deliverable is not 100 shares, otherwise false + Underlying: Ticker of the underlying security, string + Underlying_Price: Price of the underlying security, float64 + Quote_Time: Time of the quote, Timestamp Notes ----- + Note: Format of returned data frame is dependent on Yahoo and may change. + When called, this function will add instance variables named calls and puts. See the following example: @@ -618,67 +651,96 @@ def get_options_data(self, month=None, year=None, expiry=None): Also note that aapl.calls and appl.puts will always be the calls and puts for the next expiry. If the user calls this method with a different month or year, the ivar will be named callsMMYY or - putsMMYY where MM and YY are, repsectively, two digit + putsMMYY where MM and YY are, respectively, two digit representations of the month and year for the expiry of the options. """ - return [f(month, year, expiry) for f in (self.get_put_data, - self.get_call_data)] + return concat([f(month, year, expiry) + for f in (self.get_put_data, + self.get_call_data)]).sortlevel() _OPTIONS_BASE_URL = 'http://finance.yahoo.com/q/op?s={sym}' - def _get_option_data(self, month, year, expiry, table_loc, name): - if (month is None or year is None) and expiry is None: - msg = "You must specify either (`year` and `month`) or `expiry`." - raise ValueError(msg) + def _get_option_tables(self, month, year, expiry): - year, month = self._try_parse_dates(year, month, expiry) + year, month, expiry = self._try_parse_dates(year, month, expiry) url = self._OPTIONS_BASE_URL.format(sym=self.symbol) if month and year: # try to get specified month from yahoo finance - m1, m2 = _two_char_month(month), month + m1 = _two_char_month(month) # if this month use other url - if m1 != CUR_MONTH and m2 != CUR_MONTH: - url += '&m={year}-{m1}'.format(year=year, m1=m1) - else: + if month == CUR_MONTH and year == CUR_YEAR: url += '+Options' + else: + url += '&m={year}-{m1}'.format(year=year, m1=m1) else: # Default to current month url += '+Options' - try: - from lxml.html import parse - except ImportError: - raise ImportError("Please install lxml if you want to use the " - "{0!r} class".format(self.__class__.__name__)) - try: - doc = parse(url) - except _network_error_classes: - raise RemoteDataError("Unable to parse tables from URL " - "{0!r}".format(url)) + root = self._parse_url(url) + tables = root.xpath('.//table') + table_name = '_tables' + m1 + str(year)[-2:] + setattr(self, table_name, tables) + + self.underlying_price, self.quote_time = self._get_underlying_price(root) + + return tables + + def _get_underlying_price(self, root): + underlying_price = float(root.xpath('.//*[@class="time_rtq_ticker"]')[0]\ + .getchildren()[0].text) + + #Gets the time of the quote, note this is actually the time of the underlying price. + quote_time_text = root.xpath('.//*[@class="time_rtq"]')[0].getchildren()[0].text + if quote_time_text: + #weekend and prior to market open time format + split = quote_time_text.split(",") + timesplit = split[1].strip().split(":") + timestring = split[0] + ", " + timesplit[0].zfill(2) + ":" + timesplit[1] + quote_time = dt.datetime.strptime(timestring, "%b %d, %H:%M%p EDT") + quote_time = quote_time.replace(year=CUR_YEAR) else: - root = doc.getroot() - if root is None: - raise RemoteDataError("Parsed URL {0!r} has no root" - "element".format(url)) - tables = root.xpath('.//table') - ntables = len(tables) - if ntables == 0: - raise RemoteDataError("No tables found at {0!r}".format(url)) - elif table_loc - 1 > ntables: - raise IndexError("Table location {0} invalid, {1} tables" - " found".format(table_loc, ntables)) + quote_time_text = root.xpath('.//*[@class="time_rtq"]')[0].getchildren()[0].getchildren()[0].text + quote_time = dt.datetime.strptime(quote_time_text, "%H:%M%p EDT") + quote_time = quote_time.replace(year=CUR_YEAR, month=CUR_MONTH, day=CUR_DAY) + + return underlying_price, quote_time + + + def _get_option_data(self, month, year, expiry, name): + year, month, expiry = self._try_parse_dates(year, month, expiry) + m1 = _two_char_month(month) + table_name = '_tables' + m1 + str(year)[-2:] + + try: + tables = getattr(self, table_name) + except AttributeError: + tables = self._get_option_tables(month, year, expiry) + + ntables = len(tables) + table_loc = self._TABLE_LOC[name] + if ntables == 0: + raise RemoteDataError("No tables found at {0!r}".format(url)) + elif table_loc - 1 > ntables: + raise IndexError("Table location {0} invalid, {1} tables" + " found".format(table_loc, ntables)) option_data = _parse_options_data(tables[table_loc]) + option_data = self._process_data(option_data) + option_data['Type'] = name[:-1] + option_data.set_index(['Strike', 'Expiry', 'Type', 'Symbol'], inplace=True) - if month: - name += m1 + str(year)[-2:] + if month == CUR_MONTH and year == CUR_YEAR: + setattr(self, name, option_data) + + name += m1 + str(year)[-2:] setattr(self, name, option_data) return option_data def get_call_data(self, month=None, year=None, expiry=None): """ + ***Experimental*** Gets call/put data for the stock with the expiration data in the given month and year @@ -690,10 +752,29 @@ def get_call_data(self, month=None, year=None, expiry=None): Returns ------- call_data: pandas.DataFrame - A DataFrame with call options data. + A DataFrame with requested options data. + + Index: + Strike: Option strike, int + Expiry: Option expiry, datetime.date + Type: Call or Put, string + Symbol: Option symbol as reported on Yahoo, string + Columns: + Last: Last option price, float + Chg: Change from prior day, float + Bid: Bid price, float + Ask: Ask price, float + Vol: Volume traded, int64 + Open_Int: Open interest, int64 + IsNonstandard: True if the the deliverable is not 100 shares, otherwise false + Underlying: Ticker of the underlying security, string + Underlying_Price: Price of the underlying security, float64 + Quote_Time: Time of the quote, Timestamp Notes ----- + Note: Format of returned data frame is dependent on Yahoo and may change. + When called, this function will add instance variables named calls and puts. See the following example: @@ -705,13 +786,14 @@ def get_call_data(self, month=None, year=None, expiry=None): Also note that aapl.calls will always be the calls for the next expiry. If the user calls this method with a different month or year, the ivar will be named callsMMYY where MM and YY are, - repsectively, two digit representations of the month and year + respectively, two digit representations of the month and year for the expiry of the options. """ - return self._get_option_data(month, year, expiry, 9, 'calls') + return self._get_option_data(month, year, expiry, 'calls').sortlevel() def get_put_data(self, month=None, year=None, expiry=None): """ + ***Experimental*** Gets put data for the stock with the expiration data in the given month and year @@ -723,10 +805,29 @@ def get_put_data(self, month=None, year=None, expiry=None): Returns ------- put_data: pandas.DataFrame - A DataFrame with call options data. + A DataFrame with requested options data. + + Index: + Strike: Option strike, int + Expiry: Option expiry, datetime.date + Type: Call or Put, string + Symbol: Option symbol as reported on Yahoo, string + Columns: + Last: Last option price, float + Chg: Change from prior day, float + Bid: Bid price, float + Ask: Ask price, float + Vol: Volume traded, int64 + Open_Int: Open interest, int64 + IsNonstandard: True if the the deliverable is not 100 shares, otherwise false + Underlying: Ticker of the underlying security, string + Underlying_Price: Price of the underlying security, float64 + Quote_Time: Time of the quote, Timestamp Notes ----- + Note: Format of returned data frame is dependent on Yahoo and may change. + When called, this function will add instance variables named puts. See the following example: @@ -743,11 +844,12 @@ def get_put_data(self, month=None, year=None, expiry=None): repsectively, two digit representations of the month and year for the expiry of the options. """ - return self._get_option_data(month, year, expiry, 13, 'puts') + return self._get_option_data(month, year, expiry, 'puts').sortlevel() def get_near_stock_price(self, above_below=2, call=True, put=False, month=None, year=None, expiry=None): """ + ***Experimental*** Cuts the data frame opt_df that is passed in to only take options that are near the current stock price. @@ -774,9 +876,11 @@ def get_near_stock_price(self, above_below=2, call=True, put=False, The resultant DataFrame chopped down to be 2 * above_below + 1 rows desired. If there isn't data as far out as the user has asked for then + + Note: Format of returned data frame is dependent on Yahoo and may change. + """ - year, month = self._try_parse_dates(year, month, expiry) - price = float(get_quote_yahoo([self.symbol])['last']) + year, month, expiry = self._try_parse_dates(year, month, expiry) to_ret = Series({'calls': call, 'puts': put}) to_ret = to_ret[to_ret].index @@ -792,30 +896,60 @@ def get_near_stock_price(self, above_below=2, call=True, put=False, df = getattr(self, name) except AttributeError: meth_name = 'get_{0}_data'.format(nam[:-1]) - df = getattr(self, meth_name)(month, year) + df = getattr(self, meth_name)(expiry=expiry) - start_index = np.where(df['Strike'] > price)[0][0] + start_index = np.where(df.index.get_level_values('Strike') + > self.underlying_price)[0][0] get_range = slice(start_index - above_below, start_index + above_below + 1) chop = df[get_range].dropna(how='all') - chop.reset_index(inplace=True) data[nam] = chop - return [data[nam] for nam in to_ret] - def _try_parse_dates(self, year, month, expiry): - if year is not None or month is not None: + return concat([data[nam] for nam in to_ret]).sortlevel() + + @staticmethod + def _try_parse_dates(year, month, expiry): + """ + Validates dates provided by user. Ensures the user either provided both a month and a year or an expiry. + + Parameters + ---------- + year: Calendar year, int (deprecated) + + month: Calendar month, int (deprecated) + + expiry: Expiry date (month and year), datetime.date, (preferred) + + Returns + ------- + Tuple of year (int), month (int), expiry (datetime.date) + """ + + #Checks if the user gave one of the month or the year but not both and did not provide an expiry: + if (month is not None and year is None) or (month is None and year is not None) and expiry is None: + msg = "You must specify either (`year` and `month`) or `expiry` " \ + "or none of these options for the current month." + raise ValueError(msg) + + if (year is not None or month is not None) and expiry is None: warnings.warn("month, year arguments are deprecated, use expiry" " instead", FutureWarning) if expiry is not None: year = expiry.year month = expiry.month - return year, month + elif year is None and month is None: + year = CUR_YEAR + month = CUR_MONTH + expiry = dt.date(year, month, 1) + + return year, month, expiry def get_forward_data(self, months, call=True, put=False, near=False, above_below=2): """ + ***Experimental*** Gets either call, put, or both data for months starting in the current month and going out in the future a specified amount of time. @@ -841,7 +975,28 @@ def get_forward_data(self, months, call=True, put=False, near=False, Returns ------- - data : dict of str, DataFrame + pandas.DataFrame + A DataFrame with requested options data. + + Index: + Strike: Option strike, int + Expiry: Option expiry, datetime.date + Type: Call or Put, string + Symbol: Option symbol as reported on Yahoo, string + Columns: + Last: Last option price, float + Chg: Change from prior day, float + Bid: Bid price, float + Ask: Ask price, float + Vol: Volume traded, int64 + Open_Int: Open interest, int64 + IsNonstandard: True if the the deliverable is not 100 shares, otherwise false + Underlying: Ticker of the underlying security, string + Underlying_Price: Price of the underlying security, float64 + Quote_Time: Time of the quote, Timestamp + + Note: Format of returned data frame is dependent on Yahoo and may change. + """ warnings.warn("get_forward_data() is deprecated", FutureWarning) in_months = lrange(CUR_MONTH, CUR_MONTH + months + 1) @@ -860,10 +1015,9 @@ def get_forward_data(self, months, call=True, put=False, near=False, to_ret = Series({'calls': call, 'puts': put}) to_ret = to_ret[to_ret].index - data = {} + all_data = [] for name in to_ret: - all_data = DataFrame() for mon in range(months): m2 = in_months[mon] @@ -882,22 +1036,148 @@ def get_forward_data(self, months, call=True, put=False, near=False, frame = self.get_near_stock_price(call=call, put=put, above_below=above_below, month=m2, year=y2) - tick = str(frame.Symbol[0]) - start = len(self.symbol) - year = tick[start:start + 2] - month = tick[start + 2:start + 4] - day = tick[start + 4:start + 6] - expiry = month + '-' + day + '-' + year - frame['Expiry'] = expiry - - if not mon: - all_data = all_data.join(frame, how='right') - else: - all_data = concat([all_data, frame]) - data[name] = all_data - ret = [data[k] for k in to_ret] - if len(ret) == 1: - return ret.pop() - if len(ret) != 2: - raise AssertionError("should be len 2") - return ret + frame = self._process_data(frame) + + all_data.append(frame) + + return concat(all_data).sortlevel() + + def get_all_data(self, call=True, put=True): + """ + ***Experimental*** + Gets either call, put, or both data for all available months starting + in the current month. + + Parameters + ---------- + call: bool, optional (default=True) + Whether or not to collect data for call options + + put: bool, optional (default=True) + Whether or not to collect data for put options. + + Returns + ------- + pandas.DataFrame + A DataFrame with requested options data. + + Index: + Strike: Option strike, int + Expiry: Option expiry, datetime.date + Type: Call or Put, string + Symbol: Option symbol as reported on Yahoo, string + Columns: + Last: Last option price, float + Chg: Change from prior day, float + Bid: Bid price, float + Ask: Ask price, float + Vol: Volume traded, int64 + Open_Int: Open interest, int64 + IsNonstandard: True if the the deliverable is not 100 shares, otherwise false + Underlying: Ticker of the underlying security, string + Underlying_Price: Price of the underlying security, float64 + Quote_Time: Time of the quote, Timestamp + + Note: Format of returned data frame is dependent on Yahoo and may change. + + """ + to_ret = Series({'calls': call, 'puts': put}) + to_ret = to_ret[to_ret].index + + try: + months = self.months + except AttributeError: + months = self._get_expiry_months() + + all_data = [] + + for name in to_ret: + + for month in months: + m2 = month.month + y2 = month.year + + m1 = _two_char_month(m2) + nam = name + str(m1) + str(y2)[2:] + + try: # Try to access on the instance + frame = getattr(self, nam) + except AttributeError: + meth_name = 'get_{0}_data'.format(name[:-1]) + frame = getattr(self, meth_name)(expiry=month) + + all_data.append(frame) + + return concat(all_data).sortlevel() + + def _get_expiry_months(self): + """ + Gets available expiry months. + + Returns + ------- + months : List of datetime objects + """ + + url = 'http://finance.yahoo.com/q/op?s={sym}'.format(sym=self.symbol) + root = self._parse_url(url) + + links = root.xpath('.//*[@id="yfncsumtab"]')[0].xpath('.//a') + month_gen = (element.attrib['href'].split('=')[-1] + for element in links + if '/q/op?s=' in element.attrib['href'] + and '&m=' in element.attrib['href']) + + months = [dt.date(int(month.split('-')[0]), + int(month.split('-')[1]), 1) + for month in month_gen] + + current_month_text = root.xpath('.//*[@id="yfncsumtab"]')[0].xpath('.//strong')[0].text + current_month = dt.datetime.strptime(current_month_text, '%b %y') + months.insert(0, current_month) + self.months = months + + return months + + def _parse_url(self, url): + """ + Downloads and parses a URL, returns xml root. + + """ + try: + from lxml.html import parse + except ImportError: + raise ImportError("Please install lxml if you want to use the " + "{0!r} class".format(self.__class__.__name__)) + try: + doc = parse(url) + except _network_error_classes: + raise RemoteDataError("Unable to parse URL " + "{0!r}".format(url)) + else: + root = doc.getroot() + if root is None: + raise RemoteDataError("Parsed URL {0!r} has no root" + "element".format(url)) + return root + + + def _process_data(self, frame): + """ + Adds columns for Expiry, IsNonstandard (ie: deliverable is not 100 shares) + and Tag (the tag indicating what is actually deliverable, None if standard). + + """ + frame["Rootexp"] = frame.Symbol.str[0:-9] + frame["Root"] = frame.Rootexp.str[0:-6] + frame["Expiry"] = to_datetime(frame.Rootexp.str[-6:]) + #Removes dashes in equity ticker to map to option ticker. + #Ex: BRK-B to BRKB140517C00100000 + frame["IsNonstandard"] = frame['Root'] != self.symbol.replace('-','') + del frame["Rootexp"] + frame["Underlying"] = self.symbol + frame['Underlying_Price'] = self.underlying_price + frame["Quote_Time"] = self.quote_time + frame.rename(columns={'Open Int': 'Open_Int'}, inplace=True) + + return frame diff --git a/pandas/io/tests/data/yahoo_options1.html b/pandas/io/tests/data/yahoo_options1.html new file mode 100644 index 0000000000000..987072b15e280 --- /dev/null +++ b/pandas/io/tests/data/yahoo_options1.html @@ -0,0 +1,329 @@ + +AAPL Options | Apple Inc. Stock - Yahoo! Finance
 

Send me a link:

*Only U.S. numbers are accepted. Text messaging rates may apply.

 Dow Up0.20% Nasdaq Up0.50%
+ + + +

Apple Inc. (AAPL)

-NasdaqGS
585.54 Down 2.45(0.42%) May 9, 4:00PM EDT
|After Hours + : + 585.73 Up 0.19 (0.03%) May 9, 7:59PM EDT
Get the big picture on all your investments.
OptionsGet Options for:
View By Expiration: May 14 | Jun 14 | Jul 14 | Aug 14 | Oct 14 | Jan 15 | Jan 16
Call OptionsExpire at close Friday, May 30, 2014
StrikeSymbolLastChgBidAskVolOpen Int
330.00AAPL140517C00330000263.00 0.00254.30256.9062
400.00AAPL140517C00400000190.70 0.00184.35186.408735
410.00AAPL140517C00410000181.30 0.00174.40176.456810
420.00AAPL140517C00420000170.80 0.00164.35166.501241
430.00AAPL140517C00430000160.75 0.00154.40156.5037622
440.00AAPL140517C00440000149.70 0.00144.40146.60901
445.00AAPL140517C00445000145.55 0.00139.40141.451061
450.00AAPL140517C00450000131.27Down 9.18134.40136.90452
450.00AAPL7140517C00450000117.45 0.00133.40137.8052
455.00AAPL140517C00455000134.70 0.00129.40131.40902
460.00AAPL140517C00460000130.95 0.00124.40126.903091
460.00AAPL7140517C00460000122.50Down 17.50123.30127.5511
465.00AAPL140517C00465000125.70 0.00119.45121.701724
470.00AAPL140517C00470000111.95Down 5.76114.45116.101519
470.00AAPL7140517C0047000062.00 0.00113.40116.3011
470.00AAPL140523C00470000122.85 0.00114.50116.3011
475.00AAPL140517C00475000108.00Down 4.23109.40111.7018
480.00AAPL140517C00480000102.00Down 8.60104.40106.80431
485.00AAPL140517C00485000107.50 0.0099.35101.853023
490.00AAPL140517C0049000091.90Down 8.5594.3596.90118
490.00AAPL7140517C0049000097.53 0.0093.4097.3515
495.00AAPL140517C0049500089.35Down 3.0189.4091.8554
500.00AAPL140517C0050000085.00Down 4.7584.4585.957518
500.00AAPL7140517C0050000095.89 0.0083.4086.90241
500.00AAPL140523C0050000085.55Down 1.1585.2586.00103260
500.00AAPL140530C0050000091.45 0.0084.5587.00855
502.50AAPL140530C0050250080.20Down 6.5282.0583.7011
505.00AAPL140517C0050500087.73 0.0079.3581.25243
505.00AAPL7140517C0050500092.71 0.0078.4081.3015
505.00AAPL140523C0050500028.00 0.0079.5081.9038520
510.00AAPL140517C0051000071.58Down 10.9574.4576.0028104
515.00AAPL140517C0051500067.00Down 7.0569.4071.00150
515.00AAPL140523C0051500073.20 0.0069.5071.8011
515.00AAPL140530C0051500074.24 0.0069.5071.506310
520.00AAPL140517C0052000062.30Down 5.1964.4566.005116
520.00AAPL7140517C0052000072.00 0.0063.4567.00127
520.00AAPL140530C0052000072.00 0.0064.6566.3035110
522.50AAPL140523C0052250060.20Down 5.9562.0564.3012
525.00AAPL140517C0052500059.87Down 2.6859.7061.0015380
525.00AAPL7140517C0052500060.00Down 7.3558.4561.85127
525.00AAPL140523C0052500057.70Down 8.6059.5561.151117
525.00AAPL7140523C0052500060.00Up 46.0058.4561.4022
525.00AAPL140530C0052500057.02Down 8.6459.6561.103343
525.00AAPL7140530C0052500056.64Up 11.6458.6062.9011
530.00AAPL140517C0053000054.86Down 2.4455.1555.9021326
530.00AAPL7140517C0053000055.00Down 5.0053.4056.45522
530.00AAPL140523C0053000057.00 0.0054.5056.35481
530.00AAPL7140523C0053000063.18 0.0053.5557.4013
530.00AAPL140530C0053000052.05Down 9.9554.6556.90114
532.50AAPL140523C0053250057.40 0.0052.0054.151651
532.50AAPL140530C0053250057.86 0.0052.2554.506610
535.00AAPL140517C0053500050.35Down 2.7550.1051.05228769
535.00AAPL7140517C0053500057.36 0.0048.5051.25317
535.00AAPL140523C0053500057.75 0.0049.6051.4023
535.00AAPL140530C0053500047.52Down 9.2349.7551.90258
540.00AAPL140517C0054000041.80Down 5.8944.4546.003199
540.00AAPL7140517C0054000043.37Down 6.8343.5046.35515
540.00AAPL140523C0054000042.29Down 10.3644.6046.30233
540.00AAPL140530C0054000042.80Down 10.2044.7546.95213
542.50AAPL140523C0054250048.55 0.0042.1543.901561
542.50AAPL140530C0054250050.80 0.0042.4544.3577
545.00AAPL140517C0054500036.72Down 5.6840.2541.05177901
545.00AAPL7140517C0054500042.90 0.0038.5041.40144150
545.00AAPL140530C0054500045.85 0.0040.0041.901255
550.00AAPL140517C0055000035.50Down 2.0035.6536.00131701
550.00AAPL7140517C0055000030.50Down 11.5033.5536.3515
550.00AAPL140523C0055000034.45Down 7.6034.8036.301920
550.00AAPL140530C0055000032.83Down 7.8235.5036.80342
552.50AAPL140523C0055250038.95 0.0032.4034.202141
552.50AAPL140530C0055250037.64 0.0032.9534.80691
555.00AAPL140517C0055500030.67Down 1.6630.4531.0544132
555.00AAPL7140517C0055500036.65 0.0028.5032.5592
555.00AAPL140523C0055500032.80 0.0029.9531.6523
555.00AAPL140530C0055500038.30 0.0030.6532.251011
557.50AAPL140530C0055750026.52Down 9.4828.4029.85110
560.00AAPL140517C0056000026.00Down 2.3025.6526.15142439
560.00AAPL7140517C0056000025.50Down 6.6723.6027.65426
560.00AAPL140523C0056000023.11Down 4.8925.3526.8510127
560.00AAPL7140523C0056000042.95 0.0024.3028.2012
560.00AAPL140530C0056000024.12Down 9.6326.2027.658102
562.50AAPL140517C0056250019.95Down 3.3523.1023.80111
562.50AAPL140523C0056250024.45Down 2.7523.2024.55296
562.50AAPL140530C0056250031.29 0.0024.1025.5043
565.00AAPL140517C0056500021.10Down 1.4020.7521.3564247
565.00AAPL7140517C0056500017.01Down 9.0218.7522.80310
565.00AAPL140523C0056500020.60Down 3.4021.4522.3511145
565.00AAPL7140523C0056500029.30 0.0019.8022.85115
565.00AAPL140530C0056500023.00Down 2.6022.8523.4015119
565.00AAPL7140530C0056500033.80 0.0021.2023.8523
567.50AAPL140517C0056750016.50Down 33.5018.3018.95102
567.50AAPL140523C0056750020.00Down 4.8519.5020.2084
570.00AAPL140517C0057000016.60Down 1.6416.1016.65475581
570.00AAPL7140517C0057000012.80Down 7.3814.4517.05984
570.00AAPL140523C0057000015.21Down 4.6417.5018.1011146
570.00AAPL7140523C0057000016.60Down 4.0316.0018.7012
570.00AAPL140530C0057000018.40Down 2.2018.9019.3511295
570.00AAPL7140530C0057000018.90Down 2.5016.8020.05663
572.50AAPL140517C0057250014.15Up 7.1513.9014.4022240
572.50AAPL140523C0057250016.00Down 2.1015.5516.10797
572.50AAPL140530C0057250017.30Down 1.2516.8517.50344
572.50AAPL7140530C005725008.20 0.0015.3517.8533
575.00AAPL140517C0057500012.15Down 2.0812.0012.30705678
575.00AAPL7140517C0057500013.90 0.009.9512.55113
575.00AAPL140523C0057500014.10Down 1.3013.8514.25101277
575.00AAPL7140523C0057500014.10Down 3.1211.7514.55617
575.00AAPL140530C0057500015.60Down 0.9015.3015.7084449
575.00AAPL7140530C0057500014.00Down 4.5813.6015.954179
577.50AAPL140517C0057750010.25Down 21.859.9510.351,15446
577.50AAPL140523C0057750010.99Down 2.7612.1012.45125130
577.50AAPL7140523C0057750015.07 0.0010.4513.40215
580.00AAPL140517C005800008.40Down 2.058.258.455,0972,008
580.00AAPL7140517C005800008.45Down 5.807.708.8050597
580.00AAPL140523C0058000010.60Down 1.4510.5010.80395418
580.00AAPL7140523C0058000010.00Down 10.908.9011.65218
580.00AAPL140530C0058000012.21Down 1.5912.1512.45224544
580.00AAPL7140530C005800009.96Down 5.9910.5012.701188
582.50AAPL140517C005825006.90Down 1.406.706.853,52898
582.50AAPL7140523C005825005.60Up 5.60N/AN/A082
582.50AAPL7140530C0058250041.32Up 41.32N/AN/A014
585.00AAPL140517C005850005.25Down 1.845.255.4511,7854,386
585.00AAPL7140517C005850005.30Down 1.824.705.6539208
585.00AAPL140523C005850007.85Down 1.407.657.95854484
585.00AAPL7140523C005850006.50Down 4.435.659.0011535
585.00AAPL140530C005850009.60Down 1.309.409.70348234
585.00AAPL7140530C005850008.75Down 2.257.509.85426
587.50AAPL140517C005875004.25Down 1.534.054.202,245305
587.50AAPL7140517C005875003.35Up 3.353.504.40510
587.50AAPL7140523C005875000.05Up 0.05N/AN/A2159
590.00AAPL140517C005900003.20Down 1.353.103.208,5796,343
590.00AAPL7140517C005900003.20Down 1.102.003.2586380
590.00AAPL140523C005900005.50Down 1.245.405.55786809
590.00AAPL7140523C005900004.50Down 2.053.905.901476
590.00AAPL140530C005900007.20Down 1.407.157.30196649
590.00AAPL7140530C005900007.20Down 2.805.308.10173
592.50AAPL140517C005925002.35Down 1.102.302.402,326493
592.50AAPL7140517C005925002.14Up 2.141.702.57126
595.00AAPL140517C005950001.75Down 0.931.681.754,5794,449
595.00AAPL7140517C005950001.65Down 0.851.541.867160
595.00AAPL140523C005950003.75Down 0.953.703.75652747
595.00AAPL7140523C005950003.50Down 4.603.553.906104
595.00AAPL140530C005950005.40Down 1.025.205.45377867
595.00AAPL7140530C005950004.40Down 4.105.105.451324
597.50AAPL140517C005975001.23Down 0.861.161.251,237392
597.50AAPL7140517C005975000.94Down 2.410.591.3921
600.00AAPL140517C006000000.89Down 0.660.880.898,02413,791
600.00AAPL7140517C006000000.95Down 0.550.780.95331,692
600.00AAPL140523C006000002.45Down 0.832.352.541,9971,364
600.00AAPL7140523C006000002.43Down 1.602.322.6121225
600.00AAPL140530C006000003.80Down 0.953.653.901,0265,990
600.00AAPL7140530C006000003.75Down 1.303.753.95253882
602.50AAPL140517C006025000.61Down 0.540.610.66972286
602.50AAPL7140517C006025002.09 0.000.310.791111
605.00AAPL140517C006050000.44Down 0.410.430.442,4766,776
605.00AAPL7140517C006050000.47Down 0.330.390.5131351
605.00AAPL140523C006050001.53Down 0.681.501.64626582
605.00AAPL140530C006050002.69Down 0.712.582.69155872
607.50AAPL140517C006075000.33Down 0.300.310.34432261
610.00AAPL140517C006100000.28Down 0.180.250.281,7964,968
610.00AAPL7140517C006100000.23Down 0.790.210.3246272
610.00AAPL140523C006100000.97Down 0.460.971.06335897
610.00AAPL140530C006100001.85Down 0.551.801.85208728
612.50AAPL140517C006125000.19Down 0.190.190.2412860
615.00AAPL140517C006150000.19Down 0.080.180.191,1253,790
615.00AAPL7140517C006150000.73 0.000.130.2534328
615.00AAPL140523C006150000.69Down 0.260.630.70123576
615.00AAPL140530C006150001.28Down 0.431.231.34127264
617.50AAPL140517C006175000.14Down 0.070.120.1644148
620.00AAPL140517C006200000.14Down 0.060.120.146963,306
620.00AAPL7140517C006200000.45 0.000.080.202970
620.00AAPL140523C006200000.45Down 0.220.420.47133476
620.00AAPL140530C006200000.90Down 0.290.850.95213910
622.50AAPL140517C006225000.10Down 0.070.080.1383174
625.00AAPL140517C006250000.09Down 0.060.080.094653,311
625.00AAPL7140517C006250000.80 0.000.050.1621112
625.00AAPL140523C006250000.30Down 0.170.300.35139284
625.00AAPL140530C006250000.57Down 0.430.590.6915443
627.50AAPL140517C006275000.10Down 0.030.060.11479
630.00AAPL140517C006300000.07Down 0.050.050.105813,159
630.00AAPL7140517C006300001.40 0.000.050.143177
630.00AAPL140523C006300000.23Down 0.170.230.2874281
630.00AAPL140530C006300000.40Down 0.250.420.5136206
635.00AAPL140517C006350000.07Down 0.040.050.06691,251
635.00AAPL7140517C006350000.37 0.000.020.12484
635.00AAPL140523C006350000.20Down 0.100.170.23210201
635.00AAPL140530C006350000.34Down 0.120.320.3917377
640.00AAPL140517C006400000.05Down 0.040.040.054542,284
640.00AAPL7140517C006400000.15 0.000.010.251455
640.00AAPL140523C006400000.17Down 0.050.140.1962197
640.00AAPL140530C006400000.29Down 0.180.250.3119214
645.00AAPL140517C006450000.04Down 0.06N/A0.04155633
645.00AAPL7140517C006450000.90 0.00N/A0.184490
645.00AAPL140523C006450000.11Down 0.070.100.163193
645.00AAPL140530C006450000.25Down 0.200.200.3025178
650.00AAPL140517C006500000.02Down 0.060.020.036315,904
650.00AAPL7140517C006500000.46 0.00N/A0.28172
650.00AAPL140523C006500000.10Down 0.050.080.1544243
650.00AAPL140530C006500000.20Down 0.020.120.209225
655.00AAPL140517C006550000.03Down 0.020.010.0427491
655.00AAPL7140517C006550000.70 0.00N/A0.22965
655.00AAPL140523C006550000.08Down 0.060.060.14371
660.00AAPL140517C006600000.03Down 0.040.020.0321582
660.00AAPL140523C006600000.09Down 0.020.010.12562
665.00AAPL140517C006650000.06 0.00N/A0.068316
665.00AAPL140523C006650000.07Down 0.01N/A0.10155
670.00AAPL140517C006700000.03Down 0.02N/A0.0710841
670.00AAPL140523C006700000.08 0.000.020.099123
675.00AAPL140517C006750000.04 0.00N/A0.03113483
675.00AAPL140523C006750000.10 0.000.010.081344
680.00AAPL140517C006800000.05 0.00N/A0.05952,580
680.00AAPL140523C006800000.10 0.00N/A0.135050
685.00AAPL140517C006850000.04 0.00N/A0.1138236
685.00AAPL140523C006850000.05 0.00N/A0.071817
690.00AAPL140517C006900000.04 0.00N/A0.04109430
695.00AAPL140517C006950000.03 0.00N/A0.0353188
695.00AAPL140523C006950000.11 0.00N/A0.083266
700.00AAPL140517C007000000.01 0.000.010.02631,329
700.00AAPL140523C007000000.05 0.00N/A0.081010
705.00AAPL140517C007050000.01 0.00N/A0.0157457
710.00AAPL140517C007100000.02 0.00N/A0.023494
710.00AAPL140523C007100000.03Down 0.02N/A0.0410282
715.00AAPL140517C007150000.02 0.00N/A0.0136293
720.00AAPL140517C007200000.02 0.00N/A0.0114331
725.00AAPL140517C007250000.02 0.00N/A0.0112599
730.00AAPL140517C007300000.01 0.00N/A0.016146
735.00AAPL140517C007350000.02 0.00N/A0.0322116
740.00AAPL140517C007400000.02 0.00N/A0.032151
745.00AAPL140517C007450000.02 0.00N/A0.031313
750.00AAPL140517C007500000.02 0.00N/A0.032213
755.00AAPL140517C007550000.09 0.00N/A0.045879
760.00AAPL140517C007600000.24 0.00N/A0.04039
770.00AAPL140517C007700000.24 0.00N/A0.04099
775.00AAPL140517C007750000.40 0.00N/A0.0405
795.00AAPL140517C007950000.20 0.00N/A0.04055
800.00AAPL140517C008000000.04 0.00N/A0.02147
805.00AAPL140517C008050000.15 0.00N/A0.04010
Put OptionsExpire at close Friday, May 30, 2014
StrikeSymbolLastChgBidAskVolOpen Int
280.00AAPL140517P002800000.05 0.00N/A0.1226
290.00AAPL140517P002900000.02 0.00N/A0.111111
295.00AAPL140517P002950000.01 0.00N/A0.0838
300.00AAPL140517P003000000.05 0.00N/A0.09123
305.00AAPL140517P003050000.05 0.00N/A0.101020
310.00AAPL140517P003100000.10 0.00N/A0.1101
315.00AAPL140517P003150000.12 0.00N/A0.1101
320.00AAPL140517P003200000.10Up 0.08N/A0.1217
325.00AAPL140517P003250000.05 0.00N/A0.01185342
330.00AAPL140517P003300000.02 0.00N/A0.1255
335.00AAPL140517P003350000.02 0.00N/A0.1256
340.00AAPL140517P003400000.04Up 0.02N/A0.1256
345.00AAPL140517P003450000.02 0.00N/A0.1255
350.00AAPL140517P003500000.01 0.00N/A0.0160636
355.00AAPL140517P003550000.01 0.00N/A0.126392
360.00AAPL140517P003600000.02 0.00N/A0.108167
365.00AAPL140517P003650000.01 0.00N/A0.10228
370.00AAPL140517P003700000.04 0.00N/A0.12127
375.00AAPL140517P003750000.02 0.00N/A0.121536
380.00AAPL140517P003800000.04 0.00N/A0.126303
385.00AAPL140517P003850000.09 0.00N/A0.054331
390.00AAPL140517P003900000.01 0.00N/A0.1233239
395.00AAPL140517P003950000.07 0.00N/A0.1210270
400.00AAPL140517P004000000.02 0.00N/A0.121431
405.00AAPL140517P004050000.04 0.00N/A0.028284
410.00AAPL140517P004100000.02Up 0.01N/A0.032400
415.00AAPL140517P004150000.03 0.00N/A0.0222401
420.00AAPL140517P004200000.04 0.00N/A0.0410489
425.00AAPL140517P004250000.02 0.00N/A0.031863
430.00AAPL140517P004300000.01 0.00N/A0.023673,892
435.00AAPL140517P004350000.01 0.00N/A0.121956
435.00AAPL7140517P004350000.90 0.00N/A1.7111
440.00AAPL140517P004400000.01Down 0.01N/A0.108803
440.00AAPL7140517P004400000.69 0.00N/A1.711313
445.00AAPL140517P004450000.02 0.00N/A0.02101,616
450.00AAPL140517P004500000.02Down 0.01N/A0.02103,981
450.00AAPL7140517P004500000.64 0.00N/A1.711116
455.00AAPL140517P004550000.04Up 0.01N/A0.028487
455.00AAPL7140517P004550001.47 0.00N/A1.71156
460.00AAPL140517P004600000.01Down 0.010.010.02602,133
460.00AAPL7140517P004600000.02 0.00N/A0.542138
465.00AAPL140517P004650000.01Down 0.020.010.0211,617
465.00AAPL7140517P004650000.52 0.00N/A0.50272
470.00AAPL140517P004700000.02 0.000.010.0218,005
470.00AAPL7140517P004700000.73 0.00N/A0.43361
470.00AAPL140523P004700000.16 0.00N/A0.1555
475.00AAPL140517P004750000.02Up 0.010.010.0223,076
475.00AAPL7140517P004750000.10 0.00N/A0.341142
480.00AAPL140517P004800000.02 0.00N/A0.05793,648
480.00AAPL7140517P004800000.10Up 0.010.050.282147
485.00AAPL140517P004850000.02Down 0.03N/A0.091802,581
485.00AAPL7140517P004850000.05 0.00N/A0.2314178
485.00AAPL140523P004850000.10 0.00N/A0.0733
490.00AAPL140517P004900000.03Up 0.010.010.03344,959
490.00AAPL7140517P004900000.10 0.00N/A0.2326511
490.00AAPL140523P004900000.12 0.00N/A0.057594
490.00AAPL140530P004900000.11 0.000.020.2120140
490.00AAPL7140530P004900000.25 0.00N/A0.25163
492.50AAPL140530P004925000.35 0.00N/A0.22445
492.50AAPL7140530P004925003.95 0.00N/A0.42172175
495.00AAPL140517P004950000.03 0.000.020.04234,303
495.00AAPL7140517P004950000.05 0.00N/A0.082267
495.00AAPL140523P004950000.05Down 0.07N/A0.123220
495.00AAPL7140523P004950004.60 0.00N/A0.13427433
495.00AAPL140530P004950000.10 0.00N/A0.227119
495.00AAPL7140530P004950004.55 0.00N/A0.43154154
497.50AAPL140530P004975000.43 0.00N/A0.2288
497.50AAPL7140530P004975004.65 0.00N/A0.4411145
500.00AAPL140517P005000000.03Down 0.010.030.0418710,044
500.00AAPL7140517P005000000.05Up 0.04N/A0.051400
500.00AAPL140523P005000000.07 0.000.010.1312356
500.00AAPL7140523P005000000.31 0.00N/A0.131106
500.00AAPL140530P005000000.15Up 0.050.020.191189
500.00AAPL7140530P005000000.08 0.00N/A0.454279
502.50AAPL140523P005025000.07 0.00N/A0.1310217
502.50AAPL140530P005025000.24 0.00N/A0.232549
502.50AAPL7140530P005025005.90 0.00N/A0.46114270
505.00AAPL140517P005050000.04Down 0.010.020.05383,196
505.00AAPL7140517P005050000.05 0.000.010.091217
505.00AAPL140523P005050000.07Up 0.010.010.0946659
505.00AAPL7140523P005050000.16 0.00N/A0.361549
505.00AAPL140530P005050000.16Up 0.040.010.23131
505.00AAPL7140530P005050000.54 0.00N/A0.462305
507.50AAPL140523P005075000.07Down 0.020.030.1419152
507.50AAPL7140523P005075006.70 0.00N/A0.15109527
507.50AAPL140530P005075000.10 0.000.020.22165194
507.50AAPL7140530P005075008.50 0.00N/A0.485500
510.00AAPL140517P005100000.04Down 0.010.020.059210,771
510.00AAPL7140517P005100000.08Down 0.03N/A0.10101,109
510.00AAPL140523P005100000.08Up 0.020.030.0896512
510.00AAPL7140523P005100000.17 0.00N/A0.38176
510.00AAPL140530P005100000.10 0.000.020.193123
510.00AAPL7140530P005100000.62 0.00N/A0.211253
512.50AAPL140523P005125000.10Up 0.040.040.1528116
512.50AAPL140530P005125000.08Down 0.040.020.205107
512.50AAPL7140530P005125009.05 0.00N/A0.235454
515.00AAPL140517P005150000.04Down 0.030.020.043383,916
515.00AAPL7140517P005150000.09Down 0.06N/A0.111470
515.00AAPL140523P005150000.11Up 0.040.040.1480441
515.00AAPL7140523P005150000.86 0.00N/A0.39319
515.00AAPL140530P005150000.16 0.000.040.22207298
515.00AAPL7140530P0051500012.00 0.00N/A0.2344
517.50AAPL140523P005175000.13Up 0.020.050.1514106
517.50AAPL7140523P005175000.70 0.00N/A0.40430
517.50AAPL140530P005175000.19 0.000.050.18232244
517.50AAPL7140530P005175001.18 0.00N/A0.2545
520.00AAPL140517P005200000.06Down 0.010.050.062029,047
520.00AAPL7140517P005200000.09Up 0.01N/A0.123357
520.00AAPL140523P005200000.10Down 0.010.060.1362387
520.00AAPL7140523P005200000.25 0.00N/A0.195114
520.00AAPL140530P005200000.16Down 0.030.070.222330
520.00AAPL7140530P0052000013.10 0.00N/A0.2726
522.50AAPL140523P005225000.16Up 0.040.070.17686
522.50AAPL7140523P005225000.83 0.00N/A0.20112
522.50AAPL140530P005225000.17Down 0.040.090.201279
522.50AAPL7140530P0052250019.90 0.00N/A0.2911
525.00AAPL140517P005250000.08Up 0.010.060.094503,526
525.00AAPL7140517P005250000.13Down 0.050.050.131471
525.00AAPL140523P005250000.16Up 0.020.080.1952670
525.00AAPL7140523P0052500016.00 0.00N/A0.217386
525.00AAPL140530P005250000.20Up 0.020.110.2369348
525.00AAPL7140530P005250001.25 0.00N/A0.3014
527.50AAPL140523P005275000.16Up 0.010.090.166318
527.50AAPL7140523P005275001.50 0.00N/A0.2314
527.50AAPL140530P005275000.28 0.000.140.251518
527.50AAPL7140530P005275001.46 0.000.110.3111
530.00AAPL140517P005300000.10Up 0.020.050.1053013,138
530.00AAPL7140517P005300000.10Down 0.06N/A0.1416436
530.00AAPL140523P005300000.18Up 0.010.130.23121589
530.00AAPL7140523P005300000.19Down 1.26N/A0.24138
530.00AAPL140530P005300000.26Up 0.030.200.27284,407
530.00AAPL7140530P005300002.43 0.000.100.3514
532.50AAPL140523P005325000.22Up 0.050.150.22656252
532.50AAPL7140523P0053250017.60 0.000.030.2912
532.50AAPL140530P005325000.33 0.000.250.363233
535.00AAPL140517P005350000.09Down 0.040.080.154253,948
535.00AAPL7140517P005350000.12Down 0.030.100.19127656
535.00AAPL140523P005350000.23Up 0.020.170.2686358
535.00AAPL7140523P005350000.31Down 0.010.040.32340
535.00AAPL140530P005350000.30 0.000.260.3726221
535.00AAPL7140530P005350001.05 0.000.150.5213
537.50AAPL140523P005375000.28Up 0.110.200.2956148
537.50AAPL7140523P005375001.96 0.000.070.31116
537.50AAPL140530P005375000.47 0.000.350.442774
540.00AAPL140517P005400000.11Down 0.010.100.143916,476
540.00AAPL7140517P005400000.15Up 0.050.060.252415
540.00AAPL140523P005400000.32Up 0.040.250.3119321
540.00AAPL7140523P005400000.70 0.000.100.331018
540.00AAPL140530P005400000.57Up 0.220.410.5141426
540.00AAPL7140530P005400001.60 0.000.390.54132134
542.50AAPL140523P005425000.36Up 0.070.250.356478
542.50AAPL7140523P005425003.67 0.000.130.36174176
542.50AAPL140530P005425000.66 0.000.480.57102124
542.50AAPL7140530P005425005.95 0.000.470.5911
545.00AAPL140517P005450000.13Down 0.040.120.172594,469
545.00AAPL7140517P005450000.14Down 0.010.080.261275
545.00AAPL140523P005450000.35Up 0.010.290.3973105
545.00AAPL7140523P005450001.02 0.000.110.41481
545.00AAPL140530P005450000.65Up 0.090.570.6563324
545.00AAPL7140530P005450001.48 0.000.550.67168
547.50AAPL140523P005475000.53Up 0.270.330.435178
547.50AAPL7140523P005475001.82 0.000.320.4522161
547.50AAPL140530P005475000.53 0.000.670.74471
550.00AAPL140517P005500000.16Down 0.030.150.161,1325,742
550.00AAPL7140517P005500000.16Down 0.390.100.211619
550.00AAPL140523P005500000.45Down 0.070.400.4591241
550.00AAPL7140523P005500000.41 0.000.400.51422
550.00AAPL140530P005500000.84Up 0.210.780.8742311
550.00AAPL7140530P005500001.14Up 0.490.740.9025
552.50AAPL140523P005525000.72Up 0.360.480.582268
552.50AAPL140530P005525001.14Up 0.290.931.04158
555.00AAPL140517P005550000.19Down 0.040.170.206183,546
555.00AAPL7140517P005550000.20Down 0.290.140.251413
555.00AAPL140523P005550000.65Down 0.020.590.66125232
555.00AAPL140530P005550001.27Up 0.441.111.2252204
555.00AAPL7140530P005550004.25 0.001.001.2311
557.50AAPL140517P005575000.22Down 0.030.200.2536552
557.50AAPL140523P005575001.15Up 0.290.720.8161225
557.50AAPL7140523P005575004.10 0.000.660.8611
557.50AAPL140530P005575001.35Up 0.261.321.452071
557.50AAPL7140530P005575001.93Down 1.921.291.4512
560.00AAPL140517P005600000.28Down 0.020.250.292,3064,494
560.00AAPL7140517P005600000.45Down 0.180.190.369424
560.00AAPL140523P005600001.06Up 0.120.880.97324580
560.00AAPL7140523P005600001.50Up 0.450.841.1088
560.00AAPL140530P005600001.84Up 0.241.581.73230599
560.00AAPL7140530P005600002.45Down 0.101.561.73133
562.50AAPL140517P005625000.32Down 0.050.290.361,450160
562.50AAPL140523P005625001.16Up 0.021.111.19200201
562.50AAPL7140523P005625003.50 0.001.021.261115
562.50AAPL140530P005625002.67Up 0.711.912.052112
562.50AAPL7140530P005625002.77 0.001.862.17169
565.00AAPL140517P005650000.45Down 0.010.390.462,7384,705
565.00AAPL7140517P005650000.50 0.000.350.521493
565.00AAPL140523P005650001.42 0.001.381.48449660
565.00AAPL7140523P005650001.30 0.001.291.60313
565.00AAPL140530P005650002.41 0.002.292.443081,159
565.00AAPL7140530P005650001.80 0.002.182.48663
567.50AAPL140517P005675000.55Down 0.070.530.551,213260
567.50AAPL140523P005675001.99Up 0.221.711.83111194
567.50AAPL7140523P005675002.90 0.001.651.95114
567.50AAPL140530P005675003.30Up 1.302.772.9216241
567.50AAPL7140530P005675003.90Down 1.552.673.0518
570.00AAPL140517P005700000.74Down 0.020.730.744,8474,582
570.00AAPL7140517P005700001.65Up 0.750.690.8726228
570.00AAPL140523P005700002.20Up 0.062.142.27619788
570.00AAPL7140523P005700003.20Up 1.152.072.32615
570.00AAPL140530P005700003.40Up 0.143.253.50260999
570.00AAPL7140530P005700004.79Up 2.173.203.501157
572.50AAPL140517P005725001.02Down 0.071.001.051,653434
572.50AAPL140523P005725002.95Up 0.302.622.79405224
572.50AAPL7140523P005725004.20Up 0.052.552.92178
572.50AAPL140530P005725005.25Up 2.453.904.15275376
572.50AAPL7140530P005725002.81 0.003.804.1511103
575.00AAPL140517P005750001.47Up 0.071.451.515,4555,975
575.00AAPL7140517P005750002.78Up 1.631.321.642284
575.00AAPL140523P005750003.45Up 0.213.253.45417604
575.00AAPL7140523P005750002.52 0.003.153.6015
575.00AAPL140530P005750004.75Up 0.254.654.905821,420
575.00AAPL7140530P005750006.50Up 0.954.554.9010111
577.50AAPL140517P005775001.98Down 0.051.952.052,748232
577.50AAPL140523P005775004.10Up 0.104.004.20197200
577.50AAPL7140523P005775006.10Up 3.053.904.352276
580.00AAPL140517P005800002.72Up 0.142.702.757,1274,696
580.00AAPL7140517P005800002.78Up 0.182.542.99211302
580.00AAPL140523P005800004.95Up 0.204.905.10466525
580.00AAPL7140523P005800005.20Down 0.404.755.204528
580.00AAPL140530P005800006.72Up 0.466.456.70191560
580.00AAPL7140530P005800006.68Up 0.886.107.503100
582.50AAPL140517P005825003.60Up 0.073.553.753,184607
585.00AAPL140517P005850004.80Up 0.424.654.855,4033,487
585.00AAPL7140517P005850004.86Up 0.564.455.0038493
585.00AAPL140523P005850007.14Up 0.447.057.205981,335
585.00AAPL7140523P005850007.80Up 0.756.859.50230
585.00AAPL140530P005850008.75Up 0.418.658.9576294
585.00AAPL7140530P005850009.89Up 1.398.4510.503946
587.50AAPL140517P005875006.00Up 0.505.906.101,375367
587.50AAPL7140517P005875008.67Up 2.675.756.3026
587.50AAPL140523P005875000.15Up 0.15N/AN/A0119
587.50AAPL7140523P005875000.01Up 0.01N/AN/A0265
587.50AAPL140530P005875001.00Up 1.00N/AN/A020
587.50AAPL7140530P005875000.03Up 0.03N/AN/A86513
590.00AAPL140517P005900007.50Up 0.847.407.652,9144,498
590.00AAPL7140517P005900007.80Up 0.307.057.8020274
590.00AAPL140523P005900009.74Up 0.849.7510.00310601
590.00AAPL7140523P0059000012.52Up 5.679.5511.60119
590.00AAPL140530P0059000011.90Up 1.4511.3011.7037285
590.00AAPL7140530P0059000013.92Up 3.9211.0513.85122
592.50AAPL140517P005925009.35Up 1.109.109.35368633
595.00AAPL140517P0059500011.05Up 1.3010.9511.304001,569
595.00AAPL7140517P0059500011.00 0.0010.7013.0024140
595.00AAPL140523P0059500013.35Up 1.1812.9513.25353477
595.00AAPL7140523P0059500016.37Up 4.7212.7515.4018
595.00AAPL140530P0059500015.10Up 2.6514.4514.7519228
595.00AAPL7140530P0059500017.57Up 6.0714.1016.95519
597.50AAPL140517P0059750013.05Up 1.4512.8513.3585149
597.50AAPL7140517P005975009.00 0.0012.0014.901818
600.00AAPL140517P0060000015.15Up 1.5515.0015.502822,184
600.00AAPL7140517P0060000018.50Up 8.3014.8016.807142
600.00AAPL140523P0060000017.10Up 1.7516.5517.0092262
600.00AAPL7140523P0060000015.75 0.0016.1519.1058
600.00AAPL140530P0060000018.20Up 3.5617.8018.3036133
600.00AAPL7140530P0060000020.03Up 5.7517.6020.40129
602.50AAPL140517P0060250017.67Up 16.1717.2517.751263
605.00AAPL140517P0060500019.80Up 1.7019.6020.10251970
605.00AAPL7140517P0060500015.40 0.0018.5022.15166
605.00AAPL140523P0060500021.10Up 1.9020.6521.15305198
605.00AAPL140530P0060500023.31Up 1.3121.8522.753164
607.50AAPL140517P0060750021.90Down 2,240.1021.9022.5528
610.00AAPL140517P0061000024.55Up 1.0024.4024.9528417
610.00AAPL7140517P0061000016.04 0.0022.9026.9511
610.00AAPL140523P0061000026.30Up 1.8025.1026.4023134
610.00AAPL140530P0061000030.14Up 5.2125.9027.101132
612.50AAPL140517P0061250022.20Down 2,357.8026.7528.251010
615.00AAPL140517P0061500029.73Down 0.1729.1530.052156
615.00AAPL140523P0061500025.70 0.0029.7531.052046
615.00AAPL140530P0061500022.10 0.0030.3031.65112
620.00AAPL140517P0062000034.97Up 1.2233.9535.654275
620.00AAPL140523P0062000029.95 0.0034.2035.95472
620.00AAPL140530P0062000028.35 0.0034.5036.25522
625.00AAPL140517P0062500037.25 0.0038.6040.756130
625.00AAPL7140517P0062500033.80 0.0037.4041.4033
625.00AAPL140523P0062500032.20 0.0039.0040.802832
625.00AAPL140530P0062500038.85 0.0039.4541.1051010
630.00AAPL140517P0063000043.00 0.0043.2045.703246
630.00AAPL140523P0063000038.30 0.0044.0545.75812
630.00AAPL140530P0063000041.30 0.0043.7545.9014
635.00AAPL140517P0063500035.20 0.0048.2050.651240
635.00AAPL7140517P0063500055.50 0.0047.3051.7511
635.00AAPL140523P0063500044.20 0.0048.4550.7566
635.00AAPL140530P0063500046.10 0.0048.8050.80113
640.00AAPL140517P0064000050.90 0.0053.1555.654035
640.00AAPL7140517P00640000102.30 0.0052.6056.703242
640.00AAPL140523P0064000043.95 0.0053.6555.80612
640.00AAPL140530P0064000047.60 0.0053.7055.7522
645.00AAPL140517P0064500065.37 0.0058.5060.65213
645.00AAPL140523P0064500045.78 0.0058.6560.6511
645.00AAPL140530P0064500051.40 0.0059.0060.7022
650.00AAPL140517P0065000064.52Up 2.5264.0065.655004,292
650.00AAPL7140517P0065000062.90 0.0062.3566.7012
650.00AAPL140530P0065000065.00 0.0063.7065.7522
655.00AAPL140517P0065500068.00 0.0068.1570.652445
655.00AAPL7140517P0065500065.00 0.0067.4071.80313
660.00AAPL140517P0066000071.75 0.0073.5575.6534
675.00AAPL140517P0067500088.35 0.0088.5590.856566
680.00AAPL140517P0068000092.40 0.0093.9095.801,850600
695.00AAPL140517P00695000107.45 0.00108.60110.6512
700.00AAPL140517P00700000118.53Up 8.38113.15115.651160
710.00AAPL140517P00710000190.57 0.00123.65125.6501
715.00AAPL140517P00715000133.46Down 49.24128.60130.6578
720.00AAPL140517P00720000157.25 0.00133.60135.65115
725.00AAPL140517P00725000204.00 0.00138.65140.6587
740.00AAPL140517P00740000152.50 0.00153.60155.65133133
750.00AAPL140517P00750000164.50Down 21.15163.65165.6555
780.00AAPL140517P00780000189.60 0.00193.65195.752222
790.00AAPL140517P00790000199.37 0.00203.80205.653333
800.00AAPL140517P00800000208.26 0.00213.60215.70121121
805.00AAPL140517P00805000217.30 0.00218.55220.753434
   
Highlighted options are in-the-money.

Expand to Straddle View...

Currency in USD.

+ + + diff --git a/pandas/io/tests/data/yahoo_options2.html b/pandas/io/tests/data/yahoo_options2.html new file mode 100644 index 0000000000000..91c7d41905120 --- /dev/null +++ b/pandas/io/tests/data/yahoo_options2.html @@ -0,0 +1,329 @@ + +AAPL Options | Apple Inc. Stock - Yahoo! Finance
 

Send me a link:

*Only U.S. numbers are accepted. Text messaging rates may apply.

 Dow Up0.12% Nasdaq Down0.33%
+ + + + +

Apple Inc. (AAPL)

-NasdaqGS
593.76 Up 0.93(0.16%) 4:00PM EDT
|After Hours + : + 593.12 Down 0.64 (0.11%) 7:59PM EDT
Get the big picture on all your investments.
OptionsGet Options for:
View By Expiration: May 14 | Jun 14 | Jul 14 | Aug 14 | Oct 14 | Jan 15 | Jan 16
Call OptionsExpire at close Saturday, June 21, 2014
StrikeSymbolLastChgBidAskVolOpen Int
300.00AAPL140621C00300000229.24 0.00293.05294.501515
330.00AAPL140621C00330000184.90 0.00263.05264.5511
400.00AAPL140621C00400000192.50 0.00193.10194.60210
420.00AAPL140621C00420000171.05 0.00173.05174.601571
430.00AAPL140621C00430000163.48Up 1.48163.10164.4537
450.00AAPL140621C00450000131.63 0.00143.05144.60219
450.00AAPL7140621C00450000112.50 0.00142.00145.8011
460.00AAPL140621C00460000131.00 0.00133.10134.5513621
465.00AAPL140621C00465000124.20 0.00128.15129.551461
470.00AAPL140621C00470000122.85 0.00123.15124.45156
475.00AAPL140621C00475000115.90 0.00118.10119.5519511
475.00AAPL7140621C00475000117.35 0.00117.10120.7511
480.00AAPL140621C00480000112.50 0.00113.20114.501267
485.00AAPL140621C00485000106.55 0.00108.10109.551243
490.00AAPL140621C00490000103.50Up 0.20103.20104.60121
495.00AAPL140621C0049500092.86 0.0098.3599.5013
500.00AAPL140606C0050000085.70 0.0092.9594.6033
500.00AAPL140613C0050000093.00Up 1.3593.0094.65212
500.00AAPL7140613C0050000082.00 0.0091.9595.8011
500.00AAPL140621C0050000094.60Up 0.7093.4094.554615
500.00AAPL7140621C0050000089.00 0.0092.2595.8037
505.00AAPL140621C0050500078.38 0.0088.4089.65376
505.00AAPL7140621C0050500097.00 0.0087.2590.65310
510.00AAPL140621C0051000083.20Down 0.3083.3584.702152
510.00AAPL7140621C0051000084.00 0.0082.2085.90102
515.00AAPL140621C0051500069.95 0.0078.4079.701125
520.00AAPL140606C0052000069.20 0.0072.9574.556315
520.00AAPL140621C0052000075.00Up 0.7573.5074.7542278
520.00AAPL7140621C0052000071.80 0.0072.2575.70121
525.00AAPL140621C0052500066.90Down 1.4568.6069.8510199
525.00AAPL7140621C0052500067.00 0.0067.4070.80328
530.00AAPL140613C0053000063.75Up 10.9563.3065.0012
530.00AAPL140621C0053000063.78Down 0.5763.6064.9528359
530.00AAPL7140621C0053000064.80Up 1.7562.4565.80126
535.00AAPL140621C0053500059.40Up 2.9058.8060.103155
535.00AAPL7140621C0053500048.18 0.0057.6061.10138
540.00AAPL140606C0054000052.42Up 10.1253.4554.70112
540.00AAPL140613C0054000052.90 0.0053.5555.1011
540.00AAPL140621C0054000055.10Up 1.0554.1055.0014440
540.00AAPL7140621C0054000054.80Down 0.2053.2556.3017
545.00AAPL140606C0054500043.42 0.0048.4049.703010
545.00AAPL140621C0054500050.00Up 2.0049.4550.555622
545.00AAPL7140621C0054500053.88 0.0048.5051.301533
545.00AAPL140627C0054500041.70 0.0049.7551.1011
550.00AAPL140606C0055000044.50Up 1.0043.7044.857297
550.00AAPL140613C0055000044.50Up 1.5044.2545.65422
550.00AAPL140621C0055000045.00Down 0.5044.7545.70392,403
550.00AAPL7140621C0055000045.00Up 8.5044.1046.605223
550.00AAPL140627C0055000043.80 0.0045.2546.6022
555.00AAPL140606C0055500034.53 0.0038.7040.009910
555.00AAPL140613C0055500038.72Up 4.8739.7041.2011
555.00AAPL140621C0055500040.75Up 1.9540.4041.3528885
555.00AAPL7140621C0055500039.01 0.0039.8542.153126
560.00AAPL140606C0056000033.50Down 0.5034.1035.30284
560.00AAPL140613C0056000035.31Down 0.0435.3536.452117
560.00AAPL7140613C0056000033.20 0.0034.6036.9044
560.00AAPL140621C0056000035.75Down 0.2536.0537.00202,934
560.00AAPL7140621C0056000035.90Down 0.2535.2537.501556
560.00AAPL140627C0056000034.25 0.0036.5538.0023
562.50AAPL140606C0056250030.00 0.0031.8533.001124
562.50AAPL7140606C0056250023.25 0.0030.8034.0599
565.00AAPL140606C0056500029.50Up 0.5029.6530.708455
565.00AAPL7140606C0056500029.80Down 7.7729.1531.80213
565.00AAPL140613C0056500029.75 0.0031.0532.15627
565.00AAPL7140613C0056500035.60 0.0030.4032.6522
565.00AAPL140621C0056500031.90Down 0.5031.7032.80411,573
565.00AAPL7140621C0056500032.41 0.0031.6033.506387
567.50AAPL140613C0056750027.60 0.0028.9030.10109
570.00AAPL140606C0057000026.36Up 0.4625.5526.0512319
570.00AAPL7140606C0057000018.40 0.0024.2026.90419
570.00AAPL140613C0057000027.49 0.0026.8028.05113
570.00AAPL140621C0057000028.30Down 0.7728.3028.502,4324,953
570.00AAPL7140621C0057000029.60Up 1.6027.4028.856655
570.00AAPL140627C0057000022.70 0.0028.9029.90510
572.50AAPL140613C0057250025.94Up 3.1924.9526.052012
575.00AAPL140606C0057500021.20Down 0.3021.1521.951439
575.00AAPL7140606C0057500025.30 0.0020.5022.9536
575.00AAPL140613C0057500023.75Down 0.5023.4024.201330
575.00AAPL140621C0057500024.50Down 0.6524.6024.852012,135
575.00AAPL7140621C0057500024.93Up 0.9324.3025.254384
577.50AAPL140613C0057750020.85 0.0021.3022.05110
580.00AAPL140606C0058000018.20Down 0.2017.7018.1512433
580.00AAPL7140606C0058000016.95 0.0016.7019.15114
580.00AAPL140613C0058000020.50 0.0019.6520.455182
580.00AAPL140621C0058000020.95Down 0.6021.1521.405233,065
580.00AAPL7140621C0058000021.50Down 0.1520.9521.804246
580.00AAPL140627C0058000022.40Up 0.2021.8022.553047
582.50AAPL140613C0058250013.50 0.0018.0518.7567
582.50AAPL7140613C0058250015.00 0.0016.8019.703030
582.50AAPL140627C0058250020.95 0.0020.3521.0049
585.00AAPL140606C0058500014.25Down 0.8514.4014.7019372
585.00AAPL7140606C0058500014.14Down 0.0813.4515.65128
585.00AAPL140613C0058500017.25Up 0.8516.4517.152177
585.00AAPL140621C0058500017.90Down 1.0318.1018.251612,407
585.00AAPL7140621C0058500017.85Down 0.6517.8518.6099304
585.00AAPL140627C0058500019.55Down 0.4318.8519.45511
587.50AAPL140613C0058750015.65 0.0015.0515.65134
587.50AAPL7140613C0058750014.00 0.0014.7016.75222
587.50AAPL140627C0058750017.10 0.0017.5018.00627
590.00AAPL140606C0059000011.05Down 0.9011.3511.70551,297
590.00AAPL7140606C0059000011.50Down 1.8710.2012.40645
590.00AAPL140613C0059000014.10Down 0.3713.6514.2538448
590.00AAPL140621C0059000015.15Down 0.5915.2515.4061814,296
590.00AAPL7140621C0059000015.20Down 0.8015.0515.8519230
590.00AAPL140627C0059000016.35Down 0.9516.1516.652057
590.00AAPL7140627C0059000014.13 0.0015.0017.5533
592.50AAPL140613C0059250012.60Down 0.3512.5012.852960
592.50AAPL7140613C0059250012.70Up 2.5012.1514.3523
592.50AAPL140627C0059250015.05Down 0.6514.8015.304012
592.50AAPL7140627C0059250014.80 0.0014.5516.5534
595.00AAPL140606C005950008.78Down 0.528.809.053151,315
595.00AAPL7140606C005950009.17Up 0.678.2010.154283
595.00AAPL140613C0059500011.55Up 0.0511.4511.60292318
595.00AAPL7140613C005950009.38 0.0011.0012.4558
595.00AAPL140621C0059500012.54Down 0.6612.6512.858572,741
595.00AAPL7140621C0059500013.25Down 0.2512.4513.3517317
595.00AAPL140627C0059500013.94Down 0.8613.6014.05760
595.00AAPL7140627C0059500014.24Down 1.7613.2015.1017
597.50AAPL140613C005975009.96 0.0010.0010.552274
597.50AAPL140627C0059750012.85 0.0012.6512.905236
600.00AAPL140606C006000006.70Down 0.406.656.903231,841
600.00AAPL7140606C006000006.75Down 0.806.557.1015179
600.00AAPL140613C006000009.40Down 0.409.209.40123690
600.00AAPL7140613C006000009.43Up 0.238.8510.001618
600.00AAPL140621C0060000010.55Down 0.5010.5010.608278,816
600.00AAPL7140621C0060000010.15Down 0.8510.2011.0068416
600.00AAPL140627C0060000011.63Down 0.8711.3511.80334
600.00AAPL7140627C006000009.22 0.0011.2012.6511
602.50AAPL140613C006025008.50 0.008.058.50551
602.50AAPL7140613C006025006.20 0.008.058.5033
605.00AAPL140606C006050005.03Down 0.274.905.10476849
605.00AAPL7140606C006050005.20 0.004.855.3014132
605.00AAPL140613C006050007.40Down 0.707.157.607112
605.00AAPL7140613C006050007.80 0.007.159.0029
605.00AAPL140621C006050008.45Down 0.608.508.604192,326
605.00AAPL7140621C006050008.70 0.008.358.657738
605.00AAPL140627C006050009.75Down 0.109.409.80817
607.50AAPL140613C006075005.72 0.006.356.7559
607.50AAPL7140613C0060750010.25 0.006.356.7544
607.50AAPL140627C006075009.64 0.008.558.90619
610.00AAPL140606C006100003.65Down 0.553.553.70648924
610.00AAPL7140606C006100003.90Down 0.253.503.9516135
610.00AAPL140613C006100006.10Down 0.255.606.0026131
610.00AAPL7140613C006100009.70 0.005.606.00510
610.00AAPL140621C006100006.75Down 0.646.857.004972,521
610.00AAPL7140621C006100007.20Down 0.206.757.0013423
610.00AAPL140627C006100008.01Down 0.447.758.10140
610.00AAPL7140627C006100008.02 0.007.559.1033
612.50AAPL140613C006125005.80 0.004.905.35345
612.50AAPL7140613C006125006.55 0.004.905.4012
612.50AAPL140627C006125005.57 0.007.007.402021
615.00AAPL140606C006150002.95Down 0.052.542.73105619
615.00AAPL7140606C006150002.82Down 0.172.422.838135
615.00AAPL140613C006150004.80Up 0.204.354.75551
615.00AAPL140621C006150005.40Down 0.605.455.552471,992
615.00AAPL7140621C006150005.30Down 0.015.355.70574
615.00AAPL140627C006150007.40 0.006.306.603938
617.50AAPL140613C006175004.15Up 0.653.854.20103
617.50AAPL7140613C006175006.45 0.003.804.1511
617.50AAPL140627C006175004.60 0.005.605.95121
617.50AAPL7140627C006175004.55 0.005.406.6033
620.00AAPL140606C006200001.88Down 0.411.841.97217738
620.00AAPL7140606C006200002.00Up 0.601.782.151846
620.00AAPL140613C006200003.50Down 0.553.353.7016140
620.00AAPL7140613C006200003.65Down 1.073.303.6543
620.00AAPL140621C006200004.26Down 0.494.304.402497,992
620.00AAPL7140621C006200004.60Down 0.354.204.459226
620.00AAPL140627C006200005.48Down 0.275.055.40176
620.00AAPL7140627C006200004.00 0.003.655.951016
622.50AAPL140613C006225003.20Up 0.452.933.251311
622.50AAPL7140613C006225003.10 0.002.903.3012
622.50AAPL7140627C006225004.60 0.004.405.4011
625.00AAPL140606C006250001.53Down 0.041.361.442,1642,256
625.00AAPL7140606C006250001.50Up 0.501.301.481029
625.00AAPL140613C006250002.75Down 0.452.582.841354
625.00AAPL7140613C006250002.18 0.002.532.8312
625.00AAPL140621C006250003.40Down 0.403.403.454112,307
625.00AAPL7140621C006250003.64Down 0.113.203.609230
625.00AAPL140627C006250004.40Down 0.204.104.35128
625.00AAPL7140627C006250004.42Up 0.223.904.9511
627.50AAPL140613C006275002.76 0.002.262.5224
627.50AAPL140627C006275003.94Down 0.263.653.95317
627.50AAPL7140627C006275003.80 0.003.454.4011
630.00AAPL140606C006300001.01Down 0.130.951.07139409
630.00AAPL7140606C006300001.77 0.000.891.1038
630.00AAPL140613C006300002.20Down 0.221.972.1441568
630.00AAPL7140613C006300005.10 0.001.972.1823
630.00AAPL140621C006300002.69Down 0.382.682.737325,019
630.00AAPL7140621C006300003.15 0.002.522.8521148
630.00AAPL140627C006300003.50Down 0.453.303.55439
630.00AAPL7140627C006300003.45 0.002.043.9511
632.50AAPL140613C006325001.95Down 0.051.721.8810925
632.50AAPL7140613C006325003.65 0.001.651.9611
635.00AAPL140606C006350000.74Down 0.010.690.7947252
635.00AAPL7140606C006350002.07 0.000.510.84322
635.00AAPL140613C006350001.65Down 0.301.531.664560
635.00AAPL7140613C006350003.30 0.001.431.8211
635.00AAPL140621C006350002.10Down 0.362.112.162171,188
635.00AAPL7140621C006350002.44 0.001.952.18157
635.00AAPL140627C006350002.94Down 0.162.652.85271
640.00AAPL140606C006400000.55Down 0.150.500.6439260
640.00AAPL7140606C006400000.65 0.000.470.66224
640.00AAPL140613C006400001.30Down 0.231.151.31141187
640.00AAPL7140613C006400001.24Down 0.211.151.331013
640.00AAPL140621C006400001.66Down 0.271.661.701121,451
640.00AAPL140627C006400002.29Down 0.182.112.31107
645.00AAPL140606C006450000.44Down 0.060.380.4933147
645.00AAPL7140606C006450001.65 0.000.200.5423
645.00AAPL140613C006450001.10 0.000.901.03489
645.00AAPL7140613C006450002.39 0.000.881.0755
645.00AAPL140621C006450001.35Down 0.261.321.36147848
645.00AAPL140627C006450001.78Up 0.131.681.882314
645.00AAPL7140627C006450001.91 0.001.172.1211
650.00AAPL140606C006500000.29Down 0.150.280.4014742
650.00AAPL7140606C006500000.35 0.000.120.44227
650.00AAPL140613C006500000.95 0.000.690.843124
650.00AAPL7140613C006500000.78Down 1.460.670.871011
650.00AAPL140621C006500001.08Down 0.221.061.1069410,025
650.00AAPL140627C006500001.46Up 0.131.361.572832
650.00AAPL7140627C006500003.95 0.000.521.8611
655.00AAPL140621C006550000.87Down 0.230.860.881661,192
660.00AAPL140621C006600000.74Down 0.120.690.721531,066
665.00AAPL140621C006650000.63Down 0.100.570.6062462
670.00AAPL140621C006700000.50Down 0.130.480.5049475
675.00AAPL140621C006750000.45Down 0.080.410.4231377
680.00AAPL140621C006800000.36Down 0.090.350.3625456
685.00AAPL140621C006850000.31Down 0.090.300.3112393
690.00AAPL140621C006900000.26Down 0.070.260.2718485
695.00AAPL140621C006950000.26Down 0.030.230.247333
700.00AAPL140621C007000000.21Down 0.060.200.211113,476
705.00AAPL140621C007050000.22Down 0.010.170.1825790
710.00AAPL140621C007100000.17Down 0.020.140.1612520
715.00AAPL140621C007150000.15Down 0.020.120.139441
720.00AAPL140621C007200000.11Down 0.030.100.1213265
725.00AAPL140621C007250000.10 0.000.090.109178
730.00AAPL140621C007300000.09Down 0.020.080.0938260
735.00AAPL140621C007350000.08Down 0.030.050.08116687
740.00AAPL140621C007400000.07Down 0.020.040.0798870
745.00AAPL140621C007450000.06Down 0.01N/A0.05171659
750.00AAPL140621C007500000.07 0.000.020.0521,954
755.00AAPL140621C007550000.07 0.00N/A0.04210558
760.00AAPL140621C007600000.03Down 0.01N/A0.03653,809
765.00AAPL140621C007650000.04 0.000.010.0352,394
770.00AAPL140621C007700000.01Down 0.020.010.022744,282
775.00AAPL140621C007750000.02 0.00N/A0.02502,627
780.00AAPL140621C007800000.02 0.00N/A0.025001,941
785.00AAPL140621C007850000.01Down 0.01N/A0.01362,514
Put OptionsExpire at close Saturday, June 21, 2014
StrikeSymbolLastChgBidAskVolOpen Int
280.00AAPL140621P002800000.05 0.00N/A0.091010
300.00AAPL140621P003000000.09 0.00N/A0.07144
325.00AAPL140621P003250000.09 0.00N/A0.091010
330.00AAPL140621P003300000.02 0.00N/A0.09120
335.00AAPL140621P003350000.01 0.00N/A0.094242
345.00AAPL140621P003450000.01 0.00N/A0.096666
350.00AAPL140621P003500000.20 0.00N/A0.083102
360.00AAPL140621P003600000.17 0.00N/A0.091020
365.00AAPL140621P003650000.02 0.00N/A0.0912180
370.00AAPL140621P003700000.02 0.00N/A0.09511
375.00AAPL140621P003750000.02 0.00N/A0.0955
380.00AAPL140621P003800000.10 0.00N/A0.032628
385.00AAPL140621P003850000.02 0.00N/A0.034176
390.00AAPL140621P003900000.03 0.00N/A0.054104
395.00AAPL140621P003950000.17 0.00N/A0.09215
400.00AAPL140621P004000000.02 0.00N/A0.032981
405.00AAPL140621P004050000.05Up 0.03N/A0.051749
410.00AAPL140621P004100000.02 0.00N/A0.055109
415.00AAPL140621P004150000.10 0.00N/A0.051097
420.00AAPL140621P004200000.01 0.00N/A0.0540256
425.00AAPL140621P004250000.04 0.00N/A0.0413685
425.00AAPL7140621P004250000.47 0.00N/A0.1655
430.00AAPL140621P004300000.04 0.00N/A0.0410412
435.00AAPL140621P004350000.04 0.00N/A0.043199
435.00AAPL7140621P004350000.31 0.00N/A0.1712
440.00AAPL140621P004400000.02 0.00N/A0.0411,593
440.00AAPL7140621P004400001.05 0.00N/A0.17116
445.00AAPL140621P004450000.02Down 0.03N/A0.041233
450.00AAPL140621P004500000.07 0.000.020.042732,123
450.00AAPL7140621P004500001.27 0.00N/A0.1915
455.00AAPL140621P004550000.05 0.00N/A0.1129245
460.00AAPL140621P004600000.06Up 0.01N/A0.111506
460.00AAPL7140621P004600000.30 0.00N/A0.2033
465.00AAPL140621P004650000.11 0.000.010.09271,123
465.00AAPL7140621P004650002.99 0.00N/A0.256498
470.00AAPL140621P004700000.04Down 0.050.020.1021,279
470.00AAPL7140621P004700004.70 0.00N/A0.251354
475.00AAPL140621P004750000.05Down 0.050.040.07412,028
475.00AAPL7140621P004750000.25 0.00N/A0.24579
480.00AAPL140621P004800000.07Down 0.050.040.09232,070
480.00AAPL7140621P004800000.22 0.000.030.25232
485.00AAPL140621P004850000.08Down 0.050.070.0816871
485.00AAPL7140621P004850004.45 0.00N/A0.25239
490.00AAPL140606P004900000.34 0.00N/A0.15266
490.00AAPL140621P004900000.09Down 0.070.090.101312,770
490.00AAPL7140621P004900005.00 0.00N/A0.30287
492.50AAPL140606P004925000.30 0.00N/A0.19412
495.00AAPL140606P004950000.60 0.00N/A0.2088
495.00AAPL140621P004950000.11Down 0.080.110.12642,606
495.00AAPL7140621P004950005.75 0.000.050.22322
500.00AAPL140606P005000000.21 0.000.010.18910
500.00AAPL7140606P005000001.45 0.00N/A0.253030
500.00AAPL140613P005000000.33 0.000.050.19412
500.00AAPL140621P005000000.13Down 0.110.130.142672,383
500.00AAPL7140621P005000000.20Down 0.150.090.24196
505.00AAPL140606P005050000.86 0.00N/A0.201617
505.00AAPL140621P005050000.16Down 0.110.150.17487861
505.00AAPL7140621P005050000.40 0.000.100.27334
507.50AAPL140606P005075000.27 0.000.010.22818
510.00AAPL140606P005100000.17 0.000.030.222035
510.00AAPL140621P005100000.20Down 0.130.190.202272,308
510.00AAPL7140621P005100000.23Down 0.150.120.303112
515.00AAPL140606P005150000.29 0.000.030.23150
515.00AAPL140613P005150000.24 0.000.130.2711
515.00AAPL140621P005150000.24Down 0.170.230.251591,634
515.00AAPL7140621P005150000.35Down 0.750.080.35124
517.50AAPL140606P005175000.41 0.000.030.18223
520.00AAPL140606P005200000.13Down 0.160.040.194128
520.00AAPL140613P005200000.34 0.000.180.31120
520.00AAPL140621P005200000.31Down 0.210.310.322952,777
520.00AAPL7140621P005200000.50 0.000.160.405125
522.50AAPL140606P005225000.54 0.000.060.2022
525.00AAPL140606P005250000.20Down 0.170.080.191204
525.00AAPL140613P005250000.47 0.000.250.371141
525.00AAPL140621P005250000.40Down 0.210.380.392122,729
525.00AAPL7140621P005250001.20 0.000.340.49194
527.50AAPL140606P005275000.17Down 1.290.100.20122
530.00AAPL140606P005300000.56 0.000.110.25372
530.00AAPL7140606P005300003.24 0.000.060.2744
530.00AAPL140613P005300000.76 0.000.340.45327
530.00AAPL140621P005300000.52Down 0.260.480.502892,675
530.00AAPL7140621P005300001.44 0.000.420.60475
530.00AAPL140627P005300000.75Down 0.230.680.8512122
532.50AAPL140606P005325000.90 0.000.110.2712
535.00AAPL140606P005350000.41 0.000.140.2940100
535.00AAPL7140606P005350001.12 0.000.150.31102
535.00AAPL140613P005350000.56Down 0.350.440.553108
535.00AAPL7140613P005350000.51Down 0.640.290.58101
535.00AAPL140621P005350000.65Down 0.300.630.651171,322
535.00AAPL7140621P005350002.05 0.000.580.75242
537.50AAPL140606P005375000.33 0.000.180.32336
540.00AAPL140606P005400000.29Down 0.120.220.3229133
540.00AAPL7140606P005400004.85 0.000.210.3716
540.00AAPL140613P005400001.09 0.000.600.70217
540.00AAPL140621P005400000.85Down 0.380.820.851443,077
540.00AAPL7140621P005400000.88Down 0.420.690.952369
540.00AAPL140627P005400001.25Down 1.931.151.33364
542.50AAPL140606P005425001.02 0.000.250.3912118
545.00AAPL140606P005450000.45Down 0.690.270.448107
545.00AAPL7140606P005450001.91 0.000.250.4611
545.00AAPL140613P005450000.87Down 0.270.810.9064135
545.00AAPL7140613P005450003.05 0.000.560.981010
545.00AAPL140621P005450001.14Down 0.411.091.133854,203
545.00AAPL7140621P005450003.10 0.000.951.217426
545.00AAPL140627P005450001.58Down 0.981.501.65221
547.50AAPL140606P005475000.49Down 0.280.360.49753
547.50AAPL7140606P005475002.43 0.000.310.5211
550.00AAPL140606P005500000.49Down 0.230.420.4926431
550.00AAPL7140606P005500001.10 0.000.240.6016
550.00AAPL140613P005500001.16Down 0.461.081.2069100
550.00AAPL7140613P005500001.11Down 2.690.981.271011
550.00AAPL140621P005500001.47Down 0.551.451.493444,118
550.00AAPL7140621P005500001.60Down 1.071.331.662348
550.00AAPL140627P005500002.54Down 0.711.952.121083
552.50AAPL140606P005525000.60Down 0.290.520.63933
552.50AAPL7140606P005525004.90 0.000.330.683030
555.00AAPL140606P005550000.89Down 0.120.620.745372
555.00AAPL7140606P005550003.55 0.000.430.7812
555.00AAPL140613P005550001.52Down 0.601.471.60102113
555.00AAPL7140613P005550004.70 0.001.261.642020
555.00AAPL140621P005550002.03Down 0.561.941.983881,057
555.00AAPL7140621P005550002.65Down 0.111.802.11827
555.00AAPL140627P005550003.75 0.002.532.72616
557.50AAPL140606P005575000.84Down 0.380.750.89567
557.50AAPL7140606P005575003.55 0.000.650.9214
557.50AAPL140627P005575002.96Down 3.592.873.10419
560.00AAPL140606P005600000.98Down 0.310.901.0041396
560.00AAPL7140606P005600001.73 0.000.721.06112
560.00AAPL140613P005600002.10Down 0.492.002.2315148
560.00AAPL140621P005600002.64Down 0.692.562.633875,780
560.00AAPL7140621P005600003.10Down 0.892.452.742130
560.00AAPL140627P005600003.90Down 0.703.203.502175
562.50AAPL140606P005625001.21Down 0.341.101.232154
562.50AAPL7140606P005625004.60 0.000.911.2512
562.50AAPL140613P005625002.51Down 2.542.292.573779
562.50AAPL7140613P005625006.45 0.002.092.491010
565.00AAPL140606P005650001.50Down 0.291.351.42461,051
565.00AAPL7140606P005650001.82Down 3.331.281.4817
565.00AAPL140613P005650002.87Down 0.592.662.9530191
565.00AAPL7140613P005650006.20 0.002.422.87113
565.00AAPL140621P005650003.50Down 0.703.403.452532,292
565.00AAPL7140621P005650008.32 0.003.253.605222
565.00AAPL140627P005650004.96Down 0.824.204.40114
567.50AAPL140613P005675003.22Down 0.783.103.401547
567.50AAPL140627P005675005.52 0.004.705.00733
567.50AAPL7140627P005675008.55 0.004.356.1011
570.00AAPL140606P005700002.05Down 0.531.942.12117469
570.00AAPL7140606P005700007.00 0.001.832.17715
570.00AAPL140613P005700004.05Down 0.443.553.95678
570.00AAPL7140613P005700008.03 0.003.553.8066
570.00AAPL140621P005700004.55Down 0.804.454.557593,360
570.00AAPL7140621P005700004.68Down 5.324.404.65480
570.00AAPL140627P005700006.10Down 1.125.305.60840
570.00AAPL7140627P005700008.30 0.005.006.7511
572.50AAPL140613P005725004.38Down 0.694.104.501893
572.50AAPL7140613P005725008.35 0.004.104.40111
572.50AAPL140627P005725007.30 0.005.956.3013
572.50AAPL7140627P0057250010.30 0.005.607.5011
575.00AAPL140606P005750003.00Down 0.852.832.9795265
575.00AAPL7140606P005750006.50 0.002.763.101263
575.00AAPL140613P005750005.10Down 0.904.705.1522144
575.00AAPL7140613P005750006.80 0.004.605.10122
575.00AAPL140621P005750005.86Down 0.975.705.855061,326
575.00AAPL7140621P005750007.79 0.005.705.953306
575.00AAPL140627P005750007.48Down 0.776.657.00123
577.50AAPL140613P005775005.73Down 1.425.405.85163
577.50AAPL7140613P0057750010.40 0.005.405.8015
577.50AAPL140627P0057750010.34 0.007.457.8011
580.00AAPL140606P005800004.15Down 0.924.004.20171301
580.00AAPL7140606P005800005.00 0.003.954.353346
580.00AAPL140613P005800006.58Down 1.426.206.601486
580.00AAPL7140613P005800007.40 0.006.056.60522
580.00AAPL140621P005800007.50Down 1.067.307.455133,276
580.00AAPL7140621P005800008.05Down 1.607.207.6024162
580.00AAPL140627P005800009.45Down 0.608.358.70127
582.50AAPL140613P005825007.25Down 1.207.007.45131
582.50AAPL7140613P0058250012.85 0.007.008.857272
582.50AAPL140627P0058250011.95 0.009.259.651384
585.00AAPL140606P005850005.60Down 1.855.555.95561271
585.00AAPL7140606P005850007.48 0.005.456.05212
585.00AAPL140613P005850009.15Down 0.757.958.404159
585.00AAPL7140613P0058500010.05 0.007.7510.3511
585.00AAPL140621P005850009.30Down 1.159.159.302931,145
585.00AAPL7140621P005850009.50Down 0.909.109.8020171
585.00AAPL140627P0058500010.25Down 1.6510.2510.60116
585.00AAPL7140627P0058500013.82 0.009.9512.0537
587.50AAPL140613P005875009.00Down 2.209.009.251099
587.50AAPL7140613P0058750013.50 0.008.6511.3522
587.50AAPL140627P0058750014.20 0.0011.3011.70454
590.00AAPL140606P005900007.80Down 1.207.607.85264546
590.00AAPL7140606P0059000017.67 0.007.359.40938
590.00AAPL140613P0059000010.80Down 1.5510.0510.5010211
590.00AAPL140621P0059000011.39Down 0.9711.3011.459462,582
590.00AAPL7140621P0059000012.39Down 2.7911.2511.60598
590.00AAPL140627P0059000015.90 0.0012.4012.801243
590.00AAPL7140627P0059000014.75 0.0012.1014.7024
592.50AAPL140613P0059250012.20Down 2.0011.2011.801017
592.50AAPL7140613P0059250013.02Down 2.4311.0013.6012
592.50AAPL140627P0059250017.00 0.0013.6013.904840
595.00AAPL140606P0059500010.15Down 0.9510.0010.3057406
595.00AAPL7140606P0059500018.55 0.009.7012.00125
595.00AAPL140613P0059500013.10Down 2.5012.5012.9518168
595.00AAPL7140613P0059500016.85 0.0012.2014.851313
595.00AAPL140621P0059500014.00Down 0.8913.8013.901851,228
595.00AAPL7140621P0059500023.00 0.0013.7014.50277
595.00AAPL140627P0059500015.07Down 1.6814.9015.15127
597.50AAPL140613P0059750017.00 0.0013.9014.65933
597.50AAPL140627P0059750025.10 0.0016.2016.50134
600.00AAPL140606P0060000013.02Down 1.9812.8013.4029153
600.00AAPL7140606P0060000013.00Down 9.9012.0015.10124
600.00AAPL140613P0060000015.53Down 3.1915.3015.752214
600.00AAPL7140613P0060000024.82 0.0014.9017.5025
600.00AAPL140621P0060000016.75Down 0.9516.4516.652182,099
600.00AAPL7140621P0060000022.80 0.0016.4517.301071
600.00AAPL140627P0060000020.20 0.0017.6018.1011
600.00AAPL7140627P0060000020.90 0.0016.9519.5022
602.50AAPL140613P0060250019.37 0.0016.8017.50323
602.50AAPL140627P0060250028.40 0.0019.1019.6033
605.00AAPL140606P0060500016.55Down 0.7016.1016.3517695
605.00AAPL7140606P0060500020.75 0.0015.0018.3014
605.00AAPL140613P0060500018.65Down 3.8518.3519.05741
605.00AAPL7140613P0060500023.40 0.0017.1020.001111
605.00AAPL140621P0060500019.85Down 1.1019.5519.70118468
605.00AAPL7140621P0060500030.30 0.0019.5020.3515
607.50AAPL7140613P0060750025.05 0.0019.1521.751212
607.50AAPL140627P0060750026.10 0.0022.2022.8522
610.00AAPL140606P0061000020.00Down 10.1019.7020.003473
610.00AAPL7140606P0061000024.10 0.0019.0021.852526
610.00AAPL140613P0061000024.70 0.0021.6522.6027
610.00AAPL140621P0061000023.20Down 1.0022.8023.1061493
610.00AAPL7140621P0061000027.80 0.0022.7523.652428
612.50AAPL140613P0061250034.05 0.0023.4024.3547
612.50AAPL7140613P0061250026.65 0.0022.3525.751010
612.50AAPL140627P0061250026.20Down 8.4525.6526.302525
615.00AAPL140606P0061500023.85Down 3.2023.7024.053435
615.00AAPL140613P0061500034.30 0.0025.3026.4046
615.00AAPL140621P0061500037.45 0.0026.5026.7513184
615.00AAPL7140621P0061500082.30 0.0026.4027.152010
617.50AAPL140613P0061750037.45 0.0027.2528.25417
617.50AAPL7140627P0061750039.68 0.0027.9031.2533
620.00AAPL140606P0062000028.70Down 10.0527.6528.7515
620.00AAPL7140606P0062000032.56 0.0026.6029.9534
620.00AAPL140613P0062000032.30 0.0029.2030.6527
620.00AAPL140621P0062000033.18 0.0030.3031.0020123
620.00AAPL7140627P0062000042.87 0.0029.9033.1033
625.00AAPL140606P0062500043.00 0.0032.1033.15133
625.00AAPL140613P0062500037.90 0.0033.4034.502020
625.00AAPL140621P0062500037.30 0.0034.1035.1021142
625.00AAPL7140621P0062500091.40 0.0033.7536.402010
627.50AAPL140627P0062750043.55 0.0036.8038.001010
630.00AAPL140606P0063000041.20 0.0036.3538.101414
630.00AAPL140613P0063000038.70Down 7.0037.7538.952510
630.00AAPL7140613P0063000041.50 0.0036.9539.7511
630.00AAPL140621P0063000039.00Down 10.8538.3539.352236
630.00AAPL7140621P0063000038.95 0.0038.0040.6555
630.00AAPL140627P0063000041.85 0.0039.0540.1511
635.00AAPL140606P0063500046.80 0.0041.4042.7544
635.00AAPL140613P0063500045.30 0.0042.2543.4048
635.00AAPL140621P0063500045.60 0.0042.7543.901124
635.00AAPL7140621P0063500047.20 0.0042.1045.0011
640.00AAPL140621P0064000048.00Down 1.5047.3048.60276
645.00AAPL140621P0064500054.50 0.0051.9553.102378
650.00AAPL140621P0065000058.00Down 8.9056.7057.852144
655.00AAPL140621P0065500060.80 0.0061.5062.702351
660.00AAPL140621P0066000069.80 0.0066.3567.5511
665.00AAPL140621P0066500069.25 0.0071.0572.4011
670.00AAPL140621P0067000078.75Down 9.7776.1077.4015
680.00AAPL140621P0068000081.60 0.0086.0087.2511
685.00AAPL140621P0068500099.75 0.0090.8092.3011
700.00AAPL140621P00700000138.05 0.00105.55107.3012
740.00AAPL140621P00740000155.70 0.00145.80147.2511
750.00AAPL140621P00750000159.65 0.00155.75157.2044
755.00AAPL140621P00755000168.60 0.00160.75162.2511
760.00AAPL140621P00760000173.60 0.00165.75167.2088
   
Highlighted options are in-the-money.

Expand to Straddle View...

Currency in USD.

+ + + diff --git a/pandas/io/tests/test_data.py b/pandas/io/tests/test_data.py index cf7c906a273b1..c13553d14b861 100644 --- a/pandas/io/tests/test_data.py +++ b/pandas/io/tests/test_data.py @@ -3,11 +3,12 @@ import warnings import nose from nose.tools import assert_equal -from datetime import datetime +from datetime import datetime, date +import os import numpy as np import pandas as pd -from pandas import DataFrame +from pandas import DataFrame, Timestamp from pandas.io import data as web from pandas.io.data import DataReader, SymbolWarning, RemoteDataError from pandas.util.testing import (assert_series_equal, assert_produces_warning, @@ -242,6 +243,12 @@ def setUpClass(cls): year = year + 1 month = 1 cls.expiry = datetime(year, month, 1) + cls.dirpath = tm.get_data_path() + cls.html1 = os.path.join(cls.dirpath, 'yahoo_options1.html') + cls.html2 = os.path.join(cls.dirpath, 'yahoo_options2.html') + cls.root1 = cls.aapl._parse_url(cls.html1) + cls.root2 = cls.aapl._parse_url(cls.html2) + @classmethod def tearDownClass(cls): @@ -251,29 +258,31 @@ def tearDownClass(cls): @network def test_get_options_data(self): try: - calls, puts = self.aapl.get_options_data(expiry=self.expiry) + options = self.aapl.get_options_data(expiry=self.expiry) except RemoteDataError as e: nose.SkipTest(e) else: - assert len(calls)>1 - assert len(puts)>1 + assert len(options)>1 + def test_get_options_data(self): # regression test GH6105 - self.assertRaises(ValueError,self.aapl.get_options_data,month=3) - self.assertRaises(ValueError,self.aapl.get_options_data,year=1992) + self.assertRaises(ValueError, self.aapl.get_options_data, month=3) + self.assertRaises(ValueError, self.aapl.get_options_data, year=1992) @network def test_get_near_stock_price(self): try: - calls, puts = self.aapl.get_near_stock_price(call=True, put=True, + options = self.aapl.get_near_stock_price(call=True, put=True, expiry=self.expiry) except RemoteDataError as e: nose.SkipTest(e) else: - self.assertEqual(len(calls), 5) - self.assertEqual(len(puts), 5) + assert len(options)> 1 + + self.assertTrue(len(options) > 1) + @network def test_get_call_data(self): @@ -293,6 +302,52 @@ def test_get_put_data(self): else: assert len(puts)>1 + @network + def test_get_expiry_months(self): + try: + dates = self.aapl._get_expiry_months() + except RemoteDataError: + raise nose.SkipTest("RemoteDataError thrown no dates found") + self.assertTrue(len(dates) > 1) + + @network + def test_get_all_data(self): + try: + data = self.aapl.get_all_data(put=True) + except RemoteDataError: + raise nose.SkipTest("RemoteDataError thrown") + + self.assertTrue(len(data) > 1) + + @network + def test_get_all_data_calls_only(self): + try: + data = self.aapl.get_all_data(call=True, put=False) + except RemoteDataError: + raise nose.SkipTest("RemoteDataError thrown") + + self.assertTrue(len(data) > 1) + + def test_sample_page_price_quote_time1(self): + #Tests the weekend quote time format + price, quote_time = self.aapl._get_underlying_price(self.root1) + self.assertIsInstance(price, (int, float, complex)) + self.assertIsInstance(quote_time, (datetime, Timestamp)) + + def test_sample_page_price_quote_time2(self): + #Tests the weekday quote time format + price, quote_time = self.aapl._get_underlying_price(self.root2) + self.assertIsInstance(price, (int, float, complex)) + self.assertIsInstance(quote_time, (datetime, Timestamp)) + + def test_sample_page_chg_float(self): + #Tests that numeric columns with comma's are appropriately dealt with + tables = self.root1.xpath('.//table') + data = web._parse_options_data(tables[self.aapl._TABLE_LOC['puts']]) + option_data = self.aapl._process_data(data) + self.assertEqual(option_data['Chg'].dtype, 'float64') + + class TestOptionsWarnings(tm.TestCase): @classmethod @@ -327,7 +382,7 @@ def test_get_options_data_warning(self): def test_get_near_stock_price_warning(self): with assert_produces_warning(): try: - calls_near, puts_near = self.aapl.get_near_stock_price(call=True, + options_near = self.aapl.get_near_stock_price(call=True, put=True, month=self.month, year=self.year)