Bug 244561 - Report "Investment Performance by Account" incorrect and slow
Summary: Report "Investment Performance by Account" incorrect and slow
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-14 03:26 UTC by Jan
Modified: 2010-07-19 02:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan 2010-07-14 03:26:44 UTC
Version:           unspecified (using KDE 1.2) 
OS:                Linux

The Report "Investment Performance by Account" seems correct for accounts in the base currency (USD) but totally incorrect for an account in a foreign currency (EUR).  Annualized Returns listed vary from -13% to +1,714,074% when converting to base currency and -16% to 41,157,361% when not converting.  Several values are exactly 100.00%.  Return-on-Investment values are also incorrect (tens of thousands of %).  The report further takes a very long time to generate.

Reproducible: Always

Steps to Reproduce:
Generate mentioned report, customized or not.



Wrong pointers used for Return columns?
Comment 1 Jan 2010-07-14 03:28:52 UTC
KMyMoney 1.0.4 (KDE 3.5.10)
Comment 2 Alvaro Soliverez 2010-07-14 03:38:10 UTC
I need an anonymized version of your file, plus your price precision settings.
Comment 3 Jan 2010-07-17 14:01:05 UTC
Dear Alvaro,

 
> --- Comment #2 from Alvaro Soliverez <asoliverez gmail com>  2010-07-14
> 03:38:10 --- I need an anonymized version of your file, plus your price
> precision settings.

Please find attached the requested anonymized file.  This is not the complete 
file.  I removed many accounts and transactions.  As a result, performance to 
generate the report is no longer an issue.  However, the Investment 
Performance by Account is still incorrect.  Many annualized returns are 
exactly 100%.  Some other values are, in the non-anonymized file, but with 
their names translated to the anonymized symbols:

A000300:  922,678.82%
A000297:  73,697.53%
A000288:  36,818.27%
A000290:  190,383.57%

Clearly incorrect return on investment (ROI) values are:

A000296:  16,260.60%
A000300:  14,055.65%
A000288:  2,369.68%
A000290:  5,914.65%

In the anonymized report, values are completely different, but I suppose that 
is normal.

Please do not hesitate to ask if you need any more information.  Thanks for 
looking into this, and kind regards,

Jan Clinckemaillie


BTW:  the non-anonymized file hangs when trying to edit some investments, but I 
could not reproduce it in the anonymized version; cf. my bug 238454.
Comment 4 Alvaro Soliverez 2010-07-17 14:07:53 UTC
You have to upload the file on the web page of the bug. It won't work by sending it on the email, unless you send directly to the kmymoney mailing list.
Comment 5 Alvaro Soliverez 2010-07-17 19:03:59 UTC
Please make sure you have a price from the commodity to the currency of the commodity for all your investments. The calculations are of course way off, because it will default to 1 if it doesn't find a suitable price.
Comment 6 Alvaro Soliverez 2010-07-17 19:15:11 UTC
The QIF import process apparently loaded the prices for the stock to USD, not EUR, which is the correct currency for those investments. Correcting this will probably fix the issues on the reports.

You can check the starting balances of the report, where the balance shows up as the number of shares. That gives you a hint on where the problem is, price calculation. After that, any calculation will be off.
Comment 7 Jan 2010-07-18 02:22:02 UTC
The reporting period starts at 01/01/2010, but I do not have any price histories until 05/12/2010.  It is obvious that if no price is known at the start of the reporting period, KMM takes one currency unit for investments in a currency different from the base currency.

For investments in the base currency, KMM computes the starting balance using the price of the last Buy prior to the reporting period.

That said, for all my investments in base currency, I have Buy activities (reinvest div) less than two weeks prior to the start of the reporting period (late December 2009).  The most recent activity in foreign values is 11/25/09, i.e. more than a month away.  KMM did *not* use the price of that transaction but rather used 1 currency unit.

The starting balance may or may not be computed differently for investments in base currency, but I would rather have no report, or a different rule  determining the Starting Balance (e.g. start the report at date of first available price, if within reporting period) than Return values that are incorrect.

Concerning the import in USD instead of EUR, I have no evidence of that, but then, I do not know the code.  I think my explanation above is sufficient to explain what is happening.
Comment 8 Alvaro Soliverez 2010-07-18 16:44:46 UTC
SVN commit 1151233 by asoliverez:

Improved consistency check of prices of investments and foreign currencies.
This will help pinpoint cases where prices are not set or where imported incorrectly.

It might a little stricter than needed, but that can be fine-tuned later.

BUG:244561

 M  +19 -21    mymoneyfile.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1151233
Comment 9 Alvaro Soliverez 2010-07-19 02:08:50 UTC
SVN commit 1151375 by asoliverez:

The consistency check of prices will also look for the reverse rate, which can be used for rate conversion too

BUG:244561

 M  +6 -1      mymoneyfile.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1151375