Here, we look at how stock dealing can be recorded in a journal in a way that facilitates report visualization.
Account for your stock broker
You should use an account for each stock broker that you deal with.
If you have stocks that are not in the custody of any stock broker or is somehow not listed on any stock broker's system (in some countries, some stocks only show up at central depository of stocks), you can create an account for that central depository too.
You may start with some cash already deposited in the cash account at your stock broker:
2016/07/08 * Opening Balances Assets:Shares:AbneyShares $5000 Equity:Opening Balances
If you have existing stocks, add like this:
2016/07/08 Assets:Shares:AbneyShares 100 "SOMST" @ $50.80 Equity:OpeningBalances
"SOMST" is the code of the stock and the price above is the price of the stock at the time where the opening balance is defined. This gives you accurate historical valuation of your assets. The transactions thus far are recognized as the following:
16-Jul-08 Opening Cash Ass:Shares:AbneyShares $5000 $5000 16-Jul-08 SOMST Opening Balance Ass:Shares:AbneyShares 100 SOMST $5000 100 SOMST
This way, AbneyShares becomes a multi-commodity account. Currently, there's
SOMST in this account.
Here's how to indicate a stock purchase:
2020/02/27 * Buy with cash in acc Assets:Shares:AbneyShares 50 "SOMST" @ $61.30 Assets:Shares:AbneyShares
Notice how the transaction actually involves the same account. In this case, we are using part of the
$2000 that's already available in
AbneyShares (as recorded earlier) to pay for the stock purchase. This transaction is recognized as the following:
20-Feb-27 Buy with cash in acc Ass:Shares:AbneyShares 50 SOMST $5000 150 SOMST Ass:Shares:AbneyShares $-3065 $1935 150 SOMST
Here's how to indiciate a stock sale:
2020/02/28 * Sell Assets:Shares:AbneyShares -100 "SOMST" @ $65.30 Assets:Shares:AbneyShares
This transaction is recognized as the following:
20-Feb-28 Sell Ass:Shares:AbneyShares -100 SOMST $1935 50 SOMST Ass:Shares:AbneyShares $6530 $8465 50 SOMST
Updating stock price
The stock price can be updated with the following line:
P 2020/3/21 16:31:9 SOMST $58.30
Base-currency asset reports (such as the Net Worth) will use the above price to calculate asset value for the date stated.
Stocks that are priced in pence and other sub-units
For markets that are priced in units of a currency (LSE for example are priced in pence), see the Unit Conversion section in Currencies and Commodities. There's a permanent one-liner that you can add to get reports in a single currency unit (i.e. £ instead of pence).
Navigating stock history and obtaining stock balance
You can try the following with a sample: AbneyShares.journal.
To see your current and historical stock balance for a specific broker:
- View the transactions for that broker's account by clicking on the balance for that account. For example:
- Select the period of transactions that you're interested in. For stocks, you will typically want to view the historical transactions in it's entirety, hence click on 'All':
- Transactions can be viewed summarized in the base currency but the multi-commodity view here is super helpful as you then get to see the exact stocks that are transacted.
- Remove all filters on the transaction view if you actually convert stock to cash or vice versa with a cash account that resides with the same stock broker (as per transactions above):
This step is necessary as the default Transaction view does not show transactions of an account with itself. This option indicates that those transactions should be shown too.
If you follow the steps above on the sample journal, you will arrive at a transaction register that looks like this:
16-Jul-08 Opening Cash Ass:Shares:AbneyShares $5000 $5000 16-Jul-08 SOMST Opening Balance Ass:Shares:AbneyShares 100 SOMST $5000 100 SOMST 20-Feb-27 Buy with cash in acc Ass:Shares:AbneyShares 50 SOMST $5000 150 SOMST Ass:Shares:AbneyShares $-3065 $1935 150 SOMST 20-Feb-28 Sell Ass:Shares:AbneyShares -100 SOMST $1935 50 SOMST Ass:Shares:AbneyShares $6530 $8465 50 SOMST
The last two lines expresses the balance of assets in the account, i.e. $8645 and 50 SOMST.
The transactions in this guide are available as a sample journal.