Skip to content
Commit c6e31c96 authored by Łukasz Wojniłowicz's avatar Łukasz Wojniłowicz
Browse files

Fix rounding problem with investments

Patch introduces rounding rules per security for fixing bug #372163. It
seems that this broker always rounds amounts down while my broker rounds
amounts depending on the outlying digit, so it couldn't work for both of
us without rules.

Rounding is done in InvestTransactionEditor because it has all needed
informations at hand.

No rounding of shares is done in InvestTransactionEditor::setupPrice.
Transaction from bug #372163 looks as follows:
brokerage:
shares = 1,009 ; value = 1,009
investment:
shares = -1 ; value = 1,009

InvestTransactionEditor::setupPrice causes brokerage to look as follows:
shares = 1,01 ; value = 1,009
As we can see shares and value diverge, which is unacceptable here.

Patch makes assumption that transaction has only single split of
stock/mutual fund/bond.

BUG:345655
BUG:357784
BUG:365177
BUG:372163
FIXED-IN:5.0

Differential Revision: https://phabricator.kde.org/D5187



Signed-off-by: default avatarŁukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
parent c8b12d84
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment