Tús Go Sasta

Tosaigh in aon teanga

Is JSON REST API rialta API FXMacroData é. Oibríonn aon teanga le tacar HTTP. Tá endpointí freemium time-series ar fáil do na 90 laethraí is déanaí gan eochair. Cuir eochair API Indibiduáltach leis chun an stair iomlán agus teaglaigh endpointí tíortha a dh unlocking.

Bunús URL

https://api.fxmacrodata.com

Cruthú

X-API-Eochair: YOUR_API_KEY

Ceadú: Bearer YOUR_API_KEY

?api_key=YOUR_API_KEY

Formáit fhreagairte

JSON (Content-Type: application/json)

Gineadh cliaint sainaitheanta go huathoibríoch: Úsáid an publish Spec OpenAPI 3.1 le openapi-generator-cli chun cliantas a ghiniú go huathoibríoch i dteangacha 40+.
Buaí feidhmíochta saor: Seol Accept-Encoding: gzip ar gach iarratas (8–12× payloads níoslyú ETag ceannaire freagra i If-None-Match ar pollanna athchúrsaithe (torthaí 304 Not Modified gan corp), agus pasáil ?limit=50 ar deireadh-phointe amháin cosúil le /v1/announcements/usd/inflation/v1/predictions/usd/inflation nuair nachnraíonn tú ach sraithanna leiseanacha. Feic an tagairt iomlán →
Faigh slugs comharthaí amach sula gcuirtear cosmaidheanna dochtúla isteach: Sluagh-tíomán éagsúla de réir airgeadais — core_pce tá sé ann do USD ach níl sé ann do gach airgeadas. Liostaigh gach slug a thacaíonn le hairgead le haghaidh GET /v1/data_catalogue/{currency}, mar shampla /v1/data_catalogue/usd. 404 le error_code: NO_DATA_IN_REQUESTED_WINDOW ciallaíonn go bhfuil an slug bailí agus go bhfuil an fuinneog dáta iarrtha folumháin amháin — leathnaigh start_date/end_date seachas an URL a athrú.
Seiceáil cáilíocht na freagairte: Tugann deireadh-phointe atá bunaithe ar fhóinsí torthaí leibhéal uachtarach data_quality aithirg. point_in_time_safe, has_announcement_datetime, source_type, agus is_stale.

Glaoch API chéadúla

Iarratas Gasta

Tosaigh le deireadh (endpoint) fógra beo. Fanann an t-úchtú sa api_key paraiméadar cuideachta le haghaidh testáil brabhraire agus scripte díreach.

sampla inflaide EUR GET /api/v1/announcements/eur/inflation
Iarratas snipit
curl "https://api.fxmacrodata.com/v1/announcements/eur/inflation?api_key=YOUR_API_KEY"

Python iarratas

Iarratais Python API is féidir leagadh

Úsáid na samplaí díreach REST seo nuair atá an iarratas API amhrach u Aghaidh ar SDK. Athraigh YOUR_API_KEY ar chóir ar threoracha cosanta amháin.

comhcheol margaidh inflation USD

Comhaontais, suirmhú, baincisiú, IMF, agus réamhaisnéisí FXMacroData nasctha le fógraí réalaise.

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 le timestamps known-at

Onóraí infláite USD phoiblí le haghaidh backtests ag amanna ar leith.

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

stair spot EUR/USD FX

Stair praghas FX laethúil do chomharthaí páir, modailí, agus díreachadh scaoileadh.

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

historia ráta beilidheachais AUD

Stair chinntheas baincéire lárna le timing scaoileadh le haghaidh taighde gan breathnú chun tosaigh.

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

sceideal scaoileadh upcoming JPY

Imeachtaí macro atá le teacht le UTC, réimsí margaidh-rialacha, agus réimsí tíomnáire iarrata, le haghaidh pleanáil fógraí, athnuachan modail, agus athbhreithniú caidrimh.

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

Praghsanna earraí óir

Sraith ama oifigiúil metiléis luachacha laethúla agus cúntais athraithe.

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))
Oifigiúil SDK

Python

Suiteáil an oifigiúil fxmacrodata pacáid ó PyPI. Cliantanna comhtháilithe agus neamhtháilithe, toradh réidh le pandas.

pip install fxmacrodata

Ag úsáid an 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")

Ag baint úsáide as an REST API go díreach

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

Cliant asincrúnach

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

Réamhaisnéisí & Réamhaisnéisí

An /v1/predictions/{currency}/{indicator} fochaillí tairsealaíonn sonraí réamhaispeis ó shuísí comhaontuithe margaidh, tograí bainc chentralacha, IMF World Economic Outlook, agus shuísí forasaithe gairmiúla. Déan iarratas ar réamhaispeisí do airgeadra agus tíomnáir ar leith, mar shampla https://api.fxmacrodata.com/v1/predictions/usd/inflation; ní thacaítear le hiarrataí réamhaisnéis curasaig amháin. Tá gach réamhaisnéis nasctha lena fógrainthe trí announcement_id, ionas gur féidir leat foraoisneacha a nascadh le observations réallaithe.

Ná tabhair leithleis ar gach réamhaisnéis mar thionglas. prediction_type="fxmacrodata" is meascán é a генеराíodh ag FXMacroData; tá tionglas cumhachtach fíor le marcáil market_consensus. Íongann an fheidhmíocht réamhaisnéis de réir sráithe — seiceáil an matrise clúdach. Le haghaidh taighde gan breathnú ar aghaidh, lean an treoir backtesting le pointe amhair.
Tá USD in saor in Éirinn ar 90 laethraí is déanaí — ní gá eochair API do réamhaispeisí USD laistigh den uainseán sin. Is gá le stór iomlán USD agus gach airgeadra eile triail éifeachtach nó eochair API íoscainte a bheith acu.

Python — faigh réamhaisnéisí agus nasc le réalaiseacha

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 — féigh tormánacha de réir cineál

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

Tagairt do chineálacha réamhaisnéise

cineál_réamhaisnéiseSíosúlú
market_consensusComhdhéanú imeachtaí margaidh nó eaconomóra, nuair atá sé ar fáil
market_predictionPoint prediction foraoisneach gairmiúil
model_nowcastNowcast múnla baincisiú nó bainc tairiscint
suirmhánSuiteach bainc an bhanc ceannais ar fógraíocht ghairmiúil (m.sh. ECB SPF)
central_bank_forecastTograil oifigiúla bainc chentralacha (m.sh. RBNZ MPS, BoC MPR)
central_bank_projectionTaismeach oifigiúil banca lárna
imf_weoTograil IMF World Economic Outlook
fxmacrodataRéamhaispeis ghineadh le haghaidh FXMacroData a cheanglaíonn treoir bainc chentralacha, suís, agus tendendí stairiúla

cURL

Ní gá suiteáil a dhéanamh. Oibríonn ó aon inchinn.

# 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

Oibríonn sé in Node.js (18+), Deno, Bun, agus brabhair nua-aimseartha leis an Fetch API.

Cliant npm oifigiúil

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

Úsáid Fetch go díreach

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

Imigh

Níl pacáistí externacha uait — láimhseálann an leabharlann std iomlán.

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

Tá gá le httr agus 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

Úsáideanna java.net.http (Java 11+). Ní gá leabhair eachtracha a úsáid.

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

Úsáideanna 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

Úsáideann sé an built-in webread feidhme.

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

Giniúla cliant clóite do gach teanga

Cuireann API FXMacroData i leagan iomlán Sainmhíniú OpenAPI 3.1. Úsáid é le openapi-generator chun cliantas go hiomlán clóite a tháirgeadh do Kotlin, Swift, Rust, Dart, Ruby, PHP, agus 40+ teangacha eile.

# 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

Réidh le tógáil?

Tacaíonn deireadhacha USD le measúnú gan eochair go 100 iarratas/lá. Liostáil le haghaidh teorainneacha níos airde agus rochtain il-airgeadaí.

AI Réidh le Freagra

Fíricí Príomhchaithí

Leathanach
Tús Go Sasta
Rann
Doiciméadú
Canóineach URL
https://fxmacrodata.com/ga/documentation/quickstart
FTestSource
Tagairtí eagarthóra agus oifigiúlaí poblaí FXMacroData
Deireanú Uasghrádattha
Feic meta-sonraí leathanach

Provenans agus Muinín

Cite an URL bunúsach agus an réimse foinse thuas. Nuair atá sé ar fáil, nascann an leathanach seo le ráiteasanna poblaithe agus nuashonruithe le seanchra.

Ceist Thapa&A;

Cad is é cuspóir an leathanach seo? Míníonn an leathanach seo Quickstart le comhthéacs in úsáid go díreach le haghaidh rudaí margaidh, taighde, agus oibrithe API.

Cén nguồnbaith ar chóir a mhargadh? Úsáid an URL canonical agus an réimse foinse liostaithe; tagair chuig tagairtí oifigiúla an fhoirtheora nuair a bhíonn siad ar fáil.

Cén chomh nua is atá an t-ábhar seo? Leagann an luach is déanaí thuas le haghaidh meta-faisnéis an leathanach nó amanna faisnéise is déanaí atá ar fáil.

An féidir é seo a úsáid i gcuid cúntóirí AI? Tá. Tá an rann seo struchtúradh go rannaithe le haghaidh fáilteoireacht agus u citations i gcúntóirí comhrá.

Pacáidí Prompts

Úsáid iad seo i ChatGPT, Claude, Gemini, Mistral, Perplexity, nó Grok le haghaidh torthaí comhthéanais atá faisnéach faoin mbunús.

Roinn leathanach X LinkedIn Ríomhphost