Summary: | Import of stock transactions with a separate fee results in a calculation error | ||
---|---|---|---|
Product: | [Applications] kmymoney | Reporter: | k6lw |
Component: | importer | Assignee: | KMyMoney Devel Mailing List <kmymoney-devel> |
Status: | REPORTED --- | ||
Severity: | normal | ||
Priority: | NOR | ||
Version First Reported In: | 5.1.3 | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Sample CSV import File
Analysis of the problem Analysis of the problem |
Description
k6lw
2025-04-10 20:15:51 UTC
What version are you running? What type of import are you using: ofx, qif, csv? If you are running 5.1.3, can you try a development version, just to be sure it hasn't been fixed in the meantime? I'm not aware of any recent changes in the import code, but it's certainly possible fees are processed in the wrong order to get the right price per share if you are starting with a total price for the transaction. Can you provide a kmy and import file which reproduce the issue? Note that if the amount looks wrong, but gets corrected when you accept the transaction, that's probably OK, but if you have to edit and save it, there may be something to fix. Created attachment 180216 [details]
Sample CSV import File
Here is a sample stock transaction file containing both sells and buys, with and without "fees".
When importing the file any of the transactions with a fee will appear in the ledger with an incorrect amount. If you click on edit SOMETIMES the amount changes to the correct value. Otherwise I either need to subtract the fee from the total and divide the result by the number of shares to determine the share price to 4 digits and then the correct value is obtained. In other cases I need to add the fee to the total then divide by the number of shares to obtain the correct value.
Answer to questions. File import of CSV. Sample file submitted I confirmed the error appears for both 5.1.3-eef04f1 on windows and in 5.1.3 in Linux. Complete rundown: OS Windows 10 Pro 22H2 64 bit Version 19045.4842 KMyMoney version 5.1.3-eef04f1 On Import I used the following settings: Date column 1, Action column 2, Fee column 8, Price column 6, Quantity column 5, Amount column 9 price faction=1, Symbol column 3 Compare ledger entries with amount shown on the spreadsheet. e.g. Stock SPHQ's amount shown in the ledger should be $4589.19. The amount displayed will be different. Click on EDIT in the ledger and the total amount will change to the correct value. There are 9 other rows where you can see the differences. FYI, It didn't do it today while creating this test file, but yesterday when importing the file I told KMyMoney that row 1 was headers. When it came time to import the file it complained about an incorrect date format. The program was trying to import the header row. I backed out and just told the importer to start on row 2 and then the import worked with the exception of these errors which I can reproduce at will. For Kubuntu: Version 24.0.4 Plasma 5.27.12 KDE Framework 5.115 Kernal: 6.8.0-57 64 bit KMyMoney 5.1.3 All other settings identical. Same results Created attachment 180220 [details]
Analysis of the problem
I wrote up what I have found with details and screenshots and attached it as a PDF document.
Git commit de1965c949066b51e61a419099b9c9bbc5637341 by Thomas Baumgart. Committed on 13/04/2025 at 09:10. Pushed by tbaumgart into branch 'master'. Transport more investment attributes in statement file The members of that object were correctly transported between CSV importer and statement reader but the dump to the statement file was missing them. M +8 -0 kmymoney/mymoney/mymoneystatement.cpp https://invent.kde.org/office/kmymoney/-/commit/de1965c949066b51e61a419099b9c9bbc5637341 Created attachment 180221 [details]
Analysis of the problem
Updated analysis after more values were written to the statement file.
|