Looking to learn more about ETFs and how to use Python to aggregate your ETF equity allocations? Look no further, this post will explain and elaborate on ETFs and also demonstrate how to use Python and Intrinio’s ETF Holdings data to calculate your ETF allocations to individual companies.
Exchange-Traded Funds or ETFs are investment funds that purchase and rebalance a basket of individual securities such as stocks and bonds.
ETFs trade identically to individual securities such as AAPL and MSFT; the only difference is that with an ETF, you are not purchasing a single security but rather a basket of securities that provides your portfolio with exposure over a wide range of companies, sectors, and industries.
Some of the benefits of ETFs include:
Unlike Mutual Funds, ETFs never charge a load fee, and their expense ratios are typically much smaller.
Passive, index-based ETFs typically have the lowest fees. An example is the .03% expense ratio of Vanguard’s S&P 500 ETF (VOO). To highlight how small this fee is, you would incur only $71 in fees with a hypothetical investment of $10,000 in VOO over a 10-year period.
Passive ETFs can get away with charging lower fees because there is minimal effort on behalf of the fund manager’s team to ensure they are properly tracking the underlying index. Additionally, passive ETFs make money by loaning out the shares held within the ETF for a fee to investors interested in shorting select companies.
On the other hand, actively managed ETFs will always have higher expense fees than their passive counterparty. Active ETFs must charge higher fees to compensate the fund’s team for the data and research that goes into every investment they make. Additionally, because an actively managed ETF consistently turns over its portfolio in its pursuit of outperforming a benchmark, taxes, and fees will also eat away at the overall returns.
One of the more significant advantages of ETFs is the diversity they provide to a portfolio. Instead of owning a single or handful of stocks, ETFs can provide you with access to an entire index with a single purchase.
Additionally, ETFs track all types of indices and investment outcomes, from ESG ETFs that allow you to invest in companies that reflect your values to sector ETFs that enable you to invest only in landscapes you feel most comfortable. With the wide range of ETF investments available, you will undoubtedly be able to find one or many that work best with your investment style.
Finally, unlike mutual funds or money managers, with ETFs, you will always be able to see the underlying equities held by the fund before you invest. You can see the exact weight of each holding and compare these weights with similar ETFs that you are interested in, thereby ensuring that you hold the precise mixture of investments that you desire.
Index tracking, or indexing, is the practice of buying all the components of a market index, such as the Standard & Poor’s 500 Index, and an ETF’s ability to perform this style of investing conveniently may be its most significant benefit.
While tracking an index and matching its returns may not seem all that exciting or extraordinary, the fact that the average investor (retail or professional) underperforms the market in any given year should make the ability to own the market itself an enticing offering.
Supporting this statement is the fact that picking individual stocks is a zero-sum game as all stocks in an index must be owned by some investor. As a result, 50% of the participants actively trying to outperform the index will fail in any given year, and the other 50% will succeed. Additionally, even those in the 50% who do beat the market’s return, their net return might still be less than the market average after deducting management fees and capital gains taxes, making it even less likely to outperform.
In the end, ETFs allow investors to avoid playing this 50/50 game and while investing in an index tracking ETF such as Vanguard’s S&P 500 ETF (VOO) ensures that you will never beat the market’s return, it also guarantees that you will never join the majority of investors underperforming their benchmark index.
With the ever-growing popularity of ETFs amongst investors, Intrinio is proud to be supplying the next generation of fintech companies with a high-quality ETF data offering. Powered by CFRA, our ETF API endpoints provide in-depth metadata, stats, analytics, and complete holdings of every active ETF in the U.S. and Canada.
With all of these ETF data offerings, we constantly discuss potential use cases for the best ways to display and use this data on Fintech platforms.
Given the diversity of assets held in ETFs, there will undoubtedly be an overlap of securities held by an investor who owns multiple ETFs. Therefore, one of our most recent use cases was to allow ETF investors to see just exactly how much of their money is allocated to securities held within their ETFs.
As shown below, we can complete this task with just two simple steps:
The following _etf_holdings_dataset function accepts two arguments, an etf_ticker and allocation, and ultimately returns a Pandas DataFrame with the necessary columns — ticker | sedol | allocation — to later aggregate holding allocations across ETFs.
We achieve this outcome by first using Intrinio’s ETF Holdings endpoint to retrieve the latest holdings of a particular ETF.
After retrieving these holdings and converting our JSON API response to a Pandas Dataframe, we then construct a new column funds_allocation by taking our allocation argument — the fund’s an investor has allocated towards a particular ETF — and multiplies it by the holding’s weight in the ETF.
The _etf_diversity_dataset function below accepts a dictionary of key-value pairs where the keys are ETF tickers, and the values are an investor’s allocations to those ETFs.
It then iterates through each ticker and allocation, passing these variables as arguments into the _etf_holdings_dataset function and ultimately appending the returned Holdings Pandas DataFrame to a list.
We then use Panda’s concat method to combine our list of DataFrames into a single DataFrame. We then use the .groupby method to group similar holdings across DataFrames — those that overlap within each ETF — and sum their allocations together.
Finally, we sort and clean up these values and return a completed DataFrame that provides an investor with a clear transparent picture of how many companies they hold within their ETFs and the dollars allocated towards each one.
At Intrinio, we’re recognized for being one of the top data providers that specializes in high-quality data, immediate customer service, and modern tools for a variety of fintech platforms and businesses. Our dedicated team wants to help you find the best data package that fits your unique needs. Reach out to one of our data specialists today to find out more about our equities, options, fundamentals, ETF, and analyst ratings data packages. And to learn more about all our financial services and data please visit intrinio.com.