0

I am trying to use IEX Cloud to get stock quotes for multiple stocks with one API call.

Here is my api call for Apple,Facebook, and Tesla. What am I doing wrong? https://cloud.iexapis.com/stable/stock/market/batch?symbols=aapl,fb,tsla&types=quote?token=MY_TOKEN_HERE

The Error Message returned from the API is this:

"types" required with a valid value

2 Answers2

2

I think the main problem was question mark between 'quote' and token. It should be '&' instead. I replicated your error with question mark, but with & it works just fine.

Here is what works for me: https://cloud.iexapis.com/v1/stock/market/batch?&types=quote&symbols=aapl,fb,tsla&token=YOUR_TOKEN_HERE

if you want to retrieve just the latest price, you can use following call:

https://cloud.iexapis.com/v1/stock/market/batch?&types=price&symbols=aapl,fb,tsla&token=YOUR_TOKEN_HERE

You can learn more at this link: How do I query multiple symbols or data types in one API Call? (for production you use cloud.iexapis.com instead of sandbox)

AlicjaT
  • 21
  • 2
0

as of 2nd-July-2022,

This is how I structured my URL for a batch request.

const tickerArray = ["AAPL", "META", "GOOGL", "TSLA"];

`https://cloud.iexapis.com/v1/stock/market/batch?symbols=${tickerArray.toString().toLowerCase()}&types=quote&token=${process.env.IEXCLOUD_API_KEY}`
neil
  • 353
  • 1
  • 8
  • 17