ENH: Added method to pandas.data.Options to download all option data for... by davidastephens · Pull Request #5602 · pandas-dev/pandas (original) (raw)

In [3]:

tsla = pandas.io.data.Options("TSLA", "yahoo")
In [4]:

tsla.get_all_data()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-7b3741a59d2e> in <module>()
----> 1 tsla.get_all_data()

/home/alex/git/pandas/pandas/io/data.py in get_all_data(self, call, put)
   1109                 except AttributeError:
   1110                     meth_name = 'get_{0}_data'.format(name[:-1])
-> 1111                     frame = getattr(self, meth_name)(expiry=month)
   1112 
   1113                 all_data.append(frame)

/home/alex/git/pandas/pandas/io/data.py in get_call_data(self, month, year, expiry)
    774         for the expiry of the options.
    775         """
--> 776         return self._get_option_data(month, year, expiry, 'calls')
    777 
    778     def get_put_data(self, month=None, year=None, expiry=None):

/home/alex/git/pandas/pandas/io/data.py in _get_option_data(self, month, year, expiry, name)
    702             tables = getattr(self, table_name)
    703         except AttributeError:
--> 704             tables = self._get_option_tables(month, year, expiry)
    705 
    706         ntables = len(tables)

/home/alex/git/pandas/pandas/io/data.py in _get_option_tables(self, month, year, expiry)
    685         #Get the time of the quote, note this is actually the time of the underlying price.
    686         quote_time_text = root.xpath('.//*[@class="time_rtq"]')[0].getchildren()[0].text
--> 687         split = quote_time_text.split(",")
    688         timesplit = split[1].strip().split(":")
    689         timestring = split[0] + ", " + timesplit[0].zfill(2) + ":" + timesplit[1]

AttributeError: 'NoneType' object has no attribute 'split'