18

I wrote a script that cleans up OFX transaction files downloaded from banks so that the name and memo fields are more readable once imported into gnucash. This works great, I now get very clean records that include only the information I need for each transaction. The problem is, even after the clean up, gnucash's bayesian matching makes a lot of mistakes in matching transactions to accounts, and frequently "forgets" matchings it knew in the past.

I was wondering if there is anything else I can do to the OFX files in my cleanup script to give gnucash better hints as to what account a given transaction should go. I would like to bypass the bayesian matching stuff completely, and instead insert an explicit account name for each transaction in the OFX file. Looking through the OFX spec I could not find any fields for this. Is this possible at all?

If I could do that, then my script can assign default accounts for the common transactions that show up over and over again, like groceries, gas, etc. Then I'll have only the exceptions to handle manually.

Thanks.

5
  • Did you get an answer to your question ? I have the same interrogation and need! I'm used to MsMoney transaction matcher, and even if it's not perfect, it seems better than GnuCash's one. Maybe I've missed an important setting in GnuCash... Someone has an hint for us ? Thanks a lot!
    – user5433
    Commented Jan 4, 2012 at 15:59
  • @Pat: I did not find a satisfactory solution to this problem. I'm still using the bayesian matching, with its limitations it is still the best option for gnucash.
    – Miguel
    Commented Jan 7, 2012 at 22:41
  • 1
    Could you share your script? Gist.github or pastie or anything that is ok for you! Commented Apr 19, 2012 at 5:39
  • I wrote a tool here that tags transactions depending on payee field content, and GnuCash uses that tag as destination account ... but as of today it handles only qif files. I second @Patches idea to put account name in the memo field, and if it works maybe you should consider then put the business name elsewhere?
    – kraymer
    Commented Mar 22, 2015 at 22:18
  • Have you found a way to improve the OFX transaction matching yet (in the last ~ 5 years)? In any case, I'd appreciate if you could post the your "optimization" script. Thanks!
    – shoyu
    Commented Jan 5, 2017 at 16:34

3 Answers 3

7

You can generate the transactions directly into your GnuCash XML file via the GnuCash python bindings. You could probably alter your script to directly generate the XML for the transactions into your GnuCash database in this manner. You would then open GnuCash and everything would already be there.

See a simple example which creates some accounts and transactions, and the docs for the python bindings.

5

You can turn off bayesian matching, so you can bypass it like you want to do without messing with the import file.

Go to Edit->Preferances, Online Banking tab, uncheck "Use bayesian matching"

From the gnucash documentation, about half way down this page: http://code.gnucash.org/docs/help/set-prefs.html

4
  • I don't think this solves the problem. I do not want to have to manually match every transaction to the proper account. If I disable the bayesian matching won't I have to assign accounts to every transaction? What I really want to do is to insert the accounts in the OFX, it would be very easy for me to do that in the script that I use to clean the OFX files I download from my banks.
    – Miguel
    Commented Jan 7, 2012 at 22:38
  • @Miguel hmm... after re-reading your question, I guess you're calling transaction categories "accounts"? Try inserting the category keyword into the memo field and let the bayesian matching do it's thing. In other words, add "groceries" onto the memo to help it show up in the "groceries" account.
    – Patches
    Commented Jan 8, 2012 at 4:51
  • In gnucash there are only accounts, there are no categories. The problem with rewriting the Memo field is that I use it to store the business name. Even if I used the memo, this does not solve the problem that every once in a while the bayesian database gets very confused and most of the mappings are lost and need to be redone.
    – Miguel
    Commented Jan 8, 2012 at 5:41
  • @Miguel Well, I only got two more ideas: one, look into the payee model of ofx - section 12.2 of the ofx documentation, IIRC. The other is buy quicken, lol
    – Patches
    Commented Jan 8, 2012 at 14:38
1

It looks like you're right, in that the OFX spec doesn't support what you're trying to do, which means that GnuCash probably won't support it.

As a last option, you could build a GnuCash plugin to to this (http://svn.gnucash.org/docs/HEAD/group__Plugins.html), but it doesn't seem like a very easy architecture to get into.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .