EODHD offers one of the best ways for investors, developers, and data analysts to incorporate real-time finance data for the stocks, 1100+ Forex pairs, 1000+ Digital Currencies into their decision-making projects with a delay of less than 50ms via WebSockets. For stocks our real-time data API supports pre-market and post-market hours (from 4 am to 8 pm EST).
The subscription provides real-time access to prices for 50 tickers simultaneously via WebSockets. Additionally, the 50-symbol limit can be increased through the user dashboard.
For global markets and all exchanges around the world we also offer Live (Delayed) data with 15min delay.
What is WebSocket protocol
WebSockets is a communication protocol that provides full-duplex communication channels over a single TCP connection. It enables real-time communication between a client and a server, allowing them to exchange messages continuously without the overhead of repeatedly establishing new connections. In the case of financial data providers, Websockets API provides real-time stock market information with minimal delay.
Because real-time WebSocket streaming is resource-intensive, it is offered on paid plans rather than a free tier.
What you get (Data availability)
Stocks (full list of tickers available)
• Trade stream (last price, size, conditions, etc.)
• Quote stream (bid/ask, sizes)
• Extended hours supported (pre‑ and post‑market)
FOREX (full list of available currency pairs)
• Bid/ask + day change/difference
• Tickers like EURUSD, AUDUSD, etc.
Digital Currencies (Full list of available crypto pairs)
• Last price, quantity, day change/difference
• Tickers like ETH-USD, BTC-USD
Lists of available tickers and pairs for Real-Time feeds can be retrieved in JSON format via this API endpoint, providing the full list of exchange or asset class components (use “US” for US stocks, “CC” for cryptocurrencies, “FOREX” for currency pairs).
Demo access is available with API key “demo” for: AAPL, MSFT, TSLA, EURUSD, ETH-USD, BTC-USD.
Updates & Latency
- Streaming updates pushed in real time over a persistent WebSocket connection.
- Typical transport latency < 50 ms from our gateway to your client (excluding network distance).
- Market status flag indicates open, closed, or extended hours for stocks.
Endpoints
Open connection – use wss:// in production. ws:// is available for local testing.
Equities (Trades and Quotes):
wss://ws.eodhistoricaldata.com/ws/us?api_token=YOUR_API_KEY
wss://ws.eodhistoricaldata.com/ws/us-quote?api_token=YOUR_API_KEY
Forex
wss://ws.eodhistoricaldata.com/ws/forex?api_token=YOUR_API_KEY
Crypto
wss://ws.eodhistoricaldata.com/ws/crypto?api_token=YOUR_API_KEY
Subscribe / Unsubscribe
After the socket is open, send JSON commands.
Connection and status messages: on a successful connection the server first sends an authorization message. If you subscribe to a symbol your plan does not allow, for example a non-demo ticker on the demo key, the server replies with a status message instead of data.
{"status_code": 200, "message": "Authorized"}
{"status_code": 422, "message": "Only limited symbols allowed for demo"}
Subscribe:
{"action": "subscribe", "symbols": "ETH-USD"}
Multiple symbols (comma‑separated):
{"action": "subscribe", "symbols": "AAPL,TSLA"}
Unsubscribe:
{"action": "unsubscribe", "symbols": "ETH-USD,BTC-USD"}
Response Schemas
Trades (endpoint: /ws/us):
{
"s": "AAPL", // ticker
"p": 316.9603, // last trade price
"c": [14, 37, 41], // trade condition codes (array; see glossary)
"v": 48, // trade size (shares)
"dp": false, // dark pool (true/false)
"ms": "extended-hours", // market status: open | closed | extended-hours
"t": 1784115290873 // epoch ms
}
Note: Trade messages include “c” (numeric) that maps to a condition code. See the downloadable glossary in the docs (pdf).
Quotes (endpoint: /ws/us-quote):
{
"s": "AAPL", // ticker
"ap": 317.297, // ask price
"as": 160, // ask size
"bp": 316.988, // bid price
"bs": 40, // bid size
"t": 1784115291977 // epoch ms
}
FOREX (endpoint: /ws/forex):
{
"s": "EURUSD", // symbol
"a": 1.1419, // ask
"b": 1.1416, // bid
"dc": "0.3005", // daily change, % (string)
"dd": "0.0034", // daily difference, price units (string)
"ppms": true, // pre/post market status flag
"t": 1784115288241 // epoch ms
}
Crypto (endpoint: /ws/crypto):
{
"s": "ETH-USD", // symbol
"p": "1881.0931", // last price (string)
"q": "1", // trade quantity (string)
"dc": "5.6041", // daily change, % (string)
"dd": "105.4177", // daily difference, price units (string)
"t": 1784115286805 // epoch ms
}
Symbol Limits & Usage Notes
Concurrent subscriptions: up to 50 symbols per connection by default (upgradeable in user dashboard for extra fee).
Tickers:
- Stocks: use plain tickers like AAPL, MSFT
- Forex: no separator, e.g., EURUSD
- Crypto: dash‑separated, e.g., BTC-USD
Resubscribe on reconnect: if the socket reconnects, re‑send your current subscriptions.
Compression/Throughput: consider batching symbol lists in a single subscribe call for efficiency.
Examples (copy‑paste ready)
Open connection for trades:
wss://ws.eodhistoricaldata.com/ws/us?api_token=demo
Then send:
{"action": "subscribe", "symbols": "AMZN,TSLA"}
Open connection for Forex pairs:
wss://ws.eodhistoricaldata.com/ws/forex?api_token=demo
Then send:
{"action": "subscribe", "symbols": "EURUSD,AUDUSD"}
Open connection for Crypto:
wss://ws.eodhistoricaldata.com/ws/crypto?api_token=demo
Then send:
{"action": "subscribe", "symbols": "ETH-USD,BTC-USD"}
Tools for Testing
Chrome: Simple WebSocket Client extension (open a socket, paste open URL, send JSON quote).
EODHD Chrome extension: free mini ticker window for live Stocks/FX/Crypto. Perfect to see our real-time data feed. No commands needed. Install from here.
Postman (or Insomnia) – point-and-click:
- New → WebSocket Request
- URL: wss://ws.eodhistoricaldata.com/ws/crypto?api_token=demo
- Connect → send: {“action”:”subscribe”,”symbols”:”BTC-USD”}
Python (minimal script):
import asyncio, websockets, json
URL = "wss://ws.eodhistoricaldata.com/ws/crypto?api_token=demo"
async def main():
async with websockets.connect(URL) as ws:
await ws.send(json.dumps({"action":"subscribe","symbols":"BTC-USD"}))
while True:
print(await ws.recv())
asyncio.run(main())
Mac Os Terminal – websocat (via Homebrew):
Install websocat:
brew install websocat
One-liner command:
printf '{"action":"subscribe","symbols":"BTC-USD"}\n' | \
websocat "wss://ws.eodhistoricaldata.com/ws/crypto?api_token=demo"
Quick Comparison with Live (Delayed) API and Intraday API
| Aspect | Real-Time (WebSockets) | Live (Delayed) | Intraday Historical |
|---|---|---|---|
| Transport | WebSocket (push) | HTTPS REST (pull) | HTTPS REST (pull) |
| Latency / Freshness | ~live (<50 ms transport) | Stocks: 15–20 min delay; Currencies: ~1 min | Finalized ~2–3 h after US after-hours close |
| Data types | Trades & quotes; FX ticks; crypto ticks | Latest OHLCV snapshot (1-min updates) | OHLCV bars at 1m / 5m / 1h |
| Time ranges | n/a (streaming) | n/a (snapshot feed) | 1m: 120 d · 5m: 600 d · 1h: 7200 d |
| Markets & assets* | US stocks (pre/post supported), Forex & Digital Currencies | US & Global Stocks, Forex & Digital Currencies | US & Global Stocks, Forex & Digital Currencies |
| Best for | Dashboards, signals, market-making tools | Quote tickers, watchlists, lightweight UIs | Backtests, analytics, charting |
* Get the full list of covered tickers.