Skip to content

Commit 7044c7d

Browse files
authored
Merge pull request #677 from gliptak/alpha1
Correct AlphaVantage data source
2 parents bdc1967 + cfeb3b9 commit 7044c7d

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

pandas_datareader/av/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _read_lines(self, out):
6060
except KeyError:
6161
if "Error Message" in out:
6262
raise ValueError("The requested symbol {} could not be "
63-
"retrived. Check valid ticker"
63+
"retrieved. Check valid ticker"
6464
".".format(self.symbols))
6565
else:
6666
raise RemoteDataError()

pandas_datareader/tests/av/test_av_forex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_bad_pairs_format(self):
3232
@pytest.mark.skipif(TEST_API_KEY is None,
3333
reason="ALPHAVANTAGE_API_KEY not set")
3434
def test_one_pair(self):
35-
df = web.DataReader("USD/EUR", "av-forex")
35+
df = web.DataReader("USD/EUR", "av-forex", retry_count=6, pause=20.5)
3636
assert isinstance(df, pd.DataFrame)
3737
assert df.loc["To_Currency Name"][0] == "Euro"
3838
assert df.loc["Time Zone"][0] == 'UTC'
@@ -41,6 +41,6 @@ def test_one_pair(self):
4141
reason="ALPHAVANTAGE_API_KEY not set")
4242
def test_multiple_pairs(self):
4343
pairs = ["USD/JPY", "EUR/JPY"]
44-
df = web.DataReader(pairs, "av-forex")
44+
df = web.DataReader(pairs, "av-forex", retry_count=6, pause=20.5)
4545
assert isinstance(df, pd.DataFrame)
4646
assert df.columns.equals(pd.Index(pairs))

pandas_datareader/tests/av/test_av_quotes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_bad_multiple_symbol(self):
3333
@pytest.mark.skipif(TEST_API_KEY is None,
3434
reason="ALPHAVANTAGE_API_KEY not set")
3535
def test_single_symbol(self):
36-
df = web.get_quote_av("AAPL")
36+
df = web.get_quote_av("AAPL", retry_count=6, pause=20.5)
3737
assert len(df) == 1
3838

3939
expected = pd.Index(["price", "volume", "timestamp"])
@@ -42,7 +42,7 @@ def test_single_symbol(self):
4242
@pytest.mark.skipif(TEST_API_KEY is None,
4343
reason="ALPHAVANTAGE_API_KEY not set")
4444
def test_multi_symbol(self):
45-
df = web.get_quote_av(["AAPL", "TSLA"])
45+
df = web.get_quote_av(["AAPL", "TSLA"], retry_count=6, pause=20.5)
4646
assert len(df) == 2
4747

4848
expected = pd.Index(["price", "volume", "timestamp"])
@@ -52,7 +52,7 @@ def test_multi_symbol(self):
5252
reason="ALPHAVANTAGE_API_KEY not set")
5353
@pytest.mark.xfail(reason="May return NaN outside of market hours")
5454
def test_return_types(self):
55-
df = web.get_quote_av("AAPL")
55+
df = web.get_quote_av("AAPL", retry_count=6, pause=20.5)
5656

5757
assert isinstance(df["AAPL"]["price"], np.int64)
5858
assert isinstance(df["AAPL"]["volume"], np.float64)

pandas_datareader/tests/av/test_av_sector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setup_class(cls):
2020
@pytest.mark.skipif(TEST_API_KEY is None,
2121
reason="ALPHAVANTAGE_API_KEY not set")
2222
def test_sector(self):
23-
df = get_sector_performance_av()
23+
df = get_sector_performance_av(retry_count=6, pause=20.5)
2424

2525
cols = pd.Index(["RT", "1D", "5D", "1M", "3M", "YTD", "1Y", "3Y", "5Y",
2626
"10Y"])

pandas_datareader/tests/av/test_av_time_series.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ def end(self):
3636
def test_av_bad_symbol(self):
3737
with pytest.raises((ValueError, RemoteDataError)):
3838
web.DataReader("BADTICKER", "av-daily", start=self.start,
39-
end=self.end)
39+
end=self.end, retry_count=6, pause=20.5)
4040

4141
def test_av_daily(self):
42-
df = web.DataReader("AAPL", "av-daily", start=self.start, end=self.end)
42+
df = web.DataReader("AAPL", "av-daily", start=self.start,
43+
end=self.end, retry_count=6, pause=20.5)
4344
assert df.columns.equals(self.col_index)
4445
assert len(df) == 578
4546
assert df["volume"][-1] == 19178000
@@ -54,7 +55,7 @@ def test_av_daily(self):
5455

5556
def test_av_daily_adjusted(self):
5657
df = web.DataReader("AAPL", "av-daily-adjusted", start=self.start,
57-
end=self.end)
58+
end=self.end, retry_count=6, pause=20.5)
5859
assert df.columns.equals(pd.Index(["open", "high", "low", "close",
5960
"adjusted close", "volume",
6061
"dividend amount",
@@ -87,7 +88,7 @@ def _helper_df_weekly_monthly(df, adj=False):
8788

8889
def test_av_weekly(self):
8990
df = web.DataReader("AAPL", "av-weekly", start=self.start,
90-
end=self.end)
91+
end=self.end, retry_count=6, pause=20.5)
9192

9293
assert len(df) == 119
9394
assert df.iloc[0].name == '2015-02-13'
@@ -97,7 +98,7 @@ def test_av_weekly(self):
9798

9899
def test_av_weekly_adjusted(self):
99100
df = web.DataReader("AAPL", "av-weekly-adjusted", start=self.start,
100-
end=self.end)
101+
end=self.end, retry_count=6, pause=20.5)
101102

102103
assert len(df) == 119
103104
assert df.iloc[0].name == '2015-02-13'
@@ -107,7 +108,7 @@ def test_av_weekly_adjusted(self):
107108

108109
def test_av_monthly(self):
109110
df = web.DataReader("AAPL", "av-monthly", start=self.start,
110-
end=self.end)
111+
end=self.end, retry_count=6, pause=20.5)
111112

112113
assert len(df) == 27
113114
assert df.iloc[0].name == '2015-02-27'
@@ -117,7 +118,7 @@ def test_av_monthly(self):
117118

118119
def test_av_monthly_adjusted(self):
119120
df = web.DataReader("AAPL", "av-monthly-adjusted", start=self.start,
120-
end=self.end)
121+
end=self.end, retry_count=6, pause=20.5)
121122

122123
assert df.columns.equals(self.col_index_adj)
123124
assert len(df) == 27
@@ -127,7 +128,7 @@ def test_av_monthly_adjusted(self):
127128

128129
def test_av_intraday(self):
129130
# Not much available to test, but ensure close in length
130-
df = web.DataReader("AAPL", "av-intraday")
131+
df = web.DataReader("AAPL", "av-intraday", retry_count=6, pause=20.5)
131132

132133
assert len(df) > 1000
133134
assert 'open' in df.columns

0 commit comments

Comments
 (0)