New Portfolio Tracker Extension - Beta testers welcome!

Jim Richmond's Avatar

Jim Richmond

11 Sep, 2019 08:09 PM

Hello All,

I recently switched to Moneydance from an un-named and not-so-quick-anymore competitor and I've been very pleasantly surprised by how mature and feature rich this software is and how relatively painless the cutover has been. One thing I wasn't able to find is a compact yet information rich report of portfolio performance that quickly an efficiently conveys what's happening with my investment portfolio.

Fortunately, thanks to the Moneydance API and my rusty but apparently still workable programming skills, all is not lost. I was able to cobble together something that gives me exactly what I've been looking for.

On the off chance that others might also find this useful, I posted the code and the extension's .mxt file up on bitbucket.

Wiki for Portfolio Tracker Extension on bitbucket

The extension isn't signed and is hot off the presses, so you'll have to decide if you mind being a beta tester for this. The code doesn't attempt to modify the moneydance data model in any way at all and all source code is available for review on bitbucket. That said, coding is a fraught enterprise and I can't guarantee that my code will work as intended or that it won't somehow mess something up for you. So use it at your own risk.

That said,I'm eager for any feedback you have and if there is interest I expect to make a few cycles of changes before the extension becomes hardened. Based on the response, I may ask the folks at InfiniteKind if they'd be willing to include a signed version of the extension in their distribution.

I've done a fair bit of testing and verification of results using my own data and some test data files I found in the wild and so far the extension seems very stable. I did find one issue which I described here, but it doesn't look like it's related to the extension since I can reproduce the problem with a simple python script.


  1. 1 Posted by sprimost on 11 Sep, 2019 09:32 PM

    sprimost's Avatar

    From: sprimost

    Not support, just a user

    I'm game for it. It looks good so far, but I will check some of the
    totals since it does show a difference from the "official" benchmark
    site (Vanguard). Also, "cash" does not appear to register (type is
    "BANK" but don't know whether that is intentional.

    Nice work


  2. 2 Posted by Jim Richmond on 11 Sep, 2019 10:17 PM

    Jim Richmond's Avatar

    Thanks for the comments.

    For cash the code only considers "Investment" type accounts, so cash in a bank account won't be included into the total.

  3. 3 Posted by kepler on 12 Sep, 2019 05:41 PM

    kepler's Avatar

    I'm in, I'll give it a try.

    Thanks for doing this, I really appreciate it.


  4. 4 Posted by derekkent23 on 13 Sep, 2019 07:53 AM

    derekkent23's Avatar

    Hi Jim

    I have just started to look at the great work you are doing in developing the Portfolio Tracker Extension and was wondering if there was a way to exclude selected securities from the calculations. Perhaps a tick box next to each security that could be untick to exclude a security?

  5. 5 Posted by Jim Richmond on 13 Sep, 2019 02:30 PM

    Jim Richmond's Avatar


    Thanks for the comments and the suggestion. I'm interested in learning a bit more about what you're trying to accomplish with the ability to exclude securities from the calculation.
    1) What's the exact situation where you don't want certain securities included. Are the securities you'll exclude all from the same asset class, or is there some other reason why you want them excluded?
    2) In an ideal world, would it be best if the securities were excluded from the table completely, or is it better to still have the securities show up in the table? The reason I ask is that I'm thinking of some sort of grouping or filtering capability, but I'd be inclined to have filtered securities excluded from the table as well as the total portfolio calculation.
    3) would you want to switch back and forth between having the total portfolio calculation include all securities vs just including the selected securities, or would you never want the unselected securities included in the totals?
    4) Would you want the info on which securities are selected to be remembered between launches of the extension?

    Here's a possible new feature that might cover what you're looking for, and maybe also provide a more general benefit as well.

    I could add a drop-down control that let's you select from a list of user-configured "groupings" that each contain a list of securities to be included in the table and in the totals calculations. The default grouping would be "all". Next to the drop down their would be a button that lets you configure the groupings. I'd use this myself to quickly see total return numbers for each asset class, but I'd probably make the drop down list of groupings fully configurable. Or maybe by default I'd include groupings for each of the standard Moneydance asset classes?

    Would this give you what you're looking for? I realize it's a lot more involved than what you suggested, but the hardest parts of this are 1) being able to persist lists of securities between runs, and 2) recalculating the total portfolio returns to only include a subset of the securities loaded in. The way the current code works, I calculate the portfolio totals when I pull everything in from the Moneydance data model and never recalculate it after that (since the "hide" controls don't affect the totals).

  6. 6 Posted by derekkent23 on 13 Sep, 2019 06:25 PM

    derekkent23's Avatar

    Hi Jim

    1) I update my securities at the end of each Month, although as I now use the Quote Loader to update price, rather than looking each one up on the web, I am considering updating at the end of each week. The selection of my securities is done for by a portfolio manager. I get a report after the end of every quarter. This report is for two investment accounts, one tax free. Each account has a cash amount. Back in 2016 when I first started using Moneydance I did not really know how it worked so decided to account for the cash by setting up one pseudo security in each account, one share and the price being value of the cash. These are the securities I want to exclude. As for asset class see below.

    2) A grouping or filtering capability that excludes selected securities from the calculation and the table would also work for me.

    3) In my case switching back and forward would not be required, although in other situations I could see the advantage of being able to create what if scenarios.

    4) As in my case I would always want to exclude the same securities remembered between launches of the extension would save time, but having said that I would be happy to accept the need for selection each time the extension is opened.

    Your list of possible new features.

    A drop-down control that lets you select from a list of user-configured "groupings" would also work for me covering my needs and I think would have wider user appeal.

    When you talk about Moneydance asset classes are you talking about Type and Subtype that can be set for each security within each Investment Account under SECURITIES DETAIL window – select security using dropdown – EDIT SECURITY? If so, then I have set my pseudo cash securities to Type – Other, Subtype – Cash. So, if I am reading you correctly, I could exclude this asset class.
    Being able to select an asset class to see how it performs would be valuable to many I am sure.

    If you need any more clarification just post.

  7. 7 Posted by sprimost on 16 Sep, 2019 10:47 PM

    sprimost's Avatar

    Hi Jim --

    I have been testing this extension pretty much for the past week, and
    find it extremely useful. While there are reports that give some of the
    information, this makes it easier to see in more "real time" (I check my
    portfolio on a daily basis, and track/graph it on a weekly basis. I does
    seem to be consistent with data that I had on spreadsheets (much
    difficulty and lots of editing!), so it is a great time-saver.

    There are a couple of questions I have on it, as it does seem peculiar:
    (1) When I start the extension the first time in a day, the total amount
    of investments is equal to that in the summary. Subsequent refresh
    varies the total to be the correct total, which is not equal to the
    summary total, but consistent with "stock glance" and any report, like
    portfolio! Can anyone explain why the summary total is _not_ correct?
    (2) I could not export the data to a csv file. it gives an "error
    writing to csv file null" (or, if to the default MD directory,
    permission error). I am running LINUX/Ubuntu 18.04 and MD 2019.3.

    I could recommend two improvements to this excellent extension:
    (1) Some sort of way to group, or select a set of investment accounts
    would be very helpful. I manage my portfolio  as IRA accounts and
    non-IRA accounts, each having a different investment strategy (more
    willing to have capital gains and dividend inefficient funds in IRA. So
    it would be great to see how the two groups fare.
    (2) A major part of my investment gain during the year are dividends,
    but they are not accounted for in the investment reports. I am wondering
    if you can have a separate column for this. I know your report is a
    point in time, but implicit is a time frame in the ROI columns. If
    interested, I can share my code that computes the dividends for a time
    period; I use it for determining income by quarters.

    Again, thank you so much for sharing. ***And now, if only IK would set
    up a place to share code on an "as-is" basis!!!


  8. 8 Posted by Jim Richmond on 17 Sep, 2019 02:22 PM

    Jim Richmond's Avatar


    Thanks for giving the extension a try and for the excellent feedback.

    First, the export problem you're seeing is a bug. I accidentally uploaded the wrong version when I created the bitbucket repository and I thought I corrected it before any downloads happened, but apparently not. If you get the latest version of the extension (using the link at the top of this thread), that problem should be corrected. The version number on the correct version is v1001 as reported by the MD extension manager.

    I don't have any insights as to why the totals would not be correct, either on the summary or in Portfolio Tracker. Although as I mentioned up thread, when I was debugging this extension, I occasionally got incorrect account balances and tracked it down to intermittent errors that happened when iterating through the moneydance data model. I was able to reproduce the problem with a simple python script disconnected from my extension as mentioned up thread. MD support hasn't followed up on this yet, so I'm not sure if they've been able to reproduce the problem or what the status is.

    Dividends should be included in the "change" amounts that Portfolio Tracker reports, but it sounds like you're looking for a separate break out of dividends from other gains. Is that correct? I guess I have mixed feelings on this. I can see the value and It'd be relatively easy to add one more radio button option under the "show portfolio changes as" with a "dividend payouts only" option or something like that, but otoh, this might be too much scope creep for the extension. I'd be interested in whether others would find this useful. Personally, I'd probably tend to use the reporting features for this myself, but I'm pretty new to the app and I may not understand the limitations with this approach.

    Finally, it sounds like there's general interest for some sort of security filtering or grouping capability. By far the easiest approach would be to do it based on the canned security types that moneydance already tracks (eg stock, bond, cd, mutual fund, other), but I'm not sure if that would be good enough. My initial thought was to add some "Filter" controls in the bottom of the window with a dropdown that lets you select "all" or a single security type (from the MD securities types). I'd also need a checkbox or radio group so you could select whether to "include" or "exclude" the selected security type. This may be too simplistic and it might be better to just let users create their own named groups of securities which could then be shown in the dropdown. With that approach I'd probably drop the "include/exclude" option and just have you put the securities you want included in each named group (with a default "all" group). I'd have to then save these named groups, which probably isn't too tough, but may get complicated once you factor in error handling and support for renaming securities and the like.

  9. 9 Posted by sprimost on 17 Sep, 2019 04:09 PM

    sprimost's Avatar

    From: sprimost

    Thank you ...

    The updated version fixed the export problem.

    Regarding totals being different, the nearest I have gotten is around
    $35! so part of the problem may be rounding errors along the way. Prices
    stored internally by MD are way more digits than what is being reported
    (from my experience writing my python script). Not seeing MD code, it is
    speculation. No big problem.

    I did not know that dividends were in the change amounts. I will have to
    look at this again, as it appears to be dividends _reinvested_ and not
    dividends paid into a money market account. I would think the latter
    would be difficult to manage, especially over 5 years.

    IMHO, just keep it simple, especially that you allow export of the
    results. Just a check box to select the securities seems the most
    straight forward. As it is, sending the results to a spreadsheet and
    manipulating the reporting is still a big win for me. You have saved me
    a whole lot of effort.



  10. 10 Posted by derekkent23 on 17 Sep, 2019 05:45 PM

    derekkent23's Avatar

    Hi Jim

    Would be interested in the direction you decide on before you put in the hard work.

    Have Fun

  11. 11 Posted by dwg on 17 Sep, 2019 10:12 PM

    dwg's Avatar

    There are different ways you can look at investment data.

    The most obvious one for many is ROI, a combination of income received (dividends) plus realised and unrealised capital gains, and I could further complicate that in countries that can have tax credits associated with dividends.

    One thing to keep in mind is how do you pick up what are dividends. For example where I am dividends have to be classified and they current fall into 2 classifications, if you can take what is a parent category and roll in all the subcategories that is workable - that could even take in the tax credit I mentioned above, but if it only takes in a single Dividend category and the values directly in that category then it would not work at all.

    Another measurement people can look it is just on the income side, so dividends received as a return on the cost basis of an investment, if you are a retiree living of investment income this can be a relevant measure, you are looking at it as more of an "interest " rate. So such information can be used to help determine if it is an investment that is worth holding.

    On the other side is looking at it from the capital side, what sort of capital gain am I seeing in this investment, is it making sense to hold it for the long term based on capital growth. Information like this can be an input into sell decisions.

  12. 12 Posted by Jim Richmond on 17 Sep, 2019 10:47 PM

    Jim Richmond's Avatar

    scp, I believe that both reinvested dividends and paid out dividends are included in the change calculation.

    When I first started coding the concept for this in python, I added up all the cash flows manually myself by iterating through all the transactions over the specified date range. When I did this, I definitely included dividends paid out (and also handled the reinvestments). Later, I moved to using some moneydance API calls to handle dealing with the cash flow stuff and I got the exact same answers from the API calls that I got from doing adding up all the cash flows myself manually.

    So at this point I'm pretty sure that both reinvested dividends and paid out dividends are included in the change calculations.

  13. System closed this discussion on 17 Dec, 2019 10:50 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac