# Introducing FXMacroData SSE Streaming

Canonical: https://fxmacrodata.com/articles/introducing-fxmacrodata-sse-streaming
Author: Robert Tidball
Published: 2026-04-28T09:00:00Z

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.

FXMacroData now offers a real-time Server-Sent Events (SSE) stream endpoint. Connect once and your application receives a live push notification the moment any economic release is ingested — covering all 18 supported currencies including[Federal Reserve](/dashboard/press-releases/usd) policy decisions,[ECB](/dashboard/press-releases/eur) rate announcements, and data from every other major central bank.

### What's new

- Live SSE streaming endpoint at`api.fxmacrodata.com/v1/stream/events`

- Free plan: USD announcement events, no API key required

- Professional plan: all 18 currencies, filterable by currency and indicator

- Automatic heartbeat every ~30 seconds to keep connections alive through proxies

- Replay support via`Last-Event-ID`header — resume missed events after a disconnect

## The endpoint

The SSE stream is available at the following URL. This is a direct connection to the FXMacroData API server —**do not use the`fxmacrodata.com/api/...`path for SSE**, as that route passes through the CDN layer which buffers the response and breaks the live stream.

```
https://api.fxmacrodata.com/v1/stream/events
```

Optional query parameters let you narrow the feed:

- **`currencies`**— comma-separated list:`usd,eur,gbp`

- **`indicators`**— comma-separated list:`inflation,policy_rate`

- **`api_key`**— Professional API key required for non-USD currencies

```
curl -N "https://api.fxmacrodata.com/v1/stream/events?currencies=usd&indicators=inflation,policy_rate"
```

## Event format

Each published economic release produces a standard W3C EventSource frame:

```
id: usd_inflation_1772109000
event: announcement
data: {"event_id": "usd_inflation_1772109000", "currency": "usd", "indicator": "inflation", "records_written": 1, "timestamp": 1772109002}

```

The SSE message is an operational trigger, not the full data payload. On receipt, call the matching announcement endpoint under[API data docs](/api-data-docs/) to retrieve the complete time series including the new value.

## Browser example

In a browser, native`EventSource`handles reconnection automatically. The following example subscribes to[USD non-farm payrolls](/api-data-docs/usd/non_farm_payrolls) and[USD inflation](/api-data-docs/usd/inflation) using the free unauthenticated tier:

```
const streamUrl = new URL("https://api.fxmacrodata.com/v1/stream/events");
streamUrl.searchParams.set("currencies", "usd");
streamUrl.searchParams.set("indicators", "non_farm_payrolls,inflation");

const source = new EventSource(streamUrl);

source.addEventListener("announcement", async (event) => {
const payload = JSON.parse(event.data);
console.log("Release received:", payload.currency, payload.indicator);

// Fetch the full record now that we know new data is available
const resp = await fetch(
  `https://api.fxmacrodata.com/v1/announcements/${payload.currency}/${payload.indicator}`
);
const records = await resp.json();
console.log("Latest record:", records[records.length - 1]);
});

source.onerror = (err) => console.error("SSE error", err);
```

## Python example

For a server-side worker, use`requests`in streaming mode. Pass`Last-Event-ID`on reconnect to replay any missed events:

```
import json, time, requests

API_KEY = "YOUR_API_KEY"
STREAM_URL = (
  "https://api.fxmacrodata.com/v1/stream/events"
  "?currencies=usd,eur&indicators=inflation,policy_rate&api_key=" + API_KEY
)

def consume():
  last_id = None
  while True:
      headers = {"Accept": "text/event-stream"}
      if last_id:
          headers["Last-Event-ID"] = last_id
      try:
          with requests.get(STREAM_URL, headers=headers, stream=True, timeout=90) as r:
              r.raise_for_status()
              event = {}
              for line in r.iter_lines(decode_unicode=True):
                  if not line:
                      if event.get("event") == "announcement" and event.get("data"):
                          payload = json.loads(event["data"])
                          last_id = event.get("id") or payload["event_id"]
                          print("New release:", payload)
                      event = {}
                      continue
                  if not line.startswith(":"):
                      field, _, value = line.partition(":")
                      event[field] = value.lstrip()
      except requests.RequestException as e:
          print(f"Disconnected: {e}. Retrying...")
          time.sleep(3)

consume()
```

## Plan availability

Free plan

USD announcement events only. No API key required. Connect directly to`api.fxmacrodata.com/v1/stream/events`without any authentication parameter.

Professional plan

All 18 currencies. Filter by any combination of currencies and indicators. Pass your API key as`?api_key=YOUR_KEY`in the query string.

## What to build next

The SSE stream works best as a trigger layer on top of your existing REST workflow. Practical patterns include:

- **Real-time dashboard card updates**— refresh one panel the moment new data arrives instead of polling every N minutes.

- **Trading alerts**— compare the latest release to your thresholds and fire a Slack or webhook notification immediately.

- **Cache invalidation**— use the SSE event as the signal to re-fetch and store the updated indicator record.

- **Combined with the[release calendar](/dashboard/release-calendar)**— know what is scheduled next and use SSE as the live confirmation when it actually publishes.

For a full step-by-step implementation walkthrough, see the[SSE streaming how-to guide](/articles/how-to-use-fxmacrodata-sse-streams) .

— The FXMacroData Team

Source: FXMacroData
