Sell and Buy investment transactions based on positive or negative amount.
andy-vdg opened this issue · 3 comments
Thanks for an awesome script - got most of it working for an ANZ investment statement. However I can't figure out how to get the transaction type to be Sell for negative GrossAmount and Buy for positive GrossAmount.
I'm also not sure if I got the mapping correct as the documentation is very sparse for investement statements.
Here's the CSV
Fund,EffectiveDate,Description,GrossAmount,NetAmount,UnitPrice,Units ANZ Growth Fund ,9/03/2018,PIE Rebate,0.95,0.95,1.91,0.4966,598.6836 ANZ Growth Fund ,2/03/2018,Administration fee,-2.00,-2.00,1.90,1.0513 ANZ Growth Fund ,2/02/2018,Administration fee,-2.00,-2.00,1.95,1.0232 ANZ Growth Fund ,4/01/2018,Administration fee,-2.00,-2.00,1.94,1.0301 ANZ Growth Fund ,4/12/2017,Administration fee,-2.00,-2.00,1.91,1.0456 ANZ Growth Fund ,3/11/2017,Administration fee,-2.00,-2.00,1.89,1.0607 ANZ Growth Fund ,6/10/2017,Administration fee,-2.00,-2.00,1.85,1.079 ANZ Growth Fund ,8/09/2017,Administration fee,-2.00,-2.00,1.82,1.0981 ANZ Growth Fund ,4/08/2017,Administration fee,-2.00,-2.00,1.80,1.1113
My Mapping
mapping = { 'bank': 'ANZ' ,'has_header': True ,'is_split': False ,'is_investment': True ,'account_types': 'Invst' ,'currency': 'NZD' ,'date_fmt': '%m/%d/%Y' ,'date': itemgetter('EffectiveDate') ,'amount': itemgetter('GrossAmount') ,'price': itemgetter('UnitPrice') ,'shares': itemgetter('Units') ,'account': itemgetter('Fund') ,'symbol': itemgetter('Fund') ,'investment': itemgetter('Fund') ,'ticker': itemgetter('Fund') ,'desc': itemgetter('Description') ,'delimiter':',' ,'type': 'buy' }
And the output
!Account NANZ Growth Fund TNone ^ !Type:None D09/03/2018 NShrsIn YANZ Growth Fund I1.91 Q0.4966 Cc MPIE Rebate T0.95 ^ !Type:None D02/03/2018 NShrsIn YANZ Growth Fund I1.90 Q1.0513 Cc MAdministration fee T2.00 ^ !Type:None D02/02/2018 NShrsIn YANZ Growth Fund I1.95 Q1.0232 Cc MAdministration fee T2.00 ^ !Type:None D04/01/2018 NShrsIn YANZ Growth Fund I1.94 Q1.0301 Cc MAdministration fee T2.00 ^ !Type:None D04/12/2017 NShrsIn YANZ Growth Fund I1.91 Q1.0456 Cc MAdministration fee T2.00 ^ !Type:None D03/11/2017 NShrsIn YANZ Growth Fund I1.89 Q1.0607 Cc MAdministration fee T2.00 ^ !Type:None D06/10/2017 NShrsIn YANZ Growth Fund I1.85 Q1.079 Cc MAdministration fee T2.00 ^ !Type:None D08/09/2017 NShrsIn YANZ Growth Fund I1.82 Q1.0981 Cc MAdministration fee T2.00 ^ !Type:None D04/08/2017 NShrsIn YANZ Growth Fund I1.80 Q1.1113 Cc MAdministration fee T2.00 ^
Sadly, I haven't had time to test investment transactions. See #32 for more info. PRs are always welcome :).
Not sure this is specific to investment transactions.
What if I had a normal bank CSV with positive or negative amounts in a column.
How would I be able to get a Debit or Credit transaction type from that value?
Ok, in that case you can have something like the default setup and mapping using the options from the test.