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.
USD 25/month 14-day free trial
Start Free Trial
すべてのFXMacroData API エンドポイントの使用方法: 完全なガイド image
Share headline card X LinkedIn Email
Download

Implementation

How-To Guides

すべてのFXMacroData API エンドポイントの使用方法: 完全なガイド

公開されたすべてのエンドポイントのステップバイステップウォークスルー FXMacroData API 発表シリーズとリリースカレンダーからCOTポジショニング,商品,外為レート,リアルタイムSSEストリーミング,GraphQLバッチングまで.

他言語版 English
Share article X LinkedIn Email

このガイドの終わりまでに,FXMacroData APIのすべての公開エンドポイントの実用例が表示されます. 発表シリーズとリリースカレンダーからCOTポジショニング,貴金属価格,外為レート,およびGraphQLインターフェースまで,あらゆるマクロデータワークフローに適切なツールを選択することができます.

条件

  • FXMacroDataアカウント fxmacrodata.com について
  • 非USDおよび有料エンドポイントへのアクセスのためのプロフェッショナル APIキー (ほとんどのエンドポイントではUSD要求が無料)
  • curl Python 3.9+ の例で, requests 図書館
  • REST API と JSON 応答の基本的な熟知
簡単な参照表
エンドポイントファミリー 経路 オーサー
発表 /api/v1/発表/{通貨}/{指標} USD無料 · 他者向けプロ
リリースカレンダー /api/v1/カレンダー/{通貨} 免費
データカタログ /api/v1/data_catalogue/{通貨} 通貨について 免費
COT 位置付け /api/v1/cot/{通貨} USD無料 · 他者向けプロ
金属 /api/v1/commodities/{インディケーター} プロキーは常に必要
外国為替レート /api/v1/forex/{ベース}/{引用} 免費
市場セッション /api/v1/市場_セッション 免費
グラフQL /api/v1/グラフql USD + カタログ無料 · 他者向けプロ

ステップ1 発表:歴史的な指標シリーズ

発表エンドポイントはFXMacroDataの核心です.サポートされるマクロ経済指標の標準化されたタイムスタンプ付きタイムシリーズを返します.各行には観測日,リリース値,公式出版物の正確なユニックスタイムスタンップが載っています.

USD リクエストは API キーを不要に動作します.他の通貨では,キーをクエリパラメータとして添付します. start_date ほら end_date (YYY-MM-DD) は,このウィンドウを絞り込むため,過去365日をデフォルトで設定します.

# USD inflation series — no key needed
curl "https://fxmacrodata.com/api/v1/announcements/usd/inflation"

# AUD policy rate — Pro key required
curl "https://fxmacrodata.com/api/v1/announcements/aud/policy_rate?api_key=YOUR_API_KEY"

# EUR GDP with a custom date range
curl "https://fxmacrodata.com/api/v1/announcements/eur/gdp?start_date=2024-01-01&end_date=2026-03-01&api_key=YOUR_API_KEY"
{
  "currency": "USD",
  "indicator": "inflation",
  "has_official_forecast": false,
  "start_date": "2025-03-01",
  "end_date": "2026-03-30",
  "data": [
    {
      "date": "2026-02-01",
      "val": 2.8,
      "announcement_datetime": 1741082400,
      "pct_change": -0.5,
      "pct_change_12m": -6.7
    }
  ]
}

ほら announcement_datetime このフィールドは,データが公式に公開された正確な瞬間のUnixタイムスタンプ (秒, UTC) である. イベント研究の調整のために使用し,バックテストの先見偏見を避けるために使用する. データカタログ (ステップ 3) または API データ ドキュメントほら


ステップ2 リリースカレンダー:次の発表時間

カレンダーエンドポイントは,特定の通貨の各マクロリリースに対する予定された UTC 発表タイムスタンプを返します. 固定間隔で継続的に投票するのではなく,新しいデータが公開されると発射される標的型フェッチをスケジュールするために使用します.

API キーは不要です.選択可能な 特定の指標にフィルター indicator 特別通貨コード COMM 商品のリリーススケジュールを返します.

# All upcoming releases for USD
curl "https://fxmacrodata.com/api/v1/calendar/usd"

# Filter to a single indicator
curl "https://fxmacrodata.com/api/v1/calendar/usd?indicator=non_farm_payrolls"

# Commodity release schedule
curl "https://fxmacrodata.com/api/v1/calendar/COMM"
{
  "currency": "USD",
  "indicator": "non_farm_payrolls",
  "data": [
    {
      "release": "non_farm_payrolls",
      "announcement_datetime": 1746540600,
      "requires_api_key": false
    }
  ]
}

タイムスタンプを人間で読み取れる UTC 時間に変換する datetime.fromtimestamp(ts, tz=timezone.utc) Python でか new Date(ts * 1000).toISOString() JavaScript で 完全なスケジューリングパターンを参照してください リリースカレンダー API を Indicator 取得をスケジュールするには,どのように使うかほら


ステップ3 資料カタログ:利用可能な指標を発見

特定の指標をターゲットとするコードを書く前に,通貨の利用可能なものを確認するためにカタログに問い合わせます. 応答は,各指標スラグを人間に読み取れる名前,単位,リリース頻度,そして中央銀行が公式な予測を公表しているか映写します.

# List all indicators for EUR — no key required
curl "https://fxmacrodata.com/api/v1/data_catalogue/eur"

# Include routing and auth discovery metadata per indicator
curl "https://fxmacrodata.com/api/v1/data_catalogue/usd?include_capabilities=true"
{
  "gdp": {
    "name": "GDP Growth",
    "unit": "%QoQ",
    "frequency": "Quarterly",
    "has_official_forecast": false
  },
  "inflation": {
    "name": "Inflation (CPI)",
    "unit": "%YoY",
    "frequency": "Monthly",
    "has_official_forecast": false
  },
  "policy_rate": {
    "name": "Policy Rate",
    "unit": "%",
    "frequency": "Meeting",
    "has_official_forecast": true
  }
}

答えのトップレベルのキーが 正確です {indicator} サポートされる通貨には,USD,EUR,GBP,JPY,AUD,CAD,CHF,NZD,CNY,SGD,SEK,DKK,PLN,BRLが含まれます. パス include_coverage=true 単一の応答でクロス通貨利用格を入手できます


ステップ4 COT ポジショニング: 投機的な先物データ

取引者のコミットメントエンドポイントは,FX先物契約のCFTCポジショニングデータを毎週提供します.非商業 (投機的),商業 (ヘッジャー) および非報告対象参加者間の総公開利息分割を示します. 通貨トレンドの逆転と混雑したポジションの広範に追跡された主要な指標です.

サポートされる通貨:USD,EUR,GBP,JPY,AUD,CAD,CHF,NZD.USDは無料で,他のすべての通貨にはProキーが必要です.

# USD COT history — free
curl "https://fxmacrodata.com/api/v1/cot/usd"

# EUR COT with a custom date range
curl "https://fxmacrodata.com/api/v1/cot/eur?start_date=2025-01-01&api_key=YOUR_API_KEY"
{
  "currency": "EUR",
  "instrument": "EURO FX - CHICAGO MERCANTILE EXCHANGE",
  "fx_overlay": { "pair": "EUR/USD" },
  "start_date": "2025-01-07",
  "end_date": "2026-03-25",
  "data": [
    {
      "date": "2026-03-18",
      "announcement_datetime": 1742493000,
      "open_interest": 812345,
      "noncommercial_long": 185000,
      "noncommercial_short": 92000,
      "noncommercial_net": 93000,
      "commercial_long": 203000,
      "commercial_short": 310000,
      "commercial_net": -107000,
      "nonreportable_long": 21000,
      "nonreportable_short": 9000
    }
  ]
}

ほら noncommercial_net 投機的な長マイナス短 (long minus short) は,FXトレーダーにとって最も頻繁に引用されるポジショニング指標です.各行には, announcement_datetime for the Friday 3:30 PM ET CFTC publication. For EUR pair context see the 政策金利の文書ほら


ステップ 5 金属:金,銀,プラチナの価格

金属エンドポイントは,ロイヤル・ミント (LBMA固定) から調達された貴金属の日々の価格シリーズを返します.これらのシリーズは,特に安全な港湾流とUSD関連動的を追跡するために,クロス資産マクロインプットとして有用です.

このエンドポイントにはプロフェッショナル API キーが常に必要です. 入手可能な指標スラッグ: goldほら silverほら platinumほら

# Gold LBMA PM Fix daily prices
curl "https://fxmacrodata.com/api/v1/commodities/gold?api_key=YOUR_API_KEY"

# Silver with a date range
curl "https://fxmacrodata.com/api/v1/commodities/silver?start_date=2025-01-01&api_key=YOUR_API_KEY"

# Platinum spot
curl "https://fxmacrodata.com/api/v1/commodities/platinum?api_key=YOUR_API_KEY"
{
  "currency": "COMM",
  "indicator": "gold",
  "has_official_forecast": false,
  "start_date": "2025-03-30",
  "end_date": "2026-03-30",
  "data": [
    {
      "date": "2026-03-28",
      "val": 2870.00,
      "pct_change": 1.2,
      "pct_change_12m": 30.1
    }
  ]
}

応答形は,アナウンスエンドポイントと同一なので,同じ解析コードを再利用できます. announcement_datetime やってる null 日々の価格シリーズで,公式の月刊イベントのみで記入されます.


ステップ6 外為レート: 日々のスポット価格シリーズ

フォレックスエンドポイントは,サポートされる通貨ペアの任意のOHLCスポットレートデータを毎日返します.APIキーは必要ありません.バックテストまたはチャートビジュアライゼーションワークフローのためにマクロインジケーターのリリースと同時為替レートを調整するために使用します. フォローは,すべての対応した通貨ペアのデータと一致します.

経路の別々の部分としてベースと引数をパスする (例: /forex/eur/usd テクニカルインジケーターの重複を indicators 検索パラメータ

# EUR/USD daily rates — no key required
curl "https://fxmacrodata.com/api/v1/forex/eur/usd"

# AUD/JPY with a custom date range
curl "https://fxmacrodata.com/api/v1/forex/aud/jpy?start_date=2025-01-01"

# GBP/USD with technical indicators overlaid
curl "https://fxmacrodata.com/api/v1/forex/gbp/usd?indicators=sma_20,rsi_14"
{
  "base": "EUR",
  "quote": "USD",
  "start_date": "2025-03-30",
  "end_date": "2026-03-30",
  "data": [
    {
      "date": "2026-03-28",
      "close": 1.0832,
      "open": 1.0821,
      "high": 1.0867,
      "low": 1.0798
    }
  ]
}

ステップ7 市場セッション:リアルタイムセッション状態

The market sessions endpoint returns the current open/close status for all four major FX sessions — Sydney, Tokyo, London, and New York — together with the active overlap windows. No API key is required. Use it to gate time-sensitive automation to peak-liquidity windows or to annotate charts with session boundaries.

# Real-time snapshot — no key required
curl "https://fxmacrodata.com/api/v1/market_sessions"

# Historical snapshot for scheduling or testing
curl "https://fxmacrodata.com/api/v1/market_sessions?at=2026-03-28T12:00:00Z"
{
  "now_utc": "2026-03-30T08:47:00Z",
  "now_unix": 1743324420,
  "is_market_day": true,
  "sessions": [
    {
      "name": "London",
      "is_open": true,
      "seconds_to_close": 25200,
      "currencies": ["EUR", "GBP", "CHF"],
      "open_utc": "2026-03-30T07:00:00Z",
      "close_utc": "2026-03-30T15:00:00Z"
    }
  ],
  "overlaps": [
    {
      "name": "London / New York",
      "is_active": false,
      "priority": "high",
      "start_utc": "2026-03-30T12:00:00Z",
      "end_utc": "2026-03-30T16:00:00Z",
      "notable_pairs": ["EUR/USD", "GBP/USD", "USD/CHF"],
      "duration_hours": 4
    }
  ]
}

ロンドン/ニューヨークの重複は取引日の最流動性の窓であり,マクロリリースが最も頻繁に最大のスポットシフトを引き起こすときです. is_market_day: false 週末や主要休日の自動化を省くために


Step 8 — GraphQL: batch multiple queries in one request

FXMacroDataは,REST 表面を正確に反映する GraphQL エンドポイントを暴露します. 同じ認証ルール,同じフィールド名,同じデータ,しかし,必要なフィールドのみを宣言し,複数のクエリを単一のHTTP往復に組み合わせることができます. そして 政策金利 GBP そして an AUD release calendar, that is one POST instead of three GETs.

送ってくれ POST やってる https://fxmacrodata.com/api/v1/graphql 文字列を表示する query 可能なルートフィールドは, 検索するときに, announcementsほら dataCatalogueほら calendarほら

# Single free USD query — no key required
curl -s -X POST "https://fxmacrodata.com/api/v1/graphql" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "{ announcements(currency: \"USD\", indicator: \"inflation\") { currency indicator data { date val pctChange } } }"
  }'

# Batched: EUR inflation + GBP policy rate in one request
curl -s -X POST "https://fxmacrodata.com/api/v1/graphql?api_key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query { eurCPI: announcements(currency: \"EUR\", indicator: \"inflation\") { data { date val } } gbpRate: announcements(currency: \"GBP\", indicator: \"policy_rate\") { data { date val } } }"
  }'
{
  "data": {
    "eurCPI":  { "data": [{ "date": "2026-02-28", "val": 2.3 }] },
    "gbpRate": { "data": [{ "date": "2026-03-20", "val": 4.5 }] }
  }
}
ポイント: 問い合わせの別名 (例えば eurCPI: 複数のバッチをセットする際にフィールド名前の衝突を避けるため announcements 単一のリクエストでクエリを処理します. data 反応対象

GraphQL は,クエリフィールドが失敗しても HTTP 200 を返します. errors 応答処理前に常にその配列を確認する.エラー処理とバッチングパターンを持つ完全な Python と JavaScript 実装については,参照してください. FXMacroData を GraphQL で 問い合わせる の 方法ほら


ステップ10 端から端へのPythonワークフロー

The snippet below pulls together the most common patterns in sequence: discover available indicators, check the next scheduled release, fetch two indicator series in a single GraphQL request, and then conditionally check market session state before routing the output.

import requests
from datetime import datetime, timezone

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


def params(require_key: bool = True) -> dict:
    return {"api_key": API_KEY} if require_key else {}


# 1. Discover available indicators for AUD (free)
catalogue = requests.get(f"{BASE}/data_catalogue/aud", params=params(False), timeout=10)
catalogue.raise_for_status()
print("AUD indicators:", list(catalogue.json().keys())[:5])

# 2. Check the next USD non-farm payrolls release timestamp (free)
cal = requests.get(f"{BASE}/calendar/usd", params={"indicator": "non_farm_payrolls"}, timeout=10)
cal.raise_for_status()
events = cal.json().get("data", [])
if events:
    ts = events[0]["announcement_datetime"]
    dt = datetime.fromtimestamp(ts, tz=timezone.utc)
    print(f"Next NFP release: {dt.strftime('%Y-%m-%d %H:%M UTC')}")

# 3. Fetch EUR inflation + AUD policy rate in one GraphQL request (Pro key)
gql_query = """
query {
  eurCPI: announcements(currency: "EUR", indicator: "inflation") {
    data { date val pctChange }
  }
  audRate: announcements(currency: "AUD", indicator: "policy_rate") {
    data { date val }
  }
}
"""
resp = requests.post(
    f"{BASE}/graphql",
    params={"api_key": API_KEY},
    json={"query": gql_query},
    timeout=15,
)
resp.raise_for_status()
payload = resp.json()
if "errors" in payload:
    raise RuntimeError(payload["errors"])
data = payload["data"]

eur_latest = data["eurCPI"]["data"][-1]
aud_latest = data["audRate"]["data"][-1]
print(f"EUR CPI  {eur_latest['date']}: {eur_latest['val']}%")
print(f"AUD Rate {aud_latest['date']}: {aud_latest['val']}%")

# 4. Check market sessions before triggering a trade alert (free)
sessions_resp = requests.get(f"{BASE}/market_sessions", timeout=10)
sessions_resp.raise_for_status()
session_data = sessions_resp.json()

if session_data["is_market_day"]:
    for overlap in session_data.get("overlaps", []):
        if overlap["is_active"] and overlap["priority"] == "high":
            print(f"High-liquidity window active: {overlap['name']}")
else:
    print("Market closed — skipping alert")

あなたが成し遂げたこと

  • ✓ 公開時間切符を正確に示す 履歴指標シリーズを 入手しました 発表 終点
  • ✓ 公開予定について 検索 リリースカレンダー 終点
  • 通貨ごとに利用可能な指標スラムが発見されました データカタログ 終点
  • 投機的な先物ポジショニングを 生産量 終点
  • ✓ 価格シリーズから抽出した 金属 終点
  • ✓ 市場から入手した即時レートとマクロデータを一致させ 外国為替レート 終点
  • ✓ リアルセッション状態をチェック 市場セッション 終点
  • 単一の往復で複数の指標のクエリを グラフQL 終点

建設する

簡単な手順をいくつかご紹介します.

  • 連続的な REST コールを GraphQL バッチングで置き換える. Anywhere you make three or more independent GET requests, a single GraphQL POST can replace them. Start with FXMacroData を GraphQL で 問い合わせる の 方法わかった
  • レーヤーCOT位置付け 速度差 COTのエンドポイントからの投機的ネットと政策金利の連続を組み合わせて,G8通貨宇宙全体にわたる複合マクロ信号を構築します.
  • 貨幣の発行と金属の価格を調整する 金属のエンドポイントからAUDまたはUSDの発表シリーズと黄金をペアして,時間とともに安全な避難所とドルの相関を追跡します.

FXマクロデータチーム

Blogroll

AI Answer-Ready

Key Facts

Page
How To Use All FXmacrodata API Endpoints
Section
Articles
Canonical URL
https://fxmacrodata.com/ja/articles/how-to-use-all-fxmacrodata-api-endpoints
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 Use All FXmacrodata API Endpoints 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.