5

I'm using the Alpha Vantage API to fetch stock market data. However, this API seems to be geared towards only providing series of data which is also implied in its aptly named functions like TimeSeries. That means that if I request a quote from the API I get a series of different dates, times and so forth.

What I'm after is to get only data from a specific date and nothing else. I could get todays date and then use the "is in" if loop to check for it, but that does not seem like a good solution and it would waste quite a bit of resources, so I'm looking to see if there is another better solution available. I have not seen any mention of getting a single entry from their API and tring to get a slice of the dict returned does not seem to work good as the dict is unsorted.

Does someone know about a good way of fetching only stock market data from a single date from the TimeSeries class ?

jww
  • 97,681
  • 90
  • 411
  • 885
exceed
  • 459
  • 7
  • 19

1 Answers1

1

I came across this problem and this question, and after looking into the documentation I saw this Quote Endpoint that returns just the latest info. Here is the description:

A lightweight alternative to the time series APIs, this service returns the latest price and volume information for a security of your choice.

Example from the documentation:

https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=MSFT&apikey=demo

If you need data from another day in the past you can download all historical data once and cache it.

klaus
  • 1,187
  • 2
  • 9
  • 19
  • From what I know this is a recently added feature which solves the problem in this question. This feature was not available from what I remember earlier. When using it now it works nicely although there is a limit for how many requests you are allowed to do using the API. Either the API is a bit unstable or you are just not getting data back when you request it often so I suppose its the limitations on the API – exceed Nov 26 '18 at 20:17