redstreet/beancount_reds_importers

FYI: Vanguard qfx files: possibility of dividend reinvest transactions with unitprice set to 0.

savingsandloan opened this issue ยท 3 comments

Hi, using your vanguard ofx importer again (thanks!). Perhaps it may be an anomaly but noticed that vanguard has a possibility of generating a dividend reinvestment with a unitprice of 0, triggering the "Either price ({}) or cost ({}) must be specified".format(price_number, cost_number) in libtransactionbuilder/common.py . This is more of a heads-up as I'm not sure yet if it's better to have a special case around this or expect the user to make a minor edit to their ofx file to deal with this. This may just be a a one-off anomaly since I don't see it with other dividend reinvest transactions.

Sample of what it looks like:

<REINVEST><INVTRAN><FITID>999999999<DTTRADE>20210922160000.000[-5:EST]<DTSETTLE>20210622160000.000[-5:EST]<MEMO>DIVIDEND REINVEST</INVTRAN><SECID><UNIQUEID>999999999<UNIQUEIDTYPE>CUSIP</SECID><INCOMETYPE>DIV<TOTAL>-9.99<SUBACCTSEC>CASH<UNITS>9.99<UNITPRICE>0.0</REINVEST>

Transaction(meta={'filename':                                                   
'/home/savingsandloan/OfxDownload.qfx', 'lineno': 106},        
date=datetime.date(2021, 9, 22), flag='*', payee='DIVIDEND REINVEST',           
narration='[VMRXX] Vanguard Cash Reserves Federal Money Market Fund - Admiral   
Shares', tags=frozenset(), links=frozenset(), postings=[])

Things also appear this way on the transactions table on their website, and the csv output.

Ah yes, I ran into this exactly once in the last four years. Hadn't plumbed a handler to fix this because I figured it was a bug at Vanguard's end specific to my one single instance. Since you're seeing it too, I went ahead and made that fix. Check it out above. pypi not released, so you'll have to use pip install ..

Thanks for including the sample and output, which let me locate my own qfx, and also helped debug quickly!

Seems to work, thanks!

For anyone curious, this may happen on the rare occasion where vanguard moves to a different money market account (e.g. VMMXX to VMRXX which happened around june 2021) - you may also end up with a duplicate dividend transaction (just comment it out manually)