내 주문의 접수, 체결, 완료, 취소 이벤트를 실시간으로 수신합니다(Private v2).
요청한 마켓에서 발생한 내 주문의 접수, 체결, 처리 완료, 취소 이벤트를 실시간으로 수신합니다.
이 페이지는 Private v2 응답 스펙입니다. v1에서 옮겨오는 경우 Private v2 마이그레이션 가이드를 참고하세요. v1 엔드포인트는 2026년 11월 13일에 종료됩니다.
Request
요청은 ticket, type, format 필드로 구성됩니다. 처음이라면 다음 페이지를 함께 확인하세요:
- 기본 정보: WebSocket 엔드포인트, Rate limit
- 요청 방법 및 포맷: 인증 방법, 요청 필드 상세
- 연결 관리: PING/PONG, 커넥션 유지
Type Field
| 필드명 | 타입 | 설명 | 필수 | 기본값 |
|---|---|---|---|---|
type | String | 데이터 타입. myOrder 고정 | O | — |
codes | List | 구독할 거래 페어 목록(대문자, 예: KRW-BTC) | X | 생략 또는 빈 배열이면 전체 거래 페어 수신 |
Response
값이 없는 필드는 응답 JSON에서 생략됩니다.
공통 필드(모든 이벤트)
| 필드명 | SIMPLE | 타입 | 설명 |
|---|---|---|---|
type | ty | String | 데이터 타입. myOrder 고정 |
stream_type | st | String | REALTIME 고정 |
code | cd | String | 거래 대상 페어(예: KRW-BTC) |
order_id | oid | String | 서버 발급 주문 고유 ID |
client_order_id | coid | String | 주문 생성 시 사용자가 지정한 식별 ID - 미지정 시 포함 x |
side | sd | String | 매수/매도 구분 - buy: 매수- sell: 매도 |
order_type | ot | String | 주문 유형 - limit: 지정가- price: 시장가 매수- market: 시장가 매도- best: 최유리 |
state | s | String | 주문 상태 - wait: 체결 대기- trade: 체결 발생- done: 주문 처리 완료- cancel: 주문 취소 |
time_in_force | tif | String | 주문 처리 조건. limit, best 주문에서만 사용- ioc: 즉시 체결, 잔량 취소- fok: 전량 체결 가능한 경우에만 체결, 그 외에는 전량 취소(부분 체결 없음)- post_only: maker 주문으로만 호가창에 등록(taker 가격이면 즉시 취소) |
order_price | op | Double | 사용자가 지정한 주문 가격 - 시장가( price, market), 최유리(best): 0 |
order_quantity | oq | Double | 사용자가 지정한 주문 수량 - 시장가 매수( price), 최유리 매수(best + buy): 0 |
order_amount | oa | Double | 주문 금액 - 지정가( limit): order_price × order_quantity- 시장가 매수( price), 최유리 매수(best + buy): 사용자 입력 총 금액- 시장가 매도( market), 최유리 매도(best + sell): 0 |
order_timestamp | otms | Long | 주문 생성 시각(ms) |
timestamp | tms | Long | 메시지 송신 시각(ms) |
주문 유형 및 처리 조건 참고
order_type: best(최유리): 원화 마켓 전용. 매수는 매도 1호가, 매도는 매수 1호가로 즉시 체결되는 주문입니다.
time_in_force: 주문 유형별 사용 가능 값
limit주문:ioc/fok/post_only중 하나(미설정 가능)best주문:ioc또는fokprice/market주문: 사용하지 않음
체결 이벤트 추가 필드(state: trade)
state: trade)체결이 발생한 경우에만 공통 필드와 함께 다음 필드가 추가됩니다.
| 필드명 | SIMPLE | 타입 | 설명 |
|---|---|---|---|
trade_id | tid | String | 이번 체결 고유 ID |
trade_price | tp | Double | 이번 체결가 |
trade_quantity | tq | Double | 이번 체결 수량 |
trade_amount | ta | Double | 이번 체결 금액(= trade_price × trade_quantity) |
trade_timestamp | ttms | Long | 이번 체결 시각(ms) |
executed_quantity | eq | Double | 누적 체결 수량 |
remaining_quantity | rq | Double | 잔여 수량 |
executed_amount | ea | Double | 누적 체결 금액(KRW: 소수점 0자리, 그 외: 소수점 8자리) |
paid_fee | pf | Double | 해당 체결의 수수료 |
remaining_fee | rmf | Double | 잔여 수수료 - 매도 주문은 0 |
reserved_fee | rsf | Double | 예약 수수료 - 매도 주문은 0 |
취소 관련 필드
state: cancel에서는 항상 포함됩니다. state: done에서는 자전거래 방지/주문 조건(IOC/FOK 부분 체결의 잔량 취소 등)으로 완료된 경우 포함됩니다.
| 필드명 | SIMPLE | 타입 | 설명 |
|---|---|---|---|
cancel_type | ct | String | 취소 유형 - user_cancel: 사용자- admin_cancel: 관리자- stp_cancel: 자전거래 방지- tif_cancel: 주문 조건 |
canceling_order_id | cnoid | String | 충돌을 일으킨 상대 주문의 ID - cancel_type: stp_cancel일 때만 포함 |
이벤트 흐름
주문 처리 중 도착할 수 있는 state 값과 의미는 다음과 같습니다. 기본 흐름은 wait → trade → done이지만, 주문 유형 및 조건(time_in_force)에 따라 일부 단계가 생략될 수 있습니다(아래 시나리오 참고). 시장가 주문도 동일한 state 값을 사용합니다.
| 순서 | state | 의미 | 추가로 채워지는 필드 |
|---|---|---|---|
| 1 | wait | 주문 접수 | — |
| 2 | trade | 체결 발생 (체결 건수만큼 반복) | trade_*, 누적/수수료 필드 |
| 3a | done | 주문 처리 완료 | 자전거래 / IOC·FOK 조건으로 완료 시 cancel_type |
| 3b | cancel | 주문 취소 | cancel_type (STP 시 canceling_order_id 추가) |
주문 조건(time_in_force)에 따라 흐름이 달라집니다:
- IOC:
wait단계 없이 즉시trade → done(전량/부분 체결) 또는cancel(전량 미체결)로 종료됩니다. 부분 체결 시 잔량은done메시지의cancel_type: tif_cancel로 자동 취소됩니다. - FOK:
wait단계 없이 즉시trade → done(전량 체결) 또는cancel(전량 취소)로 종료됩니다. 부분 체결은 발생하지 않습니다. post_only: Taker 가격으로 들어오면wait없이 즉시cancel되며cancel_type은tif_cancel입니다. Maker 가격이면 일반 지정가처럼wait으로 호가 등록 후 진행합니다.
시나리오별 메시지 흐름
주문 유형/조건별로 어떤 state 메시지가 어떤 cancel_type과 함께 도착하는지 한눈에 확인할 수 있는 표입니다.
| 시나리오 | 메시지 흐름 | cancel_type |
|---|---|---|
일반 limit: 체결 완료 | wait → trade → done | — |
일반 limit: taker 즉시 체결 | trade → done | — |
일반 limit: 사용자/관리자 취소 | wait → cancel | user_cancel / admin_cancel |
ioc: 전량 체결 | trade → done | — |
ioc: 부분 체결(잔량 자동 취소) | trade → done | tif_cancel |
ioc: 미체결(전량 즉시 취소) | cancel | tif_cancel |
fok: 전량 체결 | trade → done | — |
fok: 체결 불가(전량 즉시 취소) | cancel | tif_cancel |
post_only: Maker 등록 후 체결 | wait → trade → done | — |
post_only: Maker 등록 후 사용자 취소 | wait → cancel | user_cancel |
post_only: Taker 가격, 즉시 취소 | cancel | tif_cancel |
시장가(price / market): 체결 | trade → done | — |
best + ioc / fok | 위 ioc / fok 규칙과 동일 | 위 ioc / fok 규칙과 동일 |
| 자전거래 방지(STP): 모든 주문 유형 | cancel 또는 done | stp_cancel (+ canceling_order_id) |
Example
Request
[
{ "ticket": "test example" },
{ "type": "myOrder", "codes": ["KRW-BTC"] }
][
{ "ticket": "test example" },
{ "type": "myOrder", "codes": [] }
]Response
post_only 지정가 매수 주문 0.5 BTC @ 100,000,000원이 maker 가격으로 호가창에 등록된 직후의 메시지입니다. wait에는 공통 필드 외 추가 필드가 없습니다. IOC/FOK 주문은 wait 상태로 남지 않으므로 이 단계가 없습니다.
{
"type": "myOrder",
"stream_type": "REALTIME",
"code": "KRW-BTC",
"order_id": "C0101000000001820001",
"client_order_id": "my-order-003",
"side": "buy",
"order_type": "limit",
"state": "wait",
"time_in_force": "post_only",
"order_price": 100000000,
"order_quantity": 0.5,
"order_amount": 50000000,
"order_timestamp": 1735689600000,
"timestamp": 1735689600050
}{
"ty": "myOrder",
"st": "REALTIME",
"cd": "KRW-BTC",
"oid": "C0101000000001820001",
"coid": "my-order-003",
"sd": "buy",
"ot": "limit",
"s": "wait",
"tif": "post_only",
"op": 100000000,
"oq": 0.5,
"oa": 50000000,
"otms": 1735689600000,
"tms": 1735689600050
}IOC 주문 중 즉시 체결 가능한 0.3 BTC가 체결된 시점의 메시지입니다. 잔여 0.2는 다음 done 메시지에서 IOC 규칙에 따라 자동 취소 처리됩니다.
{
"type": "myOrder",
"stream_type": "REALTIME",
"code": "KRW-BTC",
"order_id": "C0101000000001818113",
"client_order_id": "my-order-001",
"side": "buy",
"order_type": "limit",
"state": "trade",
"time_in_force": "ioc",
"order_price": 100000000,
"order_quantity": 0.5,
"order_amount": 50000000,
"order_timestamp": 1735689600000,
"trade_id": "T0101000000099999999",
"trade_price": 100000000,
"trade_quantity": 0.3,
"trade_amount": 30000000,
"trade_timestamp": 1735689612345,
"executed_quantity": 0.3,
"remaining_quantity": 0.2,
"executed_amount": 30000000,
"paid_fee": 15000,
"remaining_fee": 10000,
"reserved_fee": 25000,
"timestamp": 1735689612400
}{
"ty": "myOrder",
"st": "REALTIME",
"cd": "KRW-BTC",
"oid": "C0101000000001818113",
"coid": "my-order-001",
"sd": "buy",
"ot": "limit",
"s": "trade",
"tif": "ioc",
"op": 100000000,
"oq": 0.5,
"oa": 50000000,
"otms": 1735689600000,
"tid": "T0101000000099999999",
"tp": 100000000,
"tq": 0.3,
"ta": 30000000,
"ttms": 1735689612345,
"eq": 0.3,
"rq": 0.2,
"ea": 30000000,
"pf": 15000,
"rmf": 10000,
"rsf": 25000,
"tms": 1735689612400
}IOC 주문이 부분 체결(0.3) 후 잔여 0.2가 IOC 규칙에 따라 자동 취소되며 주문이 종료된 시점의 메시지입니다. 주문 조건으로 완료된 것이므로 cancel_type이 tif_cancel로 설정됩니다. done 메시지에는 trade_*, 누적/수수료 필드가 포함되지 않습니다.
{
"type": "myOrder",
"stream_type": "REALTIME",
"code": "KRW-BTC",
"order_id": "C0101000000001818113",
"client_order_id": "my-order-001",
"side": "buy",
"order_type": "limit",
"state": "done",
"time_in_force": "ioc",
"order_price": 100000000,
"order_quantity": 0.5,
"order_amount": 50000000,
"order_timestamp": 1735689600000,
"cancel_type": "tif_cancel",
"timestamp": 1735689720000
}{
"ty": "myOrder",
"st": "REALTIME",
"cd": "KRW-BTC",
"oid": "C0101000000001818113",
"coid": "my-order-001",
"sd": "buy",
"ot": "limit",
"s": "done",
"tif": "ioc",
"op": 100000000,
"oq": 0.5,
"oa": 50000000,
"otms": 1735689600000,
"ct": "tif_cancel",
"tms": 1735689720000
}아래 예시는 별도의 일반 limit 매수 주문이 자전거래 방지(STP)로 취소된 경우입니다. canceling_order_id에는 충돌을 일으킨 상대 주문 ID가 들어갑니다. 일반 사용자 취소(user_cancel)인 경우 canceling_order_id 필드가 응답에 포함되지 않으며, 그 외 필드는 동일합니다.
{
"type": "myOrder",
"stream_type": "REALTIME",
"code": "KRW-BTC",
"order_id": "C0101000000001819234",
"client_order_id": "my-order-002",
"side": "buy",
"order_type": "limit",
"state": "cancel",
"order_price": 100000000,
"order_quantity": 0.5,
"order_amount": 50000000,
"order_timestamp": 1735689600000,
"cancel_type": "stp_cancel",
"canceling_order_id": "C0101000000001818112",
"timestamp": 1735689700000
}{
"ty": "myOrder",
"st": "REALTIME",
"cd": "KRW-BTC",
"oid": "C0101000000001819234",
"coid": "my-order-002",
"sd": "buy",
"ot": "limit",
"s": "cancel",
"op": 100000000,
"oq": 0.5,
"oa": 50000000,
"otms": 1735689600000,
"ct": "stp_cancel",
"cnoid": "C0101000000001818112",
"tms": 1735689700000
}