I’ve been using KMYMoney for some time and it’s great. The one serious issue that I have with it is that when I look at the investment holding report, it shows every equity and bond that I’ve ever bought and sold. So 90% of the report are closed positions with an amount of 0. These are not “holdings” any longer and there is no way to fliter them out.
I attempted to use the “Filters” tab to say that the amount needed to be greater than .01 but that didn’t work.
I clone the Github repo and did a grep and found a comment that the Investment Holdings Report is a special case and the rows/columns filters don’t apply.
Sorry for the delay, Discuss is still pretty new here (although it will eventually replace the forums) so we’re not yet used to watching.
Unfortunately, I don’t know if there is an easy (or any) way around this right now. However, I think that comment is perhaps not completely true, as I just ran the Investment Holdings By Account report - and it is for current year to date, and it is not showing any old holdings, only those from this year. I’d have to dig into the code to see any or none of the filters are actually applied.
That might actually be the answer as I have them from the beginning of time until current. Which is the way it always was in every accounting software I’ve ever used. “Holdings” are literally what you’re holding now, not what you’ve already sold. I’ll change the time frame and see what it looks like. But that sort of implies that I would have to move to begin time to after the last thing that I sold.
I appreciate the response.
There are lots of things about Investments that need revising in KMM, but the current effort is on resolving bugs and getting ready for the port to Qt6. I’m working (very slowly) on accumulating all the Investment issues that need to be addressed, and there will eventually be a more public request for input, but not until it is closer to actually being worked on.
One thing that would really help is improved documentation. For example, debugging online quotes I can’t find docs on exactly what KmyMoney is looking for from the regex and I can’t find docs on how to log for debug.
Example; I created a Python script to access a paid subscription service, it appears that KmyMoney is executing it, and I tested the regex that I’m using in a regex tester. But is KmyMoney looking for “Price: 175.50” when I use “Price: (\d+.\d+)” or is it only looking for the dollar figure. There is no information like that. Can I get some debug logs somewhere?
Documentation is always a problem with FOSS. I am the primary
maintainer of the KMM Handbook, and would be extremely happy to get any
specific suggestions for improvements, but I can’t document what I
don’t sufficiently understand. Also, as far as I know, there is
unfortunately limited debug output of any sort available. I am
primarily familiar with debugging OFX import data.
For starts, have you looked at console output? That often provide
additional information, although not for everything.
How well do you understand regexs? “Price: (\d+.\d+)” is looking for
the explicit string "Price: " followed by one or more digits a period
and one or more digits. The parens save that piece of the match to be
used as the price. Nothing about dollar sign or any currency symbol.
One thing that would really help is improved documentation. For
example, debugging online quotes I can’t find docs on exactly what
KmyMoney is looking for from the regex and I can’t find docs on how
to log for debug.
For a stock price, KMM needs two things. First a URL that returns an
html page which includes the desired information. Then it needs way of
finding that info (the price and date) on that page. It uses a regex
(regular expression) for each of them. If a price fetch is failing
(with inability to find the data, not some other type of failure) a way
to debug is to just download the page with curl or wget or even a
browser and save it to a file. Looking at that file in a text editor
can help figure out (assuming the data is actually present) why the
current regex is not working. In all cases, things need to be stable.
The underlying problem here is that Yahoo doesn’t actually want people
to be able to get this data without visually looking at the page (and
all its ads) and so it changes the format on occasion.
There is no dollar sign or currency symbol. What I’d like to know is exactly what KmyMoney is looked for once it executes the regex. The return is:
Brain fart on my side. I started by creating a reverse proxy with a URL before I realized that I could just run a script. When I converted to a script I changed the protocol from http:// to file:// but forgot to change the get variable to a positional command line variable. After I did that it worked great.
Has the original question been answered?
I am dealing with the same problem. I try using the filters, and the only way I’ve been able to get a proper holdings report is by unchecking the account for the old investment.
It would seem to me that deleting that account would be one way to prevent seeing the investment, but there seems to be no way to do that.
I noticed also a mention of regex filters for reports. I am extremely comfortable with regexes, and I would be happy to filter on an amount regex. Alas, I see no mention in the documentation or here about how I can access them.
Is there any answer for the original question? Why does the amount filter not work?
As far as I can tell, there is no way to eliminate “holdings” with a quantity of zero. Which means they aren’t technically holdings at all.
I don’t run KDE as my desktop which makes it very hard for me to debug through the code and make suggestions. If I get time I’m going to create a virtual machine that’s running the KDE desktop to make it easier to compile and debug the app.
In fact, when trying to apply text filters and other filters, I see no evidence that the filters work at all. I tried a TEXT filter on details, and was unable to select investment(s) based on that. No other filters seem to work on this report either, other than the one removing certain accounts if you uncheck the box.
One question - have you closed the accounts for the securities you no longer hold? This is not the same as deleting them. Note I am not sure if this matters or not, but running the report for current year does not show old/empty/closed securities.
I also had a thought as to why most of the filters might not seem to apply to these reports. Most of those filters apply at the transaction level. While KMM does process all the transactions in an Investment account for each security (buy, sell, add, …) to get the current number of shares, the final report is per security, not per transaction.
Another thing I need to check is what effect the date filter actually has. To properly calculate how many shares of a security is held, the calculation needs to include all transactions the change the number of shares of that security, so filtering by date shouldn’t have any real effect, unless a stop date gives you the holdings as of that date.
For now, however, the effect is really cosmetic - including securities with 0 current shares (as annoying as it might be) I don’t know there is much that can be done in the short term.
In terms of debugging, you really don’t need a full KDE desktop. You just need a version of the program with debugging symbols, and a debugger. gdb works fine, and I use ddd for a gui. There are situations where using kdevelop helps, as it can look inside some of the otherwise cryptic Qt and KDE constructs, but even that doesn’t actually require a full KDE desktop, although it will likely pull in quite a few dependencies.
I don’t have any of the zero-amount securities in the Accounts section to close – they apparently are auto-closed when they go to zero. I do see them in Investments->Securities, but there is no menu provided that might have a “Close Account” option.
Also, when I run the report for current year the zero-amount securities are still listed in the report.
There is no auto closing, but I think I now have a better concept of what is going on.
In the Investments View, the Securities tab shows all underlying securities you have ever invested in. The Equities tab shows those securities owned in the Investment Account shown in the “Select Account:” dropdown. This is one of the confusing aspects of how KMM handles investments, but when a security is held within an Investment Account, there is and Account for that Security, which is a sub-account of the Investment Account.
Typing Ctl-Shift-A (or View/Show All Accounts) will show any closed securities in that investment account. If you see a security there with 0 shares, you can right click on it and close that account. That should remove it from the report.
On top of all this, there are two setting in Settings/Configure KMyMoney…, General, Filter view:
Show Equity Accounts controls whether these sub-sccounts are shown in some of the displays. Try checking this if it is not already checked. Then, be sure that “Do not show zero balance equities” is not checked, so they don’t get hidden when you are trying to find them to close them.
Let us know if this helps.
I did see that I had “Do not show zero balance equities” checked, and that made the zero balance items show up in the Investments->Equities screen. When I right clicked on one and attempted to close the account, I got a core dump. But when I restarted from the command line to try and view the debug info, it started working. I am now able to get the proper reports.
If the “account” (security) is closed, what happens if you reinvest? Example, I buy GOOG in March 22 and sell in December 22. Then I close it. Then I buy it again in June 23.
It seems to me that it would be relatively simple to stick to the definition of a holding and simply not show equities with 0 shares:
" Holdings are the contents of an investment portfolio held by an individual or an entity,"
Feel free to file a wishlist bug for that (or I might eventually do it) but as I said, unless it’s extremely easy (or someone other than the core team does it) it’s not likely to get attention very soon.
In terms of reinvesting, it actually depends on how that transaction gets entered. If you manually try to create a buy transaction, you will not be able to do so until you reopen the account. If such a transaction is imported, it will work, but the security account will still be closed. I should probably also file a bug against that, since it leaves you in a funny state, where most thing work, but you would have trouble editing that transaction, without knowing what the problem is. I’ve had it happen enough that I actually recognize the situation now.
I found a stupid simple solution. I had tried all kinds of filters and none worked, including dates. My logical assumption was that “holdings” really mean what was currently held in the accounts.
All you have to do is open the report, go to “Configure | Filters | Date” and select “Today”. Boom! It will only show current holdings.