> For the complete documentation index, see [llms.txt](https://hdsd2.entrade.com.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hdsd2.entrade.com.vn/entrade-api/7.-dat-lenh.md).

# 7. Đặt lệnh

* **URL:**
  * PROD: <https://services.entrade.com.vn/entrade-api/derivative/orders>
  * PAPERTRADE: <https://services.entrade.com.vn/papertrade-entrade-api/derivative/orders>
* **Method:** `POST`
* **Description:** Lấy sức mua qmax
* **Parameters: None**
* **Query parameters: None**
* **Request body:**

```
{
  "bankMarginPortfolioId": 34,
  "investorId": 1000000036,
  "symbol": "VN30F2512",
  "price": 1920.9,
  "orderType": "LO",
  "side": "NB",
  "quantity": 1
}
```

* **Mô tả:**
  * `bankMarginPortfolioId`: id gói vay
  * `investorId`: investorId của khách hàng
  * `symbol`: mã Phái Sinh
  * `price`: giá
  * `orderType`: LO/MTL/ATC/ATO/MAK/MOK
  * `side`
    * NB: Long
    * NS: Short
  * `quantity`: khối lượng
* **Response:**

```
{
    "id": 1110910,
    "side": "NB",
    "investorId": 1000000036,
    "investorAccountId": 1000000036,
    "bankId": 10000,
    "bankAccountId": 1000040,
    "symbol": "VN30F2512",
    "price": 1920.9,
    "quantity": 1,
    "orderType": "LO",
    "orderStatus": "PendingNew",
    "fillQuantity": 0,
    "lastQuantity": 0,
    "lastPrice": 0.0,
    "averagePrice": 0.0,
    "createdDate": "2025-11-27T07:48:43.911Z",
    "modifiedDate": "2025-11-27T07:48:43.911Z",
    "bankMarginPortfolioId": 34,
    "dealId": 0,
    "tradingFee": 0.0,
    "tradingTax": 0.0,
    "orderSecure": 9604500.0,
    "priceSecure": 1920.9,
    "marginRate": 0.05,
    "quantitySecure": 1,
    "leavesQuantity": 0,
    "maker": "0013000000",
    "version": 1,
    "type": "DERIVATIVE",
    "fillValue": 0.0
}
```

* **Mô tả các field quan trọng:**
  * `id`: id của lệnh đặt
  * `side`
    * `NB`: Long
    * `NS`: Short
  * `orderStatus`: trạng thái lệnh đặt
  * `quantity`: KL lệnh
  * `fillQuantity`: KL khớp
  * `lastQuantity`: KL khớp cuối cùng
  * `averagePrice`: giá trung bình khớp của lệnh
  * `bankMarginPortfolioId`: gói vay của lệnh
  * `price`: giá đặt lệnh
  * `lastPrice`: giá khớp cuối cùng
