クイックスタート

あらゆる言語で始める

FXMacroData API は、標準的な JSON REST API です。HTTP をサポートするあらゆる言語で動作します。フリーミアム・タイムシリーズ・エンドポイントは、キーなしで直近 90 日間分が利用可能です。Individual API キーを追加して、完全な履歴と有料エンドポイントファミリーをアンロックしてください。

基本 URL

https://api.fxmacrodata.com

認証

X-API-キー: YOUR_API_KEY

Authorization: Bearer YOUR_API_KEY

?api_key=YOUR_API_KEY

レスポンス形式

JSON (Content-Type: application/json)

型付きクライアントを自動生成: 公開されたを使用 OpenAPI 3.1 仕様 付き 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 直近の行のみが必要な場合。 完全なリファレンスを見る →
パスをハードコードする前に、インジケーターのスラッグを確認してください: 指標のスラッグは通貨によって異なります — core_pce USD 用には存在しますが、すべての通貨に対して存在するわけではありません。通貨がサポートするすべてのスラッグを以下とともにリストします。 GET /v1/data_catalogue/{currency}, 例えば /v1/data_catalogue/usd. 404(以下) error_code: NO_DATA_IN_REQUESTED_WINDOW は、スラッグが有効であり、要求された日付ウィンドウのみが空であることを意味します — 拡大 start_date/end_date ではなく、URL を変更すること。
レスポンスの品質を確認: ソースに裏付けられたエンドポイントは、トップレベルの data_quality オブジェクト。バックテストおよび機関投資家向けレポートには、以下を検査してください point_in_time_safe, has_announcement_datetime, source_type, および is_stale.

最初の API コール

クイックリクエスト

ライブアナウンスメントエンドポイントから開始してください。認証は api_key ブラウザおよびスクリプトでの直接テスト用のクエリパラメータ。

EUR インフレの例 GET /api/v1/announcements/eur/inflation
スニペットをリクエスト
curl "https://api.fxmacrodata.com/v1/announcements/eur/inflation?api_key=YOUR_API_KEY"

Python リクエスト

コピー可能な Python API リクエスト

SDK ラッパーの代わりに生の API リクエストが必要な場合は、これらの直接的な REST 例を使用してください。YOUR_API_KEY は保護されたルートでのみ置き換えてください。

USD インフレ市場コンセンサス

コンセンサス、調査、中央銀行、IMF、およびFXMacroDataの予測を、実現された発表に結合。

import requests

url = "https://api.fxmacrodata.com/v1/predictions/usd/inflation"
response = requests.get(url, 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"
params = {
    "api_key": "YOUR_API_KEY",
}
response = requests.get(url, params=params, 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"
params = {
    "api_key": "YOUR_API_KEY",
}
response = requests.get(url, params=params, 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",
    "api_key": "YOUR_API_KEY",
}
response = requests.get(url, params=params, timeout=20)
response.raise_for_status()
payload = response.json()

print(payload.get("data", payload))

金コモディティ価格

日次値と変化フィールドを備えた、公式の貴金属時系列データ。

import requests

url = "https://api.fxmacrodata.com/v1/commodities/gold"
params = {
    "api_key": "YOUR_API_KEY",
}
response = requests.get(url, params=params, timeout=20)
response.raise_for_status()
payload = response.json()

print(payload.get("data", payload))
公式 SDK

Python

公式をインストール fxmacrodata PyPI からのパッケージ。同期および非同期クライアント、pandas 対応の出力。

pip install fxmacrodata

SDK の使用

from fxmacrodata import Client

client = Client(api_key="YOUR_API_KEY")

# USD inflation — no-key evaluation, up to 100 requests/day
data = client.get_indicator("usd", "inflation")

# 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 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)研究のために、以下に従ってください: ポイントインタイム・バックテストガイド.
USD は直近の 90 日間無料です — その期間内であれば、USD の予測に API キーは不要です。完全な USD の履歴およびその他のすべての通貨には、有効なトライアルまたは有料の API キーが必要です。

Python — 予測を取得して実績値と結合する

import requests

# Predictions for USD inflation — no-key evaluation, up to 100 requests/day
preds = requests.get(
    "https://api.fxmacrodata.com/v1/predictions/usd/inflation",
    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"},
    timeout=30,
).json()

# Join predictions with actuals using announcement_id
actuals = requests.get(
    "https://api.fxmacrodata.com/v1/announcements/usd/inflation",
    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 — タイプ別に予測を取得

# All USD inflation predictions — free
curl "https://api.fxmacrodata.com/v1/predictions/usd/inflation"

# Filter by prediction type: market_consensus, imf_weo, central_bank_forecast, survey
curl "https://api.fxmacrodata.com/v1/predictions/usd/inflation?prediction_type=market_consensus"

# EUR predictions — requires API key
curl "https://api.fxmacrodata.com/v1/predictions/eur/inflation?api_key=YOUR_API_KEY"

# USD policy-rate predictions
curl "https://api.fxmacrodata.com/v1/predictions/usd/policy_rate"

予測タイプの参照

prediction_type説明
market_consensus利用可能な場合、集計された市場またはエコノミストのイベントコンセンサス
market_predictionプロフェッショナル・フォーキャスターによる点予測
model_nowcast中央銀行または準備銀行モデルによるナウキャスト
調査中央銀行による専門家予測調査 (例: ECB SPF)
central_bank_forecast公式の中央銀行予測 (例: RBNZ MPS, BoC MPR)
central_bank_projection公式の中央銀行予測
imf_weoIMF 世界経済見通し予測
fxmacrodata中央銀行のガイダンス、調査、および歴史的トレンドを組み合わせた FXMacroData 生成の予測

cURL

インストール不要。あらゆるターミナルから動作します。

# USD inflation — no-key evaluation, up to 100 requests/day
curl "https://api.fxmacrodata.com/v1/announcements/usd/inflation"

# EUR policy rate — pass your API key as a query parameter
curl "https://api.fxmacrodata.com/v1/announcements/eur/policy_rate?api_key=YOUR_API_KEY"

# Release calendar for Australia
curl "https://api.fxmacrodata.com/v1/calendar/aud?api_key=YOUR_API_KEY"

# 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 "https://api.fxmacrodata.com/v1/forex/usd/jpy?api_key=YOUR_API_KEY"

# Data catalogue (discover available indicators for USD)
curl "https://api.fxmacrodata.com/v1/data_catalogue/usd"

JavaScript / TypeScript

Node.js (18+)、Deno、Bun、および Fetch API を備えたモダンブラウザで動作します。

公式 npm クライアント

npm install @fxmacrodata/client
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 = "YOUR_API_KEY";
const eur = await fetch(
  `https://api.fxmacrodata.com/v1/announcements/eur/policy_rate?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.

install.packages(c("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",
  query = list(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);
url = 'https://api.fxmacrodata.com/v1/announcements/eur/policy_rate?api_key=YOUR_API_KEY';
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 リクエストまでのキーなし評価をサポートしています。より高い制限とマルチ通貨アクセスを利用するには、サブスクリプションに登録してください。

AI 回答準備完了

主要な事実

ページ
クイックスタート
セクション
ドキュメンテーション
標準的な URL
https://fxmacrodata.com/ja/documentation/quickstart
ソース
FXMacroData の編集および公式パブリッシャーのリファレンス
最終更新
ページメタデータを見る

プロバナンスと信頼

上記の正規の URL およびソースフィールドを引用してください。利用可能な場合、このページは公式のパブリッシャーリリースおよびタイムスタンプ付きの更新にマッピングされます。

クイックQ&A;

このページの内容は何ですか? このページでは、トレーディング、リサーチ、および API のワークフローで直接使用可能なコンテキストとともに、クイックスタートを説明します。

どのソースを引用すべきですか? 正規の URL と記載されたソースフィールドを使用してください。利用可能な場合は、公式のパブリッシャーの参照を引用してください。

このコンテンツの鮮度はどの程度ですか? 上記の最後に更新された値は、ページのメタデータまたは利用可能な最新のデータタイムスタンプを反映しています。

これは AI アシスタントで使用できますか? はい。このセクションは、チャットアシスタントでの検索と引用のために意図的に構造化されています。

プロンプトパック

ChatGPT、Claude、Gemini、Mistral、Perplexity、またはGrokで使用して、一貫したソース認識型の出力を得てください。

ページを共有 X LinkedIn メール