3 ms·
OFX is a painful spec; hard to know what is and is not used by various banks. I spent a bit of time writing a simple streaming OFXv1 (SGML) parser in Rust, but
by indemnity 7y ago
OFX is a painful spec; hard to know what is and is not used by various banks.
I spent a bit of time writing a simple streaming OFXv1 (SGML) parser in Rust, but I'm too ashamed to open-source it. The idea behind it was you read the OFX file byte by byte, using Nom to parse out tokens, and emit events when you hit SGML tags and element content (SAX-parser style). Then you have something over the top of that that accumulates state until it has a complete OFX data element, and then emits that.
Advantage: Very low memory usage. Disadvantage: Probably overkill, since OFX files probably wouldn't be megabytes or gigabytes.
It works for my bank feed, but who knows how many other banks!
If you have any ideas on how to support this well in a non-hacky way that doesn't involve relying on a scripting language (all other existing implementations seem to be some form of scripting language :().
- tekknolagi 7y agoPlease open source it! I'm sure people would be delighted to contribute once you do.
- kibibyte 7y ago> Probably overkill, since OFX files probably wouldn't be megabytes or gigabytes. Maybe not gigabytes, but if you wanted to pull transaction-level data from a relatively active brokerage account, you could end up with an OFX file of a couple of megabytes. I'm sure someone might appreciate the efficiency.