내 주문 및 체결 (MyOrder)

내 주문의 접수, 체결, 완료, 취소 이벤트를 실시간으로 수신합니다(Private v2).

요청한 마켓에서 발생한 내 주문의 접수, 체결, 처리 완료, 취소 이벤트를 실시간으로 수신합니다.

이 페이지는 Private v2 응답 스펙입니다. v1에서 옮겨오는 경우 Private v2 마이그레이션 가이드를 참고하세요. v1 엔드포인트는 2026년 11월 13일에 종료됩니다.

Request

요청은 ticket, type, format 필드로 구성됩니다. 처음이라면 다음 페이지를 함께 확인하세요:

Type Field

필드명타입설명필수기본값
typeString데이터 타입. myOrder 고정O—
codesList구독할 거래 페어 목록(대문자, 예: KRW-BTC)X생략 또는 빈 배열이면 전체 거래 페어 수신

Response

값이 없는 필드는 응답 JSON에서 생략됩니다.

공통 필드(모든 이벤트)

필드명SIMPLE타입설명
typetyString데이터 타입. myOrder 고정
stream_typestStringREALTIME 고정
codecdString거래 대상 페어(예: KRW-BTC)
order_idoidString서버 발급 주문 고유 ID
client_order_idcoidString주문 생성 시 사용자가 지정한 식별 ID
- 미지정 시 포함 x
sidesdString매수/매도 구분
- buy: 매수
- sell: 매도
order_typeotString주문 유형
- limit: 지정가
- price: 시장가 매수
- market: 시장가 매도
- best: 최유리
statesString주문 상태
- wait: 체결 대기
- trade: 체결 발생
- done: 주문 처리 완료
- cancel: 주문 취소
time_in_forcetifString주문 처리 조건. limit, best 주문에서만 사용
- ioc: 즉시 체결, 잔량 취소
- fok: 전량 체결 가능한 경우에만 체결, 그 외에는 전량 취소(부분 체결 없음)
- post_only: maker 주문으로만 호가창에 등록(taker 가격이면 즉시 취소)
order_priceopDouble사용자가 지정한 주문 가격
- 시장가(price, market), 최유리(best): 0
order_quantityoqDouble사용자가 지정한 주문 수량
- 시장가 매수(price), 최유리 매수(best + buy): 0
order_amountoaDouble주문 금액
- 지정가(limit): order_price × order_quantity
- 시장가 매수(price), 최유리 매수(best + buy): 사용자 입력 총 금액
- 시장가 매도(market), 최유리 매도(best + sell): 0
order_timestampotmsLong주문 생성 시각(ms)
timestamptmsLong메시지 송신 시각(ms)

주문 유형 및 처리 조건 참고

order_type: best(최유리): 원화 마켓 전용. 매수는 매도 1호가, 매도는 매수 1호가로 즉시 체결되는 주문입니다.

time_in_force: 주문 유형별 사용 가능 값

  • limit 주문: ioc / fok / post_only 중 하나(미설정 가능)
  • best 주문: ioc 또는 fok
  • price / market 주문: 사용하지 않음

체결 이벤트 추가 필드(state: trade)

체결이 발생한 경우에만 공통 필드와 함께 다음 필드가 추가됩니다.

필드명SIMPLE타입설명
trade_idtidString이번 체결 고유 ID
trade_pricetpDouble이번 체결가
trade_quantitytqDouble이번 체결 수량
trade_amounttaDouble이번 체결 금액(= trade_price × trade_quantity)
trade_timestampttmsLong이번 체결 시각(ms)
executed_quantityeqDouble누적 체결 수량
remaining_quantityrqDouble잔여 수량
executed_amounteaDouble누적 체결 금액(KRW: 소수점 0자리, 그 외: 소수점 8자리)
paid_feepfDouble해당 체결의 수수료
remaining_feermfDouble잔여 수수료
- 매도 주문은 0
reserved_feersfDouble예약 수수료
- 매도 주문은 0

취소 관련 필드

state: cancel에서는 항상 포함됩니다. state: done에서는 자전거래 방지/주문 조건(IOC/FOK 부분 체결의 잔량 취소 등)으로 완료된 경우 포함됩니다.

필드명SIMPLE타입설명
cancel_typectString취소 유형
- user_cancel: 사용자
- admin_cancel: 관리자
- stp_cancel: 자전거래 방지
- tif_cancel: 주문 조건
canceling_order_idcnoidString충돌을 일으킨 상대 주문의 ID
- cancel_type: stp_cancel일 때만 포함

이벤트 흐름

주문 처리 중 도착할 수 있는 state 값과 의미는 다음과 같습니다. 기본 흐름은 wait → trade → done이지만, 주문 유형 및 조건(time_in_force)에 따라 일부 단계가 생략될 수 있습니다(아래 시나리오 참고). 시장가 주문도 동일한 state 값을 사용합니다.

순서state의미추가로 채워지는 필드
1wait주문 접수—
2trade체결 발생 (체결 건수만큼 반복)trade_*, 누적/수수료 필드
3adone주문 처리 완료자전거래 / IOC·FOK 조건으로 완료 시 cancel_type
3bcancel주문 취소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 → canceluser_cancel / admin_cancel
ioc: 전량 체결trade → done—
ioc: 부분 체결(잔량 자동 취소)trade → donetif_cancel
ioc: 미체결(전량 즉시 취소)canceltif_cancel
fok: 전량 체결trade → done—
fok: 체결 불가(전량 즉시 취소)canceltif_cancel
post_only: Maker 등록 후 체결wait → trade → done—
post_only: Maker 등록 후 사용자 취소wait → canceluser_cancel
post_only: Taker 가격, 즉시 취소canceltif_cancel
시장가(price / market): 체결trade → done—
best + ioc / fok위 ioc / fok 규칙과 동일위 ioc / fok 규칙과 동일
자전거래 방지(STP): 모든 주문 유형cancel 또는 donestp_cancel (+ canceling_order_id)

Example

Request

[
  { "ticket": "test example" },
  { "type": "myOrder", "codes": ["KRW-BTC"] }
]

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
}