# 3.1. Báo cáo tài chính

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
fs_dict = client.FundamentalAnalysis().get_financial_statement(
    tickers=tickers,
    statement=statement,
    years=years,
    quarters=quarters,
    audited=True,
    type=type,
    fields=fields
)
```

**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ó       |
| statement   | Loại báo cáo tài chính, là 1 trong 3 giá trị ‘balancesheet’, ‘incomestatement’, ‘cashflow’, hoặc ‘full’ là lấy hết. Nếu muốn lấy nhiều loại báo cáo tài chính thì liệt kê list các loại ra.                                                                                   | str           |          | Có       |
| years       | Năm của kỳ báo cáo, có thể chọn nhiều năm bằng cách liệt kê list các năm ra                                                                                                                                                                                                   | list\[int]    |          | Có       |
| quarters    | Quý của kỳ báo cáo, nếu không truyền mặc định lấy báo cáo tài chính của năm dựa trên tham số year, có thể chọn nhiều quý bằng cách liệt kê list các quý ra                                                                                                                    | list\[int]    | None     | Không    |
| audited     | Kiểm toán hay chưa (True là đã kiểm toán, False là chưa kiểm toán).                                                                                                                                                                                                           | bool          |          | Có       |
| type        | 1 trong 2 giá trị (‘consolidated’ hoặc ‘separate’). 'consolidated' là báo cáo tài chính hợp nhất, 'separate' là báo cáo tài chính công ty mẹ                                                                                                                                  | str           |          | Có       |
| fields      | Trường dữ liệu cần lấy (không truyền sẽ lấy hết). Biến fields có thể truyền theo dạng đường dẫn phân cấp cách nhau bằng dấu chấm ('Assets'.'CurrentAssets' – Lấy phần Tài sản ngắn hạn trong báo cáo tài chính) hoặc truyền thẳng sections là node cần lấy ('CurrentAssets'). | str           | None     | Không    |

Class nhận dữ liệu là FundamentalAnalysis và có phương thức nhận dữ liệu là get\_financial\_statement()

```python
### pseudocode
import json

fs_dict = client.FundamentalAnalysis().get_financial_statement(
    tickers=tickers,
    statement="balancesheet",
    years=[2024],
    quarters=[4],
    audited=True,
    type="consolidated"
)

print(json.dumps(fs_dict, indent=4))
```

* Ví dụ lấy dữ liệu full bảng cân đối kế toán của báo cáo tài chính hợp nhất đã kiểm toán quý 4 năm 2024 của mã HPG&#x20;

```python
import json

from FiinQuantX import FiinSession

username = 'REPLACE_WITH_YOUR_USER_NAME'
password = 'REPLACE_WITH_YOUR_PASS_WORD'

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

tickers = ['HPG']

fs_dict = client.FundamentalAnalysis().get_financial_statement(
    tickers=tickers,
    statement="balancesheet",
    years=[2024],
    quarters=[4],
    audited=True,
    type="consolidated"
)

print(json.dumps(fs_dict, indent=4))
```

Kết quả trả ra đầy đủ sẽ có cấu trúc ở phần [mau-du-lieu-bctc-hop-nhat](https://docs.fiinquant.vn/huong-dan-python/cau-truc-du-lieu-mau/mau-du-lieu-bctc-hop-nhat "mention")

* Ví dụ lấy dữ liệu các chỉ tiêu thuộc phần TỔNG TÀI SẢN thuộc bảng cân đối kế toán của báo cáo tài chính hợp nhất đã kiểm toán quý 4 năm 2024 của mã HPG

```python
import json

from FiinQuantX import FiinSession

username = 'REPLACE_WITH_YOUR_USER_NAME'
password = 'REPLACE_WITH_YOUR_PASS_WORD'

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

tickers = ['HPG']

fs_dict = client.FundamentalAnalysis().get_financial_statement(
    tickers=tickers,
    statement="balancesheet",
    years=[2024],
    quarters=[4],
    audited=True,
    type="consolidated",
    fields=["Assets"]
)

print(json.dumps(fs_dict, indent=4))
```

Kết quả trả ra:

```json
[
    {
        "ticker": "HPG",
        "year": 2024,
        "quarter": 4,
        "reportType": "consolidated",
        "audited": true,
        "assets": {
            "totalAssets": 224489707553981,
            "currentAssets": {
                "shortTermInvestments": {
                    "totalShortTermInvestments": 18974716730905,
                    "tradingSecurities": 0,
                    "heldToMaturityInvestments": 18974716730905,
                    "provisionForTradingSecurities": 0
                },
                "shortTermReceivables": {
                    "tradeReceivables": 4352135419872,
                    "shortTermInternalReceivables": 0,
                    "receivablesUnderConstructionContracts": 0,
                    "advancesToSuppliers": 2118824427004,
                    "allowanceForDoubtfulReceivables": -159993736285,
                    "pendingAssetsShortage": 379714580,
                    "shortTermLoans": 87461616439,
                    "otherReceivables": 1248992845378,
                    "totalShortTermReceivables": 7647800286988
                },
                "inventories": {
                    "allowanceForImpairment": -101069892341,
                    "inventories": 46192292081813,
                    "totalInventories": 46091222189472
                },
                "totalCurrentAssets": 86674276272995,
                "cashAndCashEquivalents": {
                    "totalCashAndCashEquivalents": 6887646139852,
                    "cashEquivalents": 3968114193944,
                    "cash": 2919531945908
                },
                "otherCurrentAssets": {
                    "taxAndOrderReceivables": 10074967536,
                    "other": 0,
                    "governmentBondRepurchaseAgreement": 0,
                    "prepayments": 426149499088,
                    "totalOtherCurrentAssets": 7072890925778,
                    "deductibleValueAddedTax": 6636666459154
                }
            },
            "longTermAssets": {
                "otherLongTermAssets": {
                    "other": 0,
                    "deferredTaxAssets": 254671208385,
                    "prepayments": 4269141694868,
                    "longTermSparePartsAndEquipment": 429422385383,
                    "totalOtherLongTermAssets": 5016848415359,
                    "goodWill": 63613126723
                },
                "totalLongTermAssets": 137815431280986,
                "longTermAssetsInProgress": {
                    "constructionInProgress": 63655857440382,
                    "totalLongTermAssetsInProgress": 63750717325406,
                    "longTermWorkInProgress": 94859885024
                },
                "longTermInvestments": {
                    "provisionForLongTermInvestments": 0,
                    "heldToMaturityInvestments": 136500000000,
                    "totalLongTermInvestments": 136500000000,
                    "equityInvestmentsInOthers": 0,
                    "investmentsInSubsidiaries": 0,
                    "investmentsInJointVentures": 0
                },
                "fixedAssets": {
                    "intangibleFixedAssets": {
                        "cost": 367057604707,
                        "totalIntangibleFixedAssets": 184215978466,
                        "accumulatedAmortisation": -182841626241
                    },
                    "financeLeaseFixedAssets": {
                        "cost": 0,
                        "totalFinanceLeaseFixedAssets": 0,
                        "accumulatedDepreciation": 0
                    },
                    "totalFixedAssets": 67428366953514,
                    "tangibleFixedAssets": {
                        "cost": 108146566348954,
                        "totalTangibleFixedAssets": 67244150975048,
                        "accumulatedDepreciation": -40902415373906
                    }
                },
                "longTermReceivables": {
                    "longTermCustomerReceivables": 0,
                    "longTermAdvancesToSuppliers": 82805287792,
                    "capitalAtAffiliatedUnits": 0,
                    "otherLongTermReceivables": 840594835822,
                    "provisionForDoubtfulLongTermReceivables": 0,
                    "longTermIntercompanyReceivables": 0,
                    "longTermLoanReceivables": 0,
                    "totalLongTermReceivables": 923400123614
                },
                "investmentProperty": {
                    "cost": 860549015615,
                    "accumulatedDepreciation": -300950552522,
                    "totalInvestmentProperty": 559598463093
                }
            }
        },
        "companyType": "MANUFACTURING"
    }
]
```

* Ví dụ lấy dữ liệu các chỉ tiêu thuộc phần TÀI SẢN NGẮN HẠN nằm trong phần TỔNG TÀI SẢN thuộc bảng cân đối kế toán của báo cáo tài chính hợp nhất đã kiểm toán quý 4 năm 2024 của mã HPG

```python
import json

from FiinQuantX import FiinSession

username = 'REPLACE_WITH_YOUR_USER_NAME'
password = 'REPLACE_WITH_YOUR_PASS_WORD'

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

tickers = ['HPG']

fs_dict = client.FundamentalAnalysis().get_financial_statement(
    tickers=tickers,
    statement="balancesheet",
    years=[2024],
    quarters=[4],
    audited=True,
    type="consolidated",
    fields=["CurrentAssets"]
)

print(json.dumps(fs_dict, indent=4))
```

```json
[
    {
        "ticker": "HPG",
        "year": 2024,
        "quarter": 4,
        "reportType": "consolidated",
        "audited": true,
        "currentAssets": {
            "shortTermInvestments": {
                "totalShortTermInvestments": 18974716730905,
                "tradingSecurities": 0,
                "heldToMaturityInvestments": 18974716730905,
                "provisionForTradingSecurities": 0
            },
            "shortTermReceivables": {
                "tradeReceivables": 4352135419872,
                "shortTermInternalReceivables": 0,
                "receivablesUnderConstructionContracts": 0,
                "advancesToSuppliers": 2118824427004,
                "allowanceForDoubtfulReceivables": -159993736285,
                "pendingAssetsShortage": 379714580,
                "shortTermLoans": 87461616439,
                "otherReceivables": 1248992845378,
                "totalShortTermReceivables": 7647800286988
            },
            "inventories": {
                "allowanceForImpairment": -101069892341,
                "inventories": 46192292081813,
                "totalInventories": 46091222189472
            },
            "totalCurrentAssets": 86674276272995,
            "cashAndCashEquivalents": {
                "totalCashAndCashEquivalents": 6887646139852,
                "cashEquivalents": 3968114193944,
                "cash": 2919531945908
            },
            "otherCurrentAssets": {
                "taxAndOrderReceivables": 10074967536,
                "other": 0,
                "governmentBondRepurchaseAgreement": 0,
                "prepayments": 426149499088,
                "totalOtherCurrentAssets": 7072890925778,
                "deductibleValueAddedTax": 6636666459154
            }
        },
        "companyType": "MANUFACTURING"
    }
]
```

* Ví dụ lấy dữ liệu chỉ tiêu PHẢI THU KHÁCH HÀNG thuộc bảng cân đối kế toán của báo cáo tài chính hợp nhất đã kiểm toán quý 4 năm 2024 của mã HPG

```python
import json

from FiinQuantX import FiinSession

username = 'REPLACE_WITH_YOUR_USER_NAME'
password = 'REPLACE_WITH_YOUR_PASS_WORD'

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

tickers = ['HPG']

fs_dict = client.FundamentalAnalysis().get_financial_statement(
    tickers=tickers,
    statement="balancesheet",
    years=[2024],
    quarters=[4],
    audited=True,
    type="consolidated",
    fields=["tradeReceivables"]
)

print(json.dumps(fs_dict, indent=4))
```

```json
[
    {
        "ticker": "HPG",
        "year": 2024,
        "quarter": 4,
        "reportType": "consolidated",
        "audited": true,
        "tradeReceivables": 4352135419872,
        "companyType": "MANUFACTURING"
    }
]
```
