Importing investment transactions with csvimporter

I am running KMyMoney Version 5.1.3-fc8f557ef from kmymoney-5.1-348-linux-gcc-x86_64.AppImage on kubuntu jammy.

I have been using KMM for about 7 years and find it to a superior replacement for Quicken. Download banking and credit card data with OFX files from banks and credit cards seems to work flawlessly. I decided to try downloading investment transactions which I briefly looked at some years ago and gave up - seemed to be more bother than it was worth. All my investment brokers only support CSV downloads. Looking at the OFX/FDX website and the sponsor participants I don’t see any brokers so I suspect OFX downloads for investments will not happen soon. I got a CSV download from one of my brokers and massaged it to pass all the CSV import checks I could, but when I click the CSV Import button I get an error popup “The values in the columns you have selected do not match any expected investment type. Please check the fields in the current transaction and also you current selections.” The only option is “OK” and then to abandon the import.
https://drive.google.com/file/d/1IN0dNb2SoL2VlsRhuXwxqV3E0Ny-1S_b/view?usp=drive_link

Next, I made a copy of my KMM database, and manually entered transactions for January. I then exported those transactions for one account as a CSV file and tied to import it into KMM using the KMM database copy I made earlier. After selecting only the 1st data row, and mapping the columns to appropriate fields, I click “next” and KMM disappears/ shuts down without any notice. I can’t find any error log.

I looked at the csvimporterrc file and the setup I entered for the investment account is not saved, just the account profile name.

I am now scratching head over how to proceed. I was really looking forward to being able to import most investment transactions, even if it is not a slick as banking transactions with OFX files.

Any pointers would be appreciated.

First, I regularly do investment OFX donloads. File download for Vanguard, and direct connect for Merrill Lynch. I do understand that fewer and fewer brokers still support it.

In terms of the error message about not matching an investment type, at what point in the process does this happen? I haven’t looked at the code, but that sounds like it is not recognizing the type or investment activity (buy/sell/dividend/…) although that doesn’t sound like the error for that problem. I can’t see your screenshot due to permission errors.

I do know it is possible to do investment csv imports, but it’s been a while since I played with it. From memory, the last time I tried, the csv export of investment data needed some massaging to be able to actually import it, but that was a few years ago, and I would have to hunt through old email to find the actual resolution.

If I can see your screenshot, I might have a better idea.

Also, can you just post here a few lines of your csv import file to confirm you do have the necessary columns available?

I worked myself through the code and it does the following: for all rows that are selected as transactions (except the header and footer) it extracts the values of columns selected as Quantity, Amount, Price and Type/Action. Out of these values it verifies that one of the following conditions is true:

A: Shares > 0 AND Price > 0 AND Amount != 0
B: Shares == 0 AND Price == 0 AND Amount != 0
C: Shares > 0 AND Price == 0 AND Amount == 0

Any other combination currently is treated as incorrect.

Apparently, at least one transaction does not match any of the above criteria. Only when this happens, the error message you presented is shown. Not knowing the column headers presented in your screenshot, I could imagine that all you interest transactions don’t match any of the above because they seem to have

Shares == 0 AND Price > 0 AND Amount > 0.

Sorry I forgot to relax sharing rules on the screenshot in my original post. It has been relaxed for it and the following screenshots.

Thanks for the tips. I am still not able to import broker CSV files. I have dumbed the csv file down to one line of data. It seems to meet all the rules in the csvimporter plugin but I still get the error popup. The 1st screenshot has the column mappings, and the second is the screen after "next: is clicked which has the “Import csv” button that results in the error popup.
screenshot1.png - Google Drive
Screenshot2.png - Google Drive

The .csv files looks like :

Transaction Type=All,Product Type=All,Symbol=,From=2024-02-10,To=2023-11-12,,,,,
Transaction Date,Settlement Date,Activity Description,Description,Symbol,Quantity,Price,Price Currency,Total Amount,Total Currency
----------------,---------------,--------------------,-----------,------,--------,-----,--------,------------,--------
2024-01-04,2024-01-04,Interest,ISHARES S&P/TSX SMALLCAP INDEX,XCS,1500,0, ,258.15,CAD

I was able to import a transaction that I exported from KMM without KMM crashing. The transaction file looks like:

Account Type:Investment

Date,Security,Action/Type,Amount,Quantity,Price,Interest,Fees,Account,Memo,Status
2024-01-04,"iShares Core Equity ETF",DivX,"100.20",,,"-100.20",,"Registered Retirement Investments:BMO Inverstorline Spousal RIF CDN (Brokerage)",,C

Transaction does not look very different from broker txn…
Any additional advice welcome.

Greg

My earlier assumption that your transactions have

was wrong. They all show

Shares > 0 AND Price == 0 AND Amount > 0

and therefore don’t match none of the conditions (A, B or C). The exported CSV is a bit different, as it has

Shares == 0 AND Price == 0 AND Amount > 0

and with this it matches condition B.

The question now is: what type of transaction would that be? It looks like a reinvest dividend to me where the price is actually 0.1721. Once I add that price to the transaction, I get prompted to support the correct transaction type:

If the combination of

Shares > 0 AND Price == 0 AND Amount > 0

is an indicator for a reinvest dividend that simply does not have a price information but which could be calculated by dividing shares by amount then we can add that as condition to the application. But we need some confirmation that this is the case.

I have not investigated if the import then works properly. It could be, that there are still other uncovered problems hiding somewhere.

Thanks so much. I think I understand the requirement now. It looks like I will need to massage the csv file a bit to get it into import ready shape. And of course each broker does it differently, so I’ll need to preprocess each brokers csv file a little differently.

Thanks again.
Greg