본문 바로가기

공개 시세 스트림

wss://api-ws.btxpro.co.kr/v1/market/stream

API 키 없이 연결합니다. 현재 공개 채널은 ticker이며, REST 시세와 같은 시세 객체를 전달합니다.

구독

{
  "id": "sub-1",
  "op": "subscribe",
  "args": [
    { "channel": "ticker", "symbol": "BTC-USDT" },
    { "channel": "ticker", "symbol": "ETH-USDT" }
  ]
}

서버는 정규화된 구독 확인을 먼저 보냅니다.

{
  "event": "subscribed",
  "id": "sub-1",
  "args": [
    { "channel": "ticker", "symbol": "BTC-USDT" },
    { "channel": "ticker", "symbol": "ETH-USDT" }
  ],
  "serverTime": 1783420800123
}

캐시된 ticker가 있으면 확인 메시지 직후 현재 값을 보냅니다. 이후의 이벤트 예시:

{
  "event": "ticker",
  "sequence": 1,
  "arg": { "channel": "ticker", "symbol": "BTC-USDT" },
  "data": {
    "symbol": "BTC-USDT",
    "baseCurrencyId": 1002,
    "quoteCurrencyId": 1001,
    "lastPrice": "65000.000000000",
    "priceChange": "1000.000000000",
    "priceChangeRate": "0.015600000",
    "high": "66000.000000000",
    "low": "63000.000000000",
    "volume": "12.500000000",
    "quoteVolume": "810000.000000000",
    "time": 1783420800123
  },
  "serverTime": 1783420800123
}

가격과 수량은 문자열입니다. sequence는 symbol별이 아니라 연결 전체에서 증가합니다.

구독 해제와 전체 구독

{
  "id": "unsub-1",
  "op": "unsubscribe",
  "args": [{ "channel": "ticker", "symbol": "BTC-USDT" }]
}

해제 확인의 event는 unsubscribed입니다.

동작 args의 symbol
전체 활성 마켓 구독 subscribe에서 *
전체 구독 중 한 마켓 제외 unsubscribe에서 해당 symbol
제외한 마켓 다시 포함 subscribe에서 해당 symbol
모든 구독 해제 unsubscribe에서 *

일반 구독은 최대 100개 symbol입니다. wildcard는 하나로 계산됩니다. trades, orderbook, candles는 현재 지원 채널이 아닙니다.

오류와 재연결

오류 이벤트의 정확한 필드는 MarketStreamErrorEvent를 확인하세요. 연결이 끊어지거나 sequence가 건너뛰면 새 연결에서 구독을 다시 설정합니다. 이전 연결의 데이터는 재전송하지 않습니다.