Question about selling stocks

Donald Allen donaldcallen at gmail.com
Mon May 5 13:01:40 EDT 2008


On Mon, May 5, 2008 at 12:24 PM, Derek Atkins <warlord at mit.edu> wrote:
> "Matheus Leite" <matheus at longadata.com> writes:
>
>  > Hi, I am new to gnucash and I am considering using it to track my investments.
>  >
>  > Reading the online manual there is one thing which I don't understand
>  > regarding selling stocks. The example there displays a situation where
>  > you buy a certain quantity of shares for a certain price and later
>  > sells all these shares for a higher price, characterizing a profit
>  > gain. It's recorded in gnucash as a split transaction and the user
>  > needs to know the buying price beforehand
>  > (http://www.gnucash.org/docs/v2.0/C/gnucash-guide/invest-sell1.html).
>  >
>  > In a more realistic scenario, one buy and sells shares of the same
>  > stock multiple times and it's hard to know what was the buying price.
>  > How could I manage stock selling in gnucash, for example, if I bought
>  > 100, 200, 50 and 150 shares of, say, Amazon stocks, at different times
>  > and prices, and later I want to sell them all together? Do I have to
>  > calculate the profit by hand before entering the transaction in
>  > gnucash?
>
>  If you're selling them all at once then you already know your cost
>  basis so it's pretty easy to compute by hand.  But yes, right now
>  (unfortunately) you have to calculate the profit by hand before entering
>  the transaction into gnucash.

Which is actually not that difficult. I use the transaction journal
view of the security account register, so I can see all the opening
transactions in detail. I then use gnucash's ability to evaluate
arithmetic expressions to calculate the gain on each lot, being
careful to use net-of-commission values for both cost of buying and
receipts on selling, and scaling correctly to account for splits
and/or partial lots. For each lot, there will be a split for the
capital gain income and a corresponding zero-share split for the
security. Do the calculation I just described in the capital gain
split in the credit (right) column. If it comes out negative (a
capital loss), gnucash will do the right thing. Always using that
column will insure that the sign of the capital gain will be correct.
Once you've done it a few times, it gets much less complicated to do
than to explain.

/Don


>
>  > Thanks in advance for any response.
>  >
>  > Matheus
>
>  > Please remember to CC this list on all your replies.
>  > You can do this by using Reply-To-List or Reply-All.
>
>  -derek
>
>  --
>        Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
>        Member, MIT Student Information Processing Board  (SIPB)
>        URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
>        warlord at MIT.EDU                        PGP key available
>  _______________________________________________
>  gnucash-user mailing list
>  gnucash-user at gnucash.org
>  https://lists.gnucash.org/mailman/listinfo/gnucash-user
>  -----
>  Please remember to CC this list on all your replies.
>  You can do this by using Reply-To-List or Reply-All.
>


More information about the gnucash-user mailing list