redstreet / beancount_reds_importers

Simple ingesting tools for Beancount (plain text, double entry accounting software). More importantly, a framework to allow you to easily write your own importers.
GNU General Public License v3.0
111 stars 38 forks source link

Handle the INVEXPENSE field #79

Closed farktronix closed 1 year ago

farktronix commented 1 year ago

When an E*Trade receives a dividend on an international stock it pulls out taxes from that amount and records it as an INVEXPENSE. Here is an example:

<INVEXPENSE>
<INVTRAN>
<FITID>230714_DIV_0
<DTTRADE>20230714170000.000
<MEMO>DIV - TAIWAN SEMI Foreign Stk W/HLTD-SPONSORED ADR REPSTG 5 COM
</INVTRAN>
<SECID>
<UNIQUEID>874039100
<UNIQUEIDTYPE>CUSIP
</SECID>
<TOTAL>-21.89
<SUBACCTSEC>CASH
<SUBACCTFUND>CASH
</INVEXPENSE>

This patch handles those as a transfer, which is a little odd, but I didn't think this was worth creating its own function to handle. Here is the resulting output:

2023-07-14 * "DIV - TAIWAN SEMI Foreign Stk W/HLTD-SPONSORED ADR REPSTG 5 COM" "invexpense"
  Assets:Investments:ETrade:USD               -21.89 USD
  Expenses:Investment-Expenses:ETrade          21.89 USD
farktronix commented 1 year ago

Sorry- I should have included the unit test fixes with the original commit. I fixed up the unit tests that this change broke, then I added a unit test for the E*TRADE importer.

I think this PR is complete now

redstreet commented 1 year ago

Awesome, thanks for adding this :-), merged!

farktronix commented 1 year ago

Thank you, and thanks for writing and maintaining these importers. I really appreciate it!

redstreet commented 1 year ago

Thanks for the kind words, and I'm always very glad when people find this useful :)