portfolio icon indicating copy to clipboard operation
portfolio copied to clipboard

Historical quotes with Alphavantage using TIME_SERIES_DAILY_ADJUSTED not working

Open kmietas opened this issue 8 months ago • 6 comments

Describe the bug The call for historical quotes using Alphavantage with: https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=SYMBOL&apikey=KEY

is not working anymore. Also, the amount of data delivered by default has been changed, so the call should look like that now: https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=SYMBOL&outputsize=full&apikey=KEY

To Reproduce Steps to reproduce the behavior:

  1. Go to security, click edit, select Alphavantage as provider (upon previously configuring the key in the application)
  2. Click on 'historical quotes' tab and click "show server response"
  3. See error { "Information": "Thank you for using Alpha Vantage! This is a premium endpoint. You may subscribe to any of the premium plans at https://www.alphavantage.co/premium/ to instantly unlock all premium endpoints" }

Expected behavior No error and historical quotes are being obtained

Desktop (please complete the following information):

  • OS: Windows
  • Version 0.65.4

kmietas avatar Oct 24 '23 08:10 kmietas

Just as note for @buchen: Some months ago there were a similar issue (#3275) where TIME_SERIES_DAILY was premium and TIME_SERIES_DAILY_ADJUSTED not. Alpha vantage seems to swap premium functions. So we have to find solutions to not need to change the source code again ater some months.

OnkelDok avatar Oct 24 '23 12:10 OnkelDok

I gues the only chance to get rid of the Alpha Vantage back and forth behaviour is to create a second quote feed, one for TIME_SERIES and the other for TIME_SERIES_DAILY_ADJUSTED. For Yahoo it's more or less similar.

Morpheus1w3 avatar Oct 24 '23 17:10 Morpheus1w3

I gues the only chance to get rid of the Alpha Vantage back and forth behaviour is to create a second quote feed, one for TIME_SERIES and the other for TIME_SERIES_DAILY_ADJUSTED.

Given the behavior described (them switching it back and forth behind users' backs), I doubt that would help for long time. More scalable approach would be to let use define which API endpoint they want to use, as a settings parameter.

But before that, you may want to consider why you use AlphaVantage with such a behavior in the first place. For me, in #3275, it was the case that AlphaVantage was forced upon me by a particular importer. The issue with that importer was since then fixed, it was switched to the default Yahoo Finance, and I never looked back.

pfalcon avatar Oct 24 '23 17:10 pfalcon

Or alternatively we leave it with one provider for alpha vatage, but add configurations to switch between TIME_SERIES_DAILY and TIME_SERIES_DAILY_ADJUSTED. Or we allow to configure the complete URL.

OnkelDok avatar Oct 24 '23 17:10 OnkelDok

I think the most elastic solution is to let user configure the parameters themselves as @OnkelDok suggests. So that the beginning is pre-defined, i.e. the part: https://www.alphavantage.co/query?symbol=SYMBOL&outputsize=full&apikey=KEY and let user define the rest, with &function=TIME_SERIES_DAILY as default value. But this would only work assuming the response JSON stays the same and doesn't require different mapping depending on parameters, which I don't know.

But also thank you for the remark regarding Yahoo Finance @pfalcon, seems all my Invesco ETF's are covered by it in the mean time so I also switched.

kmietas avatar Oct 24 '23 18:10 kmietas

Some months ago there were a similar issue (https://github.com/portfolio-performance/portfolio/issues/3275) where TIME_SERIES_DAILY was premium and TIME_SERIES_DAILY_ADJUSTED not.

That reads like it was a mistake on their product team. It does not make the data series "premium" which has less data than the free one 🙃

Therefore first we should just revert the commit. Any objections? @OnkelDok @pfalcon

Then about the question how to make the AlphaVantage more configurable:

It is not only about the URL, but also the content changes - because the code is using the CSV format, one has to read the value from a different column. Plus: if one would want to use the adjusted value, then one has to also be able configure which values to use (and PP does not supported the download of adjusted values properly because one has to alway reload all values). And one can use the generic JSON Provider to run any query against AlphaVantage if wanted. And finally: how many folks really use AlphaVantage? Therefore I am hesitating to invest precious time to invest on this issue while we have many other to spend time on...

buchen avatar Nov 01 '23 20:11 buchen