Is there any way to do a currency conversion with "ledger csv"

40 views
Skip to first unread message

lipp f

unread,
Sep 5, 2023, 8:52:14 AM9/5/23
to Ledger
I am doing this:
$ ledger csv INV:Assets:External  | csvcut -c 1,6,5
and the return is correct, like this:
2018/05/04,-100,USD
2018/05/10,-100,CAD
2018/05/11,-18242,USD
2018/06/11,99,CAD
2018/07/16,-0.12,CAD
2018/07/18,-0.15,CAD
2018/07/25,-42100,CAD
2018/08/03,99,CAD
2018/08/09,10,USD
2018/08/21,13.3,CAD
2018/08/22,90,USD
2018/09/04,-72000,CAD
2018/09/07,-100,USD
2018/10/10,-2,USD
2018/10/17,-70050,CAD
2018/11/13,177.43,USD
2018/11/15,-180,USD
2018/11/15,30.6,USD
2018/11/19,-30,USD
2018/11/20,-1,CAD
2018/11/22,-14500,CAD
2019/01/18,78.29,USD
2019/04/10,208.15,USD
2019/04/12,104.8,CAD
2019/04/15,-292,USD
2019/05/03,114.9,USD
2019/05/10,28.84,USD
2019/06/11,30.02,USD
2019/07/11,28.97,USD
2019/08/06,135,USD
2019/08/12,29.4,USD
2019/09/12,28.97,USD
2019/10/04,-398,USD
2019/10/10,27.85,USD
2019/10/23,-26412,CAD
2019/10/26,-15,CAD
2019/11/04,129.76,USD
2019/11/12,27.36,USD
2019/12/11,26.79,USD
2019/12/30,24.24,USD
2020/01/03,18.68,USD
2020/01/15,-1200,CAD
2020/02/04,129.45,USD
2020/02/13,63.97,USD
2020/03/03,1200,CAD
2020/03/12,60.6,USD
2020/04/08,330.86,USD
2020/04/09,62.92,USD
2020/05/04,130.69,USD
2020/05/08,57.16,USD
2020/06/08,-1090,USD
2020/06/09,55.57,USD
2020/06/11,-56,USD
2020/07/10,50.67,USD
2020/07/21,400,CAD
2020/08/05,129.97,USD
2020/08/11,50.27,USD
2020/08/13,-232,USD
2020/09/10,48.36,USD
2020/09/15,-48,USD
2020/10/09,44.7,USD
2020/10/14,-45,USD
2020/11/03,126.27,USD
2020/11/05,-126,USD
2020/11/10,44.8,USD
2020/11/13,-45,USD
2020/12/03,-50,CAD
2020/12/09,43.09,USD
2020/12/11,-46,USD
2020/12/23,-50,CAD
2020/12/29,43.34,USD
2020/12/31,-43,USD
2021/01/11,-200,CAD
2021/01/26,-50,CAD
2021/02/01,-130.28,USD
2021/02/05,-70388,CAD
2021/02/18,-49999.99,CAD
2021/02/24,-50,CAD
2021/03/24,-50,CAD
2021/04/23,-50,CAD
2021/05/26,-50,CAD
2021/06/23,-50,CAD
2021/07/22,-50,CAD
2021/08/24,-50,CAD
2021/09/23,-50,CAD
2021/10/22,-50,CAD
2021/11/22,-50,CAD
2021/12/22,-50,CAD
2022/01/21,-50,CAD
2022/02/24,-50,CAD
2022/03/23,-50,CAD
2022/04/21,-50,CAD
2022/05/20,-50,CAD
2022/06/22,-50,CAD
2022/06/27,300,CAD
2022/07/22,-50,CAD
2022/08/23,-50,CAD
2022/09/21,-50,CAD
2022/10/22,-50,CAD
2022/11/23,-50,CAD
2022/12/21,-50,CAD
2023/01/20,-50,CAD
2023/02/23,-50,CAD
2023/03/22,-50,CAD
2023/04/22,-50,CAD
2023/05/19,-50,CAD
2023/06/21,-50,CAD
2023/07/21,-50,CAD
2023/08/22,-50,CAD
Some lines in CAD and some in USD, but I need all lines in CAD
When I try:
$ ledger csv INV:Assets:External -X CAD -V | csvcut -c 1,6,5
it returns 1335 lines instead of 109.

John Wiegley

unread,
Sep 11, 2023, 9:25:40 PM9/11/23
to lipp f, Ledger
>>>>> "lf" == lipp f <flip...@gmail.com> writes:

lf> $ ledger csv INV:Assets:External -X CAD -V | csvcut -c 1,6,5

The -X and -V options are mutually exclusive, so I would use only “-X CAD”.
Maybe you can use it with the register command, to find out what all of those
entries are that it’s reporting?

John

lipp f

unread,
Sep 12, 2023, 9:22:17 AM9/12/23
to Ledger
Using "reg":

$ ledger reg INV:Assets:External -X CAD 

I'm getting 1230 lines like this:

2018-05-17 Commodities revalued                    <Revalued>                                    -88.023258000000000 CAD -23,624.678836000000000 CAD
2018-05-25 Commodities revalued                    <Revalued>                                    -275.992074000000000 CAD -23,900.670910000000000 CAD
2018-05-29 Commodities revalued                    <Revalued>                                    -86.445846000000000 CAD -23,987.116756000000000 CAD
2018-05-30 Commodities revalued                    <Revalued>                                    261.190080000000000 CAD -23,725.926676000000000 CAD
2018-06-01 Commodities revalued                    <Revalued>                                    -146.369160000000000 CAD -23,872.295836000000000 CAD
2018-06-04 Commodities revalued                    <Revalued>                                     52.568172000000000 CAD -23,819.727664000000000 CAD
2018-06-05 Commodities revalued                    <Revalued>                                    -75.385620000000000 CAD -23,895.113284000000000 CAD
2018-06-07 Commodities revalued                    <Revalued>                                     -4.695552000000000 CAD -23,899.808836000000000 CAD

John Wiegley

unread,
Sep 12, 2023, 1:10:03 PM9/12/23
to lipp f, Ledger
>>>>> "lf" == lipp f <flip...@gmail.com> writes:

lf> Using "reg":
lf> $ ledger reg INV:Assets:External -X CAD 

lf> I'm getting 1230 lines like this:

Ah, try the --no-revalued option.

John

lipp f

unread,
Sep 12, 2023, 2:45:40 PM9/12/23
to Ledger
that was it, thank you.
Reply all
Reply to author
Forward
0 new messages