Vanguard Adjusted Asset Mix Bookmarklet

Vanguard's "Asset mix" screen is useful, but often I'd like to see what my asset allocation looks like when cash is ignored. To do this I could use a calculator and punch in a few values displayed on that screen, but there's a way to compute this adjusted asset allocation with a single click of the mouse: a bookmarklet.

Vanguard's website has a great "Asset mix" tab on the first screen shown after logging in. This tab shows my portfolio allocation percentages of stocks, bonds, and "short-term reserves" (basically, cash).

For me, any "cash"-like assets I own are not related to my stocks versus bonds allocation. I keep a set amount of cash for emergencies. Therefore I would like to ignore the cash when viewing my asset allocation. When ignoring the cash, hopefully that "76.3%" of stocks is actually closer to my target 85% for stocks.

I don't want to have to remember the exact formula to plug into a calculator whenever I want to see my cash-less adjusted asset allocation. Instead I tinkered around and came up with a few lines of Javascript to compute the adjusted allocation percentages from the values displayed on the Asset mix screen. To run the Javascript I created a bookmarklet:

I created a bookmark in my browser called "Vanguard - Adjusted Asset Mix."

I pasted the following Javascript in as the bookmark "URL":

javascript:(function() {
  const stocksEl = document.querySelector('p.dataPoint.stocks > span.percentage');
  const bondsEl =  document.querySelector('p.dataPoint.bonds > span.percentage');
  const cashEl =  document.querySelector('p.dataPoint.cash > span.percentage');

  const stocksPct = stocksEl.innerText.split('%')[0];
  const bondsPct = bondsEl.innerText.split('%')[0];
  const cashPct = cashEl.innerText.split('%')[0];

  const stocksPctAdj = Math.round(stocksPct/(100.0 - cashPct) * 100 * 100) / 100;
  const bondsPctAdj = Math.round(bondsPct/(100.0 - cashPct) * 100 * 100) / 100;

  stocksEl.innerText = stocksPct + '% (' + stocksPctAdj + '%)';
  bondsEl.innerText = bondsPct + '% (' + bondsPctAdj + '%)';
})();

And that was it. Now whenever I'm viewing Vanguard's "Asset mix" tab, I can simply click on the bookmark and the adjusted asset allocation will be displayed.

As expected, the adjusted percentages for stocks and bonds (in parenthesis) are very close to my target percentages.