pandas-datareader
pandas-datareader copied to clipboard
ValueError when I try to get data from Alpha Vantage
Hello, I have tried the example to get data from alpha vantage (https://pandas-datareader.readthedocs.io/en/latest/remote_data.html#historical-time-series-data) and I got a ValueError:
Traceback (most recent call last):
File "adllib.py", line 40, in
I have also tried the test procedure with pytest:
pytest -v test_av_time_series.py::TestAVTimeSeries::test_av_daily ============================================================================================================ test session starts ============================================================================================================ platform linux -- Python 3.5.2, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 -- /home/arne/dev/python/stock/venv/bin/python cachedir: .pytest_cache rootdir: /home/arne/dev/python/stock collected 1 item
test_av_time_series.py::TestAVTimeSeries::test_av_daily FAILED [100%]
================================================================================================================= FAILURES ================================================================================================================== ______________________________________________________________________________________________________ TestAVTimeSeries.test_av_daily _______________________________________________________________________________________________________
self = <pandas_datareader.tests.av.test_av_time_series.TestAVTimeSeries object at 0x7f85079867f0>
def test_av_daily(self):
df = web.DataReader(
"AAPL",
"av-daily",
start=self.start,
end=self.end,
retry_count=6,
pause=20.5,
)
test_av_time_series.py:63:
../../../pandas/util/_decorators.py:188: in wrapper return func(*args, **kwargs) ../../data.py:579: in DataReader api_key=api_key, ../../base.py:100: in read return self._read_one_data(self.url, self.params) ../../base.py:112: in _read_one_data return self._read_lines(out)
self = <pandas_datareader.av.time_series.AVTimeSeriesReader object at 0x7f8507984eb8> out = {'Meta Data': {'1. Information': 'Daily Prices (open, high, low, close) and Volumes', '2. Symbol': 'AAPL', '3. Last Re..., '1999-12-30': {'1. open': '102.1900', '2. high': '104.1200', '3. low': '99.6200', '4. close': '100.3100', ...}, ...}}
def _read_lines(self, out):
data = super(AVTimeSeriesReader, self)._read_lines(out)
# reverse since alphavantage returns descending by date
data = data[::-1]
start_str = self.start.strftime("%Y-%m-%d")
end_str = self.end.strftime("%Y-%m-%d")
data = data.loc[start_str:end_str]
if data.empty:
raise ValueError("Please input a valid date range")
E ValueError: Please input a valid date range
../../av/time_series.py:112: ValueError
Best regards
arne
Likely relates to: https://github.com/pydata/pandas-datareader/issues/662
I have the same problem, how to fix it ? The 662 issues is disappeared