Introducing FXMacroData SSE Streaming
FXMacroData now streams economic data releases in real time over Server-Sent Events. Connect once and receive live announcement payloads the moment central bank data is ingested — no polling required.
Speed is an edge. Every second between an economic data release and the moment your system acts on it is a second the market has to price it in without you. Until today, reacting to live macro data from FXMacroData meant running a scheduled poll against the announcements endpoint — a workable approach, but one that introduces unavoidable latency and wastes bandwidth on round-trips that return no new data.
Today we are shipping the FXMacroData SSE streaming endpoint. Open a single HTTP connection and your system receives a push notification the instant any economic announcement is ingested — covering all 14 tracked currencies and every indicator in the FXMacroData catalogue. No polling. No wasted requests. Just live data, pushed to you at source.
What’s New
Server-Sent Events (SSE) is a W3C standard for unidirectional, server-to-client
streaming over plain HTTP. Unlike WebSockets it requires no special protocol upgrade
and works transparently through every standard HTTP reverse proxy and CDN. The browser
EventSource API supports it natively; Python, Node.js, and Go all have
lightweight SSE client libraries.
The new endpoint is:
GET https://fxmacrodata.com/api/v1/stream/eventsContent-Type: text/event-stream — W3C EventSource compatible
Each push event carries the full announcement payload for one economic release:
currency, indicator, date, value, and the precise
announcement_datetime Unix timestamp accurate to the second —
the same field available in the
announcements REST endpoint.
Event types
- announcement — new economic data release ingested
- heartbeat — keep-alive comment every 15 s
Filtering parameters
- currencies — comma-separated codes, e.g.
usd,eur - indicators — comma-separated slugs, e.g.
inflation,gdp
Reconnection support
- Pass
Last-Event-IDheader on reconnect - Server replays up to 200 buffered events automatically
Authentication follows the same pattern as the rest of the API: USD events are
available without a key, making it easy to test the stream immediately. Subscribing
to additional currencies requires a Professional API key supplied via the
api_key query parameter. Get your key at
/subscribe.
Why It Matters for Traders
Macro releases are the highest-impact scheduled events in FX. A surprise inflation print or an unexpected central bank rate hold can move EUR/USD, AUD/USD, or USD/JPY by 50–150 pips within seconds of the headline crossing the wire. For traders and systematic strategies, the value of that data decays sharply with time: being first matters.
Polling the REST endpoint every few seconds is sufficient for dashboards and daily summaries, but it imposes a hard floor on latency equal to your poll interval. SSE streaming removes that floor entirely. The moment FXMacroData ingests a new release, every connected subscriber receives the payload within milliseconds — not on your next scheduled request.
For live trading systems
Trigger risk checks, position adjustments, or alert dispatches the instant a rate decision, CPI print, or NFP release lands — without poll overhead or batching delays.
For monitoring & dashboards
Push live indicator updates to browser dashboards, Slack bots, or Discord
channels using the native browser EventSource API or a simple
server-side relay — no WebSocket infrastructure required.
The stream also serves teams that need zero-gap coverage across a high-volume release window — for example, the first Friday of every month when the US Non-Farm Payrolls release often overlaps with other G10 data prints. SSE delivers each release as it arrives, independently, without any of the events being silently dropped by a poll window boundary.
Event Format
Every announcement event follows the W3C EventSource wire format. The
id field is the event_id you pass back in the
Last-Event-ID header if your connection drops:
id: usd_non_farm_payrolls_20260403T123000Z
event: announcement
data: {
"event_id": "usd_non_farm_payrolls_20260403T123000Z",
"currency": "USD",
"indicator": "non_farm_payrolls",
"date": "2026-04-03",
"val": 228000,
"announcement_datetime": 1743681000
}
Keep-alive heartbeat comments are sent every 15 seconds when no announcement is in flight, ensuring idle connections are not dropped by load-balancers or NAT devices:
: heartbeat
Practical Example: Live Release Monitor in Python
You are building a release monitor that logs each new macro print to a file and fires an alert if the value deviates more than one standard deviation from the trailing 12-month mean. Subscribe to the full stream with your Professional key and filter server-side to the currencies you care about:
curl -N \
"https://fxmacrodata.com/api/v1/stream/events?currencies=usd,eur,gbp&api_key=YOUR_API_KEY"
Or use the sseclient-py library to consume events in Python:
import json
import sseclient # pip install sseclient-py
import urllib.request
url = (
"https://fxmacrodata.com/api/v1/stream/events"
"?currencies=usd,eur,gbp"
"&api_key=YOUR_API_KEY"
)
with urllib.request.urlopen(url) as response:
client = sseclient.SSEClient(response)
for msg in client.events():
if msg.event == "announcement":
release = json.loads(msg.data)
print(
f"[{release['currency']}] {release['indicator']} = {release['val']}"
f" (announced {release['announcement_datetime']})"
)
A representative event printed to the console would look like:
[USD] non_farm_payrolls = 228000 (announced 1743681000)
[EUR] inflation = 2.2 (announced 1743695400)
[GBP] policy_rate = 4.5 (announced 1743696000)
From here you can route each event into a queue, a database, or a notification webhook. The USD Non-Farm Payrolls indicator page and the EUR inflation indicator page show the full historical series context if you want to compute dynamic thresholds for your alerting logic.
Practical Example: Browser Dashboard with EventSource
The native browser EventSource API requires no library. Drop the
following snippet into any web page to receive live USD releases (no key required)
and update a DOM element with each new print:
const streamUrl =
"https://fxmacrodata.com/api/v1/stream/events?currencies=usd";
const source = new EventSource(streamUrl);
source.addEventListener("announcement", (e) => {
const release = JSON.parse(e.data);
console.log(
`${release.currency} ${release.indicator}: ${release.val}`
);
// update your dashboard widget here
});
source.onerror = () => {
// EventSource reconnects automatically with Last-Event-ID
console.warn("SSE connection lost — reconnecting…");
};
The browser handles reconnection automatically. It stores the last received
id value and passes it in the Last-Event-ID header
on every reconnect attempt. The FXMacroData server maintains a replay buffer of
up to 200 recent events and will retransmit any events that occurred while your
connection was offline.
curl -N before subscribing.
Zero-Gap Reconnection
Network interruptions happen. The SSE specification defines a standard
reconnection mechanism: clients send the Last-Event-ID header set
to the last id they received. The FXMacroData server replays all
buffered events that arrived after that ID before resuming the live stream, so
your subscriber never misses a release that printed during a transient disconnect.
The replay buffer holds up to 200 events, covering several days of G10 release activity at typical calendar density. For long-running offline periods, combine the SSE stream with a periodic backfill call to the announcements REST endpoint to reconstruct any gap that exceeds the buffer window.
# Persist the last event ID across reconnects
last_event_id = load_last_event_id_from_disk() # or database, Redis, etc.
url = (
"https://fxmacrodata.com/api/v1/stream/events"
"?currencies=usd,eur"
"&api_key=YOUR_API_KEY"
)
headers = {}
if last_event_id:
headers["Last-Event-ID"] = last_event_id
# Pass headers through your SSE client to replay missed events
Get Started
The SSE stream is live now. You can try it without a key using USD events:
# No key required for USD — open in your terminal now
curl -N "https://fxmacrodata.com/api/v1/stream/events?currencies=usd"
To subscribe to all G10 currencies with filtered indicator streams, get your Professional API key at /subscribe and start building:
# Subscribe to EUR and GBP policy rate events only
curl -N \
"https://fxmacrodata.com/api/v1/stream/events?currencies=eur,gbp&indicators=policy_rate&api_key=YOUR_API_KEY"
Full endpoint reference and query parameter details are available in the API reference. From there you can explore the full suite of indicator endpoints — from the USD policy rate to EUR inflation — and wire each series into your live stream subscriber.