I see and understand. The RG is currently based on average sale price
Over a set of transactions, the following algorithm is used per each
security
Total Sales are calculated
Total Shares sold are calculated
Avg Sale Price is calculated as: Total Sales / Total Shares
RG is calculated as: (Avg Sale Price - Cost Basis Per Share) * Total
Shares Sold
The code can be viewed at the link below.
http://jgnash.svn.sourceforge.net/viewvc/jgnash/jgnash2/trunk/src/jgnash/engine/InvestmentPerformanceSummary.java?revision=2133&view=markup
The above calculate correlates well with other portfolio reporting
applications. That does not mean it is correct, and maybe there should
be an option for both forms of calculations.
I had planned to go back at a later date and add Lot based calculations
to support real time gains calculations. This would support a FIFO
based calculation.
On the slate next is to merge in a change to support reversed sign on
certain type of reporting for non-accountants for the 2.5.0 release,
and being adding budgeting functionality for 2.6.0 along with a
database upgrade.
I will add FIFO based calculation to the TODO list, and if you want,
you could create a new feature request on SF. I do want to knock out
budgeting to round out the feature set of jGnash.
Thanks,
Craig