Tús Go Sasta
Tosaigh in aon teanga
Is an FXMacroData API an JSON REST API caighdeánach le haghaidh úsáid taobh an fhreastalaigh. Oibríonn aon teanga le tacaíocht HTTP. Tá sonraí fógraíochta USD, féilire scartha USD, agus catalog sonraí saor in aisce gan eochair: na 90 láí lasta, le drochdheanach scartha de 15 nóiméad, go dtí 100 iarratas in every lá. Teastaíonn eochair API do luachanna réamhais (cuimsíonn sé USD), gach airgeadra eile, scarthaí in am realta, agus stair iomlán, a sheoltar sa X-API-Key header. Féach cad atá saor
Bunús URL
https://api.fxmacrodata.com
Cruthú
X-API-Eochair: YOUR_API_KEY
Ceadú: Bearer YOUR_API_KEY
An tseanchóras ?api_key= tá paramhadar ceist as dáta: críochnaíonn eochracha i URLs i logaí.
Formáit fhreagairte
JSON (Content-Type: application/json)
openapi-generator-cli chun cliantas a ghiniú go huathoibríoch i dteangacha 40+.
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 nó /v1/predictions/usd/inflation nuair nachnraíonn tú ach sraithanna leiseanacha. Feic an tagairt iomlán →
limit glacann sé go dtí 100. Chun raingne iomlán a bhailiú, déan an iarratas arís le offset curtha in aon pagination.next_offset until pagination.has_more is false. Féach an lúb Python ↓
fetch() tá cosc curtha ar leathanach gréasáin ag an bpráiseir. Glaoigh FXMacroData ó do bhackend agus coimeád an eochair API as cód taobh an chliant
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. 200 a bhfuil data tá array folumh agus a iompaíonn no_data.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ú nó iarratas a dhéanamh arís. Ciallaíonn 404 go bhfuil an slug currency nó taisce go mícheart.
data_quality aithirg. point_in_time_safe, has_announcement_datetime, source_type, agus is_stale. point_in_time_safe is bréag é nuair a bhíonn aon ró san feniúl ag iompar am eisiúcháin bunaithe ar neamhaird an tsraith, mar sin seiceáil assumed_release_time_count agus an ___ ar gach ró release_time_assumed marcáil sula n-éireoidh le bréag le húsáideach.
Aisíocht an Mhargadh
Úsáid FXMacroData trí RapidAPI
Is beartú margaidh eisáltach do FXMacroData REST API RapidAPI é. Soláthraíonn FXMacroData na sonraí; bainann RapidAPI le bainistíocht do shubscríobháid margaidh, do eochair API, do mostra iarratais agus do bhillitheoireacht. Ní gá cuntas FXMacroData nó eochair ar leind a bheith agat do iarratais trí an bheartú seo.
- Oscail an liosta oifigiúil FXMacroData agus roghnaigh plean. Seiceáil an leathanach praghas chun clúdaigh, cátaí agus teorainneacha ráta láithreach.
- Cóipeáil do eochair RapidAPI as an suíomh imléachta deireadhphointe agus stóráil í i dtimpeallacht do fhreastalaí mar
RAPIDAPI_KEY. - Seol iarratais chuig
https://fxmacrodata1.p.rapidapi.comle gnáth-headair RapidAPI, mar a léirítear thíos.
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"
Clúdach endpoint an Margaide
Áraíonn an liosta fógraí, cála eochair, an catlóg sonraí, rátaí FX laethúla, suíomh COT, nuacht bainc-mheánach, sesiúin margaidh agus seiceáil sláinte. Is brath ar do phlean RapidAPI an rochtain ar airgeadra agus stair. Úsáid an catlóg chun sluganna lé индикаtóraí atá tacaite a aimsiú.
Aisíocht díreach FXMacroData
Úsáideann na samplaí eile ar an leathanach seo api.fxmacrodata.com agus FXMacroData X-API-Key nuair a bhíonn sé riachtanach. Tá eochracha agus síntiúsíéis ar leith idir anailísí. Clúdaíonn síntiús RapidAPI na deireadhphointeanna REST atá liostaite; tá síntiúsas suíomh Gréasáin, MCP, réamhaisnéisí, sruthú agus webhooks mar thairiscintí ar leith.
Coinnigh do eochair amach as cód brabhsálaí agus comhtháirteachtaí poiblí. Le haghaidh ríomhtha iomlán níos mó, lean pagination.next_offset until pagination.has_more is bréag é. Ná seol do eochair API chuig tacracht go háit leis an.
Glaoch API chéadúla
Iarratas Gasta
Ritheann an rannán chéad bhunús mar atá sé: ní gá eochair do dháta USD, seirbhísithe 15 nóiméad tar éis eisiúna. Cuir leis X-API-Key do gach airgeadra 22 agus seachadadh am báire, seoltar ó fhreastalaí, scripte, nó leabhar nóta.
# 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 22 currencies and real-time releases
curl -H "X-API-Key: YOUR_API_KEY" "https://api.fxmacrodata.com/v1/announcements/eur/inflation"
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"
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))
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"
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))
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"
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))
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",
}
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))
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"
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
Suiteáil an oifigiúil fxmacrodata pacáid ó PyPI (1.2.x). Iontraíonn cliaint comhtháilithe agus ascréidte riochtaí JSON simplí a n-uaslódálann go díreach isteach i pandas. Client() gan eochair léann an leibhéal saor USD; seacháin api_key do gach airgeadra eile agus seachadadh am-réalt.
Ag úsáid an 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 22 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")
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])
Ag bogadh trí stair iomlán
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")
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())
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.
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.
/v1/predictions/coverage/{currency}. Seolann eochair thriail nó íocaithe luachraí réamhais.
Python — faigh réamhaisnéisí agus nasc le réalaiseacha
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 — féigh tormánacha de réir cineál
# 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"
Tagairt do chineálacha réamhaisnéise
| cineál_réamhaisnéise | Síosúlú |
|---|---|
| market_consensus | Comhdhéanú imeachtaí margaidh nó eaconomóra, nuair atá sé ar fáil |
| market_prediction | Point prediction foraoisneach gairmiúil |
| model_nowcast | Nowcast múnla baincisiú nó bainc tairiscint |
| suirmhán | Suiteach bainc an bhanc ceannais ar fógraíocht ghairmiúil (m.sh. ECB SPF) |
| central_bank_forecast | Tograil oifigiúla bainc chentralacha (m.sh. RBNZ MPS, BoC MPR) |
| central_bank_projection | Taismeach oifigiúil banca lárna |
| imf_weo | Tograil IMF World Economic Outlook |
| fxmacrodata | Ré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 — 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
Oibríonn sé taobh an fhreastalaí i Node.js (18+), Deno, agus Bun. Ní sheolann an API ceannthealaí CORS, mar sin glaoigh é ó do bhackend seachas ó chód an bpráiseir.
Cliant npm oifigiúil
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 = 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());
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.
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
Ú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, 'HeaderFields', {'X-API-Key', 'YOUR_API_KEY'}); url = 'https://api.fxmacrodata.com/v1/announcements/eur/policy_rate'; 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?
Oibríonn sonraí scartha USD gan eochair, go dtí 100 iarratas/lá agus 15 nóiméad ina dhiaidh an fhoilseála. Liostáil le haghaidh scarthaí in am realta, luachanna réamhais, stair iomlán, teorainneacha níos airde, agus gach airgeadra.