jseutter / ofxparse

Ofx file format parser for Python
http://sites.google.com/site/ofxparse/
MIT License
204 stars 121 forks source link

multiple accounts ofx combined #131

Closed jettero closed 7 years ago

jettero commented 7 years ago

The output of ofxclient in combined mode (with the --download of all accounts) produces an OFX file that I suspect isn't standard in any way. It seems the ofxmain.dtd allows it, but it's hard to say, since no OFX file seems to be XML validatable (imo) and xml-valid inputs (not counting the ofx file header) don't work with several of my banks.

Anyway, the output of ofxclient combined is something like this:

<OFX>
  <SIGNONMSGSRSV1>
     … <FI><FID>1</FID>…</FI>
  </SIGNONMSGSRSV1>
  <CREDITCARDMSGSRSV1>
     … blah, statement stuff here, blah
  </CREDITCARDMSGSRSV1>
  <SIGNONMSGSRSV1>
     … <FI><FID>2</FID></FI>
  </SIGNONMSGSRSV1>
  <BANKMSGSRSV1>
     … blah, statement stuff here, blah
  </BANKMSGSRSV1>
</OFX>

ofxparse is parsing this mess OK, but all accounts in ofx.accounts have the very last last FI/FID value found in the file. That is, the creditcard statement stuff will have ofx.accounts[0].institution.fid == 2 and the bank ofx.accounts[1].institution.fid == 2 as well.

Is this something I need to repair before using ofxparse on the file? or is this something ofxparse could do better?

Thanks.

captin411 commented 7 years ago

It is likely non standard. If you are having an issue, to avoid the problem and download the file from the bank without the CLI tweaking things for convenience (some software just works with this weird format) I would recommend just running the CLI in a for loop with the --account flag to force a single standard download

On Sun, Jul 9, 2017 at 7:17 AM Paul Miller notifications@github.com wrote:

The output of ofxclient in combined mode (with the --download of all accounts) produces an OFX file that I suspect isn't standard in any way. It seems the ofxmain.dtd allows it, but it's hard to say, since no OFX file seems to be XML validatable (imo) and xml-valid inputs (not counting the ofx file header) don't work with several of my banks.

Anyway, the output of ofxclient combined is something like this:

1 … blah, statement stuff here, blah 2 … blah, statement stuff here, blah

ofxparse is parsing this mess OK, but all accounts in ofx.accounts have the very last last FI/FID value found in the file. That is, the creditcard statement stuff will have ofx.accounts[0].institution.fid == 2 and the bank ofx.accounts[1].institution.fid == 2 as well.

Is this something I need to repair before using ofxparse on the file? or is this something ofxparse could do better?

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jseutter/ofxparse/issues/131, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGZk-SJ1z73j3C012ipoHia7pc9865Nks5sMOD-gaJpZM4OSEuS .

jettero commented 7 years ago

That's a good idea. I think I'll do that.

And just so this is all in once place, I'm pasting the DTD below. I'm pretty sure this says you can have equally many of each type of MSGSRS in the OFX as you like. Personally, I hate when xml has order dependent things in it, but I've seen APIs like that before... I think this really might be one.

<!ENTITY % OFXRQMSGSETS
                     "SIGNONMSGSRQV1,
                      SIGNUPMSGSRQV1?,
                      BANKMSGSRQV1?,
                      CREDITCARDMSGSRQV1?,
                      INVSTMTMSGSRQV1?,
                      INTERXFERMSGSRQV1?,
                      WIREXFERMSGSRQV1?,
                      BILLPAYMSGSRQV1?,
                      EMAILMSGSRQV1?,
                      SECLISTMSGSRQV1?,
                      PROFMSGSRQV1?
                      %EXTRARQMSGSETS">

<!ENTITY % OFXRSMSGSETS
                     "SIGNONMSGSRSV1,
                      SIGNUPMSGSRSV1?,
                      BANKMSGSRSV1?,
                      CREDITCARDMSGSRSV1?,
                      INVSTMTMSGSRSV1?,
                      INTERXFERMSGSRSV1?,
                      WIREXFERMSGSRSV1?,
                      BILLPAYMSGSRSV1?,
                      EMAILMSGSRSV1?,
                      SECLISTMSGSRSV1?,
                      PROFMSGSRSV1?
                      %EXTRARSMSGSETS">

<!ELEMENT OFX   - - ((%OFXRQMSGSETS) | (%OFXRSMSGSETS))>