Quickstart
ఏ భాషలోనైనా ప్రారంభించండి
FXMacroData API అనేది ఒక ప్రామాణిక JSON REST API. HTTP సపోర్ట్ ఉన్న ఏ భాష అయినా పనిచేస్తుంది. కీ లేకుండా ఇటీవలి 90 రోజుల కోసం ఫ్రీమియం టైమ్-సిరీస్ ఎండ్పాయింట్లు అందుబాటులో ఉన్నాయి. పూర్తి చరిత్ర మరియు పెయిడ్ ఎండ్పాయింట్ ఫ్యామిలీలను అన్లాక్ చేయడానికి ఇండివిజువల్ API కీని జోడించండి.
బేస్ URL
https://api.fxmacrodata.com
అథెంటికేషన్
X-API-Key: YOUR_API_KEY
Authorization: Bearer YOUR_API_KEY
?api_key=YOUR_API_KEY
ప్రతిస్పందన ఫార్మాట్
JSON (Content-Type: application/json)
openapi-generator-cli 40+ భాషలలో క్లయింట్లను ఆటో-జనరేట్ చేయడానికి.
Accept-Encoding: gzip ప్రతి రిక్వెస్ట్పై (8–12× చిన్న పేలోడ్స్), తిరిగి ఉపయోగించండి ETag రెస్పాన్స్ హెడర్ ఇందులో If-None-Match రిపీట్ పోల్స్పై (తిరిగి ఇస్తుంది 304 Not Modified బాడీ లేకుండా), మరియు పాస్ చేయండి ?limit=50 ఇలాంటి సింగిల్-ఇండికేటర్ ఎండ్పాయింట్లపై /v1/announcements/usd/inflation లేదా /v1/predictions/usd/inflation మీకు ఇటీవలి వరుసలు (rows) మాత్రమే అవసరమైనప్పుడు. పూర్తి రిఫరెన్స్ను చూడండి →
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 డైరెక్ట్ బ్రౌజర్ మరియు స్క్రిప్ట్ టెస్టింగ్ కోసం క్వెరీ పారామీటర్.
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))
Python
అధికారికంగా ఇన్స్టాల్ చేయండి fxmacrodata PyPI నుండి ప్యాకేజీ. సింక్ మరియు ఎసింక్ క్లయింట్లు, pandas-ready అవుట్పుట్.
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])
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())
అంచనాలు & అంచనాలు
ది /v1/predictions/{currency}/{indicator} ఎండ్పాయింట్ మార్కెట్ కాన్సెన్సస్ సర్వేలు, సెంట్రల్-బ్యాంక్ ప్రొజెక్షన్లు, IMF వరల్డ్ ఎకనామిక్ అవుట్లుక్ మరియు ప్రొఫెషనల్-ఫోర్కాస్టర్ సర్వేల నుండి ఫోర్కాస్ట్ డేటాను అందిస్తుంది. నిర్దిష్ట కరెన్సీ మరియు ఇండికేటర్ కోసం ప్రిడిక్షన్లు కోరబడతాయి, ఉదాహరణకు https://api.fxmacrodata.com/v1/predictions/usd/inflation; కరెన్సీ-ఓన్లీ ప్రిడిక్షన్ రిక్వెస్ట్లు సపోర్ట్ చేయబడవు. ప్రతి ప్రిడిక్షన్ దాని అనౌన్స్మెంట్కు దీని ద్వారా లింక్ చేయబడింది announcement_id, తద్వారా మీరు ఫోర్కాస్ట్లను రియలైజ్డ్ అబ్జర్వేషన్స్తో జాయిన్ చేయవచ్చు.
prediction_type="fxmacrodata" ఇది FXMacroData-జనరేటెడ్ అంచనా; నిజమైన కంపైల్డ్ కాన్సెన్సస్ను ఇలా లేబుల్ చేస్తారు market_consensus. ఫోర్కాస్ట్ లభ్యత విడుదలను బట్టి మారుతుంది — దీనిని తనిఖీ చేయండి కవరేజ్ మ్యాట్రిక్స్. లుక్-అహెడ్-ఫ్రీ రీసెర్చ్ కోసం, దీనిని అనుసరించండి పాయింట్-ఇన్-టైమ్ బ్యాక్టెస్టింగ్ గైడ్.
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 రకాల రిఫరెన్స్
| prediction_type | వివరణ |
|---|---|
| market_consensus | లభించిన చోట, సంకలనం చేయబడిన మార్కెట్ లేదా ఆర్థికవేత్త ఈవెంట్ ఏకాభిప్రాయం |
| market_prediction | ప్రొఫెషనల్-ఫోర్కాస్టర్ పాయింట్ ప్రిడిక్షన్ |
| model_nowcast | సెంట్రల్-బ్యాంక్ లేదా రిజర్వ్-బ్యాంక్ మోడల్ నౌకాస్ట్ |
| సర్వే | ప్రొఫెషనల్ ఫోర్కాస్టర్ల సెంట్రల్-బ్యాంక్ సర్వే (ఉదా. ECB SPF) |
| central_bank_forecast | అధికారిక సెంట్రల్-బ్యాంక్ ప్రొజెక్షన్ (ఉదా. RBNZ MPS, BoC MPR) |
| central_bank_projection | అధికారిక సెంట్రల్-బ్యాంక్ అంచనా |
| imf_weo | IMF వరల్డ్ ఎకనామిక్ అవుట్లుక్ ప్రొజెక్షన్ |
| 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 క్లయింట్
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.
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 ఫంక్షన్.
% 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 ఎండ్పాయింట్లు రోజుకు 100 రిక్వెస్ట్ల వరకు నో-కీ ఎవాల్యుయేషన్కు మద్దతు ఇస్తాయి. అధిక పరిమితులు మరియు మల్టీ-కరెన్సీ యాక్సెస్ కోసం సబ్స్క్రైబ్ చేసుకోండి.