diff --git a/src/pricehist/sources/alphavantage.py b/src/pricehist/sources/alphavantage.py index 707ba50..4824282 100644 --- a/src/pricehist/sources/alphavantage.py +++ b/src/pricehist/sources/alphavantage.py @@ -51,8 +51,7 @@ class AlphaVantage(BaseSource): "will list all digital and physical currency symbols.\n" "The PAIR for stocks is the stock symbol only. The quote currency " f"will be determined automatically. {self._stock_symbols_message()}\n" - "The price type 'adjclose' is only available for stocks, and " - "requires an access key for which premium endpoints are unlocked.\n" + "The price type 'adjclose' is only available for stocks.\n" "Beware that digital currencies quoted in non-USD currencies may " "be converted from USD data at one recent exchange rate rather " "than using historical rates.\n" @@ -187,10 +186,9 @@ class AlphaVantage(BaseSource): def _stock_data(self, series): output_quote = self._stock_currency(series.base) or "UNKNOWN" - if series.type == "adjclose": - function = "TIME_SERIES_DAILY_ADJUSTED" - else: - function = "TIME_SERIES_DAILY" + # As of 2022-11-24 TIME_SERIES_DAILY_ADJUSTED is no longer premium, but + # now TIME_SERIES_DAILY is. So, always use TIME_SERIES_DAILY_ADJUSTED. + function = "TIME_SERIES_DAILY_ADJUSTED" params = { "function": function, @@ -341,7 +339,7 @@ class AlphaVantage(BaseSource): raise exceptions.RateLimit(data["Note"]) if ( "Information" in data - and "ways to unlock premium" in data["Information"] + and "unlock all premium endpoints" in data["Information"] ): msg = "You were denied access to a premium endpoint." raise exceptions.CredentialsError([self.API_KEY_NAME], self, msg) diff --git a/tests/live.sh b/tests/live.sh index 6b391e7..c9454d4 100755 --- a/tests/live.sh +++ b/tests/live.sh @@ -47,11 +47,11 @@ name="Alpha Vantage stocks" cmd="pricehist fetch alphavantage TSLA -s 2021-01-04 -e 2021-01-08" read -r -d '' expected <