8.5. Setting Stock Price
<<< Prev | Chapter 8. Investments | Next >>>

## 8.5. Setting Stock Price

The value of a commodity, such as a stock, must be explicitly set. The stock accounts track the quantity of stocks you own, but the value of the stock is stored in the Price Editor. The values set in the Price Editor can be updated manually or automatically.

### 8.5.1. Initial Price Editor Setup

To use the Price Editor to track a stock value, you must initially insert the stock. To do so, open the Price Editor (Tools -> Price Editor) and click on Add button. Select the appropriate Commodity you want to insert into the Price Editor. At this point, you can input the price of the commodity manually. There are 5 fields in the New Commodity window:

- Commodity - the name of the commodity, must be chosen from the Select... list

- Currency - the currency the in which the Price is expressed.

- Date - date that the price is valid

- Type - one of: Bid (the market buying price), Ask (the market selling price), Last (the last transaction price), Net Asset Value (mutual fund price per share), or Unknown. Stocks and currencies will usually give their quotes as one of bid, ask or last. Mutual funds are often given as net asset value. For other commodities, simply choose "Unknown". This option is for informational purposes only, it is not used by GnuCash.

- Price - the price of one unit of this commodity.

Adding the AMZN commodity to the price editor, with an initial value of $40.50 per share.

Click OK when finished. Once you have performed this initial placement of the commodity into the Price Editor, you will not have to do it again, even if you use the same commodity in another account.

The main price editor window, showing the list of all known commodities.

### 8.5.2. Setting Stock Price Manually

If the value of the commodity (stock) changes, you can adjust the value by entering the Price Editor, selecting the commodity, clicking on edit and entering the new price.

### 8.5.3. Setting Stock Price Automatically

If you have many commodities, you will tire of having to update their prices constantly. GnuCash has the ability to automatically determine the most recent price for your commodities using the Internet. This is accomplished through the Perl module Finance::Quote, which must be installed in order to activate this feature.

To determine if the Perl module Finance::Quote is already installed on your system, type “perldoc Finance::Quote” in a terminal window and look to see if there is any documentation available. If you see the documentation, then the module is installed, if you do not see the documentation, then it has not been installed.

#### 8.5.3.1. Installing Finance::Quote

To install Finance::Quote begin by first closing any GnuCash applications you have running. Second, open a root shell and run the command “update-finance-quote” (without the quotation marks). This will launch a Perl CPAN update session that will go out onto the Internet and install the Finance::Quote module on your system. The update-finance-quote program is interactive, however, with most systems you should be able to answer "no" to the first question: “Are you ready for manual configuration? [yes]” and the update will continue automatically from that point.

After installation is complete, you should run the "dump-finance-quote" test program distributed with GnuCash to test if Finance::Quote is installed and working properly.

| Note
If you feel uncomfortable about performing any of these steps, please either email the GnuCash-user mailing list (gnucash-user@gnucash.org) for help or come to the GnuCash IRC channel on irc.gnome.org. You can also leave out this step and manually update your stock prices.

#### 8.5.3.2. Configuring Finance::Quote

With Finance::Quote installed and functioning correctly, you must configure your GnuCash stock accounts to use this feature to obtain updated price information automatically. For stock accounts that have already been setup, edit the account and select the Get Online Quotes box. You should now be able to modify the popup menus The source for price quotes and The timezone for these quotes. When finished editing the stock account, return to the price editor and click on the Get Quotes button to update your stock prices on the internet.

The command "gnucash --add-price-quotes $HOME/gnucash.xac" can be used to fetch the current prices of your stocks. This can be automated by creating a crontab entry. For example, to update your file every Friday evening after the Wall Street markets close (modify the time accordingly for your time zone), you could add the following to your personal crontab:

0 16 * * 5 gnucash --add-price-quotes $HOME/gnucash.xac > /dev/null 2>&1

### 8.5.4. Displaying Stock Value

The main account window will by default only shows the quantity of each commodity that you own, under the column heading Total. In the case of stocks, this commodity is the number of shares. Often, however, you will want to see the value of your stocks expressed in terms of some monetary unit. This is easily accomplished by entering the main window account options, by clicking on the tool bar Options button, and select to display the account field “Total in Report Currency”. You will see a new column in the main window entitled Total (Report) that will express the value of all commodities in the report currency.

Viewing the value of a stock commodity in the main window using the Total in Report Currency option.

### 8.5.5. Making Stock Value Reports

Gnucash offers three alternatives to determine stock prices in reports:

Determining the value of a stock commodity in a report by setting the Price Source option.

- Weighted Average - gives you a graph of the weighted price of all transactions. It will not take into account prices defined in the price editor.

- Most recent - displays the changing value of your stocks based solely on the most recent price available from the price editor. The price figuring in your stock transactions is not considered.

- Nearest in time - the graph is exclusively based on the prices available from the price editor. The value of your stock at each step and point in time is calculated based on the nearest available price in the price editor.

Tracking what value your stocks would've had on the stock exchanges.

<<< Prev | Home | Next >>>
8.4. Setup Stock Portfolio | Up | 8.6. Dividends