Mmalo ọsọ

Malite n'asụsụ ọ bụla

API nke FXMacroData bụ standard JSON REST API. Asụsụ ọ bụla nwere nkwado HTTP na-arụ ọrụ. Endpoints time-series freemium dị available maka 90 ụbọchị kachasị ọhụrụ n'enweghị key. Tinye key Individual API iji mepee akụkọ ihe ochie zuru oke na ezinne endpoint ndị a kwụrụ ụgwọ.

Nkpọrọala URL

https://api.fxmacrodata.com

Nnabata

X-API-Key: YOUR_API_KEY

Authorization: Bearer YOUR_API_KEY

?api_key=YOUR_API_KEY

Ụdị azịza

JSON (Content-Type: application/json)

Kpụta typed clients n'ụzọ automatiki: Jiri nke a wepụtara spec OpenAPI 3.1 na openapi-generator-cli iji mepụta clients na asụsụ 40+ ozugbo.
Mmeri ọrụ efu: Zite Accept-Encoding: gzip na onụ ọha ọ bụla (8–12× payloads ndị kacha obere), jiri ọzọ ETag response header na If-None-Match na polls na-ekwugharị (na-alaghachi 304 Not Modified n'enweghị body), ma nyere ?limit=50 na endpoint nke indicator otu ahụ dịka /v1/announcements/usd/inflation ma ọ bụ /v1/predictions/usd/inflation mgbe ị chọrọ naanị row ndị kachasị ọhụrụ. Hụ nkọwa zuru oke →
Chọpụta indicator slugs tupu ịdee path ndị ahụ n'ike: Slugs ihe ngọpụta na-agbanwe dabere n'ego — core_pce dị maka USD mana ọ bụghị maka currency ọ bụla. Lisie slug ọ bụla currency kwadoro site na GET /v1/data_catalogue/{currency}, dịka ihe atụ /v1/data_catalogue/usd. 404 nke nwere error_code: NO_DATA_IN_REQUESTED_WINDOW pụtara na slug ahụ dị mma, naanị window ụbọchị a rịọrọ ka ọ bụrụ efu — mgbasaa start_date/end_date karịa ịgbanwe URL.
Lelị quality nzaghachi: Endpoint ndị nwere nkwado isi na-enye otu kọntentu elu data_quality object. Maka backtests na ripọtụ ụlọ ọrụ, nyochaa point_in_time_safe, has_announcement_datetime, source_type, na is_stale.

Kọl API mbụ

Nnyịnye Ngwa Ngwa

Malite na live announcement endpoint. Nkwadoro nọ na api_key parameter ajụjụ maka nnyocha browser na script ozugbo.

ọmụmụ inflation EUR GET /api/v1/announcements/eur/inflation
Snippet arịrịọ
curl "https://api.fxmacrodata.com/v1/announcements/eur/inflation?api_key=YOUR_API_KEY"

Arịrịọ Python

Arịrịọ Python API a pụrụ ikopị

Jiri ihe atụ REST ndị a mgbe ị chọrọ raw API request kama nke SDK wrapper. Dozie YOUR_API_KEY naanị na routes a chebebere.

nkwekọ ahịa inflation USD

Consensus, nyocha, ụlọ akụ central-bank, IMF, na atụmatụ FXMacroData ejikọrọ na nsụpụta emere emere.

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

inflation USD na timestamps known-at

Akụkọ inflation USD nke ọha maka backtest nke oge-na-oge.

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

akụkọ spot EUR/USD FX

Akụkọ ọnụ ahịa FX nke ụbọchị maka chaatị ndị dị mkpaka, ụdị, na mwepụta 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))

akụkọ ihe ochie policy-rate AUD

Akụkọ ihe ochie nke mkpebi ụlọ akụ central na oge mwepụta maka nnyocha no-lookahead.

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

atụmatụ mwepụta JPY na-abịa

Ihe omume macro na-abịa n'ihu na UTC, ahịa-local, na mpaghara oge a rịrị maka alerts, mmeghe model, na nyocha trading.

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

Urutụ commodity gold

Siri okwu-oge nke ubi dị oke ọnụ ahịa gbalara nwere uru ụbọchị na mpaghara mgbanwe.

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 nke iwu

Python

Tụba nke gọọmenti fxmacrodata ngwụkọ site na PyPI. Client sync na async, output dị njikere maka pandas.

pip install fxmacrodata

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

Na-eji REST API ozugbo

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

Klaịyent Async

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())
Ọhụrụ

Atụmatụ & Atụmatụ

The /v1/predictions/{currency}/{indicator} endpoint na-ewepụta data ntụgharị site na nyocha consensus ahịa, ntụgharị central-bank, IMF World Economic Outlook, na nyocha ndị nyocha ọrụ. A na-arịrị ntụgharị maka ego na indicator akọrọ, dịka https://api.fxmacrodata.com/v1/predictions/usd/inflation; nrịrị atụmatụ nke akụrụba naanị anaghị ekwusi ike. Atụmatụ ọ bụla jikọra na ọkwa ya site na announcement_id, ka ị nwee ike ijikọ forecast na nlele a rụpụtara.

Atụla forecast ọ bụla anya dịka consensus. prediction_type="fxmacrodata" bụ ntụgharị FXMacroData rụrụ; consensus a gbakọrọ nke eziokwu a kpọrọ market_consensus. Inwe atụmatụ na-agbanwe dabere na nsụpụta — lelee matrix mkpụrụ. Maka nnayi n'enweghị nleba anya n'ihu, soro ndu maka point-in-time backtesting.
USD efu maka ụbọchị 90 kachasị ọhụrụ — ọ dịghị mkpa inwe key API maka ntụgharị USD n'ime windou ahụ. Akụkọ USD zuru oke na ego ndị ọzọ niile chọrọ key API dị mma nke nnwale ma ọ bụ nke a kwụfurụ ụgwọ.

Python — kpokota atụmatụ ma jikọọ ya na ihe emere

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 — nweta predictions site na ụdị

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

Ntụgharị ụdị ntụgharị

prediction_typeNkọwa
market_consensusNkọwa nkwekọrịta ahịa ma ọ bụ nke onye ọkachamara n'ihe omume, ebe ọ dị
market_predictionNnyocha point nke Professional-forecaster
model_nowcastCentral-bank ma ọ bụ reserve-bank model nowcast
nnyochaNyocha central-bank nke ndị na-atụmatụ mahe (dịka ECB SPF)
central_bank_forecastNtụgharị nke ụlọ akụ azụ central-bank (dịka RBNZ MPS, BoC MPR)
central_bank_projectionAtụmatụ ụlọ akụ kọntral official
imf_weoNtụgharị IMF World Economic Outlook
fxmacrodataNtụgharị FXMacroData mepụtara nke jikọrọ nduzi central-bank, nyocha, na usoro akụkọ

cURL

Ọ dịghị mkpa itunye ya. Ọ na-arụ ọrụ site na terminal ọ bụla.

# 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

Na-arụ ọrụ na Node.js (18+), Deno, Bun, na browser ọhụrụ na Fetch API.

npm client nke gọọmenti

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

Iji Fetch ozugbo

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

Gaa

Ọ dịghị packages izyị dị mkpa — standard library na-ahụ maka ihe niile.

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

Chọrọ httr na 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

Iji java.net.http (Java 11+). Ọ dịghị mkpa inwe ụlọ akwụkwọ mpụga.

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

Iji 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

Na-eji nke a rụrụ webread ọrụ.

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

Mepụta typed client maka asụsụ ọ bụla

FXMacroData API na-ebupụta nke zuru oke nkọwa OpenAPI 3.1. Jiri ya na openapi-generator iji mepụta clients typed zuru oke maka Kotlin, Swift, Rust, Dart, Ruby, PHP, na 40+ asụsụ ndị ọzọ.

# 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

Adịghị njikere iwulite?

USD endpoints na-akwado nyocha na-enweghị key ruo na 100 arịrịọ/ụbọchị. Debanye aha maka oke elu na ntụgharị ego dị iche iche.

AI Adịghị njikere Azịza

Ihe Ndị Dị Mkpa

Tụlbụ
Mmalo ọsọ
Ngalaba
Akwụkwọ nkọwa
URL nke bụ isi
https://fxmacrodata.com/ig/documentation/quickstart
Isi
Ihe ndị FXMacroData editorial na ndị wepụtara ya kwesịrị ekwesị kpọrọ nkaso
Emelitere na Oge Ikpeazụ
Lee metadata nke peji

Ebe itu ụzọ na Ntụkwasị obi

Sịta canonical URL na mpaghara isi n'elu. Ebe ọ dị, peji a na-ejikọ na nsụputa ọha wepụtara na mkpemputa oge.

Ajụjụ Ngwa Ngwa&A;

Gịnị ka peji a bụ maka ya? Peji a na-akọwa Quickstart na ngwa ọrụ a ga-eji eme trading, nyocha, na API workflows.

Kedu isi iyi a ga-eji kwupụta? Jiri canonical URL na field isi ihe a dere; tụọ ntụle official publisher mgbe ọ dị available.

Kedu otú ọhụrụ ihe ndị a dị? Uru ikpeazụ a rụchara n'elu na-egosi metadata peji ma ọ bụ timestamp data kachasị ọhụrụ dị.

Enwere ike iji nke a mee ihe na AI assistants? Ee. A rụrụ ngwaa ngalaba a maka nwetawara na nkọwa na ndị nyere aka chat.

Ngakpụrụ Prompt

Jiri ndị a na ChatGPT, Claude, Gemini, Mistral, Perplexity, ma ọ bụ Grok maka nsonaazụ ndị doro anya nke maara isi ike.

Kekọọ peji a X LinkedIn Imeel