Available with: All-In-One and EOD+Intraday — All World Extended packages.
Consumption: Does not consume API calls.

We have real-time data with a delay of less than 50ms via WebSockets for the US market, FOREX, Cryptocurrencies. For US stocks our real-time data API supports pre-market and post-market hours (from 4 am to 8 pm EST). You can subscribe up to 50 tickers simultaneously via WebSockets, and it’s possible to increase this number at an additional cost, discussed individually based on a user’s needs.

Register & Get Data

WebSocket Connection

There are four different endpoints, an endpoint for each data market and two types of data for the US market:

We support trade and quote data for the US market, the data is provided via different WebSocket endpoints:

  • US market trade data: wss://ws.eodhistoricaldata.com/ws/us?api_token=XXX
  • US market quote data: wss://ws.eodhistoricaldata.com/ws/us-quote?api_token=XXX

For FOREX and Crypto feeds please use the following WebSocket endpoints:

  • FOREX: wss://ws.eodhistoricaldata.com/ws/forex?api_token=XXX
  • Cryptocurrencies: wss://ws.eodhistoricaldata.com/ws/crypto?api_token=XXX

To start using the real-time API via WebSockets you should connect first to the appropriate endpoint, you can do it either via wss:// or via ws:// protocol. And after that, you should subscribe to the tickers you need.

For testing purposes, you can use our demo API key: ‘demo‘ which works for AAPL, MSFT, TSLA, EURUSD, ETH-USD, and BTC-USD.

Subscribe

To subscribe you should send the following command. If the symbol exists, you will get the data as JSON in real time. Please use the same ticker codes as provided in Cryptocurrencies and Forex lists. For Crypto, the ticker codes have the format ETH-USD, and for Forex, the ticker codes have the format EURUSD.

Examples:

{"action": "subscribe", "symbols": "ETH-USD"}
{"action": "subscribe", "symbols": "EURUSD"}

You can create more than one subscription. You can just send another subscription command or use a comma-separated list of tickers.

For US Market

{"action": "subscribe", "symbols": "AMZN, TSLA"}

Response data for US Trade:

  • s: ticker code
  • p: price
  • c: conditions, see trade conditions glossary for more information
  • v: volume, representing the number of shares traded at the corresponding time stamp
  • dp: dark pool true/false
  • ms: market status, indicating the current state of the market for the stock ( “open”, “closed”, “extended hours”)
  • t: timestamp in milliseconds

Response data for US Quote:

  • s: ticker code
  • ap: ask price
  • bp: bid price
  • as: ask size
  • bs: bid size
  • t: timestamp in milliseconds

FOREX real-time data:

{"action": "subscribe", "symbols": "EURUSD, AUDUSD"} 

Response data for Forex:

  • s: ticker code
  • a: ask price
  • b: bid price
  • dc: daily change percentage
  • dd: daily difference price
  • ppms: pre- and post-market status, always false for Forex data.
  • t: timestamp in milliseconds

Cryptocurrencies real-time data:

{"action": "subscribe", "symbols": "ETH-USD,BTC-USD"}

Response data for cryptocurrencies

  • s: ticker code
  • p: last price
  • q: quantity of the trade
  • dc: daily change percentage
  • dd: daily difference price
  • t: timestamp in milliseconds

Conditions glossary

The US trade feed has the c field in its output. This field passes a numeric value, which can be interpreted as having some meaning related to the particular tick. This is the trade conditions glossary that lists all possible values for this field.

Unsubscribe

The following command will remove the ticker from the response

{"action": "unsubscribe", "symbols": "ETH-USD,BTC-USD"}

Recommended Websocket Plugin

We recommend using the Simple WebSocket Client for Chrome for testing purposes. It’s easy to use for quick testing of our real-time data APIs.

Real-time Data API via WebSockets

Register & Get Data

You can also check our Live (Delayed) Data API.