Now that you have build an account hierarchy in the previous section, this section will show you how to populate the accounts with your stock portfolio. During this initial setup of your portfolio, you may have stocks purchased from before you started using GnuCash. For these stocks, follow the instructions in the Setup Your Pre-existing Stocks section below. If your have just purchased your stocks, then use the Buying New Stocks section.
This section will show you how to add stocks to GnuCash assuming that you purchased these stocks from before you started using GnuCash. In this section, we will assume you are using the basic predefined account setup introduced in the previous section, but the principles can be applied to any account hierarchy.
You should have within the top level Asset account, a few levels down, an account entitled Stock. Open the account tree to this level by clicking on the + (plus) signs next to the account names until the tree to fully opened. You will need to create a sub-account (of type stock) under the Stock account for every stock you own. Every stock is a separate account. The naming of these stock accounts is usually done using the stock ticker abbreviation. So, for example, you could name your accounts AMZN and IBM for your Amazon and IBM stocks respectively. Below is a schematic model of the layout (only showing the Assets sub-accounts).
- Assets
- Investments
- Brokerage Accounts
- Mutual Funds
- Market Index
- Stock
- AMZN
- IBM
- Bond
As an example, let's assume that you currently own 100 shares of Amazon stock. First, create the stock account AMZN by selecting the Stock account and click on the menu File -> New Account. The New Account dialog will appear, follow the step below to setup your new stock account.
Name the Account - Usually, use the stock ticker abbreviation, IE: “AMZN”
Create the New Commodity - To use a new stock, you must create the stock as a new commodity
Select Commodity - Click on the “Select” button next to the Commodity line. We must change the commodity from the default (your default currency) to this specific stock. This will bring up the “Select currency/security” dialog.
Commodity Type - Change the type from CURRENCY to (in this example) NASDAQ.
Create the Commodity - Click on the New... button and enter the appropriate information for this stock. The Full name: is “Amazon.com Inc”, the Symbol/abbreviation: is “AMZN”, the Type: should already be “NASDAQ”, the CUSIP or other code is where you can enter some other coding number or text (leave it blank in this example), and finally the Fraction traded should be adjusted to the smallest fraction of this commodity which can be traded, usually 1/100 or 1/10000. Below is what this window should look like when finished:
Save Commodity - Click on the OK button to save this new commodity
Select the Commodity - you should now see the newly create commodity available in the pull down menu for Currency/security. Select it (it is probably already selected) and click on OK.
Finished - You should now have been automatically returned to the New Account dialog, with the Commodity: line set to “AMZN (Amazon.com Inc)”. Click on OK to save this new stock account.
You have now create the Amazon stock account, your main account should look something like this (notice that there are a few extra account here, a bank account, and an equity account):
Open the account register window for this AMZN stock account (double click on it). Here you see the Portfolio view. This gives you an overview of your stock portfolio including the number of shares bought and sold. Obviously, we have not bought or sold any stocks yet, so the Portfolio view should not contain any transactions.
To register the initial 100 shares of this stock that you purchased previously, on the first transaction line, enter the date of the purchase (eg: Jan. 1 2001), a description (eg: Initial Purchase), transfer from Equity: Opening Balances, Shares (eg: 100), and Price (eg: $20). You do not need to fill in the Buy column, as it will be calculated for you. Your AMZN Portfolio view should now appear like this:
Notice that the Balance is in the units of the commodity (AMZN shares) not in currency units. Thus, the balance is 100 (AMZN units) rather than $2000. This is how it should be.
The only difference between setting up a new investment purchase versus the setup for preexisting stocks as described in the previous section is that instead of transferring the money used to purchase the stock from the Equity:Starting Balances account, you use your Asset:Bank account.