Stream Financial Data#
You can stream the following data if you have the appropriate Data Bundles and have a Grow plan or Enterprise plan:
U.S. stocks and securities
Forex / currencies
News
IEX top of book
IEX last sale
IEX depth of book
See also
The Data Streams reference describes all the streaming endpoints.
Prerequisites
A Grow plan or Enterprise plan to SSE Stream on a list of symbols.
An Enterprise plan to Firehose Stream on all symbols simultaneously.
Data Bundles for the data streams you want.
Note
In many cases data streaming is more efficient than REST calls because streaming provides only the latest available data. If you need to control data update frequency however, setting timed-interval REST calls may be better for you. You can test both streaming and REST calls to determine which is more efficient for your workflow.
Data Streaming Endpoints#
The Data Streams reference describes all the streaming endpoints.
Important
Go to Data Streams to see all the streaming endpoints.
Example: Streaming a Stock Quote#
Here’s an example command for streaming prices for the S&P 500 symbol SPY
.
Request:
curl --header 'Accept: text/event-stream' https://cloud-sse.iexapis.com/v1/stocksUSNoUTP\?symbols\=SPY\&token\=YOUR_TOKEN
Response:
data: [
{
"avgTotalVolume": 87666053,
"calculationPrice": "tops",
"change": 0.89,
"changePercent": 0.00188,
"close": 473.88,
"closeSource": "official",
"closeTime": 1704834000161,
"companyName": "SSgA Active Trust - SPDR S&P 500 ETF Trust",
"currency": "USD",
"delayedPrice": 474.84,
"delayedPriceTime": 1704905376803,
"extendedChange": -0.61,
"extendedChangePercent": -0.00128,
"extendedPrice": 474.16,
"extendedPriceTime": 1704897000000,
"high": 475.34,
"highSource": "15 minute delayed price",
"highTime": 1704905378334,
"iexAskPrice": 474.77,
"iexAskSize": 100,
"iexBidPrice": 474.69,
"iexBidSize": 100,
"iexClose": 474.77,
"iexCloseTime": 1704906277470,
"iexLastUpdated": 1704906277470,
"iexMarketPercent": 0.018985782109274103,
"iexOpen": 474.17,
"iexOpenTime": 1704897001767,
"iexRealtimePrice": 474.77,
"iexRealtimeSize": 2,
"iexVolume": 366731,
"lastTradeTime": 1704906277470,
"latestPrice": 474.77,
"latestSource": "IEX real time price",
"latestTime": "12:04:37 PM",
"latestUpdate": 1704906277470,
"latestVolume": 19316086,
"low": 473.87,
"lowSource": "15 minute delayed price",
"lowTime": 1704899157031,
"marketCap": 433859069100,
"oddLotDelayedPrice": 474.84,
"oddLotDelayedPriceTime": 1704905378334,
"open": 474.18,
"openTime": 1704897000000,
"openSource": "official",
"peRatio": null,
"previousClose": 473.88,
"previousVolume": 65931439,
"primaryExchange": "NYSE ARCA",
"symbol": "SPY",
"volume": 19316086,
"week52High": 477.55,
"week52Low": 372.25,
"ytdChange": -0.001128562832677586
}
]
data: [
{
"avgTotalVolume": 87666053,
...
"latestPrice": 474.77,
"latestSource": "IEX real time price",
"latestTime": "12:04:37 PM",
...
}
]
data: [
...
]
...
Note
The response above is abbreviated with ellipses (...
) for purposes of this example.
The example response’s JSON formatted data objects include the stock’s latest price (see the latestPrice
value), the update timestamp (see the latestTime
value), and more. Note, the above latest prices differ at the different times.
Stock Streaming Requirements#
Accessing 15-minute delayed, market-wide data on Nasdaq-listed stocks and on over-the-counter (OTC) stocks require UTP authorization from Nasdaq.
Endpoints Requiring UTP authorization:
stocksUS
stocksOTC
Alternatively, the stocksUSNoUTP
endpoint provides real-time data on stocks trading in IEX and has no UTP authorization requirements.
Stock Endpoint Requirements:
Endpoint |
Response Data |
Requirements |
---|---|---|
|
- IEX real-time data |
|
|
- IEX real-time data |
|
|
- 15 minute delayed OTC data |
- Grow plan or Enterprise plan |
Our Stock Data and UTP Data Authorization guide describes the UTP agreement process.
Firehose Versus SSE Streaming on Specific Symbols#
Depending on your plan, you can stream on a list of symbols (SSE Streaming) or stream all symbols simultaneously (Firehose streaming–like drinking from a firehose).
Important
SSE Streaming is available with Grow plans and Enterprise plans. Firehose is available only with Enterprise plans only.
The symbols
query parameter enables you to stream on a comma-separated list of symbols.
Note
The symbols
query parameter is limited to 50 symbols per connection, but you can make multiple connections.
To Firehose stream with a streaming endpoint, don’t specify the symbols
query parameter.
The examples below respectively demonstrate calling the stocksUS
endpoint on specific symbols and all symbols.
SSE Stream on Specific Symbols:
curl --header 'Accept: text/event-stream' 'https://cloud-sse.iexapis.com/v1/stocksUS?symbols=spy,msft&token=YOUR_TOKEN'
Firehose:
curl --header 'Accept: text/event-stream' 'https://cloud-sse.iexapis.com/v1/stocksUS?token=YOUR_TOKEN'
Note
Firehose functionality does not apply to IEX DEEP (deep
) streaming endpoints.
Snapshots#
When you connect to a streaming endpoint, you first receive a snapshot of the latest message, and then receive updates as they are available.
Note
You can disable snapshots by using the query parameter setting nosnapshot=true
.
You can also specify a snapshot starting point by using a query parameter setting snapshotAsOf=EPOCH_TIMESTAMP
; just replace EPOCH_TIMESTAMP
with a timestamp value in milliseconds since Epoch.
Streaming on Intervals#
Some data is available to stream at set time intervals:
1 second
5 seconds
1 minute
These endpoints return messages at an interval no less than the respective interval. This helps make message delivery more predictable.
Here are the U.S. stocks interval endpoints:
1 second interval:
curl --header 'Accept: text/event-stream' 'https://cloud-sse.iexapis.com/v1/stocksUS1Second?token=YOUR_TOKEN&symbols=spy'
5 second interval:
curl --header 'Accept: text/event-stream' 'https://cloud-sse.iexapis.com/v1/stocksUS5Second?token=YOUR_TOKEN&symbols=spy'
1 minute interval:
curl --header 'Accept: text/event-stream' 'https://cloud-sse.iexapis.com/v1/stocksUS1Minute?token=YOUR_TOKEN&symbols=spy'
What’s Next#
Now you’re familiar with some of the streaming endpoints, check out the Data Streams reference to learn about all the streaming endpoints.