EODHD offers one of the best ways for investors, developers, and data analysts to incorporate real-time finance data for the US market, 1100+ Forex pairs, 1000+ Digital Currencies into their decision-making projects with a delay of less than 50ms via WebSockets. For US 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.
Quick jump:
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.
Providing clients with the WebSocket protocol for real-time data answers the question: ‘What is the best stock market data API?”. Since websocket technology is quite resource consuming, “free stock API for real-time market data” stays as feature impossible to find. EODHD provides real-time data in paid plans EOD+Intraday and ALL-IN-ONE. Read more about plans here.
What you get (Data availability)
US Stocks (full list of US tickers available)
• Trade stream (last price, size, conditions, etc.)
• Quote stream (bid/ask, sizes)
• Covers primary US exchanges (e.g., NASDAQ, NYSE)
• 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 US stocks.
Endpoints
Open connection – use wss:// in production. ws:// is available for local testing.
US 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.
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
US Trades (endpoint: /ws/us):
{
"s": "AAPL", // ticker
"p": 227.31, // last trade price
"v": 100, // trade size (shares)
"c": 12, // trade condition code (see glossary)
"dp": false, // dark pool (true/false)
"ms": "open", // market status: open | closed | extended hours
"t": 1725198451165 // epoch ms
}
Note: US trade messages include “c” (numeric) that maps to a condition code. See the downloadable glossary in the docs (pdf).
US Quotes (endpoint: /ws/us-quote):
{
"s": "AAPL", // ticker
"ap": 227.33, // ask price
"as": 200, // ask size
"bp": 227.30, // bid price
"bs": 100, // bid size
"t": 1725198451165 // epoch ms
}
FOREX (endpoint: /ws/forex):
{
"s": "EURUSD", // symbol
"a": 1.08675, // ask
"b": 1.08665, // bid
"dc": 0.21, // daily change, %
"dd": 0.0023, // daily difference, price units
"ppms": false, // pre/post market status (always false for FX)
"t": 1725198451165. // epoch ms
}
Crypto (endpoint: /ws/crypto):
{
"s": "ETH-USD", // symbol
"p": 2874.12, // last price
"q": 0.145, // trade quantity
"dc": -0.54, // daily change, %
"dd": -15.61, // daily difference, price units
"t": 1725198451165. // epoch ms
}
Symbol Limits & Usage Notes
Concurrent subscriptions: up to 50 symbols per connection by default (upgradeable in user dashboard for extra fee).
Tickers:
- US: 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 US 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 | US 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 |