본문으로 건너뛰기

WebSocket 실시간 시세 스트리밍 API

하나의 WebSocket 연결로 여러 종목의 실시간 가격 변동과 체결 내역을 반복 폴링 없이 수신할 수 있습니다.

무료 플랜 제공REST + WebSocketUSDT / 잔액 즉시 개통

WebSocket을 사용하는 이유

  • Updates are pushed as prices change, which is more timely than polling REST on a timer and does not use your per-minute request allowance.
  • One connection can subscribe to many symbols, and several connections can subscribe to the same symbol without affecting each other.
  • The protocol is compatible with iTick, so existing subscription code only needs a new endpoint.

메시지 포맷

Subscribe, heartbeat and pushes
// Subscribe / unsubscribe. types: tick, quote, depth, kline@1
{"ac":"subscribe","params":"AAPL$US,700$HK","types":"quote,tick"}
{"ac":"unsubscribe","params":"AAPL$US","types":"quote"}

// Heartbeat
{"ac":"ping","params":"1731688569840"}

// Pushed message
{"code":1,"data":{"s":"BTCUSDT","r":"BA","ld":83988.54,"v":0.00019,"type":"tick"}}

JavaScript 연동 예시

JavaScript
const ws = new WebSocket("wss://api.itick.dev/crypto?token=YOUR_API_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({ ac: "subscribe", params: "BTCUSDT$BA", types: "quote,tick" }));
  // Send a heartbeat at least every 30 seconds
  setInterval(() => ws.send(JSON.stringify({ ac: "ping", params: String(Date.now()) })), 25000);
};

ws.onmessage = (event) => console.log(event.data);

지원 시장

Connect to wss://api.itick.dev/{market} where market is stock, forex, crypto, indices, future or fund. Available data depends on your plan.

연결 및 구독 한도

Concurrent connections per API key per market and symbols per connection are set by your plan; see pricing. The free plan does not include WebSocket by default.

자주 묻는 질문 (FAQ)

What if the connection drops?

If the server closes a connection because the token was disabled, reset or expired, reconnect and subscribe again once you have a valid token. Network drops also require reconnecting and subscribing again.

Do I need to send heartbeats?

Yes. Send a ping at least every 30 seconds; a connection with no heartbeat for over a minute may be closed.

How do I pass the token in a browser?

Browser WebSockets cannot set request headers, so put the token in the token query parameter of the connection URL.

몇 분 만에 API 연동 시작

무료로 가입하고 무료 플랜을 구독해 즉시 API 토큰을 발급받으세요.

무료 가입하기