Quickstart

Erste Schritte in jeder Sprache

Der FXMacroData API ist ein standardisierter JSON REST API. Jede Sprache mit HTTP Unterstützung funktioniert. Freemium-Zeitreihen-Endpunkte sind für die letzten 90 Tage ohne Schlüssel verfügbar. Fügen Sie einen Individual API Schlüssel hinzu, um die vollständige Historie und kostenpflichtige Endpoint-Familien freizuschalten.

Basis URL

https://api.fxmacrodata.com

Authentifizierung

X-API-Schlüssel: YOUR_API_KEY

Authorization: Bearer YOUR_API_KEY

?api_key=YOUR_API_KEY

Antwortformat

JSON (Content-Type: application/json)

Typisierte Clients automatisch generieren: Verwenden Sie die veröffentlichten OpenAPI 3.1 Spezifikation mit openapi-generator-cli um Clients in 40+ Sprachen automatisch zu generieren.
Kostenlose Performance-Vorteile: Senden Accept-Encoding: gzip bei jeder Anfrage (8–12× kleinere Payloads), verwenden Sie den ETag Response-Header in If-None-Match bei wiederholten Abfragen (gibt zurück 304 Not Modified ohne Body), und übergeben ?limit=50 auf Single-Indikator-Endpoints wie /v1/announcements/usd/inflation oder /v1/predictions/usd/inflation wenn Sie nur aktuelle Zeilen benötigen. Vollständige Referenz ansehen →
Entdecken Sie Indikator-Slugs, bevor Sie Pfade hartcodieren: Indikator-Slugs variieren je nach Währung — core_pce existiert für USD, aber nicht für jede Währung. Listen Sie jeden Slug auf, den eine Währung unterstützt, mit GET /v1/data_catalogue/{currency}, zum Beispiel /v1/data_catalogue/usd. Ein 404 mit error_code: NO_DATA_IN_REQUESTED_WINDOW bedeutet, dass der Slug gültig ist und nur das angeforderte Zeitfenster leer ist — erweitern start_date/end_date anstatt die URL zu ändern.
Antwortqualität prüfen: Quellengestützte Endpoints liefern eine Top-Level- data_quality Objekt. Für Backtests und institutionelles Reporting, untersuchen Sie point_in_time_safe, has_announcement_datetime, source_type, und is_stale.

Erster API Call

Schnelle Anfrage

Beginnen Sie mit einem Live-Ankündigungs-Endpunkt. Die Authentifizierung verbleibt in der api_key Abfrageparameter für direktes Browser- und Skript-Testing.

EUR Inflationsbeispiel GET /api/v1/announcements/eur/inflation
Code-Snippet anfordern
curl "https://api.fxmacrodata.com/v1/announcements/eur/inflation?api_key=YOUR_API_KEY"

Python Anfragen

Kopierbare Python API Anfragen

Verwenden Sie diese direkten REST Beispiele, wenn Sie die rohe API Anfrage anstelle eines SDK Wrappers wünschen. Ersetzen Sie YOUR_API_KEY nur auf geschützten Routen.

USD Inflations-Marktkonsens

Konsens-, Umfrage-, Zentralbank-, IMF- und FXMacroData-Prognosen, verknüpft mit realisierten Bekanntmachungen.

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 Inflation mit 'known-at' Zeitstempeln

Öffentliche USD Inflationsdaten für Point-in-Time-Backtests.

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 Spot-Historie

Tägliche FX Preis-Historie für Paarkurven, Modelle und Veröffentlichungs-Overlays.

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 Leitzinserhistorie

Zentralbank-Entscheidungshistorie mit Veröffentlichungszeitpunkt für Forschung ohne Lookahead-Bias.

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 kommender Veröffentlichungsplan

Kommende Makro-Events mit UTC, markt-lokalen und angeforderten Zeitzonen-Feldern zur Planung von Alerts, Modell-Aktualisierungen und Trading-Reviews.

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

Goldrohstoffpreise

Offizielle Edelmetall-Zeitreihen mit täglichen Werten und Änderungsfeldern.

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))
Offizielles SDK

Python

Installieren Sie das offizielle fxmacrodata Paket von PyPI. Sync- und Async-Clients, pandas-bereite Ausgabe.

pip install fxmacrodata

Verwendung der 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")

Direkte Verwendung des 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])

Async-Client

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

Vorhersagen & Prognosen

Der /v1/predictions/{currency}/{indicator} der Endpoint liefert Prognosedaten aus Marktkonsens-Umfragen, Zentralbank-Prognosen, IMF World Economic Outlook und professionellen Analysten-Umfragen. Vorhersagen werden für eine bestimmte Währung und einen Indikator angefordert, wie z. B. https://api.fxmacrodata.com/v1/predictions/usd/inflation; Vorhersageanfragen nur für Währungen werden nicht unterstützt. Jede Vorhersage ist über ihre Ankündigung verknüpft via announcement_id, sodass Sie Prognosen mit realisierten Beobachtungen verknüpfen können.

Behandeln Sie nicht jede Prognose als Konsens. prediction_type="fxmacrodata" ist eine von FXMacroData generierte Schätzung; ein echter zusammengestellter Konsens ist gekennzeichnet als market_consensus. Die Verfügbarkeit von Prognosen variiert je nach Release — prüfen Sie den Abdeckungsmatrix. Für eine Forschung ohne Look-ahead-Bias folgen Sie dem Point-in-Time Backtesting-Leitfaden.
USD ist in den letzten 90 Tagen kostenlos — kein API Key erforderlich für USD Vorhersagen innerhalb dieses Zeitfensters. Die vollständige USD Historie und alle anderen Währungen erfordern einen gültigen Test- oder kostenpflichtigen API Key.

Python — Vorhersagen abrufen und mit Ist-Werten zusammenführen

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 — Vorhersagen nach Typ abrufen

# 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"

Referenz der Prognosetypen

prediction_typeBeschreibung
market_consensusZusammengefasster Konsens für Markt- oder Ökonomenereignisse, sofern verfügbar
market_predictionPunktprognose eines professionellen Prognostikers
model_nowcastZentralbank- oder Reservebank-Modell Nowcast
UmfrageZentralbankumfrage unter professionellen Prognostikern (z. B. ECB SPF)
central_bank_forecastOffizielle Zentralbank-Prognose (z. B. RBNZ MPS, BoC MPR)
central_bank_projectionOffizielle Zentralbankprognose
imf_weoIMF World Economic Outlook Prognose
fxmacrodataFXMacroData-generierte Vorhersage, die Zentralbank-Guidance, Umfragen und historische Trends kombiniert

cURL

Keine Installation erforderlich. Funktioniert von jedem Terminal aus.

# 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

Funktioniert in Node.js (18+), Deno, Bun und modernen Browsern mit der Fetch API.

Offizieller npm-Client

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

Direkte Verwendung von 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());

Los geht's

Keine externen Pakete erforderlich — die Standardbibliothek erledigt alles.

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

Erfordert httr und 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

Verwendungen java.net.http (Java 11+). Keine externen Bibliotheken erforderlich.

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

Verwendungen 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

Verwendet das integrierte webread funktion.

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

Generieren Sie einen typisierten Client für jede Sprache

Der FXMacroData API veröffentlicht ein vollständiges OpenAPI 3.1 Spezifikation. Verwenden Sie es mit openapi-generator um vollständig typisierte Clients für Kotlin, Swift, Rust, Dart, Ruby, PHP und 40 + andere Sprachen zu erstellen.

# 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

Bereit zum Bauen?

USD Endpunkte unterstützen eine No-Key-Evaluierung bis zu 100 Anfragen/Tag. Abonnieren Sie für höhere Limits und Multi-Währungs-Zugriff.

AI Antwort-bereit

Wichtigste Fakten

Seite
Quickstart
Abschnitt
Dokumentation
Kanonisches URL
https://fxmacrodata.com/de/documentation/quickstart
Quelle
FXMacroData redaktionelle und offizielle Herausgeber-Referenzen
Zuletzt aktualisiert
Seitenmetadaten anzeigen

Herkunft und Vertrauen

Zitieren Sie das kanonische URL und das Quellfeld oben. Wo verfügbar, bildet diese Seite offizielle Veröffentlichungen der Herausgeber und zeitgestempelte Updates ab.

Kurze Fragen&A;

Worum geht es auf dieser Seite? Diese Seite erklärt den Quickstart mit direkt nutzbarem Kontext für Trading, Forschung und API Workflows.

Welche Quelle sollte zitiert werden? Verwenden Sie das kanonische URL und das aufgeführte Quellfeld; zitieren Sie offizielle Herausgeberreferenzen, sofern verfügbar.

Wie aktuell sind diese Inhalte? Der zuletzt aktualisierte Wert oben spiegelt die Metadaten der Seite oder den neuesten verfügbaren Daten-Zeitstempel wider.

Kann dies in AI Assistenten verwendet werden? Ja. Dieser Abschnitt ist absichtlich so strukturiert, dass er von Chat-Assistenten abgerufen und zitiert werden kann.

Prompt-Pakete

Verwenden Sie diese in ChatGPT, Claude, Gemini, Mistral, Perplexity oder Grok für konsistente, quellenbewusste Ausgaben.

Seite teilen X LinkedIn Email