# 7.2. Thông tin tài khoản

### 7.2.1. **Thông tin tài khoản chính**

```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()

account_info = client_order.get_account_info()
print(account_info.summary())
```

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

```json
{
    'id': '0001006289',
    'investor_id': '0001006289',
    'name': 'DANG THANH THUY',
    'error': None,
    'status_code': 200
}
```

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

| Tên thuộc tính | Kiểu dữ liệu  | Mô tả                                                              |
| -------------- | ------------- | ------------------------------------------------------------------ |
| id             | str           | Mã định danh duy nhất của tài khoản (có thể là id hoặc accountId). |
| investor\_id   | str           | Mã định danh của nhà đầu tư.                                       |
| name           | str           | Họ và tên đầy đủ của nhà đầu tư hoặc chủ tài khoản.                |
| error          | str hoặc None | Thông báo lỗi (nếu có) từ phản hồi của API. Không có lỗi thì None. |
| status\_code   | int           | Mã code, nếu thành công là 200                                     |

### 7.2.2. **Thông tin tiểu khoản**

```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()

sub_accounts = client_order.get_sub_accounts()
for account in sub_accounts.accounts:
    print(account.summary())
print(sub_accounts.default.id) # phương thức lấy tiểu khoản mặc định
```

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

```json
{
    'id': '0001177757',
    'investor_id': '0001006289',
    'custody_code': '064C500006',
    'derivative_account': False,
    'derivative_status': None,
    'status_code': 200
}
{
    'id': '0001009212',
    'investor_id': '0001006289',
    'custody_code': '064C500006',
    'derivative_account': True,
    'derivative_status': 'ACTIVE',
    'status_code': 200
}
```

Mô tả object:

* BaseSubAccount (Abstract class, không phải Base là cơ sở)

| Tên thuộc tính      | Kiểu dữ liệu  | Mô tả                                                  |
| ------------------- | ------------- | ------------------------------------------------------ |
| id                  | str           | Mã định danh của tiểu khoản.                           |
| custody\_code       | str           | Mã lưu ký chứng khoán của nhà đầu tư.                  |
| investor\_id        | str           | Mã định danh của nhà đầu tư.                           |
| derivative\_account | bool          | Cho biết đây có phải là tài khoản phái sinh hay không. |
| derivative\_status  | str hoặc None | Trạng thái của tài khoản phái sinh (nếu có).           |

* BaseSubAccountInfo(chứa các BaseSubAccount)

| Tên thuộc tính | Kiểu dữ liệu          | Mô tả                                        |
| -------------- | --------------------- | -------------------------------------------- |
| default        | BaseSubAccount        | Tài khoản mặc định được chọn của nhà đầu tư. |
| accounts       | List\[BaseSubAccount] | Danh sách tiểu khoản                         |
| error          | str hoặc None         | Thông tin lỗi (nếu có).                      |
| 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.2.-thong-tin-tai-khoan.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.
