Stream Data Using SSE#
Streaming data in specific Data Bundles requires a Grow or Enterprise plan. Streaming on specific symbols requires a Grow plan and Enterprise plan. Firehose (streaming all symbols) requires an Enterprise plan. We stream data using Server-Sent Events (SSE).
The Data Bundles provide endpoints for streaming the following types of data:
U.S. stocks and securities
Forex / currencies
News
IEX Tops
IEX Last
IEX Depth of Book
Important
The Data Streams describes the endpoints.
Note
Please refer to the Data Bundles for the data you want to stream and the IEX Cloud plan for the type of streaming you want–SSE Stream (available with Grow plan and Enterprise plan) or Firehose (available with Enterprise plan). The streaming types are described below.
Streaming Data Endpoints#
Data Streams describes the streaming endpoints.
Important
Go to Data Streams to see all the endpoints.
US Stocks and Securities#
There are three types of endpoints for U.S. stocks and securities. Two of them require a paid plan and a UTP agreement. Here’s an overview of these endpoints:
US Stocks Endpoints:
Endpoint |
Response Data |
Requirements |
---|---|---|
|
- IEX real-time data |
- Paid plan |
|
- IEX real-time data |
None |
|
- 15 minute delayed OTC data |
- Paid plan |
Get Nasdaq-listed Stock Data (UTP/OTC Data) explains the UTP agreement process.
Firehose Versus Streaming on Symbols#
Depending on your IEX Cloud plan, you can stream on specific symbols or stream everything – like drinking from a firehose.
Important
SSE Streaming is available with Grow plans and Enterprise plans; Firehose is available only with Enterprise plans.
The symbols
query parameter enables you to stream on a specific symbol or comma-separated list of symbols. The examples below respectively demonstrate calling the stocksUS
endpoint on specific symbols and all symbols.
Stream on 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'
You can use the symbols
parameter with all the streaming endpoints.
Note
Firehose functionality does not apply to IEX DEEP streaming endpoints.
Snapshots#
When you connect to a streaming endpoint, you receive a snapshot of the latest message and then receive updates as they are available. You can disable snapshots by using the query parameter setting nosnapshot=true
.
You can also specify a starting point for a snapshot by using a query parameter setting snapshotAsOf=EPOCH_TIMESTAMP
, where the value is in milliseconds since Epoch.
Interval Streaming#
Some data is available to stream at set intervals:
1 second
5 seconds
1 minute
The endpoints below, for example, compliment the stocksUS
endpoint.
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 Data Streams to learn about all of the endpoints.