TransactionSet for date range in python

Jim's Avatar


03 Aug, 2020 06:03 PM

Hi, found this:
I'm looking to do the same but using python.

This works to get all the transactions for the account: txns = moneydance_data.getTransactionSet().getTransactionsForAccount(account)
but can't seem to figure out how to build the filter in python to limit the date range.
Any help appreciated!


  1. Support Staff 1 Posted by Sean Reilly on 03 Aug, 2020 07:09 PM

    Sean Reilly's Avatar

    Hi Jim,

    Great question! We don't seem to have a call specifically for that, despite having a TxnFilter that ties into some controller/UI-level stuff. However, it might be best to do this in a python-y way, maybe with a lambda:

    from com.infinitekind.util import DateUtil
    account = moneydance_data.getRootAccount().getAccountByName("Checking")
    txns = moneydance_data.getTransactionSet().getTransactionsForAccount(account)
    today = DateUtil.getStrippedDateInt()
    first_date = DateUtil.incrementDate(today, -2, 0, 0)
    for txn in filter(lambda x: first_date <= x.getDateInt() <= today, txns):


    Sean Reilly
    Developer, The Infinite Kind

  2. 2 Posted by Jim on 03 Aug, 2020 08:01 PM

    Jim's Avatar

    Thanks for the quick reply. I had started to look at post-filtering the set. Your python-fu is much stronger than mine and this looks much more elegant than the brute-force code I would have come up with!

  3. Support Staff 3 Posted by Sean Reilly on 03 Aug, 2020 08:02 PM

    Sean Reilly's Avatar

    Ha, you're too kind. I always forget about lambda's and brute force things like that myself, but I have to admit I relied on DuckDuckGo for this one :)

    Sean Reilly
    Developer, The Infinite Kind

  4. System closed this discussion on 02 Nov, 2020 08:10 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