인포웨이의 실시간 외환 데이터 API
출처: Dev.to
Infoway API 주요 시장 메이커로부터 외환 가격 데이터를 수집하고 통합된 REST 및 WebSocket 인터페이스를 통해 제공합니다. 외환 데이터는 일관되게 100 ms 미만의 지연 시간과 99.6 % 가동률의 실제 실시간 환율을 의미합니다.
외환 피드는 주요 42개의 통화 페어와 몇 가지 이국적인 페어를 모두 포함합니다:
| Symbol | Pair |
|---|---|
| EURUSD | 유로 / 미국 달러 |
| GBPUSD | 영국 파운드 / 미국 달러 |
| USDJPY | 미국 달러 / 일본 엔 |
| USDCHF | 미국 달러 / 스위스 프랑 |
| AUDUSD | 호주 달러 / 미국 달러 |
| NZDUSD | 뉴질랜드 달러 / 미국 달러 |
| USDCAD | 미국 달러 / 캐나다 달러 |
| USDCNY | 미국 달러 / 중국 위안 |
| USDCNH | 미국 달러 / 해외 위안 |
| USDHKD | 미국 달러 / 홍콩 달러 |
| USDSGD | 미국 달러 / 싱가포르 달러 |
| USDTHB | 미국 달러 / 태국 바트 |
| USDTWD | 미국 달러 / 대만 달러 |
| USDRUB | 미국 달러 / 러시아 루블 |
| EURJPY | 유로 / 일본 엔 |
| EURGBP | 유로 / 영국 파운드 |
| EURCHF | 유로 / 스위스 프랑 |
| EURAUD | 유로 / 호주 달러 |
| EURCAD | 유로 / 캐나다 달러 |
| EURNZD | 유로 / 뉴질랜드 달러 |
| GBPJPY | 영국 파운드 / 일본 엔 |
| GBPCHF | 영국 파운드 / 스위스 프랑 |
| GBPAUD | 영국 파운드 / 호주 달러 |
| GBP CAD | 영국 파운드 / 캐나다 달러 |
| GBPNZD | 영국 파운드 / 뉴질랜드 달러 |
| AUDJPY | 호주 달러 / 일본 엔 |
| AUDCHF | 호주 달러 / 스위스 프랑 |
| AUDCAD | 호주 달러 / 캐나다 달러 |
| AUDNZD | 호주 달러 / 뉴질랜드 달러 |
| AUDDKK | 호주 달러 / 덴마크 크로네 |
| CADJPY | 캐나다 달러 / 일본 엔 |
| CADCHF | 캐나다 달러 / 스위스 프랑 |
| CADUSD | 캐나다 달러 / 미국 달러 |
| CHFJPY | 스위스 프랑 / 일본 엔 |
| CHFUSD | 스위스 프랑 / 미국 달러 |
| NZDJPY | 뉴질랜드 달러 / 일본 엔 |
| NZDCAD | 뉴질랜드 달러 / 캐나다 달러 |
| SGDUSD | 싱가포르 달러 / 미국 달러 |
| CNYUSD | 중국 위안 / 미국 달러 |
| JPYUSD | 일본 엔 / 미국 달러 |
| USDEUR | 미국 달러 / 유로 |
| USDGBP | 미국 달러 / 영국 파운드 |
외환 외에도 동일한 API 키를 통해 주식(미국, 홍콩, 중국 A‑주식, 일본, 인도), 암호화폐, 상품, 귀금속, 그리고 CFD에 대한 접근이 가능하며, 모두 동일한 인터페이스를 통해 이용할 수 있습니다. 애플리케이션이 나중에는 통화뿐만 아니라 다른 자산도 커버하게 된다면, 여러 제공업체를 연결할 필요가 없습니다.
Getting Started
Infoway 웹사이트에 가입하여 API 키를 받으세요. 신규 계정은 자동으로 7일 무료 체험을 받으며, 신용카드 없이 이용할 수 있습니다. 키는 대시보드에서 즉시 확인 가능하고 몇 분 안에 요청을 시작할 수 있습니다.
Every request needs the API key passed as a request header:
apiKey: YOUR_APPLICATION_KEY_HERE
Enter fullscreen mode
Exit fullscreen mode
REST API Examples
외환 엔드포인트는 /common/ 경로 접두사를 사용합니다. 다음은 가장 일반적인 사용 사례에 데이터를 가져오는 방법입니다.
Latest Trade Price
거래 엔드포인트는 하나 또는 여러 통화 페어의 최신 거래를 반환합니다.
import requests
url = "https://data.infoway.io/common/batch_trade/EURUSD,GBPUSD,USDJPY"
headers = {
"User-Agent": "Mozilla/5.0",
"Accept": "application/json",
"apiKey": "YOUR_API_KEY_HERE"
}
response = requests.get(url, headers=headers)
print(response.json())
Enter fullscreen mode
Exit fullscreen mode
Response:
{
"ret": 200,
"msg": "success",
"traceId": "a1b2c3d4-1234-5678-abcd-ef0123456789",
"data": [
{
"s": "EURUSD",
"t": 1781672609412,
"p": "1.08423",
"v": "1.0",
"vw": "1.08423",
"td": 1
},
{
"s": "GBPUSD",
"t": 1781672609318,
"p": "1.27185",
"v": "1.0",
"vw": "1.27185",
"td": 2
},
{
"s": "USDJPY",
"t": 1781672609501,
"p": "149.832",
"v": "1.0",
"vw": "149.832",
"td": 0
}
]
}
Enter fullscreen mode
Exit fullscreen mode
| Field | Description |
|---|---|
s | Symbol |
t | Timestamp (milliseconds) |
p | Trade price |
v | Volume |
vw | Trade value |
td | Direction: 0 = default, 1 = buy, 2 = sell |
You can query up to 100 symbols in a single request by comma- separating them in the URL path.
Candlestick / OHLCV Data
캔들 엔드포인트는 1분부터 연간까지 12가지 타임프레임을 지원합니다. JSON 바디를 사용한 POST 요청으로 호출됩니다.
import requests
import json
url = "https://data.infoway.io/common/v2/batch_kline"
headers = {
"User-Agent": "Mozilla/5.0",
"Accept": "application/json",
"Content-Type": "application/json",
"apiKey": "YOUR_API_KEY_HERE"
}
payload = {
"klineType": 1, # 1 = 1‑min, 2 = 5‑min, 5 = 1‑hour, 8 = daily
"klineNum": 20, # Number of candles to return (max 500 per symbol)
"codes": "EURUSD,GBPUSD"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
Enter fullscreen mode
Exit fullscreen mode
Response:
{
"ret": 200,
"msg": "success",
"traceId": "b2c3d4e5-2345-6789-bcde-f01234567890",
"data": [
{
"s": "EURUSD",
"respList": [
{
"t": "1781671920",
"o": "1.08401",
"h": "1.08435",
"l": "1.08398",
"c": "1.08423",
"v": "142.0",
"vw": "154.08",
"pc": "0.02%",
"pca": "0.00022"
}
]
}
]
}
Enter fullscreen mode
Exit fullscreen mode
| Field | Description |
|---|---|
t | Candle open time (Unix seconds) |
o | Open |
h | High |
l | Low |
c | Close |
v | Volume |
vw | Trade value |
pc | Change % |
pca | Change (absolute) |
To pull historical candles, add a timestamp field to the request body. The API will return candles going back from that Unix timestamp:
payload = {
"klineType": 8, # Daily candles
"klineNum": 500,
"codes": "EURUSD",
"timestamp": 1770000000 # Pull up to 500 daily candles ending at this time
}
Enter fullscreen mode
Exit fullscreen mode
Minute‑level history goes back 3 years. Daily and above have no lookback restriction.
Order Book (Bid/Ask)
시장 깊이 엔드포인트는 하나 또는 여러 통화 페어의 현재 최적 매수 및 매도가를 반환합니다.
import requests
url = "https://data.infoway.io/common/batch_depth/EURUSD,USDJPY"
headers = {
"User-Agent": "Mozilla/5.0",
"Accept": "application/json",
"apiKey": "YOUR_API_KEY_HERE"
}
response = requests.get(url, headers=headers)
print(response.json())
Enter fullscreen mode
Exit fullscreen mode
Response:
{
"ret": 200,
"msg": "success",
"traceId": "c3d4e5f6-3456-7890-cdef-012345678901",
"data": [
{
"s": "EURUSD",
"t": 1781672693007,
"a": [
["1.08431"],
["0.0"]
],
"b": [
["1.08415"],
["0.0"]
]
}
]
}
a is the ask (sell side), b is the bid (buy side). Each contains a price array and a volume array, matched by index position.
WebSocket for Real-Time Streaming
REST 폴링은 수초 단위로 대시보드를 갱신하는 데 적합하지만, 가격 변동에 실시간으로 반응해야 하는 알림 시스템, 자동 전략, 거래 터미널과 같은 경우 지속적인 WebSocket 연결을 선호합니다. 폴링이 필요 없고 반복된 라운드 트립도 없습니다.
외환(및 상품 및 귀금속과 같은 common 유형 제품)의 WebSocket 엔드포인트는:
wss://data.infoway.io/ws?business=common&apikey=YOUR_API_KEY_HERE
Enter fullscreen mode
Exit fullscreen mode
Once connected, the server pushes updates to you as they happen. No polling, no repeated round trips.
연결되면 서버는 발생하는 즉시 업데이트를 푸시합니다. 폴링이 필요 없고 반복된 라운드 트립도 없습니다.
Here’ s a produc