Example: Get Stock Quotes#

Stock Quotes are just one of the many financial data types we offer. The Stock Quote endpoint is in the Equities Market Data bundle, available during your Free Trial and available for purchase in the Console with an IEX Cloud account.

Here we’ll use the Stock Quotes endpoint to get the latest price for a couple stock symbols.

Note

This Stock Quotes endpoint is part of our Market Data category of data bundles.

Prerequisite

Free Trial or IEX Cloud account. Create one here.

Step 1: Go to the Stock Quotes Endpoint Page#

Go to the Stock Quote endpoint page. The page appears.

Note

The Stock Quotes page is in the API Reference at IEX Cloud Data → Equities Market Data → Stock Quote.

The HTTP Request and Response on the right side of the page shows a live example HTTP request and response for the endpoint.

The endpoint page’s Response Attributes table describes the response fields and their values. The image below shows some of Stock Quote’s response attribute descriptions.

Example HTTP Requests lists example URLs you can click to execute requests.

Next, let’s get a stock quote using an example request.

If you’ve already applied your API token to an API Reference browser session, then skip the next step. Otherwise, read on to apply your token.

Step 2: Apply Your API Token#

Authorize your requests by applying your API Token to your API Reference session, if you haven’t already applied it.

Your token appears in your API Reference URLs once you’ve applied it.

Note

You can always add your API token to a request via the token query parameter–however, applying your API token to the session conveniently adds your token to all the example HTTP requests you click on in the API Reference.

Step 3: Execute an Example HTTP Request#

Click one of the Example HTTP Requests to get a stock quote. A response like the one below appears in your browser.

[
  {
    "avgTotalVolume": 28151113,
    "calculationPrice": "tops",
    "change": 3.02,
    "changePercent": 0.01055,
    "close": null,
    "closeSource": "official",
    "closeTime": null,
    "companyName": "Microsoft Corporation",
    "currency": "USD",
    "delayedPrice": null,
    "delayedPriceTime": null,
    "extendedChange": null,
    "extendedChangePercent": null,
    "extendedPrice": null,
    "extendedPriceTime": null,
    "high": 291.54,
    "highSource": "IEX real time price",
    "highTime": 1681738634232,
    "iexAskPrice": 290,
    "iexAskSize": 200,
    "iexBidPrice": 289.15,
    "iexBidSize": 233,
    "iexClose": 289.16,
    "iexCloseTime": 1681739455859,
    "iexLastUpdated": 1681739455859,
    "iexMarketPercent": 0.017189150976564066,
    "iexOpen": 289.89,
    "iexOpenTime": 1681738200030,
    "iexRealtimePrice": 289.16,
    "iexRealtimeSize": 7,
    "iexVolume": 72848,
    "lastTradeTime": 1681739455859,
    "latestPrice": 289.16,
    "latestSource": "IEX real time price",
    "latestTime": "9:50:55 AM",
    "latestUpdate": 1681739455859,
    "latestVolume": 4238022,
    "low": 288.415,
    "lowSource": "IEX real time price",
    "lowTime": 1681739260403,
    "marketCap": 2152450229602,
    "oddLotDelayedPrice": null,
    "oddLotDelayedPriceTime": null,
    "open": null,
    "openTime": null,
    "openSource": "official",
    "peRatio": 32.16,
    "previousClose": 286.14,
    "previousVolume": 20987917,
    "primaryExchange": "NASDAQ",
    "symbol": "MSFT",
    "volume": 4238022,
    "week52High": 292.08,
    "week52Low": 212.3,
    "ytdChange": 0.2066834465899285,
    "isUSMarketOpen": true
  }
]

The above response is a Microsoft (MSFT) stock quote.

Note

Remember The endpoint page’s Response Attributes table describes all the response fields.

Congratulations on getting a stock quote!

Bonus: Refine the Request to Get Other Stock Quotes You Want#

You can replace the example request’s stock symbol with the symbol of another stock you want pricing for.

For example, in your browser, you can replace the the current path value after quote/ (MSFT symbol in the above example) with a different symbol. Your token value should still be in place.

Format:

https://api.iex.cloud/v1/data/core/quote/SOME_STOCK_SYMBOL?token=YOUR_API_TOKEN

Request:

https://api.iex.cloud/v1/data/core/quote/AMZN?token=pk_1234567890

When you enter your new request URL, a response is returned containing the stock quote for the symbol you entered.

Response:

[
  {
    "avgTotalVolume": 47143180,
    "calculationPrice": "tops",
    "change": -0.18,
    "changePercent": -0.00116,
    "close": null,
    "closeSource": "official",
    "closeTime": null,
    "companyName": "Amazon.com Inc.",
    "currency": "USD",
    "delayedPrice": null,
    "delayedPriceTime": null,
    "extendedChange": null,
    "extendedChangePercent": null,
    "extendedPrice": null,
    "extendedPriceTime": null,
    "high": 155.515,
    "highSource": "IEX real time price",
    "highTime": 1705069809789,
    "iexAskPrice": 159.95,
    "iexAskSize": 200,
    "iexBidPrice": 154.99,
    "iexBidSize": 100,
    "iexClose": 155,
    "iexCloseTime": 1705070010838,
    "iexLastUpdated": 1705070010838,
    "iexMarketPercent": 0.0075807188957054015,
    "iexOpen": 155.46,
    "iexOpenTime": 1705069800587,
    "iexRealtimePrice": 155,
    "iexRealtimeSize": 100,
    "iexVolume": 15488,
    "lastTradeTime": 1705070010838,
    "latestPrice": 155,
    "latestSource": "IEX real time price",
    "latestTime": "9:33:30 AM",
    "latestUpdate": 1705070010838,
    "latestVolume": 2043078,
    "low": 154.77,
    "lowSource": "IEX real time price",
    "lowTime": 1705069877342,
    "marketCap": 1601774740830,
    "oddLotDelayedPrice": null,
    "oddLotDelayedPriceTime": null,
    "open": null,
    "openTime": null,
    "openSource": "official",
    "peRatio": 79.9,
    "previousClose": 155.18,
    "previousVolume": 49072691,
    "primaryExchange": "NASDAQ",
    "symbol": "AMZN",
    "volume": 2043078,
    "week52High": 157.17,
    "week52Low": 88.12,
    "ytdChange": 0.02016420692378578,
    "isUSMarketOpen": true
  }
]

It’s just that easy to get the latest quote for a stock!

What’s Next#

Data Bundles describes our data offering. The data bundle pages summarize each endpoint and link directly to each endpoint reference page.

Query Financial Time Series Data demonstrates querying time series data.

Batch Data Queries demonstrates batching data queries in a single call.

Stream Financial Data describes streaming stock quotes and more, using SSE and Firehose endpoints available with specific IEX Cloud plans.