# 1.8. Lấy dữ liệu giao dịch theo nhà đầu tư

Mô tả cách sử dụng thư viện sau khi người dùng đã đăng nhập. Các ví dụ chi tiết được nêu ra ở cuối chương này.

```python
data = client.PriceStatistics().get_value_by_investor(
    tickers=tickers,
    from_date=from_date,
    to_date=to_date
)
```

**Tham số:**

| Tên tham số | Mô tả                               | Kiểu dữ liệu  | Mặc định       | Bắt buộc |
| ----------- | ----------------------------------- | ------------- | -------------- | -------- |
| tickers     | Danh sách mã được viết in hoa.      | str hoặc list |                | Có       |
| from\_date  | Mốc thời gian lấy dữ liệu xa nhất.  | str           |                | Có       |
| to\_date    | Mốc thời gian lấy dữ liệu gần nhất. | str           | datetime.now() | Không    |

Class nhận dữ liệu là PriceStatistics và có phương thức nhận dữ liệu là get\_value\_by\_investor()

```python
data = client.PriceStatistics().get_value_by_investor(
    tickers=tickers,
    from_date="2025-10-01",
    to_date="2025-10-08"
)

print(data)
```

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

| Tên thuộc tính                             | Mô tả                                        | Kiểu dữ liệu |
| ------------------------------------------ | -------------------------------------------- | ------------ |
| ticker                                     | Tên mã.                                      | str          |
| timestamp                                  | Thời gian giao dịch                          | str          |
| totalTrade                                 | Tổng số lệnh giao dịch                       | int          |
| totalBuyTrade                              | Tổng số lệnh mua                             | int          |
| totalSellTrade                             | Tổng số lệnh bán                             | int          |
| totalBuyTradeVolume                        | Tổng khối lượng mua                          | int          |
| totalSellTradeVolume                       | Tổng khối lượng bán                          | int          |
| foreignBuyVolumeMatched                    | KL mua khớp lệnh của NĐT nước ngoài          | int          |
| foreignBuyValueMatched                     | Giá trị mua khớp lệnh của NĐT nước ngoài     | int          |
| foreignSellVolumeMatched                   | KL bán khớp lệnh của NĐT nước ngoài          | int          |
| foreignSellValueMatched                    | Giá trị bán khớp lệnh của NĐT nước ngoài     | int          |
| foreignBuyVolumeDeal                       | KL mua thỏa thuận của NĐT nước ngoài         | int          |
| foreignBuyValueDeal                        | Giá trị mua thỏa thuận của NĐT nước ngoài    | int          |
| foreignSellVolumeDeal                      | KL bán thỏa thuận của NĐT nước ngoài         | int          |
| foreignSellValueDeal                       | Giá trị bán thỏa thuận của NĐT nước ngoài    | int          |
| foreignIndividualBuyTradingMatchValue      | Giá trị mua khớp lệnh của cá nhân nước ngoài | int          |
| foreignInstitutionalBuyTradingMatchValue   | Giá trị mua khớp lệnh của tổ chức nước ngoài | int          |
| foreignIndividualSellTradingMatchValue     | Giá trị bán khớp lệnh của cá nhân nước ngoài | int          |
| foreignInstitutionalSellTradingMatchValue  | Giá trị bán khớp lệnh của tổ chức nước ngoài | int          |
| foreignIndividualBuyTradingMatchVolume     | KL mua khớp lệnh của cá nhân nước ngoài      | int          |
| foreignInstitutionalBuyTradingMatchVolume  | KL mua khớp lệnh của tổ chức nước ngoài      | int          |
| foreignIndividualSellTradingMatchVolume    | KL bán khớp lệnh của cá nhân nước ngoài      | int          |
| foreignInstitutionalSellTradingMatchVolume | KL bán khớp lệnh của tổ chức nước ngoài      | int          |
| localIndividualBuyValue                    | Giá trị mua của cá nhân trong nước           | int          |
| localIndividualBuyVolume                   | KL mua của cá nhân trong nước                | int          |
| localIndividualSellVolume                  | KL bán của cá nhân trong nước                | int          |
| localIndividualSellValue                   | Giá trị bán của cá nhân trong nước           | int          |
| localInstitutionalBuyVolume                | KL mua của tổ chức trong nước                | int          |
| localInstitutionalBuyValue                 | Giá trị mua của tổ chức trong nước           | int          |
| localInstitutionalSellVolume               | KL bán của tổ chức trong nước                | int          |
| localInstitutionalSellValue                | Giá trị bán của tổ chức trong nước           | int          |
| localIndividualBuyMatchVolume              | KL mua khớp lệnh của cá nhân trong nước      | int          |
| localIndividualBuyMatchValue               | Giá trị mua khớp lệnh của cá nhân trong nước | int          |
| localIndividualSellMatchVolume             | KL bán khớp lệnh của cá nhân trong nước      | int          |
| localIndividualSellMatchValue              | Giá trị bán khớp lệnh của cá nhân trong nước | int          |
| localIndividualSellMatchValue              | Giá trị bán khớp lệnh của cá nhân trong nước | int          |
| localInstitutionalBuyMatchVolume           | KL mua khớp lệnh của tổ chức trong nước      | int          |
| localInstitutionalBuyMatchValue            | Giá trị mua khớp lệnh của tổ chức trong nước | int          |
| localInstitutionalSellMatchVolume          | KL bán khớp lệnh của tổ chức trong nước      | int          |
| localInstitutionalSellMatchValue           | Giá trị bán khớp lệnh của tổ chức trong nước | int          |
| proprietaryTotalMatchBuyTradeVolume        | KL mua khớp lệnh của tự doanh                | int          |
| proprietaryTotalMatchBuyTradeValue         | Giá trị mua khớp lệnh của tự doanh           | int          |
| proprietaryTotalMatchSellTradeValue        | Giá trị bán khớp lệnh của tự doanh           | int          |
| proprietaryTotalMatchSellTradeVolume       | KL bán khớp lệnh của tự doanh                | int          |
| proprietaryTotalBuyTradeVolume             | Tổng KL mua của tự doanh                     | int          |
| proprietaryTotalBuyTradeValue              | Tổng giá trị mua của tự doanh                | int          |
| proprietaryTotalSellTradeValue             | Tổng giá trị bán của tự doanh                | int          |
| proprietaryTotalSellTradeVolume            | Tổng KL bán của tự doanh                     | int          |
| proprietaryTotalDealBuyTradeVolume         | KL mua thỏa thuận của tự doanh               | int          |
| proprietaryTotalDealBuyTradeValue          | Giá trị mua thỏa thuận của tự doanh          | int          |
| proprietaryTotalDealSellTradeValue         | Giá trị bán thỏa thuận của tự doanh          | int          |
| proprietaryTotalDealSellTradeVolume        | KL bán thỏa thuận của tự doanh               | int          |
| openInterest                               | Số hợp đồng mở                               | int          |

Ví dụ:

<pre class="language-python"><code class="lang-python">from FiinQuantX import FiinSession
<strong>
</strong>username = 'REPLACE_WITH_YOUR_USER_NAME'
password = 'REPLACE_WITH_YOUR_PASS_WORD'

client = FiinSession(username=username, password=password).login()

tickers = ["HPG", "MWG"]

data = client.PriceStatistics().get_value_by_investor(
    tickers=tickers,
    from_date="2025-10-01",
    to_date="2025-10-08"
)
print(data)
</code></pre>


---

# 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/1.-danh-muc-and-thong-tin-co-ban/1.8.-lay-du-lieu-giao-dich-theo-nha-dau-tu.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.
