hledger
                                
                                 hledger copied to clipboard
                                
                                    hledger copied to clipboard
                            
                            
                            
                        redundant equity/cost detection does not work with CSV / account types do not affect CSV
This entry, when read from a journal file, is accepted. Declaring eigenkapital:umwandlung to be an equity conversion account (type V) allows the equity conversion postings to be detected and matched up with the @@ €303,20 cost:
commodity 1000,00 €
commodity 1000,0000 "LYX0Q0"
account eigenkapital:umwandlung  ; type:V
2023-01-18
    aktiva:stewmehr:bnp:giro                                        €-304,00
    eigenkapital:umwandlung                                          €303,20
    eigenkapital:umwandlung                                  "LYX0Q0"-1,5111
    aktiva:stewmehr:bnp:depot:LYX0Q0:16.01.2023    "LYX0Q0"1,5111 @@ €303,20
    aufwendungen:bankgebuehren:depot                                   €0,80
However if this journal entry is generated by CSV rules, it is rejected - even if you first read a journal file declaring the account type:
$ hledger -f accounts.journal -f txns.csv print   # fails
This seems a bug; https://hledger.org/dev/hledger.html#directive-effects says an account directive should affect all files.
I'm not quite sure where the bug is here. Notes:
- 
Reading the above entry requires the account declaration, so that hledger knows eigenkapital:umwandlung is an equity conversion posting. 
- 
A CSV file alone can't provide the account declaration. Here's one generating the same entry: a.csv: 2023-01-01,a.csv.rules: fields date, account1 aktiva:stewmehr:bnp:giro account2 eigenkapital:umwandlung account3 eigenkapital:umwandlung account4 aktiva:stewmehr:bnp:depot:LYX0Q0:16.01.2023 account5 aufwendungen:bankgebuehren:depot amount1 €-304,00 amount2 €303,20 amount3 "LYX0Q0"-1,5111 amount4 "LYX0Q0"1,5111 @@ €303,20 amount5 €0,80
- 
A journal file can't include a csv file and vice versa. A sibling journal file and csv file doesn't work: $ hledger -f accounts.j -f a.csv print hledger: Error: /Users/simon/src/hledger/a.csv:1-0: 1 | 2023-01-01 | aktiva:stewmehr:bnp:giro €-304,00 | eigenkapital:umwandlung €303,20 | eigenkapital:umwandlung "LYX0Q0"-1,5111 | aktiva:stewmehr:bnp:depot:LYX0Q0:16.01.2023 "LYX0Q0"1,5111 @@ €303,20 | aufwendungen:bankgebuehren:depot €0,80 This multi-commodity transaction is unbalanced. The real postings' sum should be 0 but is: "LYX0Q0"-1,5111, €303,20
- 
And indeed, sibling journal files doesn't work either: $ hledger -f accounts.j -f txns.j print hledger: Error: /Users/simon/src/hledger/txns.j:2-7: 2 | 2023-01-01 | aktiva:stewmehr:bnp:giro €-304,00 | eigenkapital:umwandlung €303,20 | eigenkapital:umwandlung "LYX0Q0"-1,5111 | aktiva:stewmehr:bnp:depot:LYX0Q0:16.01.2023 "LYX0Q0"1,5111 @@ €303,20 | aufwendungen:bankgebuehren:depot €0,80 This multi-commodity transaction is unbalanced. The real postings' sum should be 0 but is: "LYX0Q0"-1,5111, €303,20
- 
But putting the account declaration in an including parent journal, or an included child journal, does work. 
- 
It seems like the issue may be that https://hledger.org/dev/hledger.html#directive-effects describes the scope of the account existence declaration (= all files), but the scope of the account type is different (only parents and children). 
- 
Needed: more testing, doc updates, perhaps account directive scope changes, and some solution for generating these redundant equity/cost transactions from CSV.