0
# Mutual Funds
1
2
The Fund class provides comprehensive access to Vietnamese mutual fund data including fund listings, portfolio holdings, NAV history, and asset allocation analysis through the Fmarket data source.
3
4
## Capabilities
5
6
### Fund Class
7
8
Comprehensive mutual fund data access with portfolio analysis capabilities.
9
10
```python { .api }
11
class Fund:
12
"""
13
Mutual fund data adapter for Vietnamese fund market.
14
15
Data source: FMARKET
16
"""
17
18
def __init__(self, random_agent: bool = False) -> None:
19
"""
20
Initialize Fund data adapter.
21
22
Args:
23
random_agent (bool): Use random user agent, defaults to False
24
"""
25
26
# Instance attributes (populated after initialization)
27
fund_list: list
28
"""List of available fund short names."""
29
30
details: FundDetails
31
"""Instance of FundDetails class for symbol-based operations."""
32
```
33
34
### Fund Directory and Filtering
35
36
Fund listing and discovery capabilities with type-based filtering.
37
38
```python { .api }
39
def listing(self, fund_type: str = "") -> pd.DataFrame:
40
"""
41
Get all available mutual funds with optional type filtering.
42
43
Args:
44
fund_type (str): Fund type filter ("", "BALANCED", "BOND", "STOCK")
45
46
Returns:
47
pd.DataFrame: Fund listing with basic information
48
"""
49
50
def filter(self, symbol: str = "") -> pd.DataFrame:
51
"""
52
Filter funds by short name pattern.
53
54
Args:
55
symbol (str): Fund short name or pattern
56
57
Returns:
58
pd.DataFrame: Filtered fund results
59
"""
60
```
61
62
### Portfolio Analysis
63
64
Detailed fund portfolio composition and holdings analysis.
65
66
```python { .api }
67
def top_holding(self, fundId: int = 23) -> pd.DataFrame:
68
"""
69
Get top 10 holdings of specified fund.
70
71
Args:
72
fundId (int): Fund ID, defaults to 23
73
74
Returns:
75
pd.DataFrame: Top holdings with allocation percentages
76
"""
77
78
def industry_holding(self, fundId: int = 23) -> pd.DataFrame:
79
"""
80
Get industry distribution of fund portfolio.
81
82
Args:
83
fundId (int): Fund ID, defaults to 23
84
85
Returns:
86
pd.DataFrame: Industry allocation breakdown
87
"""
88
89
def asset_holding(self, fundId: int = 23) -> pd.DataFrame:
90
"""
91
Get asset allocation of fund portfolio.
92
93
Args:
94
fundId (int): Fund ID, defaults to 23
95
96
Returns:
97
pd.DataFrame: Asset class allocation breakdown
98
"""
99
```
100
101
### Performance Data
102
103
Fund performance metrics and NAV history tracking.
104
105
```python { .api }
106
def nav_report(self, fundId: int = 23) -> pd.DataFrame:
107
"""
108
Get daily NAV (Net Asset Value) history.
109
110
Args:
111
fundId (int): Fund ID, defaults to 23
112
113
Returns:
114
pd.DataFrame: Historical NAV data with dates and values
115
"""
116
```
117
118
### FundDetails Class
119
120
Symbol-based fund operations for detailed analysis.
121
122
```python { .api }
123
class FundDetails:
124
"""Fund details operations using fund symbols."""
125
126
def top_holding(self, symbol: str = "SSISCA") -> pd.DataFrame:
127
"""Get top holdings by fund symbol."""
128
129
def industry_holding(self, symbol: str = "SSISCA") -> pd.DataFrame:
130
"""Get industry distribution by fund symbol."""
131
132
def nav_report(self, symbol: str = "SSISCA") -> pd.DataFrame:
133
"""Get NAV report by fund symbol."""
134
135
def asset_holding(self, symbol: str = "SSISCA") -> pd.DataFrame:
136
"""Get asset allocation by fund symbol."""
137
```
138
139
## Usage Examples
140
141
```python
142
from vnstock import Fund
143
144
# Initialize fund adapter
145
fund = Fund()
146
147
# Get all available funds
148
all_funds = fund.listing()
149
150
# Get stock funds only
151
stock_funds = fund.listing(fund_type="STOCK")
152
153
# Get specific fund details
154
fund_holdings = fund.top_holding(fundId=23)
155
fund_industries = fund.industry_holding(fundId=23)
156
fund_nav = fund.nav_report(fundId=23)
157
158
# Use fund details by symbol
159
details = fund.details
160
ssisca_holdings = details.top_holding(symbol="SSISCA")
161
ssisca_nav = details.nav_report(symbol="SSISCA")
162
163
# Get fund list for reference
164
available_funds = fund.fund_list
165
print(f"Available funds: {len(available_funds)}")
166
```