8.7. Selling Stocks

Entering an investment you are selling is done in the same way as buying one except the total cost of the transaction is entered in the Sell column and the Shares column is entered as a negative amount. The proceeds from the sale should be transferred from the stock account to your bank account.

The proper recording of the stock sale *must* be done using a split transaction. In the split transaction, you must account for the profit (or loss) as coming from an Income:Capital Gains account (or Expense:Capital Loss). To balance this income, you will need to enter the stock asset twice in the split. Once to record the actual sale (using the correct number of shares and correct price per share) and once to balance the income profit (setting the number of shares to 0 and price per share to 0).

In the split transaction scheme presented below, the symbol NUM_SHARES is the number of shares you are selling, SELL_PRICE is the price for which you sold the shares, GROSS_TOTAL is the total price for which you sold shares, equal to NUM_SHARES*SELL_PRICE. PROFIT is the amount of money you made on the sale. COMMISSIONS are the brokerage commissions. NET_SALE is the net amount of money received from the sale, equal to GROSS_TOTAL - COMMISSIONS.

Table 8.1. Selling Stock Split Transaction Scheme

AccountNumber of SharesShare PriceTotal BuyTotal Sell
Asset:Bank  NET_SALE 
Asset:Stock:SYMBOL-NUM_SHARESSELL_PRICE GROSS_SALE
Asset:Stock:SYMBOL  PROFIT 
Income:Capital Gains   PROFIT
Expenses:Commissions  COMMISSION 

If you will be recording the sale of the stock as a capital gain (or loss), please see the chapter "Depreciation and Capital Gains" for more information on this topic.

8.7.1. Example

As an example, assume you bought 100 shares of a stock for $20 per share, then later sell them all for $30 per share. In the split transaction scheme above, PRICEBUY is $20 (the original buying price), NUMSHARES is 100, TOTALBUY is $2000 (the original buying price), TOTALPROFIT is $1000, and finally TOTALSALE is $3000.

Selling Stock Example

An example of selling stock. You bought 100 shares of AMZN for $20 per share, and sold for $30.