Summary: | Dashboard "Shares & Indexes" shows wrong percentaged variation | ||
---|---|---|---|
Product: | [Applications] skrooge | Reporter: | Christoph Vogtländer <kde> |
Component: | general | Assignee: | Stephane MANKOWSKI <stephane> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | stephane |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | macOS | ||
Latest Commit: | Version Fixed In: |
Description
Christoph Vogtländer
2010-09-07 00:33:16 UTC
Hi, The percentage is computed by this: 100*(EXP(LN(v2/v1)/(d1.daysTo(d2)))-1) Where, v1 and v2 are values and d1 and d3 are dates. In you case, the result is: 100*(EXP(LN(6155,04/6134,62 )/3)-1)=0.11% The problem is that, between Fridays and Monday, we have 3 days. The expected result is : 100*(EXP(LN(6155,04/6134,62 )/1)-1)=0.33% because we should use only "working" days I will check how to do that. Are you sure it is correct to divide by the number of days at all? If, for example, the values cannot be downloaded and values are entered manually every now and then imho it would be wrong to calculate the percentage based on the above formula. I think it would be better to assume the value stays as it was. This would also work around weekends, holidays and days where stock market (or a particular index) is closed for other reasons. What do you think? You are right, it's better to keep it like this. This is not what i meant. I propose to change the formula to: 100*(EXP(LN(v2/v1))-1) Sorry, I don't want to argue, and I think this it is not a very important issue. No offense. Please change back to WONTFIX if do not want to change this. Hi Christophe, Sorry for the misunderstanding. The right formula to compute the "daily" rate is: 100*(EXP(LN(v2/v1)/(d1.daysTo(d2)))-1) The problem is that in you case d1.daysTo(d2) returns 3 even if there is only 1 "working" day. I can not use systematically the following formula because some people are downloading only one value per month. So, I need a way to compute "working" days between 2 dates. SVN commit 1173419 by smankowski: BUG: 250403: Dashboard "Shares & Indexes" shows wrong percentaged variation M +1 -0 CHANGELOG M +1 -1 skgbankmodeler/skgunitobject.cpp M +14 -0 skgbasemodeler/skgservices.cpp M +8 -0 skgbasemodeler/skgservices.h M +6 -0 skgbasemodelertest/skgtestbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1173419 |