Skip to content

Commit

Permalink
Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
addisonlynch committed Jan 22, 2018
1 parent 4c32dfe commit 2d8e075
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
6 changes: 3 additions & 3 deletions pandas_datareader/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 9 additions & 6 deletions pandas_datareader/iex/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()

Expand All @@ -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]
return result[self.symbols]
7 changes: 5 additions & 2 deletions pandas_datareader/tests/test_iex_daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

class TestIEXDaily(object):

@classmethod
def setup_class(cls):
pytest.importorskip("lxml")

@property
def start(self):
return datetime(2015, 2, 9)
Expand All @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit 2d8e075

Please sign in to comment.