A Farewell to Swell: DIY Socially Responsible Investing through Alpaca

Evan Akutagawa
Automation Generation
5 min readAug 1, 2019
Photo by Gustavo Quepón on Unsplash

I was saddened to learn that on July 24th, 2019 Swell Investing stopped accepting new customers and would be shutting down operations by the end of August. Founded in 2017, Swell was an investment advisor and platform that focused exclusively on impact investing.

What is impact investing?

Impact, or socially responsible investing (SRI), includes and is also called, among others:

  • community investing
  • ethical investing
  • green investing
  • mission-related investing
  • responsible investing
  • sustainable investing
  • values-based investing

As described by the U.S. SIF Foundation, “SRI is an investment discipline that considers environmental, social and corporate governance (ESG) criteria to generate long-term competitive financial returns and positive societal impact.”

Interest in SRI has grown significantly in recent years, as depicted in the chart below. The U.S. SIF Foundation’s Report on US Sustainable, Responsible and Impact Investing Trends identified $12.0 trillion in total assets under management at the end of 2017 using one or more SRI strategies.

Farewell Swell, You Will Be Missed

Although I wouldn’t call Swell a competitor, as an employee of fintech company Alpaca, which provides a developer-friendly commission-free brokerage (no, we’re not Robinhood), I understand how challenging it is to help build an innovative investing and trading service from the ground up, and I admired Swell’s commitment to socially responsible investing.

As a tribute to Swell, I decided to write a simple but powerful python script as an example of how Alpaca users can passively invest in socially responsible companies using representative ETFs. Admittedly, this is a do-it-yourself implementation that doesn’t have any of the bells and whistles that Swell offered. No visuals, no slick mobile app, no automated rebalancing, and no set and forget allocation tools. On the other hand, there are no investment advisor fees or trading commissions. Critically though, it requires a bit of coding knowledge. You’ll need to have Python 3.5+ and the Alpaca Trade API installed to run this script. If you like the concept of this algo but don’t know how to code, leave a comment or get in touch and we’ll work on creating a Google sheets or Colab version.

Keep in mind that this is only an example to get you started. If you decide that you want to commit your own money to an automated strategy, you should first test the performance of the principles yourself. Fortunately, Alpaca provides a “paper trading” platform, so you can see this script work without having to put your real account balance on the line.

How the Algo Works

  1. Does it invest in stocks, ETFs, or mutual funds?

In this example, I’ve used one ETF for each of these various SRI themes:

The above table is for illustrative purposes only. This is not an offer, solicitation of an offer, or advice to buy or sell securities, or open a brokerage account.

2. Does the algo invest all or only a portion of your money?

It’s up to you. You’ll need to enter the percentage of your account equity you want to allocate to each SRI theme as a script argument. The algo will try to match your desired allocation, taking into consideration the money to allocate (if your account and target allocation are too small, you might unintentionally end up with a 0% allocation for some themes!). Any unallocated portion will remain in cash. For example, and for illustrative purposes only, here’s how we would allocate 90% of our funds across 6 themes with varying percentages (with the remaining 10% left in cash):

python3 sri.py --diversified=20 --water=20 --energy=20 --health=10 --disease=10 --gender=10

3. How frequently does the algo rebalance? Daily, weekly, monthly?

The algo I’ve created doesn’t have a defined rebalancing schedule. Any time you want to rebalance, you simply run the script and enter your desired portfolio allocations.

4. What’s the minimum account balance I need to use the SRI algo?

Since Alpaca does not currently support fractional shares (though we are working on adding this feature!), the minimum account balance you’ll need to use this algo is enough to buy at least 1 share of each of your desired thematic exposures. But generally speaking, the algo’s allocation model works better with at least $1,000 and can improve as even larger amounts are invested.

The Code

Without further ado, here’s the code in its entirety (and feel free to build upon this):

Originally published at https://forum.alpaca.markets.

Technology and services are offered by AlpacaDB, Inc. Brokerage services are provided by Alpaca Securities LLC, member FINRA/SIPC. Alpaca Securities LLC is a wholly-owned subsidiary of AlpacaDB, Inc.

This is not an offer, solicitation of an offer, or advice to buy or sell securities, or open a brokerage account in any jurisdiction where Alpaca is not registered (Alpaca is registered only in the United States).

All investments involve risk and the past performance of a security, or financial product does not guarantee future results or returns. Keep in mind that while diversification may help spread risk it does not assure a profit, or protect against loss, in a down market. There is always the potential of losing money when you invest in securities, or other financial products. Investors should consider their investment objectives and risks carefully before investing.

There are risks unique to automated trading algorithms that you should know about and plan for. You should setup a method or system of continuous monitoring or alerting to let you know if there is a mechanical failure, such as connectivity issues, power loss, a computer crash, or system quirk. You should also monitor for instances where your automated trading system experiences anomalies that could result in errant, missing, or duplicated orders. A more complete description of these and other risks can be found in our FAQ section.

ETFs can entail risks similar to direct stock ownership, including market, sector, or industry risks. Some ETFs may involve international risk, currency risk, commodity risk, and interest rate risk. Trading prices may not reflect the net asset value of the underlying securities.

Commission-Free trading means that there are no commission charges for Alpaca brokerage accounts that trade U.S. listed securities through an API. Relevant SEC and FINRA fees may apply.

© 2019 Alpaca Securities LLC. All rights reserved.

© 2019 AlpacaDB. All rights reserved.

--

--