---
updatedAt: 2026-11-13T10:58:46.000Z
agentTools:
  projectIndex: https://apidocs.bithumb.com/llms.txt
---

# 내 주문 및 체결 (MyOrder)

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

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

<Callout icon="fa-circle-info" theme="info">
  이 페이지는 **Private v2** 응답 스펙입니다. v1에서 옮겨오는 경우 [Private v2 마이그레이션 가이드](https://apidocs.bithumb.com/reference/private-v2-마이그레이션-가이드)를 참고하세요. **v1 엔드포인트는 추후 종료 예정입니다.** 종료 일정 변경에 대한 자세한 내용은 [Private WebSocket v1 지원 종료 일정 연기 안내](https://apidocs.bithumb.com/changelog/%EC%9D%BC%EC%A0%95-%EB%B3%80%EA%B2%BD-private-websocket-v1-%EC%A7%80%EC%9B%90-%EC%A2%85%EB%A3%8C-%EC%9D%BC%EC%A0%95-%EC%97%B0%EA%B8%B0-%EC%95%88%EB%82%B4) 공지를 확인하세요.
</Callout>

# Request

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

* [기본 정보](https://apidocs.bithumb.com/reference/기본-정보): WebSocket 엔드포인트, Rate limit
* [요청 방법 및 포맷](https://apidocs.bithumb.com/reference/요청-포맷): 인증 방법, 요청 필드 상세
* [연결 관리](https://apidocs.bithumb.com/reference/연결-관리): 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<br />- 미지정 시 포함 x                                                                                                                                       |
| `side`            | `sd`   | String | 매수/매도 구분<br />- `buy`: 매수<br />- `sell`: 매도                                                                                                                                    |
| `order_type`      | `ot`   | String | 주문 유형<br />- `limit`: 지정가<br />- `price`: 시장가 매수<br />- `market`: 시장가 매도<br />- `best`: 최유리                                                                                    |
| `state`           | `s`    | String | 주문 상태<br />- `wait`: 체결 대기<br />- `trade`: 체결 발생<br />- `done`: 주문 처리 완료<br />- `cancel`: 주문 취소                                                                                |
| `time_in_force`   | `tif`  | String | 주문 처리 조건. `limit`, `best` 주문에서만 사용<br />- `ioc`: 즉시 체결, 잔량 취소<br />- `fok`: 전량 체결 가능한 경우에만 체결, 그 외에는 전량 취소(부분 체결 없음)<br />- `post_only`: maker 주문으로만 호가창에 등록(taker 가격이면 즉시 취소) |
| `order_price`     | `op`   | Double | 사용자가 지정한 주문 가격<br />- 시장가(`price`, `market`), 최유리(`best`): `0`                                                                                                                 |
| `order_quantity`  | `oq`   | Double | 사용자가 지정한 주문 수량<br />- 시장가 매수(`price`), 최유리 매수(`best + buy`): `0`                                                                                                               |
| `order_amount`    | `oa`   | Double | 주문 금액<br />- 지정가(`limit`): `order_price × order_quantity`<br />- 시장가 매수(`price`), 최유리 매수(`best + buy`): 사용자 입력 총 금액<br />- 시장가 매도(`market`), 최유리 매도(`best + sell`): `0`        |
| `order_timestamp` | `otms` | Long   | 주문 생성 시각(ms)                                                                                                                                                                   |
| `timestamp`       | `tms`  | Long   | 메시지 송신 시각(ms)                                                                                                                                                                  |

### 주문 유형 및 처리 조건 참고

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

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

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

### 체결 이벤트 추가 필드(`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 | 잔여 수수료<br />- 매도 주문은 `0`                   |
| `reserved_fee`       | `rsf`  | Double | 예약 수수료<br />- 매도 주문은 `0`                   |

### 취소 관련 필드

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

| 필드명                  | SIMPLE  | 타입     | 설명                                                                                                                 |
| -------------------- | ------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| `cancel_type`        | `ct`    | String | 취소 유형<br />- `user_cancel`: 사용자<br />- `admin_cancel`: 관리자<br />- `stp_cancel`: 자전거래 방지<br />- `tif_cancel`: 주문 조건 |
| `canceling_order_id` | `cnoid` | String | 충돌을 일으킨 **상대 주문**의 ID<br />- `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

<Tabs>
  <Tab title="특정 마켓 구독">
    ```json
    [
      { "ticket": "test example" },
      { "type": "myOrder", "codes": ["KRW-BTC"] }
    ]
    ```
  </Tab>

  <Tab title="전체 마켓 구독">
    ```json
    [
      { "ticket": "test example" },
      { "type": "myOrder", "codes": [] }
    ]
    ```
  </Tab>
</Tabs>

### Response

<Tabs>
  <Tab title="wait(주문 접수)">
    `post_only` 지정가 매수 주문 0.5 BTC @ 100,000,000원이 maker 가격으로 호가창에 등록된 직후의 메시지입니다. `wait`에는 공통 필드 외 추가 필드가 없습니다. IOC/FOK 주문은 `wait` 상태로 남지 않으므로 이 단계가 없습니다.

    <Tabs>
      <Tab title="DEFAULT">
        ```json
        {
          "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
        }
        ```
      </Tab>

      <Tab title="SIMPLE">
        ```json
        {
          "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
        }
        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="trade(체결 발생)">
    IOC 주문 중 즉시 체결 가능한 0.3 BTC가 체결된 시점의 메시지입니다. 잔여 0.2는 다음 `done` 메시지에서 IOC 규칙에 따라 자동 취소 처리됩니다.

    <Tabs>
      <Tab title="DEFAULT">
        ```json
        {
          "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
        }
        ```
      </Tab>

      <Tab title="SIMPLE">
        ```json
        {
          "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
        }
        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="done(주문 처리 완료)">
    IOC 주문이 부분 체결(0.3) 후 잔여 0.2가 IOC 규칙에 따라 자동 취소되며 주문이 종료된 시점의 메시지입니다. 주문 조건으로 완료된 것이므로 `cancel_type`이 `tif_cancel`로 설정됩니다. `done` 메시지에는 `trade_*`, 누적/수수료 필드가 포함되지 않습니다.

    <Tabs>
      <Tab title="DEFAULT">
        ```json
        {
          "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
        }
        ```
      </Tab>

      <Tab title="SIMPLE">
        ```json
        {
          "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
        }
        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="cancel(주문 취소)">
    아래 예시는 별도의 일반 limit 매수 주문이 자전거래 방지(STP)로 취소된 경우입니다. `canceling_order_id`에는 충돌을 일으킨 상대 주문 ID가 들어갑니다. 일반 사용자 취소(`user_cancel`)인 경우 `canceling_order_id` 필드가 응답에 포함되지 않으며, 그 외 필드는 동일합니다.

    <Tabs>
      <Tab title="DEFAULT">
        ```json
        {
          "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
        }
        ```
      </Tab>

      <Tab title="SIMPLE">
        ```json
        {
          "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
        }
        ```
      </Tab>
    </Tabs>
  </Tab>
</Tabs>