# 7.1. Đăng nhập

Đăng nhập connector thông qua fiinquant.

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

**Tham số:**

| Tham số    | Kiểu dữ liệu | Bắt buộc | Mô tả                                                                                                                                                  |
| ---------- | ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| broker     | str          | Có       | Tên của sàn giao dịch mà bạn muốn kết nối. Ví dụ: 'DNSE' (hiện FiinQuant mới hỗ trợ kết nối đến sàn giao dịch DNSE).                                   |
| username   | str          | Có       | Tên đăng nhập tài khoản giao dịch của bạn tại sàn.                                                                                                     |
| password   | str          | Có       | Mật khẩu đăng nhập tài khoản giao dịch của bạn tại sàn.                                                                                                |
| smart\_otp | bool         | Không    | Cờ (flag) chỉ định có sử dụng **Smart OTP** để xác thực đăng nhập. True thì lấy OTP qua app, False thì lấy qua mail. Chỉ cần nhập 1 lần trong 8 tiếng. |

Sau khi thực hiện bước này, ở máy user sẽ xuất hiện file dạng **“trading\_token…...json”**. File này dùng để chương trình đọc và thực thi các bước đặt lệnh mà không cần lấy lại otp. Trading\_token có hiệu lực trong khoảng 8 tiếng, nếu hết hạn hệ thống sẽ yêu cầu nhập lại otp. User nên tuyệt đối giữ bí mật file này.

Các hàm từ đây sẽ trả ra object, user có thể truy cập đến thuộc tính của các object đó, hoặc gọi hàm **summary()** để lấy ra ra một số thông tin cơ bản.


---

# 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.1.-dang-nhap.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.
