WebSocket Endpoints
# Websocket IEX API Top-of-Book & Last Trade Endpoint
wss://api.tiingo.com/iex

Just remember, you will need your token in order to connect. Keep it safe.

.

3.3 Websockets (Firehose) - IEX

3.3.1 Overview

Tiingo provides updates via websocket every time the Top-of-book (best bid/offer prices and sizes) change and when a trade is executed.

We obtain our data through raw binary feeds we receive via a physical connection to IEX in the NY5 data center. We then send the data straight from IEX to you after minor processing (even before we update our databases). This means we send you the IEX data as a JSON array within our JSON object.

To further minimize latency, we use bare metal machines for our cloud infrastructure which are located about 15 miles from the NY5 data center.

  • Trades are when a security/stock was traded on an exchange and includes the price (lastPrice) and the volume done (lastSize).
  • A quote update is when the bid/ask changes, but no trades were done. Tiingo sends a Quote update message via the Websocket if the Top-of-Book values change. In other words, if the best bid price, best bid size, best ask price, or best ask size change, then an update is sent.

With Tiingo Free, Power, Commercial, and Redistribution plans all come with access to the firehose. Please note the firehose exposes a very high amount of data, in some cases to the nanosecond resolution. Please build your systems cautiously and to scale, otherwise you may use our REST API which leverages Tiingo's infrastructure for this purpose.

As of June 29th, 2022, we have implemented a 15ms delay. This delay is a new requirement by the IEX Exchange to keep the data free for customers without a license fee, separate license agreement, and reporting to the IEX Exchange. If you need data faster than 15ms, IEX Exchange does require a $500/month license fee paid directly to the Exchange along with a separate license agreement between you and the IEX Exchange. Please reach out to sales@tiingo.com and we can put you in touch with the IEX Exchange for this paperwork. Our belief is that a 15ms delay should make no practical impact to our customers, since network latency between our servers in NY/NJ and most of our customers outside of the NY Metro area, will have network latency greater than 15ms just by geographical separation.

You can find out about the full product offering on the Product - IEX page.

3.3 Websockets (Firehose) - IEX

3.3.2 Top-of-Book & Last Trade

With Tiingo's Websocket/Firehose IEX API, you can gain access to all data we receive via the cross connect, or to data our system determines is a major update.

To control how much data you would like to receive, read about the "thresholdLevel" request parameter below. A higher "thresholdLevel" means you will get less updates, which could potentially be more relevant.

For the IEX Websocket API:

  • A "thresholdLevel" of 0 means you will get ALL Top-of-Book AND Last Trade updates.
  • A "thresholdLevel" of 5 means you will get all Last Trade updates and only Quote updates that are deemed major updates by our system.
To request top-of-book and last trade data, use the following Websocket endpoint.
# Websocket Top-of-Book & Last Trade Endpoint
wss://api.tiingo.com/iex

The IEX websocket returns meta information about the websocket update message along with the raw data related to that update message.

Check out the table below to see the top-level fields returned from the Websocket IEX API.

Field Name
JSON Field
Data Type
Description
Service code
service
string
An identifier telling you this is IEX data. The value returned by this will always be "iex".
Message Type
messageType
char
A value telling you what kind of data packet this is from our IEX feed. Will always return "A" meaning new price quotes.
IEX TOP/Price Data
data
array
An array containing the IEX data. See the tables below to see the fields returned in the array depending if the message is a "Trade" or "TOP" Update message.

To see what fields are returned in the "data" field, please see the table below.

Trade & Top-of-Book (Quote) Update Messages

Field Name
Array Index
Data Type
Description
Update Message Type
0
char
Communicates what type of price update this is. Will always be "T" for last trade message, "Q" for top-of-book update message, and "B" for trade break messages.
Date
1
datetime
A string representing the datetime this quote or trade came in. This is the timestamp reported by IEX in JSON ISO Format.
Nanoseconds
2
int64
An integer representing the number of nanoseconds since POSIX (Epoch) time UTC.
Ticker
3
string
Ticker related to the asset.
Bid Size
4
int32
The number shares at the bid price.
Only available for Quote updates, null otherwise.
Bid Price
5
float
The current highest bid price.
Only available for Quote updates, null otherwise.
Mid Price
6
float
The mid price of the current timestamp when both "bidPrice" and "askPrice" are not-null. In mathematical terms:
mid = (bidPrice + askPrice)/2.0
This value is calculated by Tiingo and not provided by IEX.

Only available for Quote updates, null otherwise.
Ask Price
7
float
The current lowest ask price.
Only available for Quote updates, null otherwise.
Ask Size
8
int32
The number of shares at the ask price.
Only available for Quote updates, null otherwise.
Last Price
9
float
The last price the last trade was executed at.
Only available for Trade and Break updates, null otherwise.
Last Size
10
int32
The amount of shares (volume) traded at the last price.
Only available for Trade and Break updates, null otherwise.
Halted
11
int32
1 if the security/asset is halted, 0 if it is not halted (this comes from IEX).
After Hours
12
int32
1 if the data is after hours, 0 if the update was during market hours (this comes from IEX).
Intermarket Sweep Order (ISO)
13
int32
1 if the order is an intermarket sweep order (ISO) sweeping order, 0 if its a non-ISO order (this comes from IEX).
Oddlot
14
int32
1 if the trade is an odd lot, 0 if the trade is a round or mixed lot (this comes from IEX).
Only available for Trade updates, null otherwise.
NMS Rule 611
15
int32
1 if the trade is not subject to NMS Rule 611 (trade through), 0 if the trade is subject to Rule NMS 611 (this comes from IEX).
Only available for Trade updates, null otherwise.