To setup investment accounts in GnuCash you can either use the predefined investment account hierarchy
      or create your own. The minimum you need to do to track investments is to setup an asset
      account for each type of investment you own. However, as we have seen in previous chapters, it
      is usually more logical to create a structured account hierarchy, grouping related investments
      together. For example, you may want to group all your publicly traded stocks under a parent
      account named after the brokerage firm you used to buy the stocks.
    
|  | Note | 
|---|---|
| Regardless of how you setup your account hierarchy, remember that you can always move accounts around later (without losing the work you’ve put into them), so your initial account hierarchy does not have to be perfect. | |
The Investment Accounts option of the New Account Hierarchy
        Setup assistant will automatically create a basic investment account hierarchy
        for you. To access the predefined investment accounts hierarchy, you must make sure your
        GnuCash file is open, switch to the Accounts tab, and choose
         → 
        . This will run the New Account Hierarchy Setup assistant and allow you
        to select additional accounts to add to your account hierarchy. Choose the
        Investment Accounts option (along with any others you are interested
        in). Assuming only investment accounts were selected, this will create an account hierarchy
        as shown below.
      
|  | Tip | 
|---|---|
| You can also run the New Account Hierarchy Setup assistant by creating a new
           | |
You will probably at least want to add a Bank account to the Assets account and probably an Equity:Opening Balances account, as we have done in previous chapters. Don’t forget to save your new account file with a relevant name!
If you want to set up your own investment accounts hierarchy, you may of course do so. Investments usually have a number of associated accounts that need to be created: an asset account to track the investment itself; an income account to track dividend transactions; and expense accounts to track investment fees and commissions.
In a typical account structure, security accounts are sub accounts of an asset account representing an account at a brokerage firm. The brokerage account would be denominated in your local currency and it would include sub accounts for each security that you trade there.
Related purchases, sales, income and expense accounts should also be in the same currency as the brokerage account.
The security sub accounts would each be configured to contain units of a single security selected from the master (user defined) security list and they are expected to use the same currency as the brokerage account.
Security prices are kept in the Price Database of GnuCash (see
        Section 9.6, “Setting Share Price”). This contains prices for individual securities (not
        security accounts). All prices for an individual security are in a single currency. If a
        security is traded in multiple currencies, then a separate security and separate accounts
        should be set up for each currency.
      
The following is a somewhat more complicated example of setting up GnuCash to track your investments,
        which has the advantage that it groups each different investment under the brokerage that
        deals with the investments. This way it is easier to compare the statements you get from
        your brokerage with the accounts you have in GnuCash and spot where GnuCash differs from the
        statement.
 Assets
    Investments
       Brokerage Accounts
          I*Trade
             Stocks
                ACME Corp
             Money Market Funds
                I*Trade Municipal Fund
             Cash
          My Stockbroker
             Money Market Funds
                Active Assets Fund
             Government Securities
                Treas Bond xxx
                Treas Note yyy
             Mutual Funds
                Fund A
                Fund B
             Cash
 Income
    Investments
       Brokerage Accounts
          Capital Gains
             I*Trade
             My Stockbroker
          Dividends
             I*Trade
                Taxable
                Non-taxable
             My Stockbroker
                Taxable
                Non-taxable
          Interest Income
             I*Trade
                Taxable
                Non-taxable
             My Stockbroker
                Taxable
                Non-taxable
 Expenses
    Investment Expenses
       Commissions
          I*Trade
          My Stockbroker
       Management Fees
          I*Trade
          My Stockbroker
|  | Tip | 
|---|---|
| There really is no standard way to set up your investment account hierarchy. Play around, try different layouts until you find something which divides your investment accounts into logical groups which make sense to you. | |