Custom ETF builder

This was a tough one, and with hindsight too big for my very first proper coding project. It was also a lot of fun though during the various lockdows 😀

It started when I randomly stumbled over Part Time Larry’s Youtube channel. He produces videos on how to interact with various finance APIs, one of which is the Alpaca Markets API. At the time he only had a couple of thousands subscribers (the tally now is close to 90k), and Alpaca was hardly known back then as well. It now provides the underlying trading platform for various fintechs.

Background

In true Boglehead style I had been investing in an All-World ETF for quite some time by then, but was icked by the fact that to replicate the world economy, it also had to invest in oil, coal and gas companies. So I wanted to find a solution to create my own ETF using fractional shares.

Of course there are ESG or sustainable ETFs but they come with various issues. Their selection criteria sometimes mean that companies like Amazon or Apple are left out. Those ETFs also tend to be smaller and more expensive.

The project

For simplicity I initially limited it to the S&P 500 (which actually contains 505 companies). I found names, market share, sectors and industries of all companies online. Armed with the data I planned the app to work like this:

  1. Display all companies
  2. Filter by name, industry or sector
  3. (De)select companies for my custom selection
  4. Choose between market weighting or equal weighting
  5. Calculate minimum investment (more on that below)
  6. Enter amount
  7. Send API buy call to Alpaca
  8. Buy stonks 🚀

I decided not to implement a portfolio view. You can log into Alpaca to see a detailed performance breakdown performance, so I didn’t feel it was necessary for the beginning.

For this project I had to learn Python for the calculations within the app, the basics of REST API to let the app talk to Alpaca, and HTML/CSS for the UI. And it took forever.

I worked on it after my regular job, and occasionally on weekends. Oftentimes I had to wait for a response to my very basic posts on Stack Overflow to continue. But slowly over the course of a couple of weeks it came together.

And this is what it looks like:

Monetisation

I primarily built this for myself. A lot of great products start like that and with that in mind, I did look into ways to monetise it. However I quickly ran into a couple of issues:

Minimum spend

Alpaca only executes orders of $1 or above. It sounds small, but if you want to buy a basket of stocks, it can lead to very large minimum investments. Here’s the math: Say I want to buy 100 stocks, all with different market weights. If the lowest weight (relative to the other 99 stocks) is 1%, then my minimum investment will be $1 / 1% = $100.

However, in the S&P 500, the largest weight at the time of building it was Apple with more than 6%, whereas the smallest was around 0,01%. That’s a massive spread and means that for a lot of “green” selections the smallest weight will be around those 0,01%. So the minimum investment at market weighting then jumps from $100 to $1 / 0,01% = $10,000.

My monthly contribution to my current ETF isn’t quite there yet ;-) and that also applies to most ETF investors.

Trading revenue

ETF saving plans are often executed for free or incur a flat fee of $1 to $2 per execution. A tool that by definition wants users to build custom ETFs, not trade daily, will see very little trading revenue.

High barriers to entry

Alpaca provides great backend services but you still have to register with your national financial authority (in my case the German BaFin). The whole setup is way too complicated for an indie hacker-type of project.

What I learned:

  • Software projects can take forever. I kind of already knew that but experiencing it myself drove it home.
  • I don’t enjoy designing UIs. I find it complicated to turn something that is working into something that is working and beautiful. So for the future I’ll focus on functionality rather than design. This website is an expression of that.