reports and prices [Patch] reworked advanced-portfolio.scm

Andrew Sackville-West andrew at farwestbilliards.com
Sun Feb 19 15:41:36 EST 2006


On Sun, 19 Feb 2006 12:20:42 -0800
Andrew Sackville-West <andrew at farwestbilliards.com> wrote:

><<snipped>>
> 
> I've done some more testing using different options for price source
> and whether to show gains or not and the report, as currently modified
> in my tree shows no difference between these various settings. I need
> to go back to an earlier version of this report and see how it behaves. 

I've done some testing with the original version of the report and
afaict its not working properly either.

I have an account with a purchase of fakestock on 2/8/06 at 12.35 a
share, ten shares. then I have a pricedb entry same day that reflects
this. Then I entered another purchase of 10 shares at $15.00 a share
two days later. Regardless of the report settings, it always reports
incorrect information. It reports 20 shares at $12.35 price and shows
total value of $248.50 (20*12.35) total money in at 273.50  (123.50 +
150) and a negative gain (-6.xx% i think). Well, this is plain wrong
and the report should be able to pick up that price change from the
purchase two days later and should show a positive gain because I have
shares purchased at a lower price than current value. Am I right in
this assessment?

A

> 
> What I'm having trouble wrapping my head around is how it should behave.
> 
> In my opinion, it should essentially show a snapshot of the value of
> the portfolio at a given point in time. That is, for each stock, it
> should provide a a total value of the stock owned at the date specified
> in the report. So what is the source of that stock value information?
> there are two possible sources 1) the pricedb and 2) the actual
> transactions.  In my opinion, the default should be to check both of
> these, see which is closer to the specified date and return that value
> * number of shares held. All the other computations (% gain, total
> return) are completed using that value. 
> 
> It seems to me that this should be fairly straightforward and that
> there is no real conflict between the two sources of data, unless they
> have differing values entered for the same date. In which case, we'd
> have to give one a precendent over the other. (IMO, that should be the
> transactions. a purchase or sale of a stock at a particular price is
> "Real" data whereas a pricedb entry is not). 
> 
> So, am I on the right track here? 
> 
> And how does what you have said below affect that? It should be fairly
> straightforward to search the two sources of price data and pick the
> one that more closely matches the date of the report and spew that
> information. 
> 
> thanks all for your continued help with this.
> 
> A
> 
> > 
> > The report that shows the development of a price over time (the "Price 
> > Scatterplot"), as well as all the other reports that depend on exchange 
> > prices, has therefore the option of choosing the "price source". I 
> > implemented that at the time because to me the only meaningful choices here 
> > were 1. either prices from the pricedb, *or* 2. implicit prices, but no mix 
> > of both. That's why the option "price source" has one choice to use the 
> > "implicit prices" and two other choices that will use prices "from the 
> > pricedb". So the solution to this two choices has been to give the user the 
> > option to choose between one out of two methods. I'm actually quite sure that 
> > any mix between both methods, at least for the same commodity, really doesn't 
> > give meaningful results. The "exchange-fn" IIRC should be the abstraction to 
> > provide access to both methods the same way. The way the exchange-fn was 
> > calculated is probably not the most efficient one, but at least it gave 
> > accurate results for the choices that were available. 
> > 
> > However, although I coded quite a lot of the multi-currency stuff, this is all 
> > now quite a long time ago and I don't remember anything I ever did at the 
> > time. Hopefully I added enough comments in the scheme code.
> > 
> > In summary: The question of the price source has been an issue since the 
> > introduction of the pricedb to gnucash, and it had to be solved in all 
> > multi-commodity reports, not only the advanced-portfolio.scm. If you think 
> > the available reportsystem-wide implementation needs changes, you are of 
> > course welcome to do them, but please keep in mind that this whole issue is 
> > really not trivial. In particular, both price source options are pretty much 
> > orthogonal to each other and I haven't heard any convincing proposal to mix 
> > them, so I'd rather suggest to continue to treat both separately at some 
> > level.
> > 
> > Regards,
> > 
> > Christian
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20060219/2444670a/attachment.bin


More information about the gnucash-devel mailing list