Financial statements¶
VietFin provides access to financial statements as quarterly or annual.
Financial statement functions are grouped under the vf.equity.fundamental class.
The typical financial statements consist of three endpoints:
Balance Sheet:
vf.equity.fundamental.balance()Income Statement:
vf.equity.fundamental.income()Cash Flow Statement:
vf.equity.fundamental.cash()
The main parameters are:
symbol: The company’s ticker symbol.period: ‘annual’ or ‘quarter’. Default is ‘annual’.
However:
Every data provider has their own way of parsing and organizing the three financial statements.
Items within each statement will vary by source.
Names of line items will also vary by source.
This example will try to highlight how different providers have different labels and values for a company’s facts.
[1]:
from vietfin import vf
import pandas as pd
compare = pd.DataFrame()
# Collect all of the line item "total assets" in Balance Sheet of company "ACB" from provider "tcbs"
tcbs = vf.equity.fundamental.balance(symbol="acb", period="annual", provider="tcbs").to_df()
tcbs = tcbs.query('items.str.contains("TOTAL ASSETS", case=False)')
tcbs = tcbs.set_index("fiscal_year")
compare["tcbs"] = tcbs["values"]
# Do similar thing with "ssi" as provider
ssi = vf.equity.fundamental.balance(symbol="acb", period="annual", provider="ssi").to_df()
ssi = ssi.query('items.str.contains("TOTAL ASSETS", case=False)')
ssi['fiscal_period'] = ssi['fiscal_period'].astype(int)
ssi = ssi.set_index("fiscal_period")
compare["ssi"] = ssi["values"]
compare.head(5)
Retrieved 748 data point for balancesheet, of stock ticker ACB.
Retrieved 1 records for equity.search() from SSI.
Retrieved 1056 data point for BalanceSheet, of stock ticker ACB.
[1]:
| tcbs | ssi | |
|---|---|---|
| fiscal_year | ||
| 2023 | 718795.0 | 7.187946e+14 |
| 2022 | 607875.0 | 6.078752e+14 |
| 2021 | 527770.0 | 5.277699e+14 |
| 2020 | 444530.0 | 4.445301e+14 |
| 2019 | 383514.0 | 3.835144e+14 |
Next, let’s see how each provider organize the line items in the financial statement for each fiscal period.
[2]:
# Collect all the line items in Balance Sheet of company "ACB" for fiscal_year 2022 from provider "tcbs"
tcbs = vf.equity.fundamental.balance(symbol="acb", period="annual", provider="tcbs").to_df()
tcbs = tcbs.query('fiscal_year == 2022').reset_index(drop=True)
tcbs.head(5)
Retrieved 748 data point for balancesheet, of stock ticker ACB.
[2]:
| fiscal_year | fiscal_quarter | period | items | values | symbol | |
|---|---|---|---|---|---|---|
| 0 | 2022 | 5 | annual | shortAsset | NaN | ACB |
| 1 | 2022 | 5 | annual | cash and cash equivalents | 8461.0 | ACB |
| 2 | 2022 | 5 | annual | shortInvest | NaN | ACB |
| 3 | 2022 | 5 | annual | shortReceivable | NaN | ACB |
| 4 | 2022 | 5 | annual | inventory | NaN | ACB |
[3]:
# Collect all of the line items in Balance Sheet of company "ACB" for fiscal_year 2022 from provider "ssi"
ssi = vf.equity.fundamental.balance(symbol="acb", period="annual", provider="ssi").to_df()
ssi['fiscal_period'] = ssi['fiscal_period'].astype(int)
ssi = ssi.query('fiscal_period == 2022').reset_index(drop=True)
ssi.head(5)
Retrieved 1 records for equity.search() from SSI.
Retrieved 1056 data point for BalanceSheet, of stock ticker ACB.
[3]:
| fiscal_period | period | items | values | |
|---|---|---|---|---|
| 0 | 2022 | annual | TOTAL ASSETS | 6.078752e+14 |
| 1 | 2022 | annual | Cash and precious metals | 8.460892e+12 |
| 2 | 2022 | annual | Balances with the SBV | 1.365753e+13 |
| 3 | 2022 | annual | Placements & loan to credit institutions | 8.597131e+13 |
| 4 | 2022 | annual | Trading securities, net | 1.131327e+12 |