-
Notifications
You must be signed in to change notification settings - Fork 49
Description
I found another bug in handling reverse stock splits from Vanguard.
I owned 200 shares of LPI (CUSIP 516806205) which did a 20-for-1 reverse split. I should end up with 10 shares of LPI. Instead I end up short 190 shares of LPI and long 200.0 shares of "516806106".
I think the relevant OFX data is below
<FITID>881201203<DTTRADE>20200602160000.000[-5:EST]<DTSETTLE>20200602160000.000[-5:EST]
<MEMO>REVERSE SPLITREVERSE SPLIT</INVTRAN>
<SECID><UNIQUEID>516806205<UNIQUEIDTYPE>CUSIP</SECID>
<SUBACCTSEC>CASH
<UNITS>-200.0<TFERACTION>OUT<POSTYPE>LONG</TRANSFER>
<TRANSFER><INVTRAN>
<FITID>881209203<DTTRADE>20200602160000.000[-5:EST]
<DTSETTLE>20200602160000.000[-5:EST]
<MEMO>REVERSE SPLITREVERSE SPLIT</INVTRAN>
<SECID><UNIQUEID>516806205<UNIQUEIDTYPE>CUSIP</SECID>
<SUBACCTSEC>CASH<UNITS>10.0<TFERACTION>IN<POSTYPE>LONG</TRANSFER>
<INVBANKTRAN><STMTTRN>
Btw, if you could add some mode where it is possible to dump the OFX for a particular transaction or simplify the massive OFX file I get from ofxclient which causes problems for ledger-autosync, I could try to produce better test cases for you.
For example, if you have a unit test which includes the skeleton of an OFX file where I could dump in something like the above to get you a minimal test case, that would be great for lots of reasons.
Similarly, if somehow the txn object could carry along the raw OFX that produced it, that would also be really useful for debugging. As it is the txn object in converter.py has some fields like memo, security, and so on but if you could just keep the raw OFX in there it would be much easier to both set breakpoints to find how problems are being parsed and also dump out the offending OFX. I'm not sure how easy that is to do since OFX seems like an ugly format but just a thought.
Finally, thanks for your work on ledger-autosync. It's an awesome idea! Possibly my brokerage accounts are a bit too funky but I'm hoping we can get close. Thanks.