Unrealized gains

Mike Alexander mta at umich.edu
Mon Jun 30 18:51:24 EDT 2008

```--On June 30, 2008 12:16:50 PM -0400 Derek Atkins <warlord at MIT.EDU>
wrote:

> I still don't think I'm being thrown off here.  Honestly, I think the
> Trial Balance report is broken in that it's not properly using the
> PriceDB entries to compute the UNREALIZED gains.  The only time you
> should need to add splits are for actual realized gains (or losses,
> of course).
>
> Let me try to prove my point, and I'll try to do this by using an
> example.  Assume we start out by buying 100 shares of X at date T0
> for price P0.  Then on date T1 we see the price changed to P1.  On
> date T2 we sell 10 shares for price P2.  On T3 we see the price
> is now P3.  Then on T4 we sell another 10 shares for P4.  Just to
> make numbers easy, let's say P[i] = \$i+1 (e.g. P0 = \$1, P1 = \$2, etc).
>
> So we have the following data points:
>
> Date     Action     Txn Shares  Txn Price   Txn Value   Gain/Loss
> -----    ------     ----------  ---------   ---------   ---------
> T0        Buy         100           \$1        \$100         N/A
> T1        None         0            \$2                     N/A
> T2        Sell        -10           \$3         \$30         \$20
> T3        None         0            \$4                     N/A
> T4        Sell        -10           \$5         \$50         \$40
>
> Note that there are NO GAINS at times T1 and T3 because it's JUST
> a pricedb entry.
>
> Similarly, you don't need to RECORD the unrealized gain of the
> 90 shares at time T2 or the 80 shares at time T4 because you can
> compute that FROM the pricedb entry.  The only gain you need to
> record is the actual realized change from the actual exchange.

I think I'm finally beginning to understand why we seem to be talking
past each other here.  I think that we, in fact, basically agree on how
things should work.

You're right that you don't need to record unrealized gains.  In fact
if you use trading accounts you don't need to record realized gains
explicitly (although you can) since they are recorded implicitly in the
trading account activity.  In any real example prices change more or
less continuously so it doesn't make sense to record unrealized gains.
They only matter when you pick a time (and hence a price) for a report.

You're also right that the trial balance and balance sheet reports need
to use the price DB to convert to a common currency so they can make
things balance correctly.  The trading account balances at the time of
the report are a way for the report to know which price DB entries are
relevant for this purpose and how much of each commodity to convert to
the common currency.

I created a small file that contains the transactions T0, T2, and T4
from your message.  All five events are recorded in the price DB, but
T1 and T3 aren't really transactions.  The stock is Amalgamated Widgets
(symbol AMAL) and the date for Tn is June n+1.  I've attached this file
as well as screen shots of the Amalgamated Widgets stock register and
the AMAL trading register.  Note that there aren't any capital gains
accounts in this file and I did not record realized gains explicitly.

I've also attached a copy of the trial balance and balance sheet
reports as of June 30 (assuming no further price changes).  Both
reports were set to use the "Nearest in Time" price from the price DB.
The balance sheet report was told to not compute unrealized gains since
it doesn't need to (and shouldn't) do this if trading account
transactions exist.

If you look at the trial balance report you'll see that the USD trading
account has a debit balance of \$20.  This is the original \$100 purchase
price less the \$80 received as proceeds of the sales.  The AMAL trading
account has a balance of 80 shares of AMAL.  This is converted to \$400
using the price DB entry for T4 (the nearest one to the report date).
That means the net trading account balance in the report is \$380 credit
which is the total gain (realized and unrealized) for AMAL.

If you pick a different date for the report (and hence a different
price DB entry), or if you add a price DB entry, you'll get different
results.  I added a price of \$6 on T5 and then the trial balance report
shows a trading account balance of \$460 which is equal to a realized
gain of \$60 plus an unrealized gain of \$400.  If you run an advanced
portfolio report on this file it correctly calculates both realized and
unrealized gains.

This is not recording unrealized gains.  I agree that this wouldn't
make any sense at all.  It's recording enough information to make it
easy to calculate unrealized gains.  Does this make any sense?

Mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AMALStock.jpg
Type: image/jpeg
Size: 116164 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-user/attachments/20080630/6c89e225/attachment-0002.jpg
-------------- next part --------------
A non-text attachment was scrubbed...
Type: image/jpeg
Size: 163399 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-user/attachments/20080630/6c89e225/attachment-0003.jpg
-------------- next part --------------
Balance Sheet 06/30/2008

Assets
[1]Assets
[2]Current Assets
[3]Checking Account \$9980.00
[4]Investments
[5]Brokerage Account
80 AMAL \$400.00

Total Assets         \$10380.00
__________________________________________________________________
__________________________________________________________________

Liabilities
Total Liabilities         \$0.00
__________________________________________________________________

Equity
[6]Equity
[7]Opening Balances     \$10000.00
Retained Earnings         \$380.00
Total Equity         \$10380.00
__________________________________________________________________

Total Liabilities & Equity         \$10380.00

Exchange rate
1 AMAL \$5.00

References

1. gnc-register:acct-guid=a946c3c95248164d40dc6690fdb70c53
2. gnc-register:acct-guid=1e601053c8ec89c5d09f73083e660974
3. gnc-register:acct-guid=59c7a3010a6434bf20f6e3bac6b60133
4. gnc-register:acct-guid=b25e02877762b2d6120378c097bca1c4
5. gnc-register:acct-guid=685a5a011d60cca6b9f0d6b34319ef4a
6. gnc-register:acct-guid=a4e34d98e332d3afe8cce1a124957663
7. gnc-register:acct-guid=2221680a17f744a5f87bb7fe4fdb8600
-------------- next part --------------
Trial Balance 06/30/2008

Account Name Debit Credit
Assets
Current Assets
Checking Account \$9980.00
Investments
Brokerage Account
Stock
Amalgamated Widgets
80 AMAL \$400.00

Income
CURRENCY
USD \$20.00
NASDAQ
AMAL
80 AMAL \$400.00
Expenses
Equity
Opening Balances     \$10000.00
\$10400.00 \$10400.00

Exchange rate
1 AMAL \$5.00
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Derek.xac
Type: application/octet-stream
Size: 2664 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-user/attachments/20080630/6c89e225/attachment-0001.obj
```