[Kmymoney-devel] Import of QIF investment transactions that have commissions

Thomas Baumgart thb at net-bembel.de
Thu Aug 27 14:31:43 UTC 2015

Hi Jeff,

On Wednesday 26 August 2015 16:33:04 jeffjl.kde at outlook.com wrote:

> I am using KMM 4.7.2.  I export my data from Quicken 2013 to a QIF file. 
> When KMM imports a QIF investment buy or sell transaction that includes a
> commission, the total for the transaction has the commission added 3 times,
> so the total amount is wrong, and the warning triangle is added to the
> record in the ledger view.
> I have debugged this and come up with fixes. But I'm surprised (and
> concerned about the impact of my changes) that this has not been brought up
> as an issue before.
> The changes that make the import work and remove the warning in the ledger
> are summarized below:

This is cool. Did you hear of the reviewboard? You can find it at 
https://git.reviewboard.kde.org/ and our product name there is kmymoney. 
Please create a new review request and attach the patch against git master to 
it. This will allow us to comment on it. Using e-mail for this purpose on a 
plain verbose description of the changes is very confusing.

If you have test data it might also be useful to have. I currently don't know 
if you can attach it to the review request, but since this seems to be a bug, 
please feel free to open a bug report as well. The review has a field to 
reference the bug report, so you you might want to open the bug report first 
to have the ID at hand when opening the review request. The bug entry can take 
the test file.

If you have questions regarding the tools or the above description please let 
us know.

The description below can also be part of the bug report.

> 1. The "T" line in the QIF buy/sell record is the total including
> commissions.  MyMoneyQifReader::processInvestmentTransactionEntry() puts
> the total from the "T" line in tr.m_amount.  It also puts the commission in
> tr.m_fees, so they are included in the transaction.  I changed it so that
> tr.m_amount is the amount without the commission.
> 2. The original MyMoneyStatementReader::processTransactionEntry() adds the
> transaction amount and the transaction fee and puts the result in the split
> s1.value.  In the original code, since the amount already includes the
> commission, this is the 2nd addition of the commission.  Since the fee is
> going to be split out separately, I changed this to not add the fee to
> s1.value, and from change #1, s1.value now has no commission in it.
> 3. Since the QIF reader did not put the price per share in the transaction
> (even though it is available), the statement reader calculates a price per
> share.  But it adds the commission to the transaction amount (which
> originally already included the commission) before dividing by the number
> of shares.  This effectively adds the commission for the 3rd time.  I
> changed it to not add the commission when calculating the price per share,
> and due to change #1 use the amount that does not include any commission.
> (This results in calculating the price per share that is in the QIF file
> but is not used.)
> 4. Finally, to get rid of the warning triangle, I had to change the amount
> that gets split to the investment account's associated checking account.  I
> had to add the commission to "transfervalue".  This actually puts
> "transfervalue" back to the number it would have had in the original code
> since the transaction amount originally included the commission.
> With these changes, I can import my QIF and the buy/sell transactions in
> both ledgers (investment and associated checking) have the correct numbers
> and no warning triangles.
> Comments?

Please see above.




Thomas Baumgart

GPG-FP: E55E D592 F45F 116B 8429   4F99 9C59 DB40 B75D D3BA
640KB Memory should be enough for every computer.
 -- Bill Gates (1981)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 225 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150827/70f37bb3/attachment.sig>

More information about the KMyMoney-devel mailing list