Skip to content

Instantly share code, notes, and snippets.

@pjhoberman
Created December 23, 2021 23:59
Show Gist options
  • Save pjhoberman/c527008a336345ceaa6b0a18a3f14bd3 to your computer and use it in GitHub Desktop.
Save pjhoberman/c527008a336345ceaa6b0a18a3f14bd3 to your computer and use it in GitHub Desktop.

Hi everyone

tl;dr Is this ETF project worthwhile, of interest, useful, or should I shelve it and move on with my life?

A while ago, I was looking at some ETFs I own and wondering why they moved up or down that day. I understand that market fluctuations will do that, but I also assumed the underlying assets likely moved in some significant manner. So, I started looking at the underlying stocks to find correlations and had trouble finding a programmatic way to find what an ETF holds. While the data is freely available on brokerage sites and the ETF fund itself (in excel format, normally), I didn't find any reasonable way to get this info via api, at least not that I could afford.

So, like any good human would do, I started building my own app to find and keep track of ETF holdings. I spent some time building out the foundation, and am happy with where I got, but am unsure if I should continue, scrap it, sell it / give it away, etc. But, I like this community and I figured I'd see what y'all thought first.

Here's what it does. It updates the holdings of each ETF daily after market close (around 8pm EST). The two main functionalities are an API and automated email.

API functionality

  • list of ETFs:
{
  "count": 117,
  "next": "/api/etfs/?limit=100&offset=100",
  "previous": null,
  "results": [
    {
      "url": "/api/etfs/aiq/",
      "symbol": "AIQ",
      "name": "Artificial Intelligence & Technology ETF",
      "expense_ratio": 0.0068,
      "last_updated": "2021-12-22T20:01:08.312734-07:00",
      "website": "https://www.globalxetfs.com/funds/aiq/",
      "fund_manager": "/api/fund-manager/global-x/",
      "fund_manager_name": "Global X"
    },
    {
      "url": "/api/etfs/alty/",
      "symbol": "ALTY",
      "name": "SuperDividend:registered: Alternatives ETF",
      "expense_ratio": 0.0295,
      "last_updated": "2021-12-22T20:01:11.434884-07:00",
      "website": "https://www.globalxetfs.com/funds/alty/",
      "fund_manager": "/api/fund-manager/global-x/",
      "fund_manager_name": "Global X"
    },
    ...
  ]
}
  • ETF detail:
{
  "url": "/api/etfs/esgu/",
  "symbol": "ESGU",
  "name": "iShares ESG Aware MSCI USA ETF",
  "expense_ratio": 0.0015,
  "last_updated": "2021-12-22T20:00:53.922970-07:00",
  "website": "https://www.ishares.com/us/products/286007/ishares-esg-msci-usa-etf-fund",
  "fund_manager": "/api/fund-manager/ishares/",
  "fund_manager_name": "iShares",
  "holdings_count": 325,
  "holdings_link": "/api/etfs/esgu/holdings/"
}
  • ETF Holdings:
[
  {
    "etf": "/api/etfs/qtum/",
    "etf_name": "Q Test",
    "etf_symbol": "QTUM",
    "stock": "/api/stock/2357-tt/",
    "stock_name": "ASUSTEK COMPUTER",
    "stock_symbol": "2357 TT",
    "weight": 0.0151,
    "quantity": 196000
  },
  {
    "etf": "/api/etfs/qtum/",
    "etf_name": "Q Test",
    "etf_symbol": "QTUM",
    "stock": "/api/stock/2454-tt/",
    "stock_name": "MEDIATEK INC",
    "stock_symbol": "2454 TT",
    "weight": 0.0144,
    "quantity": 64000
  },
  ...
]

And so forth. You can look up a stock and find what ETFs hold it at what quantity and weight, all ETFs for a fund manager, et.

Email functionality

You can also subscribe to a stock or an ETF and get nightly updates if any changes happen, either if a stock is added, dropped, or changed, or if an ETF adds, drops, or changes the volume of a stock. Here's an example:

https://preview.redd.it/ro6mc1n8kd781.png?width=1440&format=png&auto=webp&s=2c91503c539f5558ab4f041b5e1afa9741595eb6

There's still work to do. The actual site needs work to make it friendly to someone who didn't write all the code. There are about 7,000 ETFs out there, so there's work to add the fund managers and ETFs. And then a bunch of features I'd like to develop eventually.

So, is it worth it? Would anyone pay $10/mo for this? Is this already done elsewhere, better, and just as accessible? Or, is it another WIP portfolio piece that I should shelve. Or heck, does anyone want to buy the code?

Thanks for your insight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment