Questions re: a plugin for semi-automated transaction import

John Didion's Avatar

John Didion

14 Jul, 2010 05:40 PM

I have several account that either do not provide OFX or charge a fee for it, which I refuse to pay. I've come up for a work-around and I want to turn it into an extension, however I've never written a MD extension before so I need a few pointers. Here's generally how it will work:

  1. User opens Firefox and logs into all the accounts he wants to sync with MoneyDance.
  2. User exports cookies using the Export Cookies plugin. This plugin saves session cookies as well as persistent cookies.
  3. User executes the sync extension from within MoneyDance and points it at the downloaded cookie file. Previously, the user will have configured the extension by telling it which accounts to sync. The extension is either hardcoded or user configured with the URLs used to download a QIF file from each bank.
  4. For each account, the extension:
    a. Figures out the date last downloaded transaction
    b. Interpolates the download URL with the from and to dates
    c. Fetches the relevant cookies from the saved cookie file
    d. Does an HTTP post to the URL and saves the resulting QIF file to a temporary location
    e. Executes the QIF import feature

My question is about 4e. I would rather do this transparently rather than pop up the import window, but the only function I can find that sounds like it might do this is "moneydance:importfile". However, this function only takes a file, not a destination account. Is there a way to do automated import of downloaded transactions to a specific account without asking for user input?

Thanks!

  1. 1 Posted by Angie Rauscher on 16 Jul, 2010 06:34 PM

    Angie Rauscher's Avatar

    John,

    Wow, this extension would be a huge asset to many of our users, myself included! I don't believe it is currently possible to do the import without asking for user input, but I've emailed our developer to see if he has any input or suggestions.

    Please let me know if I can be of further assistance,

    Angie Rauscher
    Moneydance Support

  2. Support Staff 2 Posted by Sean Reilly on 16 Jul, 2010 07:49 PM

    Sean Reilly's Avatar

    Hi John,

    This is a great idea. The easiest solution is to invoke the following method on the extension's context object:

      importQIFIntoAccount(RootAccount rootAccount, File qifFile,
                                               byte dateFormat, char dec,
                                               CurrencyType currency, Account account,
                                               byte importMode, boolean acctsOnly)

    The parameters are:
      rootAccount: the obvious answer :)
      qifFile: the QIF File
      dateFormat: one of the following: 0 (automatic, not very good), 1 (MDY), 2 (DMY), 3 (YMD)
      dec: the decimal character (in the US this is '.')
      currency: the currency of the imported file. Usually the same as account.getCurrencyType()
      account: the account into which the QIF file should be imported
      importMode: 1 (downloaded from bank) or 2 (imported from another app). you want 1
      accountsOnly: false

    However, maybe I can throw another couple of ideas by you...

    First, nearly all banks allow you to download OFX (or QFX... they're identical but for the file extension) files from their web interface. These are usually labeled as "MS Money" or "Quicken" files. OFX and QFX files are *far* preferable for importing downloaded data from banks as they include unique identifiers for each transaction which allow moneydance to ignore duplicates.

    Second, we've had an item on our to-do list for a while now which is to have a background thread running that monitors your "downloads" folder for new OFX, QFX and QIF files. When it detects a new file it will import that file with as much automation as possible (depending upon the file type and whether or not MD can connect the downloaded data to an existing account... with OFX/QFX files this will be easy). We'd like to combine this with a hook that will spawn a browser window to download transactions from Moneydance to make downloading non-direct-OFX data as seamless as possible. Maybe we could collaborate on that? I just wanted to mention it in case you'd like to avoid duplicate effort.

    Thanks!
    Sean

  3. 3 Posted by John Didion on 30 Jul, 2010 12:00 PM

    John Didion's Avatar

    I've gotten the login/export process down to three clicks. It requires the iMacros and Export Cookies plugins for Firefox.
    1. Open Firefox. I set up Firefox to open all the financial websites from which I want to export on startup (Chrome is my normal browser, so this is the only thing I use FF for).
    2. Run the login macro. I used iMacros to set up a macro that logs into all the sites and takes the necessary actions. For example, Bank of America uses sessions that are tied to each individual page, so you have to actually be on the transaction download page to be able to export the correct cookies.
    3. Run the Export Cookies extension and save the file to a temp directory.

    I also have a Python script that reads in the cookie file and downloads an OFX file from Bank of America. Unfortunately this is not generalizable...every site is a bit different. For example, there's a specific cookie you have to look for from BoA to determine which subdomain is hosting your current session. So that's the big downside of this plugin - every site will have to have a custom script written for it.

    The only thing left is to write the MD plugin. If you add the feature you mentioned so that MD watches a specific directory for new OFX files, that would be great. It would definitely simplify the plugin.

  4. 4 Posted by John Didion on 30 Jul, 2010 04:40 PM

    John Didion's Avatar

    I was hoping to use the online banking interface for this, but I don't see how I can as it is assumed that "Direct Connect" will be used. Basically I guess I want a hook so that when the user clicks Download Transactions, my code will get called, which will then figure out the appropriate dates for the query and execute the appropriate Python script to process the cookies file and actually download the transactions. Is there any way to do this?

  5. Support Staff 5 Posted by Sean Reilly on 05 Aug, 2010 03:56 AM

    Sean Reilly's Avatar

    Hi John, I've been trying to think of a way that moneydance could invoke an extension when the user selects the Download menu. Unfortunately I don't see a straightforward way to do it, mainly because the Download menu is disabled unless there is a configured direct OFX connection for the account. The best alternative is to add a menu item to the extensions menu which can be done using the extension context's registerFeature() method. I will look into adding a quick-and-dirty URL setting for accounts that will invoke a specific URL whenever the Download menu is selected.

  6. 6 Posted by John Didion on 05 Aug, 2010 10:57 AM

    John Didion's Avatar

    Understood. I think it would be a nice feature to add to make the direct OFX connection more abstract, at least for downloading. If it just took an account as input and returned an OFX file or stream then both the normal direct connect services and plugins like mine could hook into the download menu item. I'm sure this probably requires a bunch of refactoring, so I won't hold my breath :)

  7. System closed this discussion on 31 Mar, 2015 03:29 PM.

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

Keyboard shortcuts

Generic

? 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