# 7.3. Thông tin gói vay (nguồn tiền)

### 7.3.1. Gói vay thường

```python
username_dnse = 'REPLACE_WITH_YOUR_DNSE_USERNAME'
password_dnse = 'REPLACE_WITH_YOUR_DNSE_PASSWORD'

client_order = client.FiinQuantConnector(
    broker='DNSE',
    username=username_dnse,
    password=password_dnse,
    smart_otp=True
).login()

loan_packages = client_order.get_loan_packages(account_id='0001009212')
for i in loan_packages:
    print(i.summary())
```

Mẫu kết quả trả ra là một dictionary chứa các thông tin sau:

```json
{
    'id': 7905,
    'type': 'M',
    'initial_rate': 0.5,
    'maintenance_rate': 0.4,
    'interest_rate': 0.12,
    'preferential_interest_rate': 0.12,
    'allow_extend': True,
    'allow_early_payment': True,
    'buy_fee': 0.0007,
    'sell_fee': 0.0007,
    'tickers': ['ACB', 'BCC', 'BID', 'BVS',
                'CTG', 'FPT', 'GEX', 'HPG',
                'LPB', 'MBB', 'MBS', 'POW',
                'PVC', 'SHS', 'SSI', 'TCB',
                'VCB', 'VND', 'VPB'],
    'error': None,
    'status_code': 200,
    'num_tickers': 19
}
```

Dữ liệu có các thuộc tính:

* BaseLoanPackage

| Tên thuộc tính               | Kiểu dữ liệu  | Mô tả                                                                                         |
| ---------------------------- | ------------- | --------------------------------------------------------------------------------------------- |
| id                           | str           | Mã định danh gói vay.                                                                         |
| type                         | str           | Loại gói vay: M = Margin (ký quỹ), N = Normal (thông thường).                                 |
| initial\_rate                | float         | Tỷ lệ vay ban đầu (Initial Rate).                                                             |
| maintenance\_rate            | float         | Tỷ lệ duy trì (Maintenance Rate). Nếu giá trị tài sản thấp hơn mức này, có thể bị gọi ký quỹ. |
| interest\_rate               | float         | Lãi suất vay ký quỹ (%/năm).                                                                  |
| preferential\_interest\_rate | float         | Lãi suất ưu đãi trong giai đoạn khuyến mãi.                                                   |
| allow\_extend                | bool          | Cho phép gia hạn thời hạn vay hay không.                                                      |
| allow\_early\_payment        | bool          | Cho phép tất toán trước hạn hay không.                                                        |
| buy\_fee                     | float         | Phí giao dịch mua do công ty chứng khoán quy định.                                            |
| sell\_fee                    | float         | Phí giao dịch bán do công ty chứng khoán quy định.                                            |
| tickers                      | list hoặc str | Danh sách mã chứng khoán được phép áp dụng gói vay.                                           |
| error                        | str hoặc None | Thông tin lỗi (nếu có) khi lấy dữ liệu gói vay.                                               |
| status\_code                 | int           | Mã code, nếu thành công là 200                                                                |

### 7.3.1. Gói vay phái sinh

```python
username_dnse = 'REPLACE_WITH_YOUR_DNSE_USERNAME'
password_dnse = 'REPLACE_WITH_YOUR_DNSE_PASSWORD'

client_order = client.FiinQuantConnector(
    broker='DNSE',
    username=username_dnse,
    password=password_dnse,
    smart_otp=True
).login()

der_loans = client_order.get_derivative_loan_packages(account_id='0001009212')
for i in der_loans:
    print(i.summary())
```

Mẫu kết quả trả ra là một dictionary chứa các thông tin sau:

```json
{
    'id': 2278,
    'initial_rate': 0.1848,
    'maintenance_rate': 0.1771,
    'liquid_rate': 0.1731,
    'trading_fee': 500.0,
    'trading_fee_daily_close': 500.0,
    'symbol_types': ['V100F1M', 'V100F2M', 'VN30F1M',
                     'VN30F1Q', 'VN30F2M', 'VN30F2Q'],
    'error': None,
    'num_symbol_types': 6,
    'status_code': 200
}
```

Dữ liệu có các thuộc tính:

* Class BaseDerivativeLoanPackage

| Tên thuộc tính             | Kiểu dữ liệu  | Mô tả                                                                          |
| -------------------------- | ------------- | ------------------------------------------------------------------------------ |
| id                         | str           | Mã định danh của gói vay phái sinh.                                            |
| error                      | str hoặc None | Thông tin lỗi (nếu có) khi lấy dữ liệu.                                        |
| initial\_rate              | float         | Tỷ lệ ký quỹ ban đầu (Initial Margin Rate).                                    |
| maintenance\_rate          | float         | Tỷ lệ duy trì ký quỹ (Maintenance Margin Rate).                                |
| liquid\_rate               | float         | Tỷ lệ xử lý (Liquidation Margin Rate) — mức yêu cầu đóng vị thế bắt buộc.      |
| trading\_fee               | float         | Phí giao dịch cố định cho mỗi lần giao dịch.                                   |
| trading\_fee\_daily\_close | float         | Phí giao dịch cố định hàng ngày.                                               |
| ticker\_types              | list hoặc str | Danh sách loại hợp đồng phái sinh được áp dụng (ví dụ: VN30F1M, VN30F2M, ...). |
| status\_code               | int           | Mã code, nếu thành công là 200                                                 |


---

# 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://docs.fiinquant.vn/ham-va-cong-thuc/7.-ham-dat-lenh/7.3.-thong-tin-goi-vay-nguon-tien.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.
