diff --git a/pandas_datareader/data.py b/pandas_datareader/data.py index b2b41af3..d9fd8db5 100644 --- a/pandas_datareader/data.py +++ b/pandas_datareader/data.py @@ -290,9 +290,9 @@ def DataReader(name, data_source=None, start=None, end=None, elif data_source == "iex": return IEXDailyReader(symbols=name, start=start, end=end, - chunksize=25, - retry_count=retry_count, pause=pause, - session=session).read() + chunksize=25, + retry_count=retry_count, pause=pause, + session=session).read() elif data_source == "iex-tops": return IEXTops(symbols=name, start=start, end=end, diff --git a/pandas_datareader/iex/daily.py b/pandas_datareader/iex/daily.py index 5b79b40e..46fda161 100644 --- a/pandas_datareader/iex/daily.py +++ b/pandas_datareader/iex/daily.py @@ -43,8 +43,10 @@ class IEXDailyReader(_DailyBaseReader): def __init__(self, symbols=None, start=None, end=None, retry_count=3, pause=0.35, session=None, chunksize=25): - super(IEXDailyReader, self).__init__(symbols=symbols, start=start, end=end, - retry_count=retry_count, pause=pause, session=session, chunksize=chunksize) + super(IEXDailyReader, self).__init__(symbols=symbols, start=start, + end=end, retry_count=retry_count, + pause=pause, session=session, + chunksize=chunksize) @property def url(self): @@ -83,7 +85,8 @@ def _range_string_from_date(self): def read(self): """read data""" try: - return self._read_one_data(self.url, self._get_params(self.symbols)) + return self._read_one_data(self.url, + self._get_params(self.symbols)) finally: self.close() @@ -103,8 +106,8 @@ def _read_lines(self, out): df = df[values] sstart = self.start.strftime('%Y-%m-%d') send = self.end.strftime('%Y-%m-%d') - df= df.loc[sstart:send] - result.update({symbol:df}) + df = df.loc[sstart:send] + result.update({symbol: df}) if len(result) > 1: return result - return result[self.symbols] \ No newline at end of file + return result[self.symbols] diff --git a/pandas_datareader/tests/test_iex_daily.py b/pandas_datareader/tests/test_iex_daily.py index 13da23c7..f6220783 100644 --- a/pandas_datareader/tests/test_iex_daily.py +++ b/pandas_datareader/tests/test_iex_daily.py @@ -7,6 +7,10 @@ class TestIEXDaily(object): + @classmethod + def setup_class(cls): + pytest.importorskip("lxml") + @property def start(self): return datetime(2015, 2, 9) @@ -27,7 +31,7 @@ def test_daily_invalid_date(self): start = datetime(2010, 1, 5) end = datetime(2017, 5, 24) with pytest.raises(Exception): - df = web.DataReader(["AAPL", "TSLA"], "iex", start, end) + web.DataReader(["AAPL", "TSLA"], "iex", start, end) def test_single_symbol(self): df = web.DataReader("AAPL", "iex", self.start, self.end) @@ -72,4 +76,3 @@ def test_multiple_symbols_2(self): expected4 = t.loc["2017-05-24"] assert expected4["close"] == 310.22 assert expected4["high"] == 311.0 -