# 11. Lấy danh sách deals

* **URL:**
  * PROD: <https://services.entrade.com.vn/entrade-api/derivative/deals>
  * PAPERTRADE: <https://services.entrade.com.vn/papertrade-entrade-api/derivative/deals>
* **Method:** `GET`
* **Description:** Lấy danh sách deals
* **Parameters: None**
* **Query parameters:**
  * `investorAccountId`: tiểu khoản
  * `_start`: index lấy deal đầu tiên
  * `_end`: index lấy deal cuối cùng
  * `_sort`: field dùng để sort
  * `_order`: thứ tự
* **Response:**

```
{
    "data": [
        {
            "id": 1000546,
            "bankId": 10000,
            "bankAccountId": 1000040,
            "investorId": 1000000036,
            "investorAccountId": 1000000036,
            "bankMarginPortfolioId": 34,
            "symbol": "VN30F2512",
            "side": "NB",
            "positionCostPrice": 1908.0,
            "stockClosePrice": 1922.9,
            "averageCostPrice": 1908.0,
            "averageClosedPrice": 0.0,
            "adjustedCostPrice": 1908.2815096,
            "openQuantity": 1,
            "closedQuantity": 0,
            "initialQuantity": 1,
            "type": "DERIVATIVE",
            "currentMarginRate": 0.057332,
            "cash": 0.0,
            "cashSecure": 0.0,
            "receivable": 0.0,
            "loan": 4.5792E7,
            "secure": 9540000.0,
            "additionalSecure": 0.0,
            "interest": 52202.88,
            "totalDebt": 1.908E8,
            "tradingFeeAmount": 10750.0,
            "marginExcessAmount": 1398896.16,
            "marginCallAmount": 0.0,
            "sellingTaxAmount": 0.0,
            "moneyAdvanceFeeAmount": 0.0,
            "moneyAdvanceAmount": 0.0,
            "stockBorrowFee": 0.0,
            "positionRealizedProfit": 0.0,
            "lastRealizedProfit": 0.0,
            "positionUnrealizedProfit": 1490000.0,
            "receivedQuantity": 0,
            "positionType": 1,
            "createdDate": "2025-11-25T10:21:34.146Z",
            "modifiedDate": "2025-11-28T03:36:04.377Z",
            "investorSettlementAmount": 0.0,
            "bankSettlementAmount": 0.0,
            "sourDebtPayment": 0.0,
            "tradingTaxAmount": 0.0,
            "closedPositionFeeAmount": 0.0,
            "netProfit": 1398896.16,
            "unrealizedTotalTaxAndFee": 28150.96,
            "status": "ACTIVE",
            "assetManagementOvernightFeeAmount": 0.0,
            "unrealizedTradingTaxFactor": 0.0,
            "accumulatedSecure": 9540000.0,
            "breakEvenPrice": 1908.911038,
            "collectedInterestAndFee": 0.0,
            "releasedSecureAndProfit": 0.0,
            "dailyReleasedSecureAndProfit": 0.0,
            "dailyReleasedNetProfit": 0.0,
            "totalInterestAndFeeWithoutClosingTax": 91103.84,
            "orderIds": [
                1110900
            ],
            "totalInterestAndFee": 62952.88,
            "coInvestTax": 0.0,
            "fixedNetProfit": -62952.88,
            "overdueInterestRate": 0.0,
            "dailyStockBorrowFee": 0.0,
            "companySecureRate": 0.24,
            "closedPositionFee": 3.8E-4,
            "moneyAdvanceRate": 0.0,
            "assetManagementOvernightFee": 0.0,
            "overnightRate": 0.05,
            "sellingTaxRate": 0.0,
            "bankSecureRate": 0.24,
            "vsdSecureRate": 0.17,
            "tradingTaxRate": 0.0,
            "coInvestTaxRate": 0.05,
            "settled": false,
            "remainingTradeableQuantity": 1,
            "marginStatus": "NORMAL",
            "totalFee": 62952.88,
            "netProfitRate": 0.146635,
            "initialMarginRate": 0.05,
            "interestRate": 3.8E-4,
            "tradingFeeRate": 10750.0,
            "marginRate": 0.95,
            "maintenanceRate": 0.04,
            "additionalRate": 0.05,
            "liquidateMarginRate": 0.03,
            "closed": false,
            "state": "OPEN"
        }
    ],
    "total": 1,
    "start": 0,
    "end": 1
}
```

* **Mô tả (các field quan trọng):**
  * `id`: id của deal
  * `investorId`: investorId của Khác Hàng
  * `investorAccountId`: id của tiểu khoản
  * `bankMarginPortfolioId`: id gói vay
  * `secure`: cọc còn lại của deal
  * `symbol`: mã Phái sinh
  * `side`
    * NB: Long
    * NS: Short
  * `averageCostPrice`: giá mở trung bình
  * `positionCostPrice`: giá mở trung bình open quantity
  * `breakEvenPrice`: giá hoà vốn
  * `openQuantity`: khối lượng mở
  * `closedQuantity`: khối lượng đã đóng
  * `netProfit`: lãi phần đóng (đã trừ thuế phí nếu có)
  * `collectedInterestAndFee`: tổng phí thuế phần đã đóng
  * `unrealizedTotalTaxAndFee`: phí thuế phần mở


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hdsd2.entrade.com.vn/entrade-api/11.-lay-danh-sach-deals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
