Hi team,
In the attached image we see a ledger for a fake investment account. I manually entered three transactions.
At the bottom it says Investment Value is $780 however, I do not know where does it get that from? Can anyone help me understand?
Also, see the prices in the price database.
After two purchases and one sale, you own 13 shares. The most recent price is $60. 13 * 60 = 780. Investment value is number of shares time price.
ugh.. I feel so bad.
I can’t understand now why I did not see that.
I was too concerned that the 50 + 150 - 120 did not equal 780. 
thanks.
For my next riddle… on the same test dataset…
I cannot figure out what this report is saying. 
Anything you can see that I am just missing again? Why is the buy value negative?
wait..
I think I am onto something.
My cost basis was for 2 shares. I originally bought 5 shares at 10 dollars each.
So 2 of those shares were worth 20 dollars.
Then I sold 2 of them at 60 dollars: 120 dollars.
So 120 dollars (sold) - 20 dollars(cost basis) = 100 profit.
But why is the 20 negative though? that still throws me off.
Am I correct in all of this?
For the realized capital gains (as shown in that report) you bought 2 shares (part of the 5) for $20, and then sold them for $120 (assuming FIFO (first bought/in, first sold/out.)) The shares were thus sold for $100 more than they were bought for, which matches the reported gains. I wonder if the $-20 is just showing a sign flip somewhere. Time to dig into the code.
oy… I will try but the code is advanced (kudos to you all) and I am still learning. 
I did another test.
I sold 4 shares at 50 dollars.
3 of the 4 shares had a cost basis of 10 dollars.
the remaining one had a cost bases of 15 dollars.
The report updated the report and it showed accurate numbers. -65 for the cost basis and the 320 for the sell value. (I don’t know if -65 is accurate or not, I would think an absolute value is best here for display purposes)
Gain of 255.
If I used my abacus correctly, this is the correct number for FIFO.
The IRS (taxing authority in the USA) allows many methods of calculating your gains for tax purposes however, that I know of, FIFO is the simplest and most preferred. Is it safe to assume that kMyMoney is designed for FIFO? (based on what I see, it is just wondering if anyone can confirm)
This is old code and my best guess is that, yes, KMM does use FIFO to calculate capital gains.
I also agree, both buy and sell values (both shares and price) are positive numbers. No absolute value really needed. Gain can be positive or negative, unless you explicitly label it as loss.
However please recheck your numbers. (I an assuming this is a second sell transaction, not a revision of the first.) Buying 3 at $10 plus 1 at $15 is $45. Selling 4 at $50 is $200. Not sure where you got the $65 and $320.
I left the original shares I sold (2 at 60) there.
2 sold at 60 (120 revenue)- bought at 10 dollars (20 cost basis)
3 sold at 50 (150 revenue)- bought at 10 dollars (30 cost basis)
1 sold at 50 (50 revenue)- bought at 15 dollars (15 cost basis)
320 revenue - 65 cost basis = 255 profit.
I think it is correct.
Do you think I should open a bug report on the negative cost basis, or does it make sense the way it is?
OK - you were reporting the gains on both transactions, I was only doing the second.
No bug report yet - let me try to confirm from scratch, and see if a quick peek into the code shows me anything useful (I’m not much better there than you are.) It’s also good to confirm it hasn’t already been reported.
I thought that the buy amount always shows up as a negative number. I have found that disconcerting for years, but have come to accept that.
A