Wednesday, April 29, 2020

Portfolio Rebalancing Based on Expected Profit and Trading Costs (Redux)

The idea of rebalancing a portfolio to maintain target asset allocation percentages is simple in theory, but tricky in practice. It is not obvious how far asset class percentages should be away from their targets before it makes sense to rebalance. I have recently improved a scheme that I have now fully automated in my portfolio spreadsheet. Instead of obsessing over my portfolio’s returns, a script emails me when I need to rebalance.

Investors should use any new savings or withdrawals they make as opportunities to rebalance by buying low asset classes or selling high ones. However, as a portfolio grows, rebalancing with new savings and withdrawals is unlikely to be enough to maintain balance when asset classes have big swings.

Common advice is to rebalance a portfolio on a fixed schedule, such as yearly. This has the advantage of allowing investors to avoid obsessing over their portfolios all the time, but has the disadvantage of missing potentially profitable opportunities to rebalance. Computing thresholds automatically in a spreadsheet permits me to ignore my portfolio unless my script emails me. This gives me the advantages of threshold rebalancing without the disadvantage of constant monitoring.

When choosing rebalancing thresholds, most experts advise investors to either use percentage thresholds or dollar amount thresholds. For example, you might rebalance whenever you’re off target by more than 5%, or alternatively by more than $2000. However, these approaches don’t work for all portfolio sizes. Percentage thresholds lead to pointless rebalancing in small portfolios, and dollar amount thresholds lead to hourly trading in very large portfolios. We need something between these two approaches.

Computing Thresholds

When asset class A rises relative to asset class B, and then A drops back down again to the original level relative to B, rebalancing produces a profit over just holding. I compute rebalancing thresholds based on the idea that the expected profit from rebalancing should be 20 times the ETF trading costs.

All the mathematical details of how I compute rebalancing thresholds are in the updated paper Portfolio Rebalancing Strategy. I’ll just give the results here.

I have a sub-portfolio with 3 U.S. ETFs. To keep them in balance relative to each other, the spreadsheet starts by computing the following quantities for each ETF:

m – Current portfolio total value times the target allocation percentage. This is the target dollar amount for this ETF.
s – Bid-ask spread divided by the ETF share price.

Other parameters are

c – Trading commission.
f – Desired ratio of trading costs to expected profits. I use 0.05 so that the expected profits from rebalancing are 20 times the trading costs.

The dollar amount threshold for rebalancing then works out to the following formula which may seem a little intimidating, but it only has to go into a spreadsheet once.

t = (m/(2f)) * (s + sqrt(s*s + 8*f*c/m)).

So, it makes sense to rebalance an asset class if its dollar level is below m-t or above m+t. As long as there are at least two asset classes far enough out of balance (with at least one too high and at least one too low), it makes sense to rebalance.

This method works fairly well when the target allocation percentages are close enough to equal. The new part of this work that I completed recently is a more accurate method when there are only two asset classes, but their allocation percentages aren’t necessarily close to equal.

This applies to my case in two ways. I view my stocks as a sub-portfolio with one part denominated in Canadian dollars (30%) and one part denominated in U.S. dollars (70%). The U.S. part contains the 3 U.S. ETFs I mentioned earlier. One level above this, I view my overall portfolio as one part stocks (currently about 80%) and one part bonds (currently about 20%). This bond percentage will rise as I get further into retirement.

The new method for two asset classes looks remarkably similar to the old method. Consider the case of stock/bond rebalancing. Let m be the target dollar amount for stocks and b be the target dollar amount for bonds. Let m’ be the harmonic mean of m and b:

m’ = 2/(1/m + 1/b).

Then the formula for the threshold dollar amount is the same as the earlier formula, except that we replace m with m’:

t = (m’/(2f)) * (s + sqrt(s*s + 8*f*c/m’)).

If the stocks and bonds get further away from their target amounts by more than t, then it’s time to rebalance. The full paper gives further details on how the commission amount c and the bid-ask spread s should be adjusted in cases where extra trading is required, such as when rebalancing involves currency exchange with Norbert’s Gambit.

The difference between this two-asset class method and the earlier method is that the new method gives a lower threshold. The old method would give a very low threshold for the asset class with the smaller target percentage, but a high threshold for the other asset class. But we only rebalance when both thresholds are met. So, the higher threshold dominates. The new more accurate method gives a lower overall threshold, so that we can better take advantage of rebalancing opportunities.


It took me a while to work all this out, but now I don’t have to pay much attention to my portfolio. When I have some money to add, I buy the asset class that my spreadsheet says is furthest below its allocation, and occasionally I get an email telling me to rebalance.

Many readers have asked for a generic version of my portfolio spreadsheet, and I’ve tried to produce one a number of times. But, it’s difficult to make it general enough to be useful. I’m happy to answer questions for those looking to create their own spreadsheets, but I’m unlikely to produce a generic version to work from.


  1. Michael, I love the in-depth analysis of this post. Posts like these are why I started and continue to follow your blog. It will take me awhile to chew through, but I intend to attempt to make use of this.

    I have skimmed the full paper, but haven't read it in depth. So if the answer is in there, feel free to just redirect me (I don't want you to rewrite your paper in the comments!).

    One tricky part of all this seems to be in choosing the "correct" value of 'f'. Why not set it much higher, like 0.5? I'm sure using a value like this would have you trading non-stop all day every day. This is perhaps an extreme example where conditions might change so fast underfoot that by the time you executed the trade, the conditions leading to attempt the trade no longer held by the time the trade was executed.

    But let's assume rapid market changes aren't a factor. Why not settle for less of a profit per trade?

    My own thinking on this leads me to think that overall profitability of rebalancing depends on the sequence of trades on a particular holding. If this rebalancing causes you to buy, sell, buy, sell, etc, you are making a certain profit each time. But if you buy, buy, buy on one holding and sell, sell, sell on another, then these trades represent lost gains.

    The value in these "losing" trades is keeping your relative risk profile in check. But if the risk was only drifting by a couple of tenths of a percent each time, there probably isn't a lot of value. Fixed thresholds probably do a reasonable job of achieving this aspect of risk management?

    Of course, we can't really come up with a forumla to tell trade at the right time to get the magic buy/sell/buy/sell sequence of trades that profit every time. That's what active investors try to do, but usually fail at.

    I do think there is value in this line of thinking, but this aspect still has be scratching my head a bit. Do you have any thoughts in this area to help colour my thinking?

    Thanks for sharing this work!

    1. Hi Returns Reaper,

      You make some excellent observations, particularly about the disadvantages of rebalancing in the same direction multiple times in a row.

      My first answer to why not use f=0.5 is that threshold rebalancing often gets triggered during market turmoil, a time when spreads are unusually high and spread costs in trading are high. I tend to think of the spread fraction s as a fixed value (different for each ETF based on its typical spread). But s actually fluctuates, so I use a low f as a safety margin against the possibility of unprofitable rebalancing trades when spreads are high.

      Another fact to consider is that rebalancing profit is proportional to r*r, which is proportional to somewhere between 1/f and 1/(f*f). So, if you increase f by a factor of 10, rebalancing profit decreases by a factor of between 10 and 100. So, setting f high leads to picking up nickels at a modest profit.

      I don't have any justification for the particular choice of f=1/20 other than a gut feel. I'm confident it is reasonably safe, but I can't say whether it is better than f=1/10 or f=1/40.

      It's important to keep in mind that the main purpose of rebalancing is to control risk. Although I've framed the choice of rebalancing thresholds in terms of profits, my real motivation was to have thresholds high enough to avoid trading losses, but low enough to stay reasonably close to balanced.

      I'm not sure of exactly what you're asking with "Fixed thresholds probably do a reasonable job of achieving this aspect of risk management?" Some people think of fixed thresholds as fixed percentages. The risk here is for those with small portfolios trading too often and losing on commissions. Some people think of fixed thresholds as fixed dollar amounts. The risk here is for those with large portfolios trading too often and losing on spreads.

      I've seen some evidence of those with extensive experience with rebalancing saying to use certain percentages, but use wider percentages for small accounts. This is kind of a hand-wavy version of what I've formalized with some math.

  2. Interesting as always, Michael. I just wonder if in a taxable account, would you consider the capital gain tax you might have to pay in selling a too-high holding in the rebalancing cost calculation?

    1. Anonymous: Because I view the collection of accounts by wife and I have as a single portfolio, I'm able to find a way to rebalance without selling stocks within taxable accounts (or at least that's been true so far). But you're right that all costs count. If you're considering rebalancing and it would trigger capital gains taxes, that cost matters.

  3. This is an awesome post, and thank you. Can you share anything about how you are live-capturing bid-ask spreads? Today I am (trying to) do this using a Google Docs sheet that scraps Bid-Ask from Yahoo Finance!, but I am finding this method not reliable.

    1. Anonymous: I haven't found a reliable way to live-capture the spreads. I sampled them many times and a few times and choose a slightly above-average value. I've also found average figures online. So, I just have static values. This is part of why I use f=5%; I don't want to start making unprofitable trades when the market is volatile and spreads are high. I check the spreads before making a trade as well. The other reason for a lower f is that higher values lead to a lot of low-profit trades, which just wastes my time.

    2. Thanks for the quick reply. Maybe I should just resort to averages too, I'm probably going a bit too Captain Ahab trying to get this thing to work for too long. Just irks me now that I can't figure it out. :) I just feel like I'd have to check more regularly because I use more TSX-listed funds than you do (I think) and I find some of the spreads tend to be a bit larger in these than the big, liquid US funds like VTI, etc. Perhaps as you say I just compensate for this with a bigger f. (but then having an elaborate formula and slapping a huge fudge-factor constant in front of it is also offending my inner mathematical purist)

      I should go back to work now.

    3. Anonymous: The critical thing with rebalancing is to avoid the zones where you're trading for net losses or completely missing profitable trades. The acceptable range is very wide.

  4. Hi Michael, I thought I'd report back that I've finally spent the time to add the rebalancing logic from your paper into my spreadsheet, then wrote a script to check once per day and email me if rebalancing is required.

    I was actually surprised at how easy it was. I wasn't aware of google sheets' GOOGLEFINANCE() macro, which makes getting current prices dead simple.

    It would be nice if there was some way to automatically get my sheet to query my account to get up-to-date cash balances, but I can't think of a way of storing credentials that wouldn't invalidate terms with my bank. As it is now, I just maintain number of shares of each holding (update each time I make a trade) and either when it is time to rebalance or every few months I update my cash position manually.

    I'm sure its possible to automatically update my spreadsheet when funds distribute dividends, and I could also account for my automatic contributions. I'm not sure it is worth the effort however.

    I had also never before written any kind of google sheets script, and was impressed at how simple it was to poll the spreadsheet and send an email.

    It's very nice having all of this in place. I'm sure I missed some rebalance opportunities with the recent volatility, which is a shame. But it's nice that I'm setup to not miss future opportunities.

    Thanks for the legwork you put into making this publicly available.

    1. Hi Returns Reaper,

      You're welcome. I just manually update cash levels as well. Your setup sounds very similar to mine.

    2. Not sure which broker you use but Questrade actually has a read-only API that allows you to pull your account data directly from them with your own hand-code. I haven't tried to figure out how to work it yet and not sure if other brokers offer anything similar. Google Questrade API.

    3. Anonymous: Cool. If this COVID-19 isolation thing extends into the fall and winter, I might be tempted to switch from Investorline to Questrade just so I'll having something to do with my spreadsheet. I suppose I should check if this sort of thing exists for Investorline.

  5. @Michael since implementing this rebalancing logic, I've been triggered to rebalance once. It has come very close in other cases (one side could rebalance, but not the other). It's nice having this setup where I can just ignore it and get emailed when I need to act.

    But today I got an email from my broker (as I have occasionally in the past as well) telling me that if I qualify as an active trader (150 trades or more per quarter) that my commissions would be zero. Overactive trading can be dangerous, I do understand that. My initial reaction (as in the past) was to ignore this. But then I wondered how the rebalancing equation would change if there were no commissions?

    I entered the '0' trade cost into my spreadsheet and found that for most of my holdings the threshold to make a trade dropped from several thousand dollars "out of balance" to a few hundred dollars. With such small thresholds, I could well imagine exceeding 150 trades per quarter.

    A secondary question I'd have to ask myself is whether I want to spend so much time making these rebalancing trades. Perhaps in the "trade cost" calculation I should estimate the time required to make a trade and assign some value to that time.

    This just got me thinking. I can't see myself actually making trades based on thresholds of a few hundred dollars. There's also the added gotcha that you have to pay for 150 trades in a quarter before you become eligble for free trades. So you will have to pay around $1,000 in trades before you get the free tier status. Then you'll have to keep making "free" trades to maintain your status. This feels like a poor use of my time, even if I could theoretically improve my returns by some small amount.

    Have you considered what you might do differently if trades were "free"? IIRC you have some or all of your portfolio with Questrade where one side of the transaction is free, but not both sides.

    1. Hi Returns Reaper,

      Those are some interesting questions. If the commission cost were truly zero, then I think you're right that it makes sense to assign some value to your time. I've never been fully at ease about the factor of 20 I use (I insist that the expected profit from rebalancing once in each direction exceeds the trading costs by a factor of 1/f = 20). I know it needs to be there, and I think you've added another reason why: your time has value. The other reasons I used it were 1) a buffer against invisible trade costs if the broker isn't getting the best price, and 2) ensuring that you get the lion's share of any rebalancing profits instead of giving it all away in trading costs. So, we could have a more complex model where we replace commission cost c with c+v (where v is the value of your time), and replace the spread fraction s with s+u (where u is an uncertainty fraction), and then reduce the factor of 20 to 5 or 10. Doing something like this would give better answers when commissions are zero.

      Of course, as you point out, your commissions wouldn't really be very close to zero unless you do an enormous amount of trading.

      Actually, I've stayed at BMO InvestorLine. Some aspects of Questrade look better, but the difference hasn't been big enough to get me to abandon familiarity.