-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
When making the request
opt = Options('PCLN', 'yahoo')
data = opt.get_all_data()
I get the error:
ValueError Traceback (most recent call last)
in ()
1 opt = Options('PCLN', 'yahoo')
----> 2 data = opt.get_all_data()
/usr/local/lib/python3.4/dist-packages/pandas/io/data.py in get_all_data(self, call, put)
1088 expiry_dates, _ = self._get_expiry_dates_and_links()
1089
-> 1090 return self._get_data_in_date_range(dates=expiry_dates, call=call, put=put)
1091
1092 def _get_data_in_date_range(self, dates, call=True, put=True):
/usr/local/lib/python3.4/dist-packages/pandas/io/data.py in _get_data_in_date_range(self, dates, call, put)
1102 frame = getattr(self, nam)
1103 except AttributeError:
-> 1104 frame = self._get_option_data(expiry=expiry_date, name=name)
1105 data.append(frame)
1106
/usr/local/lib/python3.4/dist-packages/pandas/io/data.py in _get_option_data(self, expiry, name)
721 frames = getattr(self, frame_name)
722 except AttributeError:
--> 723 frames = self._get_option_frames_from_yahoo(expiry)
724
725 option_data = frames[name]
/usr/local/lib/python3.4/dist-packages/pandas/io/data.py in _get_option_frames_from_yahoo(self, expiry)
653 def _get_option_frames_from_yahoo(self, expiry):
654 url = self._yahoo_url_from_expiry(expiry)
--> 655 option_frames = self._option_frames_from_url(url)
656 frame_name = '_frames' + self._expiry_to_string(expiry)
657 setattr(self, frame_name, option_frames)
/usr/local/lib/python3.4/dist-packages/pandas/io/data.py in _option_frames_from_url(self, url)
682 if not hasattr(self, 'underlying_price'):
683 try:
--> 684 self.underlying_price, self.quote_time = self._get_underlying_price(url)
685 except IndexError:
686 self.underlying_price, self.quote_time = np.nan, np.nan
/usr/local/lib/python3.4/dist-packages/pandas/io/data.py in _get_underlying_price(self, url)
700 root = self._parse_url(url)
701 underlying_price = float(root.xpath('.//*[@Class="time_rtq_ticker Fz-30 Fw-b"]')[0]
--> 702 .getchildren()[0].text)
703
704 #Gets the time of the quote, note this is actually the time of the underlying price.
ValueError: could not convert string to float: '1,044.60'
It looks like commas just need to be stripped from the text before converting to a float.