Live release feed
Sub-second macro releases for FX backtests
Point-in-time history
Official CPI, jobs, GDP, and central-bank events with point-in-time history.
$25/month 14-day free trial
Start Free Trial
Introducing Fxmacrodata Sse Streaming image
Share headline card X LinkedIn Email
Download

Platform News

Product Updates

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.

متوفر أيضًا في English
Share article X LinkedIn Email

يقدم FXMacroData الآن نقطة نهاية نهر الأحداث المرسلة من الخادم (SSE) في الوقت الحقيقي. اتصل مرة واحدة ويتلقى تطبيقك إشعار دفع مباشر في اللحظة التي يتم فيها تناول أي إصدار اقتصادي يغطي جميع العملات المدعومة 18 بما في ذلك الاحتياطي الفيدرالي قرارات السياسة البنك المركزي الأوروبي إعلانات أسعار الفائدة، وبيانات من كل البنك المركزي الرئيسي الآخر.

ما الجديد

  • نقطة نهاية البث المباشر api.fxmacrodata.com/v1/stream/events
  • خطة مجانية: أحداث الإعلانات بالدولار الأمريكي، لا حاجة إلى مفتاح API
  • الخطة المهنية: جميع العملات الـ 18، قابلة للتصفية حسب العملة والمؤشر
  • نبضات قلبية تلقائية كل 30 ثانية للحفاظ على الاتصالات على قيد الحياة من خلال الوكلاء
  • إعادة تشغيل الدعم عبر Last-Event-ID الرأس استئناف الأحداث المفقودة بعد فصل

النقطة النهائية

يتوفر تيار SSE في عنوان URL التالي. هذا اتصال مباشر بخادم FXMacroData API لا تستخدم fxmacrodata.com/api/... مسار لـ SSE، حيث أن هذا الطريق يمر عبر طبقة CDN التي تخزن الاستجابة وتكسر التدفق المباشر.

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

معايير الاستفسار الاختيارية تسمح لك بتضييق نطاق الإمدادات:

  • currencies قائمة منفصلة عن الفاصلة: usd,eur,gbp
  • indicators قائمة منفصلة عن الفاصلة: inflation,policy_rate
  • api_key مطلوب مفتاح API مهني للعملات غير الدولار الأمريكي
curl -N "https://api.fxmacrodata.com/v1/stream/events?currencies=usd&indicators=inflation,policy_rate"

شكل الحدث

كل إصدار اقتصادي نشر ينتج إطارًا قياسيًا لموقع W3C EventSource:

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

رسالة SSE هي محفز تشغيلي، وليس كامل حمولة البيانات. عند استلامها، اتصل بالمركز النهائي لإعلان المطابقة تحت مستندات بيانات واجهة برمجة التطبيقات لاسترداد السلسلة الزمنية الكاملة بما في ذلك القيمة الجديدة.


مثال متصفح

في متصفح، محلي EventSource يتعامل مع إعادة الاتصال تلقائيًا. الرواتب غير الزراعية بالدولار و التضخم بالدولار باستخدام المستوى غير المصادق عليه الحر:

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);

مثال بايثون

بالنسبة لعامل جانب الخادم، استخدم requests في وضع البث Last-Event-ID على إعادة الاتصال لإعادة تشغيل أي أحداث فاتت:

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()

توافر الخطة

خطة مجانية

الأحداث الإعلانية للدولار فقط لا حاجة إلى مفتاح API api.fxmacrodata.com/v1/stream/events بدون أي معايير مصادقة

خطة مهنية

جميع العملات الـ 18 ، تصفية حسب أي مزيج من العملات والمؤشرات ، مرر مفتاح API الخاص بك كـ ?api_key=YOUR_KEY في سلسلة الاستعلامات


ما الذي سنبني بعد ذلك

يعمل تيار SSE بشكل أفضل كطبقة محفزة فوق سير العمل REST الموجود. تشمل الأنماط العملية:

  • تحديثات بطاقة لوحة القيادة في الوقت الحقيقي تحديث لوحة واحدة في اللحظة التي تصل فيها البيانات الجديدة بدلاً من الاستطلاع كل N دقيقة.
  • إنذارات التداول مقارنة أحدث إصدار إلى عتباتك وإطلاق إشعار سلاك أو ويب هوك على الفور.
  • إبطال ذاكرة التخزين المؤقت استخدام حدث SSE كإشارة لإعادة استرداد وتخزين سجل المؤشر المحدث.
  • مع الـ تقويم الإصدار تعرف ما هو المقرر بعد ذلك واستخدام SSE كالتأكيد المباشر عندما ينشر فعليا.

لمزيد من المعلومات عن خطوة خطوة في التنفيذ، انظر دليل التدريبات المتعلقة بتبث SSE.


فريق FXMacroData

Blogroll

AI Answer-Ready

Key Facts

Page
Introducing FXmacrodata Sse Streaming
Section
Articles
Canonical URL
https://fxmacrodata.com/ar/articles/introducing-fxmacrodata-sse-streaming
Source
FXMacroData editorial and official publisher references
Last Updated
2026-06-09 13:02 UTC

Provenance And Trust

Cite the canonical URL and source field above. Where available, this page maps to official publisher releases and timestamped updates.

Quick Q&A

What is this page about? This page explains Introducing FXmacrodata Sse Streaming with directly usable context for trading, research, and API workflows.

What source should be cited? Use the canonical URL and the listed source field; cite official publisher references when available.

How fresh is this content? The last updated value above reflects the page metadata or latest available data timestamp.

Can this be used in AI assistants? Yes. This section is intentionally structured for retrieval and citation in chat assistants.

Prompt Packs

Use these in ChatGPT, Claude, Gemini, Mistral, Perplexity, or Grok for consistent source-aware outputs.