빠른 시작
어떤 언어에서든 시작하기
FXMacroData API은 표준 JSON REST API입니다. HTTP 지원이 있는 모든 언어에서 작동합니다. 키 없이도 가장 최근 90일 동안의 프리미엄 시계열 엔드포인트를 사용할 수 있습니다. 전체 기록과 유료 엔드포인트 제품군을 잠금 해제하려면 개인용 API 키를 추가하십시오.
기본 URL
https://api.fxmacrodata.com
인증
X-API-키: 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 body 없이), 그리고 전달 ?limit=50 다음과 같은 단일 지표 엔드포인트에서 /v1/announcements/usd/inflation 또는 /v1/predictions/usd/inflation 최근 행만 필요한 경우. 전체 참조 보기 →
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))
known-at 타임스탬프를 포함한 USD 인플레이션
시점별(point-in-time) 백테스트를 위한 공개 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 정책 금리 이력
룩어헤드(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))
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 호환 출력.
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())
예측 & 예측
The /v1/predictions/{currency}/{indicator} 엔드포인트는 시장 컨센서스 설문 조사, 중앙은행 전망, IMF 세계 경제 전망, 전문 예측가 설문 조사에서 도출된 예측 데이터를 제공합니다. 예측은 다음과 같이 특정 통화 및 지표에 대해 요청됩니다. https://api.fxmacrodata.com/v1/predictions/usd/inflation; 통화 전용 예측 요청은 지원되지 않습니다. 각 예측은 다음을 통해 발표와 연결됩니다: announcement_id, 따라서 예측치를 실제 관측치와 결합할 수 있습니다.
prediction_type="fxmacrodata" 는 FXMacroData가 생성한 추정치입니다. 실제 취합된 컨센서스는 다음과 같이 표시됩니다. market_consensus. 예측 가능성은 발표마다 다릅니다 — 다음을 확인하십시오 커버리지 매트릭스. 룩어헤드(look-ahead) 없는 리서치를 위해 다음을 따르십시오 시점(point-in-time) 백테스팅 가이드.
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_type | 설명 |
|---|---|
| market_consensus | 가능한 경우 취합된 시장 또는 경제학자 이벤트 컨센서스 |
| market_prediction | 전문가 예측 시점 예측 |
| model_nowcast | 중앙은행 또는 준비은행 모델 나우캐스트(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건의 요청까지 키 없이 평가할 수 있습니다. 더 높은 한도와 다중 통화 액세스를 위해 구독하십시오.