> For the complete documentation index, see [llms.txt](https://hdsd.dnse.com.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hdsd.dnse.com.vn/san-pham-dich-vu/lightspeed-api-truoc-krx/ii.-trading-api/6.-lenh-dieu-kien/6.1.-dat-lenh-dieu-kien.md).

# 6.1. Đặt lệnh điều kiện

<table data-header-hidden><thead><tr><th width="222"></th><th></th></tr></thead><tbody><tr><td><strong>url</strong></td><td><code>https://services.dnse.com.vn/conditional-order-api/v1/orders</code></td></tr><tr><td><strong>method</strong></td><td>POST</td></tr><tr><td><strong>header</strong></td><td>Authorization: Bearer &#x3C;token></td></tr><tr><td><strong>param</strong></td><td> </td></tr><tr><td><strong>request body</strong></td><td><p><code>{</code> <br>   <code>"condition": "price &#x3C;= 26650",</code>   <br>   <code>"targetOrder": {</code> <br>      <code>"quantity": 100,</code> <br>      <code>"side": "NB",</code> <br>      <code>"price": 26600,</code> <br>      <code>"loanPackageId": 1531,</code> <br>      <code>"orderType": "LO"</code><br>    <code>},</code> <br>    <code>"symbol": "HPG",</code> <br>    <code>"props": {</code> <br>      <code>"stopPrice": 26650,</code> <br>      <code>"marketId": "UNDERLYING"</code> <br>    <code>},</code> <br>    <code>"accountNo": "0001000006",</code> <br>    <code>"category": "STOP",</code> <br>    <code>"timeInForce": {</code> <br>         <code>"expireTime": "2024-10-23T07:30:00.000Z",</code>   </p><p>         <code>"kind": "GTD"</code><br>    <code>}</code> <br><code>}</code></p></td></tr><tr><td><strong>success response body</strong></td><td><code>{</code> <br>    <code>"id": "csc7iqa45sbpqutqm81g"</code><br><code>}</code></td></tr><tr><td><strong>error response body</strong></td><td><code>{</code> <br>    <code>"message":</code> <br>    <code>"Invalid signature"</code> <br><code>}</code></td></tr></tbody></table>

**Request body**

| **Field**                 | **Type** | **Description**                                                                                             |
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------- |
| condition                 | String   | <p>Điều kiện đặt<br>price >= stopPrice<br>price <= stopPrice</p>                                            |
| targetOrder               | Object   |                                                                                                             |
| targetOrder.quantity      | Double   | Khối lượng đặt                                                                                              |
| targetOrder.side          | String   | Lệnh mua: NB, Lệnh bán:NS                                                                                   |
| targetOrder.price         | Doble    | Giá đặt, đơn vị đồng                                                                                        |
| targetOrder.loanPackageId | Integer  | Mã gói vay, lấy gói vay muốn đặt từ api danh sách gói vay                                                   |
| targetOrder.orderType     | String   | <p>Loại lệnh, thuộc các giá trị sau:</p><ul><li>LO: lệnh giới hạn</li><li>MP/MTL: lệnh thị trường</li></ul> |
| symbol                    | String   | Mã                                                                                                          |
| props                     | Object   |                                                                                                             |
| props.stopPrice           | Double   | Giá trigger lệnh điều kiện                                                                                  |
| props.marketId            | String   | <p>lệnh cơ sở: UNDERLYING<br>Lệnh phái sinh: DERIVATIVES</p>                                                |
| accountNo                 | String   | Mã tiểu khoản                                                                                               |
| category                  | String   | STOP                                                                                                        |
| timeInForce               | Object   |                                                                                                             |
| timeInForce.expireTime    | String   | Thời gian hết hạn lệnh                                                                                      |
| timeInForce.kind          | String   | Loại : GTD                                                                                                  |

**Response body**

| Field | Type   | Description           |
| ----- | ------ | --------------------- |
| id    | String | id của lệnh điều kiện |
