2

Good evening,

Does anyone know how to pull exclusively the close price from alpha vantage API?

I have tried this:

df, meta_data = ts.get_intraday(symbol=CCC,interval='1min', outputsize='full')['5. volume']

with no luck. thank you in advance. Also didn't find anything in their documentation.

Thank you,

jww
  • 97,681
  • 90
  • 411
  • 885
user7669093
  • 71
  • 1
  • 8

3 Answers3

0

The alpha vantage python module doesn't allow this. You just have to get the entire the data and then extract the relevant bits.

Yadub
  • 1
0

The alpha vantage python module doesn't allow this, So we can you can use get_daily function with outputsize as "compact", this will return 100 records,

data, meta_data = ts.get_daily(symbol="MSFT", outputsize="compact")

This is faster than getting all records

0

You can use the Global Quote function like so

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

This gives you the previous close and it only returns 1 record.

This is how you can use it:

# replace the "demo" apikey below with your own key from https://www.alphavantage.co/support/#api-key
url = 'https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=demo'
r = requests.get(url)
data = r.json()

print(data)
Ray Garcia
  • 66
  • 8
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/32004605) – Patrick Yoder Jun 14 '22 at 08:22