reZach / my-budget

Free, open source offline cross-platform budgeting solution built with Electron.
GNU Affero General Public License v3.0
956 stars 61 forks source link

Feature: Bank sync (non EU-banks) #8

Open reZach opened 5 years ago

reZach commented 5 years ago

Is your feature request related to a problem? Please describe. As a user, I'd like to be able to sync my transactions from my non-EU banks.

Describe the solution you'd like Clicking the Bank button should allow me to search my bank and import my transactions.

Describe alternatives you've considered Plaid.

Additional context N/A

csingley commented 5 years ago

You might be interested in ofxtools

OFX is the industry standard import/export format (it's what Mint mostly uses, I believe); the data is widely available from most banks (in US at least). You might save yourself a whole lot of headache by using it too.

reZach commented 5 years ago

Thanks @csingley for your link. Unfortunately, this library is JS, so we'll be looking for a JS-specific library for OFX usage.

I'm still in the process of trying to get OFX credentials so I am able to develop this functionality in My Budget. Hopefully I'll be able to get that answer soon.

csingley commented 5 years ago

Only JS code I've seen that handles OFX looks pretty barebones, but at least some handles OFXv1 (SGML) which is really a hard requirement if you aim at real-world utility.

If your goal is offline operation, you don't need any OFX credentials to start working on OFX import. Open an account at pretty much any US bank and download the data files from their website.

Have fun hacking!

reZach commented 5 years ago

If you happen to come across a JS-OFX library it would be very appreciated if you found one, or wrote one for the cause! @csingley

csingley commented 5 years ago

There probably aren't any that are much good; I've only seen quick & dirty hacks. The OFX spec (and its various irregular implementations) are kind of a bear.

There's a good C++ library (libofx, which is what GnuCash uses - it's battle tested). I probably would have just worked up some Python bindings to libofx, except I needed to do more than it offers. You could try to do that for JS, and distribute platform-specific versions of your app that bundle compiled libofx. It would do what you need, and libofx is fast.

It would surely take you a lot less time to figure out how to do that than to reimplement OFX parser and data models in javascript... and would be more generally useful to your application. If you're writing a GUI for crunching numbers, it's very nice to have a framework for calling out to C accelerators.

reZach commented 5 years ago

@csingley I didn't know you were the author of ofxtools! Very neat!

Well do you have references on JS-bindings for libofx? That's a new territory for me, I'm sure I could figure it out but its a possible option.

csingley commented 5 years ago

Have a look at this:

https://github.com/bradenmacdonald/ofx-js

It at least tries to handle SGML, but those regexes are going to break on real-world OFXv1.

It doesn't do any type-conversion, which means you'll get to spend some quality time with section 3.2.8 of the OFX spec.

reZach commented 5 years ago

It's a starting point, thanks @csingley. I appreciate you looking and finding this repo, I do.