Converting Investment Transaction to DIVIDEND_REINVEST
Hi
My brokerage sends statements that show Dividend Reinvestments but the OFX downloads are two separate transactions:
- One is InvestTxnType.DIVIDEND (technically the parent txn)
- One is InvestTxnType.BUY I want to delete the DIVIDEND transaction and convert the BUY to DIVIDEND_REINVEST. In the UI, I usually just delete the DIV transaction and change the type of the other to DivReinvest
From a code standpoint:
- The delete is easy.
- Is the conversion of the BUY to DIVIDEND_INVEST as simple as changing the transaction type or do I need to do something like:
parent_txn = txn.getParentTxn()
fields = InvestFields()
fields.setFieldStatus(InvestTxnType.DIVIDEND_REINVEST, parent_txn)
fields.storeFields(parent_txn)
parent_txn.syncItem()
Thanks in advance...
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Sean Reilly on 15 Nov, 2024 01:06 PM
Hi John,
That is very close! What I would do is something like this:
It is on my to-do list to add an option to automatically merge separate dividend and reinvest transactions.
Thanks,
Sean
--
Sean Reilly
Developer, The Infinite Kind
https://infinitekind.com
2 Posted by john.vogtle+inf... on 15 Nov, 2024 04:18 PM
Thanks, Sean. I'll give it a shot and report back!
3 Posted by john.vogtle+inf... on 29 Nov, 2024 04:53 PM
Hi Sean -
Just getting back to this after an "interesting" couple of weeks. I think I'm almost there but while the transaction now says DivReinvest, it acts in the account register like a Buy. I've attached a screen shot showing the weirdness.
If I the visibly no-op operation of setting the transaction in the UI to DivReinvest, the calculation straightens out.
Here's the current code for converting the transactions.
4 Posted by john.vogtle+inf... on 08 Dec, 2024 10:29 PM
@Sean - can you have a look at the code above and report what I might be missing...
5 Posted by Stuart Beesley ... on 09 Dec, 2024 07:13 AM
Can you right click the txn after your code runs and grab show raw details. Then noop edit it and grab a new raw details. Post both here. I suspect there’s a leftover parameter that needs clearing out. With the raw details it will be easy to spot.
6 Posted by Stuart Beesley ... on 09 Dec, 2024 07:43 AM
Ok. I haven’t tested this but taking a quick peek tells me you need to do this too:
…right before you set the fields.category
Then everything else should fire into place
Let me know?
7 Posted by john.vogtle+inf... on 09 Dec, 2024 03:15 PM
Just saw this Stuart. I'll respond back with my findings.
8 Posted by john.vogtle+inf... on 10 Dec, 2024 01:31 AM
Hey Stuart. Busy work day. Here's what I've found:
Raw Output Post Script
After "no-op" DivReinvestThe difference seems to be the addition of several lines:
I then added the
fields.hasCategory = True
to the script as you suggested and it worked like a champ!Thanks so much! Can you tell me where you found the fields documented or did you decompile a Java class to find out?
Thanks again.
-John