To start streaming real-time stock prices from IEX via WebSocket, use one of our Real-Time SDKs:
Here is a brief example of how to stream real-time stock prices from IEX using our NodeJS Real-Time SDK:
'use strict'; var IntrinioRealtime = require('intrinio-realtime') // Create an IntrinioRealtime instance var ir = new IntrinioRealtime({ api_key: "INTRINIO_API_KEY", provider: "iex" }) // Listen for quotes ir.onQuote(quote => { var { ticker, type, price, size, timestamp } = quote console.log("QUOTE: ", ticker, type, price, size, timestamp) }) // Join channels ir.join("AAPL", "MSFT", "GE")
In order to stream real-time stock prices, you must "join" a channel. The channels you join will determine which stock price quotes our SDK will send to you. Channels can be:
Note: The $lobby and $lobby_last_price channels require special access. Contact us for information.
In order to remain under your concurrent connection limit, you may have to "leave" channels you no longer want to receive stock price quotes from.
Depending on your subscription, the following limits may apply to your usage of our Real-Time SDKs for streaming stock price quotes from IEX:
Limit Type | Example | Explanation |
---|---|---|
Concurrent Connections | 100 | You may join up to 100 security channels at a time. |
Daily Connection Limit | 10,000 | You may join different channels up to 10,000 times per day, typically resetting at 2 AM EST. |
Firehose | Enabled | You may access the $lobby and $lobby_last_price channels. |
Here is a sample stock price quote and the corresponding field definitions.
{ "type": "ask", "timestamp": 1493409509.3932788, "ticker": "GE", "size": 13750, "price": 28.97 }
"last"
- represents the last traded price
"bid"
- represents the top-of-book bid price
"ask"
- represents the top-of-book ask price
last
trade, or total volume of orders at the top-of-book
bid
or
ask
price
Upon connecting, the system will send you the last recorded IEX bid/ask/last quotes, even during off-hours. So you will notice that the first quote update will come through immediately upon connection, and it will have an older timestamp. All quotes afterwards are live updates.
Each Real-Time SDK has a method for handling large numbers of quotes, typically by using a queue pattern. This is to prevent your system's memory from being overloaded by quotes not yet handled by your code. For more details, refer to the specific documentation for your chosen Real-Time SDK.