빠른 시작
어떤 언어에서든 시작하기
FXMacroData API은 서버 측 사용을 위한 표준 JSON REST API입니다. HTTP 지원되는 모든 언어에서 작동합니다. USD 발표 데이터, USD 출시 캘린더 및 데이터 카탈로그는 키 없이 무료로 제공됩니다: 최근 90일, 15분 출시 지연, 하루 최대 100회 요청. 예측값(USD 포함), 기타 모든 통화, 실시간 출시, 전체 이력은 API 키가 필요하며, 이는 다음으로 전송됩니다: X-API-Key header. 무료 항목 확인하기
기본 URL
https://api.fxmacrodata.com
인증
X-API-키: YOUR_API_KEY
Authorization: Bearer YOUR_API_KEY
레거시 ?api_key= 쿼리 매개변수는 더 이상 사용되지 않습니다: URL의 키가 로그에 남게 됩니다.
응답 형식
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 최근 행만 필요한 경우. 전체 참조 보기 →
limit 최대 100. 까지 허용합니다. 전체 범위를 수집하려면 다음으로 요청을 반복하십시오 offset 로 설정 pagination.next_offset until pagination.has_more is false. Python 루프 확인 ↓
fetch() 웹 페이지에서의 요청은 브라우저에 의해 차단됩니다. 백엔드에서 FXMacroData을 호출하고 API 키가 클라이언트 측 코드에 노출되지 않도록 하십시오.
core_pce USD에는 존재하지만 모든 통화에 대해 존재하지는 않습니다. 통화가 지원하는 모든 슬러그를 다음으로 나열하십시오 GET /v1/data_catalogue/{currency}, 예를 들어 /v1/data_catalogue/usd. 다음의 200 data 배열이 비어 있으며 다음을 포함합니다 no_data.error_code: NO_DATA_IN_REQUESTED_WINDOW 슬러그가 유효하며 요청된 날짜 범위만 비어 있음을 의미합니다 — 확대 start_date/end_date URL을 변경하거나 재시도하는 대신, 404은 통화 또는 지표 슬러그가 잘못되었음을 의미합니다.
data_quality 객체. 백테스트 및 기관 보고를 위해 검사하십시오 point_in_time_safe, has_announcement_datetime, source_type, 및 is_stale. point_in_time_safe 윈도우 내의 어떤 행이라도 시리즈의 측정된 릴리스 지연 시간에서 파생된 발행 시간을 가지고 있는 경우 거짓이 되므로, 확인하십시오 assumed_release_time_count 및 행당 release_time_assumed 거짓으로 처리하기 전에 플래그를 지정하십시오.
마켓플레이스 접속
RapidAPI를 통해 FXMacroData 사용하기
RapidAPI는 FXMacroData REST API를 위한 선택적 마켓플레이스 채널입니다. FXMacroData가 데이터를 공급하며, RapidAPI가 귀하의 마켓플레이스 구독, API 키, 요청 할당량 및 결제를 관리합니다. 이 채널을 통한 요청에는 별도의 FXMacroData 계정이나 키가 필요하지 않습니다.
- 다음 열기 공식 FXMacroData 목록 및 플랜을 선택하십시오. 현재 제공 범위, 할당량 및 속도 제한은 가격 탭을 확인하십시오.
- 엔드포인트 플레이그라운드에서 RapidAPI 키를 복사하여 서버 환경에 다음과 같이 저장하십시오:
RAPIDAPI_KEY. - 다음으로 요청 전송
https://fxmacrodata1.p.rapidapi.com아래에 표시된 것과 같이 두 가지 RapidAPI 헤더를 모두 사용합니다.
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"
Marketplace 엔드포인트 범위
목록에는 공지사항, 출시 일정, 데이터 카탈로그, 일일 FX 환율, COT 포지셔닝, 중앙은행 뉴스, 시장 세션 및 상태 점검이 포함됩니다. 통화 및 이력 액세스는 귀하의 RapidAPI 플랜에 따라 달라집니다. 지원되는 지표 슬러그를 찾으려면 카탈로그를 사용하십시오.
직접 FXMacroData 액세스
이 페이지의 다른 예시들은 다음을 사용합니다: api.fxmacrodata.com 및 FXMacroData X-API-Key 필요할 때 제공됩니다. 키와 구독은 채널 간에 별도로 관리됩니다. RapidAPI 구독은 나열된 REST 엔드포인트를 포함합니다; 웹사이트 구독, MCP, 예측, 스트리밍 및 웹훅은 별도의 서비스입니다.
키를 브라우저 코드 및 공개 저장소에 노출하지 마십시오. 더 긴 결과 세트의 경우, 다음을 따르십시오 pagination.next_offset until pagination.has_more 는 false입니다. 귀하의 API 키를 지원팀에 절대 보내지 마십시오.
첫 API 호출
빠른 요청
첫 번째 스니펫은 그대로 실행됩니다: USD 데이터에는 키가 필요하지 않으며, 발표 15분 후에 제공됩니다. 추가 X-API-Key 모든 22 통화 및 서버, 스크립트 또는 노트북에서 전송되는 실시간 제공을 위해.
# 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 요청
복사 가능한 Python API 요청
SDK 래퍼 대신 원시 API 요청을 원하는 경우 이 직접적인 REST 예제들을 사용하십시오. 보호된 경로에서만 YOUR_API_KEY을 교체하십시오.
USD 인플레이션 시장 컨센서스
컨센서스, 설문, 중앙은행, IMF, 그리고 FXMacroData 예측치가 실제 발표 데이터와 결합되었습니다.
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))
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"
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))
AUD 정책 금리 이력
룩어헤드(lookahead) 없는 리서치를 위한 발표 시점이 포함된 중앙은행 결정 이력.
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))
JPY 다가오는 발표 일정
알림 계획, 모델 갱신 및 트레이딩 검토를 위한 UTC, 시장 현지 및 요청된 시간대 필드가 포함된 향후 매크로 이벤트.
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))
금 원자재 가격
일일 값 및 변동 필드가 포함된 공식 귀금속 시계열.
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
공식 설치 fxmacrodata PyPI의 패키지 (1.2.x). 동기 및 비동기 클라이언트는 pandas로 즉시 로드되는 일반 JSON 딕셔너리를 반환합니다. Client() 키 없이 읽으면 무료 USD 티어를 사용하며; 전달 시 api_key 다른 모든 통화 및 실시간 제공용.
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")
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])
전체 기록 페이지 넘기기
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")
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) 백테스팅 가이드.
/v1/predictions/coverage/{currency}. 체험판 또는 유료 키는 예측값을 반환합니다.
Python — 예측치를 가져와 실제값과 결합
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 — 유형별 예측 가져오기
# 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"
예측 유형 참조
| 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 — 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
Node.js (18+), Deno 및 Bun에서 서버 측으로 작동합니다. API은 CORS 헤더를 전송하지 않으므로, 브라우저 코드보다는 백엔드에서 호출하십시오.
공식 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 = 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());
이동
외부 패키지가 필요하지 않습니다 — 표준 라이브러리가 모든 것을 처리합니다.
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", add_headers(`X-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, 'HeaderFields', {'X-API-Key', 'YOUR_API_KEY'}); url = 'https://api.fxmacrodata.com/v1/announcements/eur/policy_rate'; 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회 요청 및 발표 후 15분 지연됩니다. 실시간 출시, 예측값, 전체 이력, 더 높은 제한 및 모든 통화에 대해 구독하십시오.