SkillAgentSearch skills...

ThePassiveInvestor

Passive Investing for the Average Joe

Install / Use

/learn @JerBouma/ThePassiveInvestor
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

The Passive Investor

GitHub Sponsors Buy Me a Coffee Twitter LinkedIn Documentation PYPI Version PYPI Downloads

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.

outputExample

Installation

The package can be installed via the following commands:

  1. pip install thepassiveinvestor
    • Alternatively, download this repository.
  2. (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 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:

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:

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

Related Skills

View on GitHub
GitHub Stars618
CategoryFinance
Updated2d ago
Forks74

Languages

Python

Security Score

100/100

Audited on Mar 24, 2026

No findings