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

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

<table><thead><tr><th width="244">Tên thuộc tính</th><th>Mô tả</th><th>Kiểu dữ liệu</th></tr></thead><tbody><tr><td>ticker</td><td>Tên mã.</td><td>str</td></tr><tr><td>timestamp</td><td>Thời gian giao dịch</td><td>str</td></tr><tr><td>localIndividualNetMatchVolume</td><td>Khối lượng cá nhân trong nước khớp ròng</td><td>int</td></tr><tr><td>institutionalNetMatchVolume</td><td>Khối lượng tổ chức khớp ròng</td><td>int</td></tr><tr><td>proprietaryTotalMatchNetTradeVolume</td><td>Khối lượng tự doanh khớp ròng</td><td>int</td></tr><tr><td>foreignNetVolumeMatched</td><td>Khối lượng nhà đầu tư nước ngoài khớp ròng</td><td>int</td></tr><tr><td>localIndividualNetMatchValue</td><td>Giá trị cá nhân trong nước khớp ròng</td><td>int</td></tr><tr><td>institutionalNetMatchValue</td><td>Giá trị tổ chức khớp ròng</td><td>int</td></tr><tr><td>proprietaryTotalMatchNetTradeValue</td><td>Giá trị tự doanh khớp ròng</td><td>int</td></tr><tr><td>foreignNetValueMatched</td><td>Giá trị nhà đầu tư nước ngoài khớp ròng</td><td>int</td></tr><tr><td>openInterest</td><td>Số hợp đồng mở</td><td>int</td></tr></tbody></table>

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>
