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
How to Use the Release Calendar API to Schedule Indicator Fetches image
Share headline card X LinkedIn Email
Download

Implementation

How-To Guides

How to Use the Release Calendar API to Schedule Indicator Fetches

Stop polling every endpoint on a timer. Learn how to query the FXMacroData release calendar to find the exact announcement time for any indicator, then schedule a single targeted API call for that moment — in Python and JavaScript.

他言語版 English
Share article X LinkedIn Email

このガイドの終わりまでに,次のリリースを見つけるために生産FXMacroDataのリリースカレンダーを使用するスケジューラーを持つでしょう. announcement_datetime 新たに印刷される予定の時刻を正確に呼び出す.

条件

  • ほら FXMacroData API キーを ドル以外の通貨では,ドルスケジューリングは公開されます.
  • Python 3.9+ または Node.js 18+
  • ほら requests Python の例 の パッケージ
  • Unix のタイムスタンプ と UTC のスケジューリング に 基礎 的 な 熟知

なぜ投票ではなくスケジュール?

数分ごとに投票は簡単ですが,リクエストを無駄にし,正確なリリース秒の周りに回避可能な遅れを導入します. 生産カレンダーのエンドポイントは,次の予定された公開時間を直接提供します.

基本ワークフロー

  1. 呼び出し /api/v1/calendar/{currency} 選択してください indicator フィルター
  2. 次の列の文字を読んで announcement_datetimeわかった
  3. UTCタイムスタンプ直前まで寝て
  4. 持ってきて /api/v1/announcements/{currency}/{indicator}わかった
  5. 戻った人の最新報告を読む data 次のイベントをスケジュールします

ステップ 1 - カレンダーの応答を理解する

リリースカレンダーは JSON オブジェクトを返します. data 各行にはリリーススラグと予定された UTCタイムスタンプが含まれます.

curl "https://fxmacrodata.com/api/v1/calendar/usd?indicator=inflation"

応答形状:

{
  "currency": "USD",
  "indicator": "inflation",
  "data": [
    {
      "announcement_datetime": 1773077400,
      "release": "inflation"
    }
  ]
}

ドル以外の通貨では,同じ経路を維持し,追加します api_key 指示フィルターなしでより広い通貨スケジュールをクエリする場合は,いくつかの行には,ルーティングメタデータも含まれます. endpoint_family ほら endpoint_pathほら


ステップ2 次のリリースタイムスタンプを見つけ

下のヘルパーは,単一の指標の生産カレンダーを求め,最初の将来のタイムスタンプを返します.

import time
import requests

BASE = "https://fxmacrodata.com/api/v1"

def next_release(currency: str, indicator: str, api_key: str | None = None) -> float | None:
    url = f"{BASE}/calendar/{currency}"
    params = {"indicator": indicator}
    if api_key:
        params["api_key"] = api_key

    response = requests.get(url, params=params, timeout=10)
    response.raise_for_status()

    now = time.time()
    for row in response.json().get("data", []):
        ts = row.get("announcement_datetime")
        if row.get("release") == indicator and ts and float(ts) > now:
            return float(ts)
    return None

ステップ3 - 公開されたデータを適切なタイミングで取得

返信から最新の観測を読み取ります 返却されたデータから最新の観察を読み取れます data 配列

def wait_and_fetch(currency: str, indicator: str, api_key: str | None = None) -> dict | None:
    release_ts = next_release(currency, indicator, api_key)
    if release_ts is None:
        print(f"No upcoming release found for {currency}/{indicator}.")
        return None

    wake_at = release_ts - 2
    time.sleep(max(0.0, wake_at - time.time()))

    url = f"{BASE}/announcements/{currency}/{indicator}"
    params = {"api_key": api_key} if api_key else {}
    response = requests.get(url, params=params, timeout=10)
    response.raise_for_status()
    return response.json()
ポイント: 1-5秒早く目覚めると 時計の歪みやネットワークの遅延を 吸収するのに十分です

ステップ4 - 連続ループを構築する

import time
import requests

BASE = "https://fxmacrodata.com/api/v1"
API_KEY = None
CURRENCY = "usd"
INDICATOR = "inflation"

def on_release(payload: dict) -> None:
    rows = payload.get("data", [])
    latest = rows[-1] if rows else {}
    print(
        "New release:",
        latest.get("date"),
        "value=", latest.get("val"),
        "announced_at=", latest.get("announcement_datetime"),
    )

while True:
    release_ts = next_release(CURRENCY, INDICATOR, API_KEY)
    if release_ts is None:
        print("No release found in the current calendar window. Retrying in 24 hours.")
        time.sleep(86_400)
        continue

    sleep_seconds = max(0.0, release_ts - 2 - time.time())
    print(f"Next {CURRENCY.upper()} {INDICATOR} release in {sleep_seconds / 3600:.2f}h")
    time.sleep(sleep_seconds)

    payload = wait_and_fetch(CURRENCY, INDICATOR, API_KEY)
    if payload:
        on_release(payload)

    time.sleep(5)

リリース後の短い休止は,次のカレンダークエリの前に予定されたイベントを前方にロールするシステムに時間を与えます.


ステップ5 - 複数の時計にスケール

To follow several indicators, run one scheduler per pair. Use canonical indicator slugs throughout so the calendar and announcements routes stay aligned.

WATCHES = [
    {"currency": "usd", "indicator": "inflation"},
    {"currency": "usd", "indicator": "gdp"},
    {"currency": "aud", "indicator": "policy_rate"},
    {"currency": "gbp", "indicator": "unemployment"},
]

フォローアップの取材に関する詳細については, AUD 政策金利ほら GBPの失業率発表のドキュメントのインデックス.


ステップ6 - JavaScript / Node.js バリアント

指示フィルターでカレンダーに問い合わせ,返したタイムスタンプまで休憩,その後マッチングの通知ルートを取得します.

const BASE = "https://fxmacrodata.com/api/v1";

async function nextRelease(currency, indicator, apiKey) {
  const url = new URL(`${BASE}/calendar/${currency}`);
  url.searchParams.set("indicator", indicator);
  if (apiKey) url.searchParams.set("api_key", apiKey);

  const response = await fetch(url);
  if (!response.ok) throw new Error(`Calendar request failed: ${response.status}`);

  const payload = await response.json();
  const now = Date.now() / 1000;
  return payload.data.find((row) => row.release === indicator && row.announcement_datetime > now) ?? null;
}

async function fetchAnnouncement(currency, indicator, apiKey) {
  const url = new URL(`${BASE}/announcements/${currency}/${indicator}`);
  if (apiKey) url.searchParams.set("api_key", apiKey);

  const response = await fetch(url);
  if (!response.ok) throw new Error(`Announcement request failed: ${response.status}`);
  return response.json();
}

If you need to support a queue, cron worker, or serverless timer, keep the same two-step pattern: calendar for timing, announcements for values.

Blogroll

AI Answer-Ready

Key Facts

Page
How To Schedule With Release Calendar
Section
Articles
Canonical URL
https://fxmacrodata.com/ja/articles/how-to-schedule-with-release-calendar
Source
FXMacroData editorial and official publisher references
Last Updated
2026-06-15 11:01 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 How To Schedule With Release Calendar 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.