inconsistent behaviour in equity command

59 views
Skip to first unread message

lipp f

unread,
Nov 4, 2021, 4:21:48 PM11/4/21
to Ledger
$ ledger equity 
....
Assets:xxxxxx35:OPT     100.0 "SPY   220617C00310000"
Assets:xxxxxx35:OPT     100.0 "SPY   220617C00340000"
Assets:xxxxxx35:OPT     200.0 "XOM   220617C00047500"
Assets:xxxxxx04:STK      500.0000 QQQ
Assets:xxxxxx04:STK      100.0000 SPY
Assets:xxxxxx04:STK      200.0000 VOO
Assets:xxxxxx73:Cash  403.14000 CAD
Assets:xxxxxx73:STK   "TDB902" 8.8376
Assets:xxxxxx73:STK   "TDB952" 5.4925
Assets:xxxxxx73:STK    70.0000 VOO
Assets:xxxxxx47:Cash     52.85727 CAD
....
Some rows are account, commodity, amount and others are account, amount, commodity. Any options to fix this? 

Thanks.

Martin Michlmayr

unread,
Nov 4, 2021, 8:13:52 PM11/4/21
to ledge...@googlegroups.com
* lipp f <flip...@gmail.com> [2021-11-04 13:21]:
> Some rows are account, commodity, amount and others are account,
> amount, commodity. Any options to fix this?

And your input file doesn't use a similarly inconsistent style, or
does it match your input file?

--
Martin Michlmayr
https://www.cyrius.com/

lipp f

unread,
Nov 5, 2021, 9:23:27 AM11/5/21
to Ledger
You are correct Martin. For TDB902 and TDB952, the jurnal entries are in "commodity amount @ price" format. I got all the records through an export process and changing manually all of them does not seem like an option.

So, the quetion is the same,  how do I get a consitent equity report?

Martin Michlmayr

unread,
Nov 5, 2021, 9:32:36 AM11/5/21
to ledge...@googlegroups.com
* lipp f <flip...@gmail.com> [2021-11-05 06:23]:
> You are correct Martin. For TDB902 and TDB952, the jurnal entries are in
> "commodity amount @ price" format. I got all the records through an export
> process and changing manually all of them does not seem like an option.
>
> So, the quetion is the same, how do I get a consitent equity report?

So it sounds like ledger gives you the correct output for the input
you're feeding it. The solution then is to fix your input.

Maybe you can pipe your export script into a script that changes
"commodity amount" to "amount commodity". A small Perl script should
do the trick.

lipp f

unread,
Nov 5, 2021, 10:20:50 AM11/5/21
to Ledger
Thank you Martin. In another recent discution you are recommandin a "D" record to specify / enforce commodity format. Something like:

D 1,000.00 AUD

I have tryied that and it works fine for CAD commodity (CA currency) but not for TDB902 and TDB952. Why is that?


Martin Michlmayr

unread,
Nov 5, 2021, 7:55:52 PM11/5/21
to ledge...@googlegroups.com
* lipp f <flip...@gmail.com> [2021-11-05 07:20]:
> Thank you Martin. In another recent discution you are recommandin a "D"
> record to specify / enforce commodity format. Something like:
>
> D 1,000.00 AUD
>
> I have tryied that and it works fine for CAD commodity (CA currency) but
> not for TDB902 and TDB952. Why is that?

Because actual usage (i.e. input data) trumps the declaration with
"D".

Use this example:

D 1000.00 AUD

2021-02-02 * Foo
A 1,000.00 AUD
B

You'll get the comma as the thousand separator.
Reply all
Reply to author
Forward
0 new messages