We have real-time data with a delay of less than 50ms via WebSockets for the US market, FOREX, and Cryptocurrencies. For US stocks our real-time data API supports pre-market and post-market hours (from 4 am till 8 pm EST). WebSockets API is available within All World Extended and/or All-In-One packages.

WebSocket Connection

There are three different endpoints, an endpoint for each data 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: ‘OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX‘ 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 format ETH-USD, and for Forex, the ticker codes have 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"}

For FOREX

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

For Crypto

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

Response parameters for Crypto

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

Unsubscribe

The following command will remove the ticker from the response

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

We recommend using the Simple WebSocket Client for Chrome for testing purposes. With the standard subscription, you can use up to 50 tickers simultaneously. And it’s possible to increase the number of concurrent tickers per request.

Comments

  1. Sven Möhler

    How much does a real time api request cost (api calls)? I mean, 100000 api calls per day is not much when feeding the data in real time.

  2. Ricardo Minnaar

    Hello,

    What exactly is offered in this real-time data subscription etc.? (is it just price data or…)

    What type of data can you grab, and can you maybe give me a example and/or link to some tutorials of how to do this please?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.