How to Rebalance a Manual Algorithmic Trading Portfolio (Stocks)

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email
Share on whatsapp

Index

Free Investment Guide!
Get a list of the best performing algorithmic trading strategies. Sign up to the Aikido newsletter!

For traditional investors, keeping a portfolio up-to-date (AKA rebalancing) is really hard work! I know from personal experience… It would take hours of my time every month to review old stocks, purchase new stocks, ensure correct weighting, review exposure and risk, etc. etc. It was really hard work and I really didn’t want a second job.

Luckily, for algo traders and quantitative investors, it’s easier; a lot easier! You utilize computers to do the whole process for you – saving hundreds of hours and ensuring you don’t sprout any (more) grey hairs.

In this article, we will look at how to rebalance a ‘manual’ stock portfolio with Aikido in just a few minutes. Rebalancing a portfolio allows you to keep it up to date with the trading strategy that it’s based on.

I’m Shane; algo trader, FIRE enthusiast, and the founder of two quant startups.

So, let’s dive right in, let’s find out how you can rebalance an algorithmic trading portfolio today!

What is Portfolio Rebalancing?

Rebalancing your portfolio is an important part of managing your investments. Rebalancing means buying and selling positions in your portfolio to get back to your original asset allocation. When one asset class significantly outperforms another, your portfolio drifts from its starting allocation.

For stock-pickers, this can be a laborious process as the thesis you are following for your portfolio construction may not be very specific.

However for quants / algo-traders, this process is very structured and replicable. Here’s an overview of how to do it.

First:

  1. Choose your portfolio weighting (at Aikido we use equal-weight as default)
  2. Choose your total portfolio value (including any additional contributions you will make)

Then:

  1. Compare you current portfolio to the screen of stocks that the algorithm currently outputs
  2. Sell some stocks and shares for securities that are no longer in the screen
  3. Buy some stocks and shares for securities that have entered the screen

Keeping a portfolio up-to-date is very important for quants and algo traders as it keeps the portfolio inline with the trading strategy. When a trading strategy is backtested, rebalancing can play a huge role in the variability of returns.

Bottom line: keep on top of rebalancing!

Before you get Started

Needless to say, before you can rebalance a portfolio, you must already have one created – if you haven’t already built an algorithmic trading portfolio you can do this easily with Aikido:

Simply pick a quant strategy, build a tracker portfolio and follow along in whichever broker you like. The algorithm shows you which stocks to purchase! You can read a full guide on how to build a ‘Manual’ algorithmic trading portfolio with Aikido here.

First, Navigate to your Portfolio and Click ‘Rebalance’

Normally, you rebalance an Aikido algorithmic trading portfolio every month, quarter, or year; though you can rebalance at any time you like to keep your portfolio up to date.

Navigate to the portfolio you want to rebalance and click the ‘Rebalance’ button in the portfolio overview pane on the left.

Step 1: Add Cash

This optional step allows you to add an additional contribution (cash) to your portfolio. If you don’t want to add any more cash, you can click ‘Skip Step’

Step 2: Sell Stocks

This step show you the list of stocks and the number of shares which you will need to sell.

What’s going on in the background: The trading strategy algorithm compares your portfolio to the current strategy screen and runs an equal-weighting algorithm over the full portfolio.

Go to your online broker and work your way through the list of stocks, selling each stock shown.

How to sell the stocks in your broker:

For example (per the image above):

First, sell 57 shares of Whirlpool Corporation in your broker.

You may use a market order or a limit order to buy the stock. A market order should execute instantaneously (using the market’s best price), whereas a limit order could take some time to execute (you decide the price). Most people building an Aikido portfolio will choose to use a market order.

Whatever price you sold the stock for, enter that into the “Share Price” input in Aikido and click the red ‘S’ button – this signifies you have sold the stock in your broker.

If you do not want to sell a stock or cannot sell a stock for whatever reason, click the ‘X’ button – this signifies you did not sell the stock and will remove it from the rebalance.

If the stock market is closed when you’re building the portfolio, you may not know the exact price which you sold the stock for. If that is the case, take your best guess, or leave the default price – you can always edit the transaction price afterwards.

After you have worked your way through the list of stocks, click the ‘Next’ button to move on to the next step

Note: Aikido does not endorse or recommend any individual stock shown in this list; the stocks are purely generated by the algorithm.

Step 3: Buy Stocks

This step show you the list of stocks and the number of shares which you will need to buy.

It is identical to the previous step, but for buying securities rather than selling them.

Go to your online broker and work your way through the list of stocks, buying each stock shown.

When you have taken action on each stock, click the button ‘Complete Rebalance’ to finish the rebalancing process and go the the portfolio.

View your Portfolio

And that’s it! You’ve just rebalanced an algorithmic portfolio, nice job!

From Portfolio ‘Overview’ you can view performance, check out key metrics and view your holdings.

From the ‘Transactions’ tab you can view transaction level data (every buy or sell you have ever made). You can click a transaction row to edit it (eg. change the purchase price or the number of shares purchased). You can also click the ‘New Transaction’ to buy/sell a stock in the portfolio – you can add any publicly-traded company in the USA to the portfolio.

You will be notified when your next rebalance is due via email.

Auto-transactions & Gotchas

There are a few events which will trigger Aikido to automatically add a transaction to your Aikido portfolio. Those events are:

Delisting

A delisting occurs when a stock is removed from an exchange, this can happen for a variety of reasons including mergers, liquidation, or even lawsuits. When this event occurs, your broker will automatically sell off the position for you – Aikido mirrors this event and adds a sell transaction to your portfolio to keep it inline with your broker. This means you could have some extra cash lying about in your broker – the next rebalance will fix this and bring your portfolio back up to the number of stocks it is supposed to have.

Note: In a situation where you own shares of company B, and B is a child company of A. If B merges with parent A, in some circumstances you will be issued stock of company A automatically by your broker. This event, while uncommon, is not mirrored by Aikido. If this event occurs you should sell the parent company A in your broker manually. Rebalance will then bring your portfolio up to date again.

Stock split

A stock split is when a company increases the number of its outstanding shares to boost the stock’s liquidity. It brings the price of a individual stock down. When this event occurs, all shares of the stock are automatically sold and then the equivalent dollar amount is repurchased. These two transactions are added to your Aikido portfolio automatically.

Other corporate actions

Other corporate actions may not be tracked by Aikido. Rebalancing will sort most issues out, but if they persist – get in touch and we would be happy to help!

2% portfolio creation buffer

When creating and rebalancing your portfolio, Aikido leave 2% of the total portfolio value to the side to account for forseen and unforseen events. For example, if you are creating a portfolio with a total value of $1000, Aikido will not invest $20. That buffer will cover the cost of:

  • Slippage
  • Market volatility
  • Currency conversion rates
  • Transaction costs
  • Other fees

Most of the 2% will not be spent and you will find the cash waiting patiently for you in your broker.

Strategy screen buffer

During rebalance your portfolio is compared to the current screen of stocks generated by the strategy algorithm. Stocks are bought and sold to stay in-line with the strategy. To reduce unnecessary churn (and thus fees) in the portfolio at rebalance, if a stock is within 1.5X the screen, it will remain in the portfolio. For example: You are using The Stable Dividend strategy and through the strategy you now own 10 shares of AAPL, along with 14 other companies to make up a 15 stock portfolio. At rebalance AAPL is no longer in the top 15 in the strategy screen but has moved to position 19. In this case you will NOT sell AAPL. However, had AAPL moved to position 29, you would have sold out of the stock completely.

Thanks for reading; happy trading!

More To Explore

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email
Share on whatsapp
Free Investment Guide!​
Get a list of the best performing algorithmic trading strategies. Sign up to the Aikido newsletter!