Auto balancing portfolio through new purchases
"Finding the ""optimal"" solution (and even defining what optimal is) would probably take a lot of searching of all the possible combinations of stocks you could buy, given that you can't buy fractional shares. But I'd guess that a simple ""greedy"" algorithm should get you close enough. For any given portfolio state, look at which stock is furthest below the target size - e.g. in your example, S3 is 3.5% away whereas S1 is only 3.1% away and S2 is over-sized. Then decided to buy one stock of S3, recalculate the current proportions, and repeat until you can't buy more stocks because you've invested all the money. If you have to pay a transaction fee for each kind of stock you purchase you might want to calculate this in larger lot sizes or just avoid making really small purchases."
The GnuCash manual has a page with examples of opening new accounts. The tl;dr is: use the Equity:Opening Balance to offset your original amounts. The further explanation from the GnuCash page is: As shown earlier with the Assets:Checking account, the starting   balances in an account are typically assigned to a special account   called Equity:Opening Balance. To start filling in this chart of   account, begin by setting the starting balances for the accounts.   Assume that there is $1000 in the savings account and $500 charged on   the credit card. Open the Assets:Savings account register. Select View from the menu and check to make sure you are in Basic Ledger style. You will   view your transactions in the other modes later, but for now let’s   enter a basic transaction using the basic default style. From the Assets:Savings account register window, enter a basic 2 account transaction to set your starting balance to $1000, transferred   from Equity:Opening Balance. Remember, basic transactions transfer   money from a source account to a destination account. Record the   transaction (press the Enter key, or click on the Enter icon). From the Assets:Checking account register window, enter a basic 2 account transaction to set your starting balance to $1000, transferred   from Equity:Opening Balance. From the Liabilities:Visa account register window, enter a basic 2 account transaction to set your starting balance to $500, transferred   from Equity:Opening Balance. This is done by entering the $500 as a   charge in the Visa account (or decrease in the Opening Balance   account), since it is money you borrowed. Record the transaction   (press the Enter key, or click on the Enter icon). You should now have 3 accounts with opening balances set. Assets:Checking, Assets:Savings, and Liabilities:Visa. "My answer is Microsoft Excel.  Google ""VBA for dummies"" (seriously) and find out if your brokerage offers an 'API'.  With a brief understanding of coding you can get a spreadsheet that is live connected to your brokers data stream.  Say you have a spreadsheet with the 1990 value of each in the first two columns (cells a1 and b1).  Maybe this formula could be the third column, it'll tell you how much to buy or sell to rebalance them.   then to iterate the rebalance, set both a2 and b2 to =C1 and drag the formula through row 25, one row for each year.  It'll probably be a little more work than that, but you get the idea." Most of the “recommendations” are just total market allocations.  Within domestic stocks, the performance rotates. Sometimes large cap outperform, sometimes small cap outperform. You can see the chart here (examine year by year):  https://www.google.com/finance?chdnp=1&chdd=1&chds=1&chdv=1&chvs=maximized&chdeh=0&chfdeh=0&chdet=1428692400000&chddm=99646&chls=IntervalBasedLine&cmpto=NYSEARCA:VO;NYSEARCA:VB&cmptdms=0;0&q=NYSEARCA:VV&ntsp=0&ei=_sIqVbHYB4HDrgGA-oGoDA Conventional wisdom is to buy the entire market. If large cap currently make up 80% of the market, you would allocate 80% of domestic stocks to large cap.  Same case with International Stocks (Developed). If Japan and UK make up the largest market internationally, then so be it.  Similar case with domestic bonds, it is usually total bond market allocation in the beginning.  Then there is the question of when you want to withdraw the money. If you are withdrawing in a couple years, you do not want to expose too much to currency risks, thus you would allocate less to international markets. If you are investing for retirement, you will get the total world market.  Then there is the question of risk tolerance. Bonds are somewhat negatively correlated with Stocks. When stock dips by 5% in a month, bonds might go up by 2%. Under normal circumstances they both go upward. Bond/Stock allocation ratio is by age I’m sure you knew that already.  Then there is the case of Modern portfolio theory. There will be slight adjustments to the ETF weights if it is found that adjusting them would give a smaller portfolio variance, while sacrificing small gains. You can try it yourself using Excel solver.  There is a strategy called Sector Rotation. Google it and you will find examples of overweighting the winners periodically. It is difficult to time the rotation, but Healthcare has somehow consistently outperformed. Nonetheless, those “recommendations” you mentioned are likely to be market allocations again.  The “Robo-advisors” list out every asset allocation in detail to make you feel overwhelmed and resort to using their service. In extreme cases, they can even break down the holdings to 2/3/4 digit Standard Industrial Classification codes, or break down the bond duration etc.  Some “Robo-advisors” would suggest you as many ETF as possible to increase trade commissions (if it isn’t commission free). For example, suggesting you to buy VB, VO, VV instead a VTI. "You don't want to set up your investment account as a savings or spending (budget) account.  There are a couple of reasons.  First, investment account balances change daily based on the market.  If you set it up as a budget account, then your budget category balances would need to have money added or removed from them daily as the market value changes.  Second, because you are investing for retirement, this money will be untouchable for many years; there is no need to include that in your spending budget. Instead, enter your monthly investment amount as an expense transaction (not a transfer to another budget account).  If, for example, you are sending $400 per month to your retirement account, just enter that as a monthly $400 expense out of your checking account, assigning it to a Retirement category.  That money then leaves your budget. If you want to see the value of your investment account in YNAB (so that your Net Worth is accurate), add the account as an investment account.  The value will not affect your budget categories, but it will affect the net worth on the ""All Accounts"" page.  Either set it up as an online account so that the balance will update automatically, or add it as a manual account and simply update the balance manually when you get your monthly statement." "There's nothing to rebalance, the index fund rebalances itself to continue matching the index. However, you need to understand that such an investment is not diversified and you only invest in a very specific market, and very specific stocks on that market. S&P 500 is large (500 different companies, most of the time), but still not as broadly diversified as your retirement investment portfolio should be. You should talk to a financial adviser (CFP for example), many companies provide access to these for 401k plan participants. But in any case, I'd suggest considering ""target date"" funds - funds that are investing based on your expected retirement year, and become more conservative as you get closer to that year." You may want to have a look at DiversifyPortfolio which will give you the info you want plus quite a bit more. They offer various tools all related to stock correlation and diversification. You'll be able to create heatmaps and various other charts showing stock correlations. It also has several scans which allow you to search for stocks that meet your requirements in terms of correlation to existing positions in your portfolio or to specific stocks / ETF's. @bstpierre gave you an example of a portfolio similar to IFA's 70 portfolio. Please, look other variants of example portfolios there and investigate which would suit to you.  Although the example portfolios are not ETF-based, required by the op, you can rather easily check corresponding components with this tool here. Before deciding your portfolio, fire up a spreadsheet (samples here) and do calculations and do not underestimate things below: Bogleheads have already answered this type of questions so why not look there? Less reinventing the wheel: google retirement portfolios site:bogleheads.org. I am not making any recommendations like other replies because financial recommendations devalue. I hope I steered you to the right track, use less time to pick individual funds or stocks and use more time to do your research. "Value averaging has you shift the balance of your portfolio over time, not the amount of contributions.  So you can only do it if you have a portfolio holding both risky assets (shares etc) and some cash. You start out by making a plan about how much you will contribute every month and at what rate you expect the share part of the portfolio to grow.  Perhaps based on 20th century data you think an 8% growth rate is reasonable.  Or alternatively if you know your desired final amount obviously you can work backwards to a desired rate from that. If in any month the share part is falling below its expected growth path, you would put more money into it: possibly your whole paycheck contribution plus some from the savings cash account.  On the other hand if the share component is growing ""too fast"" you would put all your additional savings into cash.  So if your investments are doing well, you're not supposed to spend the excess money, but rather to put it aside into a dedicated cash account to top up your share component when prices fall. In theory, this has the auto-levelling benefit of Dollar Cost Averaging, but even better: when prices are high, you'll automatically buy fewer shares, or even sell some; conversely when prices are low you'll buy extra shares from your reserve account. If it turns out your estimate was unreasonably optimistic, and over your lifetime shares only ever average 3%, you'll end up with an entirely share portfolio, and a bumpier ride than you might have liked.  If you have horrible luck and over your entire investing life shares return less than cash (which has happened, though not yet in the USA), then this will be worse than a standard balanced portfolio. The original book Value Averaging by Edelson has a pretty good explanation of various cases, though I would say some of the examples are worked in excessive detail. I have not implemented this myself, one reason being that the amount I'm able to save from year to year varies, as it probably does for you, and so predicting a path is not quite so simple as he assumes.  You could still do it I suppose. I think you could get a very crude approximation to this by simply directing your savings into cash when the share market's rate of growth over the last several years is above what you think is the long term average." From Vanguard's Best practices for portfolio rebalancing: There will quickly come a time when buying to rebalance is impractical. Consider, you save 10%, and at some point, you have 5x your income saved. (you earn $50K and have accumulated $250K). A simple allocation, 50/50, so $125K stock, $125K bonds. Now, in a year the market is up much over 4%, your $5K deposit will not be enough to balance. Earlier on, the method may work just fine, later on, not so much. Edit - The above is an example, to show that there will come a time when deposits are not enough to rebalance. The above single year produces a 52/48 split, and the rebalance deposits more than 2 years. If the market continues to rise a reasonable amount, 2 years later you are even more out of balance, perhaps 56/44.  I chose reasonable numbers as a starting point, just 5X income saved, and a 10% annual deposit. In the end, you can waive off any divergence from your target. That's your choice. "First, decide on your asset allocation; are you looking for a fund with 60% stocks/risky-stuff, or 40% or 20%? Second, look for funds that have a mix of stocks and bonds. Good keywords would be: ""target retirement,"" ""lifecycle,"" ""balanced,"" ""conservative/moderate allocation."" As you discover these funds, probably the fund website (but at least Morningstar.com) will tell you the percentage in stocks and risk assets, vs. in conservative bonds. Look for funds that have the percentage you decided on, or as close to it as possible. Third, build a list of funds that meet your allocation goal, and compare the details. Are they based on index funds, or are they actively managed? What is the expense ratio? Is the fund from a reputable company? You could certainly ask more questions here if you have several candidates and aren't sure how to choose. For investing in US dollars one can't-go-wrong choice is Vanguard and they have several suitable funds, but unfortunately if you spend in NIS then you should probably invest in that currency, and I don't know anything about funds in Israel. Update: two other options here. One is a financial advisor who agrees to do rebalancing for you. If you get a cheap one, it could be worth it. Two is that some 401k plans have an automatic rebalancing feature, where you have multiple funds but you can set it up so their computer auto-rebalances you. That's almost as good as having a single fund, though it does still encourage some ""mental accounting"" so you'd have to try to only look at the total balance, not the individual fund balances, over time. Anyway both of these could be alternatives ways to go on autopilot, besides a single fund." Quick and dirty paper but pretty interesting.. I'm not in Portfolio Management but I probably would have ended up at the modal number as well.   I don't know the subject deeply enough to answer my own question, but is the bias always toward underestimation of variance? Or is that a complex of the way the problem was set up?   Another question I have for those in investment management; Would this impact asset allocation? Taking as given that your definition of VA involves selling at intermediate times, your question can be made more general.  After all, value averaging is just one special case of a portfolio that rebalances to target weights periodically. Do back-end fees (and front-end fees) harm the value of portfolios that require rebalancing?  The answer is yes, they do.  Those fees are put in place in order to prevent investors from redeeming shares over any but the longest horizons.  Any portfolio that rebalances periodically will involve some periodic selling.  If you invest in a fund with front-end or back-end fees, it is optimal to leave your money in it for as long as possible and not do any rebalancing. If you want to run a portfolio that is at all active (involves rebalancing), then it is probably wise to use no-load funds. These are often some of the best and cheapest funds anyway, but even if front or back end load funds have a lower expense ratio, you will likely lose money on those loads as you rebalance. "The effect of making a single purchase, of size and timing described, would not cause market disequilibrium, it would only hurt you (and your P&L). As @littleadv said, you would be unlikely to get your order filled.  You asked about making a ""sudden"" purchase. Let's say you placed the order and were willing to accept a series of partial fills e.g. in 5,000 or 10,000 share increments at a time, over a period of hours. This would be a more moderate approach. Even spread out over the span of a day, this remains unwise.  A better approach would be to buy small lots over the course of a week or month. But your transaction fees would increase. Investors make money in pink sheets and penny stocks due to increases in share price of 100% (on the low end), with a relatively small number of shares. It isn't feasible to earn speculator profits by purchasing huge blocks (relative to number of shares outstanding) of stock priced < $1.00 USD and profit from merely 25%  price increases on large volume." "For any accounts where you have a wish to keep track of dividends, gains and losses, etc., you will have to set up a an account to hold the separately listed securities.  It looks like you already know how to do this.  Here the trading accounts will help you, especially if you have Finance:Quote set up (to pull security prices from the internet). For the actively-managed accounts, you can just create each managed account and NOT fill it with the separate securities.  You can record the changes in that account in summary each month/year as you prefer. So, you might set up your chart of accounts to include these assets: And this income: The actively-managed accounts will each get set up as Type ""Stock.""  You will create one fake security for each account, which will get your unrealized gains/losses on active accounts showing up in your trading accounts.  The fake securities will NOT be pulling prices from the internet.  Go to     Tools -> Securities Editor -> Add and type in a name such as ""Merrill Lynch Brokerage,"" a symbol such as ""ML1,"" and in the ""Type"" field input something like ""Actively Managed."" In your self-managed accounts, you will record dividends and sales as they occur, and your securities will be set to get quotes online.  You can follow the general GnuCash guides for this.   In your too-many-transactions actively traded accounts, maybe once a month you will gather up your statements and enter the activity in summary to tie the changes in cost basis.  I would suggest making each fake ""share"" equal $1, so if you have a $505 dividend, you buy 505 ""shares"" with it.  So, you might have these transactions for your brokerage account with Merrill Lynch (for example): When you have finished making your period-end summary entries for all the actively-managed accounts, double-check that the share balances of your actively-managed accounts match the cost basis amounts on your statements.  Remember that each fake ""share"" is worth $1 when you enter it.  Once the cost basis is tied, you can go into the price editor (Tools -> Price Editor) and enter a new ""price"" as of the period-end date for each actively-managed account.  The price will be ""Value of Active Acct at Period-End/Cost of Active Acct at Period-End.""  So, if your account was worth $1908 but had a cost basis of $505 on Jan. 31, you would type ""1908/505"" in the price field and Jan. 31, 2017 in the date field. When you run your reports, you will want to choose the price source as ""Nearest in Time"" so that GnuCash grabs the correct quotes. This should make your actively-managed accounts have the correct activity in summary in your GnuCash income accounts and let them work well with the Trading Accounts feature."