1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
|
%global _empty_manifest_terminate_build 0
Name: python-thepassiveinvestor
Version: 1.2.1
Release: 1
Summary: Passive Investing for the Average Joe.
License: MIT
URL: https://github.com/JerBouma/ThePassiveInvestor
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3f/5c/661f84070dcd3e07548bf79477c23b7826393198b5e9e7eca4bdbaaf6762/thepassiveinvestor-1.2.1.tar.gz
BuildArch: noarch
Requires: python3-pandas
Requires: python3-yahooquery
Requires: python3-openpyxl
%description
# The Passive Investor
[](https://www.buymeacoffee.com/jerbouma)
[](https://github.com/JerBouma/ThePassiveInvestor/issues)
[](https://github.com/JerBouma/ThePassiveInvestor/pulls)
[](https://pypi.org/project/ThePassiveInvestor/)
[](https://pypi.org/project/ThePassiveInvestor/)
Theories and research about the stock market have stated that the semi-strong form of market efficiency seems to hold. This means that all public information is accurately reflected in the price of a financial instrument. This makes the job of a portfolio manager primarily managing the desired risk appetite of the client and not explicitly trying to outperform the market. This fact in combination with Finance professionals all around the world looking for that 'edge' to make their investment decisions as profitable as possible, makes it so the average joe can not compete.
Therefore, the term 'Passive Investing' is often coined around. This refers to buying funds (either ETFs or Mutual Funds) that follow the index (i.e. S&P 500, Dow Jones Index) or a broad market (Developed Markets, MSCI World) for diversification benefits. This means that a sudden decrease in performance of one stock within the index does not (on average) lead to a significant decline in the index as a whole. This allows the holder to spend limited time monitoring his holdings, therefore the term 'Passive'.
With a large increase in ETFs available (over 5,000 in 2020), it can become difficult to make the best choice in what you wish to invest. There are many different providers (iShares, Vanguard, Invesco) as well as with changes to the underlying stocks (i.e. High Yield, Super Dividends, Equal Weighted). This is quickly reflected when looking for a S&P 500 ETF as there are over 20 different ETFs available. With this package, I wish to make investment decisions easier to make and manage.
An example of the output can be found in the GIF below. This depicts several ETFs collected from [the Top ETFs according to Yahoo Finance](https://finance.yahoo.com/etfs).

## Installation
The package can be installed via the following commands:
1. `pip install thepassiveinvestor`
- Alternatively, download this repository.
1. (within Python) `import thepassiveinvestor as pi`
The functions within this package are:
- `collect_data(ticker)` - collects the most important data for ETFs as listed in the [Functionality](#Functionality)
section.
- `create_ETF_report(tickers, filename, folder=None)` - uses collect_data to create an Excel report with data, as
depicted in the GIF above, per sheet for each ticker.
Therefore, if you wish to collect data on an ETF or create a report of a selection of ETFs you can use the following
example:
```python
import thepassiveinvestor as pi
# Collect data from a specific ETF
vanguard_sp500 = pi.collect_data('VOO')
# Show the data
vanguard_sp500
```
Which returns the following:
```
{'long_name': 'Vanguard 500 Index Fund', 'summary': "The fund employs an indexing investment approach designed to track the performance of the Standard & Poor's 500 Index, a widely recognized benchmark of U.S. stock market performance that is dominated by the stocks of large U.S. companies. The advisor attempts to replicate the target index by investing all, or substantially all, of its assets in the stocks that make up the index, holding each stock in approximately the same proportion as its weighting in the index.", 'image_URL': 'https://s.yimg.com/lq/i/fi/3_0stylelargeeq2.gif', 'sector_holdings': {'realestate': '2.75%', 'consumer_cyclical': '10.13%', 'basic_materials': '2.4%', 'consumer_defensive': '7.38%', 'technology': '23.65%', 'communication_services': '7.43%', 'financial_services': '13.7%', 'utilities': '2.43%', 'industrials': '8.82%', 'energy': '5.11%', 'healthcare': '15.27%'}, 'company_holdings': {'Apple Inc': '5.92%', 'Microsoft Corp': '5.62%', 'Amazon.com Inc': '4.06%', 'Facebook Inc Class A': '2.29%', 'Alphabet Inc Class A': '2.02%', 'Alphabet Inc Class C': '1.97%', 'Berkshire Hathaway Inc Class B': '1.44%', 'Tesla Inc': '1.44%', 'NVIDIA Corp': '1.37%', 'JPMorgan Chase & Co': '1.3%'}, 'annual_returns': {'2022': '-18.15%', '2021': '28.66%', '2020': '18.35%', '2019': '31.46%', '2018': '-4.42%', '2017': '21.78%'}, 'risk_data': {'5y': {'year': '5y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 0.89, 'rSquared': 100, 'stdDev': 18.69, 'sharpeRatio': -0.19, 'treynorRatio': 8.04}, '3y': {'year': '3y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 0.8, 'rSquared': 100, 'stdDev': 21.17, 'sharpeRatio': -0.55, 'treynorRatio': 6.76}, '10y': {'year': '10y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 1.08, 'rSquared': 100, 'stdDev': 14.78, 'sharpeRatio': 0.88, 'treynorRatio': 11.7}}, 'key_characteristics': {'fundInceptionDate': '2010-09-07', 'category': 'Large Blend', 'totalAssets': 744769716224, 'currency': 'USD', 'navPrice': 366.24, 'previousClose': 365.67}}
```
You also have the option to generate a comparison report as follows:
```python
import thepassiveinvestor as pi
# Collect data from a set of ETFs and compare them
etf_comparison = pi.collect_data(['VOO', 'QQQ', 'ARKG', 'VUG', 'SCHA', 'VWO'], comparison=True)
# Show the comparison
etf_comparison
```
Which returns the following:
| | VOO | QQQ | ARKG | VUG | SCHA | VWO |
|:----------------------------------------------|:-------------|:-------------|:-----------|:-------------|:------------|:--------------------------|
| ('sector_holdings', 'realestate') | 2.75% | 0.29% | 0% | 2.55% | 7.16% | 2.95% |
| ('sector_holdings', 'consumer_cyclical') | 10.13% | 14.2% | 0% | 18.09% | 12.75% | 12.92% |
| ('sector_holdings', 'basic_materials') | 2.4% | 0% | 0% | 2.01% | 4.35% | 9.34% |
| ('sector_holdings', 'consumer_defensive') | 7.38% | 6.67% | 0% | 2.92% | 4.12% | 6.23% |
| ('sector_holdings', 'technology') | 23.65% | 47.62% | 3.41% | 41.19% | 14.18% | 15.49% |
| ('sector_holdings', 'communication_services') | 7.43% | 15.99% | 0% | 11.96% | 2.74% | 8.72% |
| ('sector_holdings', 'financial_services') | 13.7% | 0.74% | 0% | 6.95% | 15.68% | 20.63% |
| ('sector_holdings', 'utilities') | 2.43% | 0.88% | 0% | 0% | 1.83% | 3.78% |
| ('sector_holdings', 'industrials') | 8.82% | 4.75% | 0% | 4.64% | 16.16% | 7.26% |
| ('sector_holdings', 'energy') | 5.11% | 0.49% | 0% | 1.35% | 5.85% | 5.36% |
| ('sector_holdings', 'healthcare') | 15.27% | 7.54% | 96.58% | 8.13% | 13.98% | 4.6% |
| ('annual_returns', '2022') | -18.15% | -32.49% | -53.94% | -33.13% | -19.8% | -17.72% |
| ('annual_returns', '2021') | 28.66% | 27.24% | -33.89% | 27.26% | 16.35% | 0.96% |
| ('annual_returns', '2020') | 18.35% | 48.6% | 180.51% | 40.16% | 19.35% | 15.32% |
| ('annual_returns', '2019') | 31.46% | 39.12% | 43.75% | 37.26% | 26.54% | 20.4% |
| ('annual_returns', '2018') | -4.42% | -0.14% | 0.59% | -3.32% | -11.75% | -14.57% |
| ('annual_returns', '2017') | 21.78% | 32.7% | 45.41% | 27.8% | 15.04% | 31.38% |
| ('key_characteristics', 'fundInceptionDate') | 2010-09-07 | 1999-03-10 | 2014-10-31 | 2004-01-26 | 2009-11-03 | 2005-03-04 |
| ('key_characteristics', 'category') | Large Blend | Large Growth | Health | Large Growth | Small Blend | Diversified Emerging Mkts |
| ('key_characteristics', 'totalAssets') | 744769716224 | 145931501568 | 1899108352 | 132303921152 | 13327223808 | 93044613120 |
| ('key_characteristics', 'currency') | USD | USD | USD | USD | USD | USD |
| ('key_characteristics', 'navPrice') | 366.24 | 281.03 | 32.79 | 225.08 | 43.42 | 41.9 |
| ('key_characteristics', 'previousClose') | 365.67 | 281.54 | 33.43 | 225.66 | 43.41 | 41.92 |
| ('risk_data_3y', 'year') | 3y | 3y | 3y | 3y | 3y | 3y |
| ('risk_data_3y', 'alpha') | -0.04 | 0.76 | -4.62 | -1.7 | -3.72 | -1.28 |
| ('risk_data_3y', 'beta') | 1 | 1.08 | 1.32 | 1.11 | 1.15 | 0.9 |
| ('risk_data_3y', 'meanAnnualReturn') | 0.8 | 0.92 | 0.25 | 0.74 | 0.6 | 0.05 |
| ('risk_data_3y', 'rSquared') | 100 | 87.57 | 41.82 | 90.79 | 82.66 | 76.68 |
| ('risk_data_3y', 'stdDev') | 21.17 | 24.49 | 41.28 | 24.6 | 26.8 | 20.04 |
| ('risk_data_3y', 'sharpeRatio') | -0.55 | -0.7 | 0.27 | -0.72 | 1.58 | 2 |
| ('risk_data_3y', 'treynorRatio') | 6.76 | 7.04 | -4.51 | 4.7 | 2.44 | -2.53 |
| ('risk_data_5y', 'year') | 5y | 5y | 5y | 5y | 5y | 5y |
| ('risk_data_5y', 'alpha') | -0.04 | 2.15 | 2.44 | -0.2 | -5.06 | -0.93 |
| ('risk_data_5y', 'beta') | 1 | 1.1 | 1.5 | 1.1 | 1.16 | 0.94 |
| ('risk_data_5y', 'meanAnnualReturn') | 0.89 | 1.16 | 0.98 | 0.96 | 0.6 | 0.11 |
| ('risk_data_5y', 'rSquared') | 100 | 88.49 | 45.66 | 91.7 | 83.48 | 78.97 |
| ('risk_data_5y', 'stdDev') | 18.69 | 21.85 | 39.32 | 21.4 | 23.73 | 18.27 |
| ('risk_data_5y', 'sharpeRatio') | -0.19 | -0.44 | -0.12 | -0.3 | 1.77 | 1.58 |
| ('risk_data_5y', 'treynorRatio') | 8.04 | 9.81 | 1.98 | 7.55 | 2.69 | -1.74 |
| ('risk_data_10y', 'year') | 10y | 10y | 10y | 10y | 10y | 10y |
| ('risk_data_10y', 'alpha') | -0.04 | 2.46 | 0 | -0.51 | -4.08 | -1.79 |
| ('risk_data_10y', 'beta') | 1 | 1.1 | 0 | 1.08 | 1.16 | 0.98 |
| ('risk_data_10y', 'meanAnnualReturn') | 1.08 | 1.39 | 0 | 1.13 | 0.9 | 0.24 |
| ('risk_data_10y', 'rSquared') | 100 | 85.33 | 0 | 91.48 | 80.44 | 75.61 |
| ('risk_data_10y', 'stdDev') | 14.78 | 17.56 | 0 | 16.76 | 19.06 | 16.38 |
| ('risk_data_10y', 'sharpeRatio') | 0.88 | 0.39 | 0 | 0.78 | 2.92 | 1.44 |
| ('risk_data_10y', 'treynorRatio') | 11.7 | 14.01 | 0 | 11.05 | 7.38 | 0.79 |
Lastly, if you wish to export to Excel this is also a possibility generating an Excel file that contains the most relevant information for each ticker.
```python
import thepassiveinvestor as pi
# Create a report from a list of ETFs
etf_list = ['VOO', 'QQQ', 'ARKG', 'VUG', 'SCHA', 'VWO']
pi.create_ETF_report(etf_list, 'Popular ETFs.xlsx')
```
Which returns the following:
<img width="1512" alt="Screenshot 2023-01-19 at 13 26 48" src="https://user-images.githubusercontent.com/46355364/213443231-ee125c24-3c70-4978-87fd-783c57eacbf2.png">
## Functionality
The package outputs an overview of each fund on a separate sheet. In this overview the following data is shown:
| Topic | Contains |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| General | The title of the fund and a summary about the fund's purpose and goal. |
| Characteristics | Inception date (the start of the fund), the category, assets under management (AUM), the denominated currency, net asset value (NAV), the latest close price and the Morningstar Style Box (if available). |
| Holdings | Sector holdings (% in each sector) and company holdings (top 10 companies with highest %). |
| Risk Metrics | All metrics are displayed in an interval of 3, 5 and 10 years. This includes Jensen's Alpha, Beta, Mean Annual Return, R-squared, Standard Deviation, Sharpe Ratio and Treynor Ratio. |
| Performance | The last five annual returns of the fund as wel as a graph depicting the adjusted close prices over the last 10 years. The actual data for this graph is available on a hidden sheet. |
## Contribution
Projects are bound to have (small) errors and can always be improved. Therefore, I highly encourage you to submit issues and create pull requests to improve the package.
%package -n python3-thepassiveinvestor
Summary: Passive Investing for the Average Joe.
Provides: python-thepassiveinvestor
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-thepassiveinvestor
# The Passive Investor
[](https://www.buymeacoffee.com/jerbouma)
[](https://github.com/JerBouma/ThePassiveInvestor/issues)
[](https://github.com/JerBouma/ThePassiveInvestor/pulls)
[](https://pypi.org/project/ThePassiveInvestor/)
[](https://pypi.org/project/ThePassiveInvestor/)
Theories and research about the stock market have stated that the semi-strong form of market efficiency seems to hold. This means that all public information is accurately reflected in the price of a financial instrument. This makes the job of a portfolio manager primarily managing the desired risk appetite of the client and not explicitly trying to outperform the market. This fact in combination with Finance professionals all around the world looking for that 'edge' to make their investment decisions as profitable as possible, makes it so the average joe can not compete.
Therefore, the term 'Passive Investing' is often coined around. This refers to buying funds (either ETFs or Mutual Funds) that follow the index (i.e. S&P 500, Dow Jones Index) or a broad market (Developed Markets, MSCI World) for diversification benefits. This means that a sudden decrease in performance of one stock within the index does not (on average) lead to a significant decline in the index as a whole. This allows the holder to spend limited time monitoring his holdings, therefore the term 'Passive'.
With a large increase in ETFs available (over 5,000 in 2020), it can become difficult to make the best choice in what you wish to invest. There are many different providers (iShares, Vanguard, Invesco) as well as with changes to the underlying stocks (i.e. High Yield, Super Dividends, Equal Weighted). This is quickly reflected when looking for a S&P 500 ETF as there are over 20 different ETFs available. With this package, I wish to make investment decisions easier to make and manage.
An example of the output can be found in the GIF below. This depicts several ETFs collected from [the Top ETFs according to Yahoo Finance](https://finance.yahoo.com/etfs).

## Installation
The package can be installed via the following commands:
1. `pip install thepassiveinvestor`
- Alternatively, download this repository.
1. (within Python) `import thepassiveinvestor as pi`
The functions within this package are:
- `collect_data(ticker)` - collects the most important data for ETFs as listed in the [Functionality](#Functionality)
section.
- `create_ETF_report(tickers, filename, folder=None)` - uses collect_data to create an Excel report with data, as
depicted in the GIF above, per sheet for each ticker.
Therefore, if you wish to collect data on an ETF or create a report of a selection of ETFs you can use the following
example:
```python
import thepassiveinvestor as pi
# Collect data from a specific ETF
vanguard_sp500 = pi.collect_data('VOO')
# Show the data
vanguard_sp500
```
Which returns the following:
```
{'long_name': 'Vanguard 500 Index Fund', 'summary': "The fund employs an indexing investment approach designed to track the performance of the Standard & Poor's 500 Index, a widely recognized benchmark of U.S. stock market performance that is dominated by the stocks of large U.S. companies. The advisor attempts to replicate the target index by investing all, or substantially all, of its assets in the stocks that make up the index, holding each stock in approximately the same proportion as its weighting in the index.", 'image_URL': 'https://s.yimg.com/lq/i/fi/3_0stylelargeeq2.gif', 'sector_holdings': {'realestate': '2.75%', 'consumer_cyclical': '10.13%', 'basic_materials': '2.4%', 'consumer_defensive': '7.38%', 'technology': '23.65%', 'communication_services': '7.43%', 'financial_services': '13.7%', 'utilities': '2.43%', 'industrials': '8.82%', 'energy': '5.11%', 'healthcare': '15.27%'}, 'company_holdings': {'Apple Inc': '5.92%', 'Microsoft Corp': '5.62%', 'Amazon.com Inc': '4.06%', 'Facebook Inc Class A': '2.29%', 'Alphabet Inc Class A': '2.02%', 'Alphabet Inc Class C': '1.97%', 'Berkshire Hathaway Inc Class B': '1.44%', 'Tesla Inc': '1.44%', 'NVIDIA Corp': '1.37%', 'JPMorgan Chase & Co': '1.3%'}, 'annual_returns': {'2022': '-18.15%', '2021': '28.66%', '2020': '18.35%', '2019': '31.46%', '2018': '-4.42%', '2017': '21.78%'}, 'risk_data': {'5y': {'year': '5y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 0.89, 'rSquared': 100, 'stdDev': 18.69, 'sharpeRatio': -0.19, 'treynorRatio': 8.04}, '3y': {'year': '3y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 0.8, 'rSquared': 100, 'stdDev': 21.17, 'sharpeRatio': -0.55, 'treynorRatio': 6.76}, '10y': {'year': '10y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 1.08, 'rSquared': 100, 'stdDev': 14.78, 'sharpeRatio': 0.88, 'treynorRatio': 11.7}}, 'key_characteristics': {'fundInceptionDate': '2010-09-07', 'category': 'Large Blend', 'totalAssets': 744769716224, 'currency': 'USD', 'navPrice': 366.24, 'previousClose': 365.67}}
```
You also have the option to generate a comparison report as follows:
```python
import thepassiveinvestor as pi
# Collect data from a set of ETFs and compare them
etf_comparison = pi.collect_data(['VOO', 'QQQ', 'ARKG', 'VUG', 'SCHA', 'VWO'], comparison=True)
# Show the comparison
etf_comparison
```
Which returns the following:
| | VOO | QQQ | ARKG | VUG | SCHA | VWO |
|:----------------------------------------------|:-------------|:-------------|:-----------|:-------------|:------------|:--------------------------|
| ('sector_holdings', 'realestate') | 2.75% | 0.29% | 0% | 2.55% | 7.16% | 2.95% |
| ('sector_holdings', 'consumer_cyclical') | 10.13% | 14.2% | 0% | 18.09% | 12.75% | 12.92% |
| ('sector_holdings', 'basic_materials') | 2.4% | 0% | 0% | 2.01% | 4.35% | 9.34% |
| ('sector_holdings', 'consumer_defensive') | 7.38% | 6.67% | 0% | 2.92% | 4.12% | 6.23% |
| ('sector_holdings', 'technology') | 23.65% | 47.62% | 3.41% | 41.19% | 14.18% | 15.49% |
| ('sector_holdings', 'communication_services') | 7.43% | 15.99% | 0% | 11.96% | 2.74% | 8.72% |
| ('sector_holdings', 'financial_services') | 13.7% | 0.74% | 0% | 6.95% | 15.68% | 20.63% |
| ('sector_holdings', 'utilities') | 2.43% | 0.88% | 0% | 0% | 1.83% | 3.78% |
| ('sector_holdings', 'industrials') | 8.82% | 4.75% | 0% | 4.64% | 16.16% | 7.26% |
| ('sector_holdings', 'energy') | 5.11% | 0.49% | 0% | 1.35% | 5.85% | 5.36% |
| ('sector_holdings', 'healthcare') | 15.27% | 7.54% | 96.58% | 8.13% | 13.98% | 4.6% |
| ('annual_returns', '2022') | -18.15% | -32.49% | -53.94% | -33.13% | -19.8% | -17.72% |
| ('annual_returns', '2021') | 28.66% | 27.24% | -33.89% | 27.26% | 16.35% | 0.96% |
| ('annual_returns', '2020') | 18.35% | 48.6% | 180.51% | 40.16% | 19.35% | 15.32% |
| ('annual_returns', '2019') | 31.46% | 39.12% | 43.75% | 37.26% | 26.54% | 20.4% |
| ('annual_returns', '2018') | -4.42% | -0.14% | 0.59% | -3.32% | -11.75% | -14.57% |
| ('annual_returns', '2017') | 21.78% | 32.7% | 45.41% | 27.8% | 15.04% | 31.38% |
| ('key_characteristics', 'fundInceptionDate') | 2010-09-07 | 1999-03-10 | 2014-10-31 | 2004-01-26 | 2009-11-03 | 2005-03-04 |
| ('key_characteristics', 'category') | Large Blend | Large Growth | Health | Large Growth | Small Blend | Diversified Emerging Mkts |
| ('key_characteristics', 'totalAssets') | 744769716224 | 145931501568 | 1899108352 | 132303921152 | 13327223808 | 93044613120 |
| ('key_characteristics', 'currency') | USD | USD | USD | USD | USD | USD |
| ('key_characteristics', 'navPrice') | 366.24 | 281.03 | 32.79 | 225.08 | 43.42 | 41.9 |
| ('key_characteristics', 'previousClose') | 365.67 | 281.54 | 33.43 | 225.66 | 43.41 | 41.92 |
| ('risk_data_3y', 'year') | 3y | 3y | 3y | 3y | 3y | 3y |
| ('risk_data_3y', 'alpha') | -0.04 | 0.76 | -4.62 | -1.7 | -3.72 | -1.28 |
| ('risk_data_3y', 'beta') | 1 | 1.08 | 1.32 | 1.11 | 1.15 | 0.9 |
| ('risk_data_3y', 'meanAnnualReturn') | 0.8 | 0.92 | 0.25 | 0.74 | 0.6 | 0.05 |
| ('risk_data_3y', 'rSquared') | 100 | 87.57 | 41.82 | 90.79 | 82.66 | 76.68 |
| ('risk_data_3y', 'stdDev') | 21.17 | 24.49 | 41.28 | 24.6 | 26.8 | 20.04 |
| ('risk_data_3y', 'sharpeRatio') | -0.55 | -0.7 | 0.27 | -0.72 | 1.58 | 2 |
| ('risk_data_3y', 'treynorRatio') | 6.76 | 7.04 | -4.51 | 4.7 | 2.44 | -2.53 |
| ('risk_data_5y', 'year') | 5y | 5y | 5y | 5y | 5y | 5y |
| ('risk_data_5y', 'alpha') | -0.04 | 2.15 | 2.44 | -0.2 | -5.06 | -0.93 |
| ('risk_data_5y', 'beta') | 1 | 1.1 | 1.5 | 1.1 | 1.16 | 0.94 |
| ('risk_data_5y', 'meanAnnualReturn') | 0.89 | 1.16 | 0.98 | 0.96 | 0.6 | 0.11 |
| ('risk_data_5y', 'rSquared') | 100 | 88.49 | 45.66 | 91.7 | 83.48 | 78.97 |
| ('risk_data_5y', 'stdDev') | 18.69 | 21.85 | 39.32 | 21.4 | 23.73 | 18.27 |
| ('risk_data_5y', 'sharpeRatio') | -0.19 | -0.44 | -0.12 | -0.3 | 1.77 | 1.58 |
| ('risk_data_5y', 'treynorRatio') | 8.04 | 9.81 | 1.98 | 7.55 | 2.69 | -1.74 |
| ('risk_data_10y', 'year') | 10y | 10y | 10y | 10y | 10y | 10y |
| ('risk_data_10y', 'alpha') | -0.04 | 2.46 | 0 | -0.51 | -4.08 | -1.79 |
| ('risk_data_10y', 'beta') | 1 | 1.1 | 0 | 1.08 | 1.16 | 0.98 |
| ('risk_data_10y', 'meanAnnualReturn') | 1.08 | 1.39 | 0 | 1.13 | 0.9 | 0.24 |
| ('risk_data_10y', 'rSquared') | 100 | 85.33 | 0 | 91.48 | 80.44 | 75.61 |
| ('risk_data_10y', 'stdDev') | 14.78 | 17.56 | 0 | 16.76 | 19.06 | 16.38 |
| ('risk_data_10y', 'sharpeRatio') | 0.88 | 0.39 | 0 | 0.78 | 2.92 | 1.44 |
| ('risk_data_10y', 'treynorRatio') | 11.7 | 14.01 | 0 | 11.05 | 7.38 | 0.79 |
Lastly, if you wish to export to Excel this is also a possibility generating an Excel file that contains the most relevant information for each ticker.
```python
import thepassiveinvestor as pi
# Create a report from a list of ETFs
etf_list = ['VOO', 'QQQ', 'ARKG', 'VUG', 'SCHA', 'VWO']
pi.create_ETF_report(etf_list, 'Popular ETFs.xlsx')
```
Which returns the following:
<img width="1512" alt="Screenshot 2023-01-19 at 13 26 48" src="https://user-images.githubusercontent.com/46355364/213443231-ee125c24-3c70-4978-87fd-783c57eacbf2.png">
## Functionality
The package outputs an overview of each fund on a separate sheet. In this overview the following data is shown:
| Topic | Contains |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| General | The title of the fund and a summary about the fund's purpose and goal. |
| Characteristics | Inception date (the start of the fund), the category, assets under management (AUM), the denominated currency, net asset value (NAV), the latest close price and the Morningstar Style Box (if available). |
| Holdings | Sector holdings (% in each sector) and company holdings (top 10 companies with highest %). |
| Risk Metrics | All metrics are displayed in an interval of 3, 5 and 10 years. This includes Jensen's Alpha, Beta, Mean Annual Return, R-squared, Standard Deviation, Sharpe Ratio and Treynor Ratio. |
| Performance | The last five annual returns of the fund as wel as a graph depicting the adjusted close prices over the last 10 years. The actual data for this graph is available on a hidden sheet. |
## Contribution
Projects are bound to have (small) errors and can always be improved. Therefore, I highly encourage you to submit issues and create pull requests to improve the package.
%package help
Summary: Development documents and examples for thepassiveinvestor
Provides: python3-thepassiveinvestor-doc
%description help
# The Passive Investor
[](https://www.buymeacoffee.com/jerbouma)
[](https://github.com/JerBouma/ThePassiveInvestor/issues)
[](https://github.com/JerBouma/ThePassiveInvestor/pulls)
[](https://pypi.org/project/ThePassiveInvestor/)
[](https://pypi.org/project/ThePassiveInvestor/)
Theories and research about the stock market have stated that the semi-strong form of market efficiency seems to hold. This means that all public information is accurately reflected in the price of a financial instrument. This makes the job of a portfolio manager primarily managing the desired risk appetite of the client and not explicitly trying to outperform the market. This fact in combination with Finance professionals all around the world looking for that 'edge' to make their investment decisions as profitable as possible, makes it so the average joe can not compete.
Therefore, the term 'Passive Investing' is often coined around. This refers to buying funds (either ETFs or Mutual Funds) that follow the index (i.e. S&P 500, Dow Jones Index) or a broad market (Developed Markets, MSCI World) for diversification benefits. This means that a sudden decrease in performance of one stock within the index does not (on average) lead to a significant decline in the index as a whole. This allows the holder to spend limited time monitoring his holdings, therefore the term 'Passive'.
With a large increase in ETFs available (over 5,000 in 2020), it can become difficult to make the best choice in what you wish to invest. There are many different providers (iShares, Vanguard, Invesco) as well as with changes to the underlying stocks (i.e. High Yield, Super Dividends, Equal Weighted). This is quickly reflected when looking for a S&P 500 ETF as there are over 20 different ETFs available. With this package, I wish to make investment decisions easier to make and manage.
An example of the output can be found in the GIF below. This depicts several ETFs collected from [the Top ETFs according to Yahoo Finance](https://finance.yahoo.com/etfs).

## Installation
The package can be installed via the following commands:
1. `pip install thepassiveinvestor`
- Alternatively, download this repository.
1. (within Python) `import thepassiveinvestor as pi`
The functions within this package are:
- `collect_data(ticker)` - collects the most important data for ETFs as listed in the [Functionality](#Functionality)
section.
- `create_ETF_report(tickers, filename, folder=None)` - uses collect_data to create an Excel report with data, as
depicted in the GIF above, per sheet for each ticker.
Therefore, if you wish to collect data on an ETF or create a report of a selection of ETFs you can use the following
example:
```python
import thepassiveinvestor as pi
# Collect data from a specific ETF
vanguard_sp500 = pi.collect_data('VOO')
# Show the data
vanguard_sp500
```
Which returns the following:
```
{'long_name': 'Vanguard 500 Index Fund', 'summary': "The fund employs an indexing investment approach designed to track the performance of the Standard & Poor's 500 Index, a widely recognized benchmark of U.S. stock market performance that is dominated by the stocks of large U.S. companies. The advisor attempts to replicate the target index by investing all, or substantially all, of its assets in the stocks that make up the index, holding each stock in approximately the same proportion as its weighting in the index.", 'image_URL': 'https://s.yimg.com/lq/i/fi/3_0stylelargeeq2.gif', 'sector_holdings': {'realestate': '2.75%', 'consumer_cyclical': '10.13%', 'basic_materials': '2.4%', 'consumer_defensive': '7.38%', 'technology': '23.65%', 'communication_services': '7.43%', 'financial_services': '13.7%', 'utilities': '2.43%', 'industrials': '8.82%', 'energy': '5.11%', 'healthcare': '15.27%'}, 'company_holdings': {'Apple Inc': '5.92%', 'Microsoft Corp': '5.62%', 'Amazon.com Inc': '4.06%', 'Facebook Inc Class A': '2.29%', 'Alphabet Inc Class A': '2.02%', 'Alphabet Inc Class C': '1.97%', 'Berkshire Hathaway Inc Class B': '1.44%', 'Tesla Inc': '1.44%', 'NVIDIA Corp': '1.37%', 'JPMorgan Chase & Co': '1.3%'}, 'annual_returns': {'2022': '-18.15%', '2021': '28.66%', '2020': '18.35%', '2019': '31.46%', '2018': '-4.42%', '2017': '21.78%'}, 'risk_data': {'5y': {'year': '5y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 0.89, 'rSquared': 100, 'stdDev': 18.69, 'sharpeRatio': -0.19, 'treynorRatio': 8.04}, '3y': {'year': '3y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 0.8, 'rSquared': 100, 'stdDev': 21.17, 'sharpeRatio': -0.55, 'treynorRatio': 6.76}, '10y': {'year': '10y', 'alpha': -0.04, 'beta': 1, 'meanAnnualReturn': 1.08, 'rSquared': 100, 'stdDev': 14.78, 'sharpeRatio': 0.88, 'treynorRatio': 11.7}}, 'key_characteristics': {'fundInceptionDate': '2010-09-07', 'category': 'Large Blend', 'totalAssets': 744769716224, 'currency': 'USD', 'navPrice': 366.24, 'previousClose': 365.67}}
```
You also have the option to generate a comparison report as follows:
```python
import thepassiveinvestor as pi
# Collect data from a set of ETFs and compare them
etf_comparison = pi.collect_data(['VOO', 'QQQ', 'ARKG', 'VUG', 'SCHA', 'VWO'], comparison=True)
# Show the comparison
etf_comparison
```
Which returns the following:
| | VOO | QQQ | ARKG | VUG | SCHA | VWO |
|:----------------------------------------------|:-------------|:-------------|:-----------|:-------------|:------------|:--------------------------|
| ('sector_holdings', 'realestate') | 2.75% | 0.29% | 0% | 2.55% | 7.16% | 2.95% |
| ('sector_holdings', 'consumer_cyclical') | 10.13% | 14.2% | 0% | 18.09% | 12.75% | 12.92% |
| ('sector_holdings', 'basic_materials') | 2.4% | 0% | 0% | 2.01% | 4.35% | 9.34% |
| ('sector_holdings', 'consumer_defensive') | 7.38% | 6.67% | 0% | 2.92% | 4.12% | 6.23% |
| ('sector_holdings', 'technology') | 23.65% | 47.62% | 3.41% | 41.19% | 14.18% | 15.49% |
| ('sector_holdings', 'communication_services') | 7.43% | 15.99% | 0% | 11.96% | 2.74% | 8.72% |
| ('sector_holdings', 'financial_services') | 13.7% | 0.74% | 0% | 6.95% | 15.68% | 20.63% |
| ('sector_holdings', 'utilities') | 2.43% | 0.88% | 0% | 0% | 1.83% | 3.78% |
| ('sector_holdings', 'industrials') | 8.82% | 4.75% | 0% | 4.64% | 16.16% | 7.26% |
| ('sector_holdings', 'energy') | 5.11% | 0.49% | 0% | 1.35% | 5.85% | 5.36% |
| ('sector_holdings', 'healthcare') | 15.27% | 7.54% | 96.58% | 8.13% | 13.98% | 4.6% |
| ('annual_returns', '2022') | -18.15% | -32.49% | -53.94% | -33.13% | -19.8% | -17.72% |
| ('annual_returns', '2021') | 28.66% | 27.24% | -33.89% | 27.26% | 16.35% | 0.96% |
| ('annual_returns', '2020') | 18.35% | 48.6% | 180.51% | 40.16% | 19.35% | 15.32% |
| ('annual_returns', '2019') | 31.46% | 39.12% | 43.75% | 37.26% | 26.54% | 20.4% |
| ('annual_returns', '2018') | -4.42% | -0.14% | 0.59% | -3.32% | -11.75% | -14.57% |
| ('annual_returns', '2017') | 21.78% | 32.7% | 45.41% | 27.8% | 15.04% | 31.38% |
| ('key_characteristics', 'fundInceptionDate') | 2010-09-07 | 1999-03-10 | 2014-10-31 | 2004-01-26 | 2009-11-03 | 2005-03-04 |
| ('key_characteristics', 'category') | Large Blend | Large Growth | Health | Large Growth | Small Blend | Diversified Emerging Mkts |
| ('key_characteristics', 'totalAssets') | 744769716224 | 145931501568 | 1899108352 | 132303921152 | 13327223808 | 93044613120 |
| ('key_characteristics', 'currency') | USD | USD | USD | USD | USD | USD |
| ('key_characteristics', 'navPrice') | 366.24 | 281.03 | 32.79 | 225.08 | 43.42 | 41.9 |
| ('key_characteristics', 'previousClose') | 365.67 | 281.54 | 33.43 | 225.66 | 43.41 | 41.92 |
| ('risk_data_3y', 'year') | 3y | 3y | 3y | 3y | 3y | 3y |
| ('risk_data_3y', 'alpha') | -0.04 | 0.76 | -4.62 | -1.7 | -3.72 | -1.28 |
| ('risk_data_3y', 'beta') | 1 | 1.08 | 1.32 | 1.11 | 1.15 | 0.9 |
| ('risk_data_3y', 'meanAnnualReturn') | 0.8 | 0.92 | 0.25 | 0.74 | 0.6 | 0.05 |
| ('risk_data_3y', 'rSquared') | 100 | 87.57 | 41.82 | 90.79 | 82.66 | 76.68 |
| ('risk_data_3y', 'stdDev') | 21.17 | 24.49 | 41.28 | 24.6 | 26.8 | 20.04 |
| ('risk_data_3y', 'sharpeRatio') | -0.55 | -0.7 | 0.27 | -0.72 | 1.58 | 2 |
| ('risk_data_3y', 'treynorRatio') | 6.76 | 7.04 | -4.51 | 4.7 | 2.44 | -2.53 |
| ('risk_data_5y', 'year') | 5y | 5y | 5y | 5y | 5y | 5y |
| ('risk_data_5y', 'alpha') | -0.04 | 2.15 | 2.44 | -0.2 | -5.06 | -0.93 |
| ('risk_data_5y', 'beta') | 1 | 1.1 | 1.5 | 1.1 | 1.16 | 0.94 |
| ('risk_data_5y', 'meanAnnualReturn') | 0.89 | 1.16 | 0.98 | 0.96 | 0.6 | 0.11 |
| ('risk_data_5y', 'rSquared') | 100 | 88.49 | 45.66 | 91.7 | 83.48 | 78.97 |
| ('risk_data_5y', 'stdDev') | 18.69 | 21.85 | 39.32 | 21.4 | 23.73 | 18.27 |
| ('risk_data_5y', 'sharpeRatio') | -0.19 | -0.44 | -0.12 | -0.3 | 1.77 | 1.58 |
| ('risk_data_5y', 'treynorRatio') | 8.04 | 9.81 | 1.98 | 7.55 | 2.69 | -1.74 |
| ('risk_data_10y', 'year') | 10y | 10y | 10y | 10y | 10y | 10y |
| ('risk_data_10y', 'alpha') | -0.04 | 2.46 | 0 | -0.51 | -4.08 | -1.79 |
| ('risk_data_10y', 'beta') | 1 | 1.1 | 0 | 1.08 | 1.16 | 0.98 |
| ('risk_data_10y', 'meanAnnualReturn') | 1.08 | 1.39 | 0 | 1.13 | 0.9 | 0.24 |
| ('risk_data_10y', 'rSquared') | 100 | 85.33 | 0 | 91.48 | 80.44 | 75.61 |
| ('risk_data_10y', 'stdDev') | 14.78 | 17.56 | 0 | 16.76 | 19.06 | 16.38 |
| ('risk_data_10y', 'sharpeRatio') | 0.88 | 0.39 | 0 | 0.78 | 2.92 | 1.44 |
| ('risk_data_10y', 'treynorRatio') | 11.7 | 14.01 | 0 | 11.05 | 7.38 | 0.79 |
Lastly, if you wish to export to Excel this is also a possibility generating an Excel file that contains the most relevant information for each ticker.
```python
import thepassiveinvestor as pi
# Create a report from a list of ETFs
etf_list = ['VOO', 'QQQ', 'ARKG', 'VUG', 'SCHA', 'VWO']
pi.create_ETF_report(etf_list, 'Popular ETFs.xlsx')
```
Which returns the following:
<img width="1512" alt="Screenshot 2023-01-19 at 13 26 48" src="https://user-images.githubusercontent.com/46355364/213443231-ee125c24-3c70-4978-87fd-783c57eacbf2.png">
## Functionality
The package outputs an overview of each fund on a separate sheet. In this overview the following data is shown:
| Topic | Contains |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| General | The title of the fund and a summary about the fund's purpose and goal. |
| Characteristics | Inception date (the start of the fund), the category, assets under management (AUM), the denominated currency, net asset value (NAV), the latest close price and the Morningstar Style Box (if available). |
| Holdings | Sector holdings (% in each sector) and company holdings (top 10 companies with highest %). |
| Risk Metrics | All metrics are displayed in an interval of 3, 5 and 10 years. This includes Jensen's Alpha, Beta, Mean Annual Return, R-squared, Standard Deviation, Sharpe Ratio and Treynor Ratio. |
| Performance | The last five annual returns of the fund as wel as a graph depicting the adjusted close prices over the last 10 years. The actual data for this graph is available on a hidden sheet. |
## Contribution
Projects are bound to have (small) errors and can always be improved. Therefore, I highly encourage you to submit issues and create pull requests to improve the package.
%prep
%autosetup -n thepassiveinvestor-1.2.1
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-thepassiveinvestor -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.1-1
- Package Spec generated
|