クイックスタート
Build with official macro releases and their history
Release delivery. Supported releases target availability within one second of official publication. See measured release speed by source. Timing varies by release.
History as it was known. Selected series span decades. First prints and subsequent revisions are retained where captured, with publication-time status so backtests can respect what was known.
Plan the next event. The economic calendar connects official release schedules with available official forecasts and separately labelled FXMacroData predictions. Forecast and surprise coverage varies by release.
FXMacroData API は、サーバー側での使用を目的とした標準的な JSON REST API です。HTTP をサポートする言語であれば何でも動作します。USD 発表データ、USD リリースカレンダー、およびデータカタログはキーなしで無料で利用可能です。直近 90 日分が、15 分のリリース遅延で、1日あたり最大 100 リクエストまで提供されます。予測値(USD を含む)、その他のすべての通貨、リアルタイムリリース、および全履歴には、API キーが必要であり、以下で送信されます: X-API-Key header. 無料で利用可能なものを確認する
基本 URL
https://api.fxmacrodata.com
認証
X-API-キー: YOUR_API_KEY
Authorization: Bearer YOUR_API_KEY
レガシーの ?api_key= クエリパラメータは非推奨です:URL内のキーはログに記録されます。
レスポンス形式
JSON (Content-Type: application/json)
openapi-generator-cli により、40+ 言語でクライアントを自動生成します。
Accept-Encoding: gzip すべてのリクエストに対して (8–12× より小さなペイロード)、 ETag のレスポンスヘッダー内 If-None-Match 繰り返しのポーリングにおいて (戻り値 304 Not Modified bodyなしで)、および渡す ?limit=50 以下のような単一指標エンドポイントについて: /v1/announcements/usd/inflation または /v1/predictions/usd/inflation 直近の行のみが必要な場合。 完全なリファレンスを見る →
limit 最大 100. まで受け入れます。全範囲を収集するには、以下でリクエストを繰り返してください offset に設定 pagination.next_offset until pagination.has_more is false. Python ループを参照 ↓
fetch() ウェブページからのリクエストはブラウザによってブロックされます。バックエンドからFXMacroDataを呼び出し、APIキーをクライアント側のコードに含めないでください。
core_pce USD 用には存在しますが、すべての通貨に対して存在するわけではありません。通貨がサポートするすべてのスラッグを以下とともにリストします。 GET /v1/data_catalogue/{currency}, 例えば /v1/data_catalogue/usd。その 200 の data 配列は空であり、以下を保持します no_data.error_code: NO_DATA_IN_REQUESTED_WINDOW は、スラッグが有効であり、要求された日付ウィンドウのみが空であることを意味します — 拡大 start_date/end_date URLを変更したり再試行したりするのではなく。404は、通貨または指標のスラグが間違っていることを意味します。
data_quality オブジェクト。バックテストおよび機関投資家向けレポートには、以下を検査してください point_in_time_safe, has_announcement_datetime, source_type, および is_stale. point_in_time_safe ウィンドウ内のいずれかの行にシリーズの測定されたリリースラグから導出された公開時間が含まれている場合は常にfalseになるため、確認してください assumed_release_time_count および行ごとの release_time_assumed falseを不使用として扱う前にフラグを立ててください。
マーケットプレイスへのアクセス
RapidAPI経由でFXMacroDataを使用する
RapidAPI は、FXMacroData REST API 用のオプションのマーケットプレイスチャネルです。FXMacroData がデータを提供し、RapidAPI がマーケットプレイスのサブスクリプション、API キー、リクエスト枠、および請求を管理します。このチャネル経由のリクエストには、個別の FXMacroData アカウントやキーは必要ありません。
- 以下を開く 公式 FXMacroData リスティング プランを選択してください。現在のカバー範囲、割当、およびレート制限については、料金タブを確認してください。
- エンドポイントプレイグラウンドからRapidAPIキーをコピーし、サーバー環境に次のように保存してください:
RAPIDAPI_KEY. - リクエストの送信先
https://fxmacrodata1.p.rapidapi.com以下に示すように、両方の RapidAPI ヘッダーを使用します。
curl --request GET \ --url "https://fxmacrodata1.p.rapidapi.com/v1/announcements/usd/inflation?limit=3" \ --header "X-RapidAPI-Key: $RAPIDAPI_KEY" \ --header "X-RapidAPI-Host: fxmacrodata1.p.rapidapi.com"
Marketplace エンドポイントの網羅範囲
リスティングには、アナウンス、リリース・カレンダー、データカタログ、日次のFXレート、COTポジショニング、中央銀行ニュース、マーケットセッション、およびヘルスチェックが含まれます。通貨および履歴へのアクセスは、お客様のRapidAPIプランに依存します。サポートされているインジケーターのスラッグを見つけるには、カタログを使用してください。
直接的な FXMacroData アクセス
このページの他の例では、以下を使用しています api.fxmacrodata.com およびFXMacroData X-API-Key 必要に応じて。キーとサブスクリプションはチャネル間で分かれています。RapidAPIのサブスクリプションは、リストされているRESTエンドポイントをカバーします。ウェブサイトのサブスクリプション、MCP、予測、ストリーミング、およびウェブフックは別の提供内容です。
キーをブラウザのコードや公開リポジトリに置かないでください。より長い結果セットについては、以下に従ってください pagination.next_offset until pagination.has_more はfalseです。API キーをサポートに送信しないでください。
最初の API コール
クイックリクエスト
最初のスニペットはそのまま実行できます:USDデータにはキーは不要で、リリース15分後に提供されます。以下を追加してください X-API-Key for all 62 currencies and real-time delivery, sent from a server, script, or notebook.
# USD inflation, no key: 15-minute delay, most recent 90 days
curl "https://api.fxmacrodata.com/v1/announcements/usd/inflation?limit=5"
# EUR inflation: add X-API-Key for all 62 currencies and real-time releases
curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/announcements/eur/inflation"
Python リクエスト
コピー可能な Python API リクエスト
SDK ラッパーの代わりに生の API リクエストが必要な場合は、これらの直接的な REST 例を使用してください。YOUR_API_KEY は保護されたルートでのみ置き換えてください。
USD インフレ市場コンセンサス
コンセンサス、調査、中央銀行、IMF、およびFXMacroDataの予測を、実現された発表に結合。
import requests
url = "https://api.fxmacrodata.com/v1/predictions/usd/inflation"
headers = {"X-API-Key": "YOUR_API_KEY"}
response = requests.get(url, headers=headers, timeout=20)
response.raise_for_status()
payload = response.json()
print(payload.get("data", payload))
既知のタイムスタンプによる USD インフレ
ポイントインタイムのバックテスト用の公開 USD インフレ記録。
import requests
url = "https://api.fxmacrodata.com/v1/announcements/usd/inflation"
response = requests.get(url, timeout=20)
response.raise_for_status()
payload = response.json()
print(payload.get("data", payload))
EUR/USD FX スポット履歴
ペアチャート、モデル、およびリリースオーバーレイのための、日次の FX 価格履歴。
import requests
url = "https://api.fxmacrodata.com/v1/forex/eur/usd"
headers = {"X-API-Key": "YOUR_API_KEY"}
response = requests.get(url, headers=headers, timeout=20)
response.raise_for_status()
payload = response.json()
print(payload.get("data", payload))
AUD 政策金利履歴
先読みなしのリサーチのための、リリース時期を含む中央銀行の決定履歴。
import requests
url = "https://api.fxmacrodata.com/v1/announcements/aud/policy_rate"
headers = {"X-API-Key": "YOUR_API_KEY"}
response = requests.get(url, headers=headers, timeout=20)
response.raise_for_status()
payload = response.json()
print(payload.get("data", payload))
JPY 今後のリリーススケジュール
アラートの計画、モデルの更新、およびトレーディングのレビューのために、UTC、市場ローカル、およびリクエストされたタイムゾーンのフィールドを備えた、今後のマクロイベント。
import requests
url = "https://api.fxmacrodata.com/v1/calendar/jpy"
params = {
"timezone": "Asia/Tokyo",
}
headers = {"X-API-Key": "YOUR_API_KEY"}
response = requests.get(url, params=params, headers=headers, timeout=20)
response.raise_for_status()
payload = response.json()
print(payload.get("data", payload))
金コモディティ価格
日次値と変化フィールドを備えた、公式の貴金属時系列データ。
import requests
url = "https://api.fxmacrodata.com/v1/commodities/gold"
headers = {"X-API-Key": "YOUR_API_KEY"}
response = requests.get(url, headers=headers, timeout=20)
response.raise_for_status()
payload = response.json()
print(payload.get("data", payload))
Python
公式をインストール fxmacrodata PyPIからのパッケージ (1.2.x)。同期および非同期クライアントは、pandas に直接ロードできるプレーンな JSON 辞書を返します。 Client() キーなしでの読み取りは無料の USD ティアを利用します。パスを api_key 他のすべての通貨およびリアルタイム配信用。
SDK の使用
from fxmacrodata import Client # USD inflation — no key needed: 15-minute delay, most recent 90 days data = Client().get_indicator("usd", "inflation") print(data["data"][0]) # Add X-API-Key for all 62 currencies and real-time releases client = Client(api_key="YOUR_API_KEY") # EUR policy rate — requires API key rate = client.get_indicator("eur", "policy_rate") # Forex price data — requires API key fx = client.get_fx_price("usd", "jpy")
REST API を直接使用する
import requests resp = requests.get( "https://api.fxmacrodata.com/v1/announcements/usd/inflation", timeout=30, ) resp.raise_for_status() payload = resp.json() print(payload["data_quality"]["point_in_time_safe"], payload["data"][0])
全履歴のページング
import requests URL = "https://api.fxmacrodata.com/v1/announcements/eur/inflation" HEADERS = {"X-API-Key": "YOUR_API_KEY"} rows, offset = [], 0 while True: resp = requests.get( URL, params={"limit": 100, "offset": offset}, headers=HEADERS, timeout=30, ) resp.raise_for_status() page = resp.json() rows.extend(page["data"]) if not page["pagination"]["has_more"]: break offset = page["pagination"]["next_offset"] print(len(rows), "rows")
非同期クライアント
import asyncio from fxmacrodata import AsyncClient async def main(): async with AsyncClient(api_key="YOUR_API_KEY") as client: data = await client.get_indicator("eur", "inflation") print(data) asyncio.run(main())
予測 & 予測
その /v1/predictions/{currency}/{indicator} endpoint は、市場コンセンサス調査、中央銀行の予測、IMF 世界経済見通し、およびプロのフォーキャスターによる調査から予測データを算出します。予測は、以下のような特定の通貨と指標に対してリクエストされます: https://api.fxmacrodata.com/v1/predictions/usd/inflation;通貨のみの予測リクエストはサポートされていません。各予測は、以下を介して発表にリンクされています。 announcement_id, なので、予測と実現された観測値を結合できます。
prediction_type="fxmacrodata" はFXMacroDataが生成した推定値です。真の集計コンセンサスには、以下のようにラベル付けされます: market_consensus. 予測の可用性はリリースによって異なります — 以下を確認してください: カバレッジマトリックス. 先読みのない(look-ahead-free)研究のために、以下に従ってください: ポイントインタイム・バックテストガイド.
/v1/predictions/coverage/{currency}。トライアルまたは有料キーは予測値を返します。
Python — 予測を取得して実績値と結合する
import requests HEADERS = {"X-API-Key": "YOUR_API_KEY"} # Predictions for USD inflation — requires API key preds = requests.get( "https://api.fxmacrodata.com/v1/predictions/usd/inflation", headers=HEADERS, timeout=30, ).json() for group in preds["data"]: print(group["announcement_id"], group["date"]) for p in group["predictions"]: print(f" {p['prediction_source_label']}: {p['predicted_value']}") # Filter by prediction type market = requests.get( "https://api.fxmacrodata.com/v1/predictions/usd/inflation", params={"prediction_type": "market_consensus"}, headers=HEADERS, timeout=30, ).json() # Join predictions with actuals using announcement_id actuals = requests.get( "https://api.fxmacrodata.com/v1/announcements/usd/inflation", headers=HEADERS, timeout=30, ).json() actuals_by_id = {row["announcement_id"]: row for row in actuals["data"]} for group in preds["data"]: actual = actuals_by_id.get(group["announcement_id"]) if actual: print(f"{group['date']}: actual={actual['val']}, forecast={group['predictions'][0]['predicted_value']}")
cURL — タイプ別に予測を取得
# Which sources forecast USD indicators — free, no key curl "https://api.fxmacrodata.com/v1/predictions/coverage/usd" # All USD inflation predictions — requires API key curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/predictions/usd/inflation" # Filter by prediction type: market_consensus, imf_weo, central_bank_forecast, survey curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/predictions/usd/inflation?prediction_type=market_consensus" # EUR policy-rate predictions curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/predictions/eur/policy_rate"
予測タイプの参照
| prediction_type | 説明 |
|---|---|
| market_consensus | 利用可能な場合、集計された市場またはエコノミストのイベントコンセンサス |
| market_prediction | プロフェッショナル・フォーキャスターによる点予測 |
| model_nowcast | 中央銀行または準備銀行モデルによるナウキャスト |
| 調査 | 中央銀行による専門家予測調査 (例: ECB SPF) |
| central_bank_forecast | 公式の中央銀行予測 (例: RBNZ MPS, BoC MPR) |
| central_bank_projection | 公式の中央銀行予測 |
| imf_weo | IMF 世界経済見通し予測 |
| fxmacrodata | 中央銀行のガイダンス、調査、および歴史的トレンドを組み合わせた FXMacroData 生成の予測 |
cURL
インストール不要。あらゆるターミナルから動作します。
For an event monitor, the economic calendar API guide connects scheduled events, released values, historical queries and the live event stream.
# USD inflation — no-key evaluation, up to 100 requests/day curl "https://api.fxmacrodata.com/v1/announcements/usd/inflation" # EUR policy rate — send your API key in the X-API-Key header curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/announcements/eur/policy_rate" # Release calendar for Australia — requires API key curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/calendar/aud" # Release calendar converted to a requested IANA timezone curl "https://api.fxmacrodata.com/v1/calendar/usd?indicator=gdp&timezone=America/Sao_Paulo" # Forex price history — requires API key curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/forex/usd/jpy" # Data catalogue (discover available indicators for USD) curl "https://api.fxmacrodata.com/v1/data_catalogue/usd"
JavaScript / TypeScript
Node.js (18+), Deno, および Bun でサーバーサイドで動作します。APIはCORSヘッダーを送信しないため、ブラウザコードからではなくバックエンドから呼び出してください。
公式 npm クライアント
import { FXMacroDataClient } from "@fxmacrodata/client"; const client = new FXMacroDataClient({ apiKey: "YOUR_API_KEY", }); // Public endpoint example const usdInflation = await client.announcements("usd", "inflation"); // Non-USD endpoint example (requires paid key) const eurRate = await client.announcements("eur", "policy_rate"); console.log(usdInflation, eurRate);
Fetch を直接使用する
// USD inflation — no-key evaluation, up to 100 requests/day const res = await fetch( "https://api.fxmacrodata.com/v1/announcements/usd/inflation" ); const data = await res.json(); console.log(data); // With API key for non-USD const API_KEY = process.env.FXMD_API_KEY; const eur = await fetch( "https://api.fxmacrodata.com/v1/announcements/eur/policy_rate", { headers: { "X-API-Key": API_KEY } } ); console.log(await eur.json());
実行
外部パッケージは不要です — 標準ライブラリですべて処理されます。
package main import ( "encoding/json" "fmt" "net/http" "io" ) func main() { // USD inflation — no-key evaluation, up to 100 requests/day resp, err := http.Get("https://api.fxmacrodata.com/v1/announcements/usd/inflation") if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) var result map[string]interface{} json.Unmarshal(body, &result;) fmt.Println(result) }
R
必要条件 httr および jsonlite.
library(httr) library(jsonlite) # USD inflation — no-key evaluation, up to 100 requests/day res <- GET("https://api.fxmacrodata.com/v1/announcements/usd/inflation") data <- fromJSON(content(res, "text", encoding = "UTF-8")) # Convert to data frame df <- as.data.frame(data$data) head(df) # With API key for non-USD eur <- GET( "https://api.fxmacrodata.com/v1/announcements/eur/policy_rate", add_headers(`X-API-Key` = "YOUR_API_KEY") ) print(fromJSON(content(eur, "text")))
Java
用途 java.net.http (Java 11+)。外部ライブラリは不要です。
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class FXMacroDataExample { public static void main(String[] args) throws Exception { var client = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder() .uri(URI.create("https://api.fxmacrodata.com/v1/announcements/usd/inflation")) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
C# / .NET
用途 HttpClient (.NET 6+).
using System.Net.Http; using System.Text.Json; var client = new HttpClient(); // USD inflation — no-key evaluation, up to 100 requests/day var json = await client.GetStringAsync( "https://api.fxmacrodata.com/v1/announcements/usd/inflation" ); var doc = JsonDocument.Parse(json); Console.WriteLine(doc.RootElement);
MATLAB
組み込みのを使用 webread function.
% USD inflation — no-key evaluation, up to 100 requests/day data = webread('https://api.fxmacrodata.com/v1/announcements/usd/inflation'); disp(data); % With API key for non-USD opts = weboptions('Timeout', 30, 'HeaderFields', {'X-API-Key', 'YOUR_API_KEY'}); url = 'https://api.fxmacrodata.com/v1/announcements/eur/policy_rate'; eur = webread(url, opts); disp(eur);
任意の言語の型付きクライアントを生成
FXMacroData API は完全な OpenAPI 3.1 仕様. これを次と共に使用してください: openapi-generator Kotlin、Swift、Rust、Dart、Ruby、PHP、および 40+ のその他の言語向けに、完全に型付けされたクライアントを生成します。
# Install the openapi-generator CLI npm install @openapitools/openapi-generator-cli -g # Generate a Go client openapi-generator-cli generate \ -i https://api.fxmacrodata.com/openapi.json \ -g go \ -o ./fxmacrodata-go-client # Generate a Java client openapi-generator-cli generate \ -i https://api.fxmacrodata.com/openapi.json \ -g java \ -o ./fxmacrodata-java-client
構築の準備はできていますか?
USD リリースデータは、1日あたり最大 100 リクエストまで、公開から 15 分遅れでキーなしで動作します。リアルタイムリリース、予測値、全履歴、より高い制限、およびすべての通貨を利用するには購読してください。