This forum has been archived. All content is frozen. Please use KDE Discuss instead.

investment accounts

Tags: None
(comma "," separated)
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: investment accounts

Fri Jul 09, 2010 11:51 am
Hi,

I just found this thread, and the problem I am having is the wrong value for the investment.

Can anyone try the steps below to see if it is really a bug?

1- Create a new kmymoney file without any account.
2- Change the precision settings to 9 digits.
3- Create a new current account with 20,000.00 of opening balance.
3- Create a new investment account without an associated brokerage account.
4- Create a new investment (mutual fund), with fraction = 1000000 and Price entry = "price per share". (do not use Finance quote)
5- Manually update the price for the newly created investment using the following values:
date: 2010-07-08
price: 3,948476925

5- In the ledger view, buy shares for the new investment selecting the only existent account, and with the following values:
date: 2010-07-08
Shares: 5065.244239
Price/share: 3.948476925

The total should be 20,000.00 (5065.244239 x 3.948476925 = 19,999.9999972), but instead it shows: 1,553.255923 (1,553.26).

Anyway, finish the insertion of the transaction, and check the home view.
The investment has a balance of 1,553.26.

However, if you go to the reports view, and open the "Investment holding by account" report, the total amount is correct (20,000.00).

6- Now edit the transaction in the ledger view, and change the ammount of shares to 506,244239.
The total value is now correctly calculated (1,998.893696).

Does it happen with anyone else?

Many thanks,
Carlos
User avatar
Hei Ku
Registered Member
Posts
784
Karma
3
OS

Re: investment accounts

Sat Jul 10, 2010 2:30 am
Have you increased the price precision in the settings to match that price? The default is only 4 decimals.


Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: investment accounts

Sat Jul 10, 2010 8:13 am
Hei Ku wrote:Have you increased the price precision in the settings to match that price? The default is only 4 decimals.


Yes, this is the second step.
(2- Change the precision settings to 9 digits).

Sorry if I was not clear.
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: investment accounts

Tue Jul 20, 2010 8:00 am
Hi Hei Ku,

Did you get the same problem when executing these steps?
User avatar
Hei Ku
Registered Member
Posts
784
Karma
3
OS

Re: investment accounts

Tue Jul 20, 2010 9:56 am
Yes, I can confirm. It is an overflow of the value that contains the numbers. If you reduce the fraction of the accountm it calculates the numbers correctly.

I have filed a bug. https://bugs.kde.org/show_bug.cgi?id=245214


Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: investment accounts

Tue Jul 20, 2010 9:58 am
Many thanks,

I think this bug: https://bugs.kde.org/show_bug.cgi?id=243194 refers to the same problem.
User avatar
Hei Ku
Registered Member
Posts
784
Karma
3
OS

Re: investment accounts

Fri Jul 23, 2010 10:01 am
The bug cannot be fixed on time for the release. It requires to change a component very deep inside the application, which cannot be done at this point.


Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: investment accounts

Fri Jul 23, 2010 10:28 am
Can you tell me which component is this?

I can try to sort it out.
I started looking on the code, but still did not find where to change.
User avatar
Hei Ku
Registered Member
Posts
784
Karma
3
OS

Re: investment accounts

Fri Jul 23, 2010 10:41 am
The component is MyMoneyMoney, the main class where amounts are stored. It has to be ported libMP, to cope with high precision situations.


Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: investment accounts

Fri Jul 23, 2010 11:16 am
More precisely it needs to be ported to AlkValue which is already based on libgmp. This is something I have on my todo list for post 4.5.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: investment accounts

Sat Jul 24, 2010 7:20 pm
I have given a quick look in this class, and started replacing the m_num and m_denom (signed64) fields with a m_val field (AlkValue), but had problems with the toDouble method, which is used by several other classes.

The AlkValue class does not provide a toDouble method, so I think that some work may be necessary to either implement this method based on AlkValue, or to eliminate the calls to toDouble from the other classes (avoiding potential overflows).

Have you thought about a plan for this?
Are you planning on port only the mymoneymoney class to AlkValue, and deal with the missing methods in this class? or to change the other classes that use the toDouble method to use AlkValue instead?

Any help in pointing me in the right direction is appreciated.
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: investment accounts

Sat Jul 24, 2010 7:57 pm
That really depends from case to case. I want to spend all of my available time into the stable release first before I go and investigate the necessary steps.

If you want to go ahead and play with it, please feel free to do so. A good first step would be to document the cases where the toDouble() method is used. Please feel free to use the KDE community wiki pages at http://community.kde.org/KMyMoney to create a page for this information.

In general, I was thinking to derive MyMoneyMoney from AlkValue, such that

class MyMoneyMoney : public AlkValue {...};

Most of the methods should be directly available, others can be provided by MyMoneyMoney. Hope that gives enough information for the moment.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: investment accounts

Sat Jul 24, 2010 8:27 pm
Thanks, this really shed some light.

I will play a little bit with it following the inheritance strategy, and will create a new page in the wiki to document what I do.
User avatar
Hei Ku
Registered Member
Posts
784
Karma
3
OS

Re: investment accounts

Sun Jul 25, 2010 12:39 am
I'd recommend you subscribe to our development mailing list. kmymoney-devel@kde.org
Also, patches are received via reviewboard.kde.org, for the time when you have some running code.


Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]