> For the complete documentation index, see [llms.txt](https://docs.fiinquant.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fiinquant.vn/ham-va-cong-thuc/7.-ham-dat-lenh/7.2.-thong-tin-tai-khoan.md).

# 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               |
