From 7424c244d69c386187f6df87d309c1d54f8a435b Mon Sep 17 00:00:00 2001 From: Gwyneth Morgan Date: Tue, 28 Jun 2022 04:22:56 +0000 Subject: Document --exchange can accept multiple commodities The --exchange option can accept multiple comma-separated commodities, but this is only mentioned in one place where --exchange is documented, and notably not in the Texinfo manual. Examples made with the following ledger file: ``` P 2022-06-28 USD 54.81 PHP P 2022-06-28 EUR 58.01 PHP 2022-06-28 * Opening Balances Equity:Opening Balances Assets:USD Bank 100 USD Assets:EUR Bank 100 EUR Assets:PHP Bank 100 PHP ``` [ci skip] --- doc/ledger3.texi | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 8 deletions(-) (limited to 'doc/ledger3.texi') diff --git a/doc/ledger3.texi b/doc/ledger3.texi index 8a94271b..747e9df1 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -1877,7 +1877,7 @@ Assets:Checking because its amount is null. @node Complete control over commodity pricing, , Fixing Lot Prices, Currency and Commodities @subsection Complete control over commodity pricing @findex --market -@findex --exchange @var{COMMODITY} +@findex --exchange "@var{COMMODITY} [, @var{COMMODITY}, ...]" Ledger allows you to have very detailed control over how your commodities are valued. You can fine tune the results given using the @@ -3382,7 +3382,7 @@ from the first posting's cost, you can elide the other amount: @node Primary and secondary commodities, , Explicit posting costs, Explicit posting costs @subsection Primary and secondary commodities @findex --market -@findex --exchange @var{COMMODITY} +@findex --exchange "@var{COMMODITY} [, @var{COMMODITY}, ...]" It is a general convention within Ledger that the ``top'' postings in a transaction contain the target accounts, while the final posting @@ -6529,10 +6529,54 @@ report. Report beginning and ending of periods by the date of the first and last posting occurring in that period. -@item --exchange @var{COMMODITY} -@itemx -X @var{COMMODITY} -Display values in terms of the given @var{COMMODITY}. The latest -available price is used. The syntax +@item --exchange "@var{COMMODITY} [, @var{COMMODITY}, ...]" +@itemx -X "@var{COMMODITY} [, @var{COMMODITY}, ...]" +Display values in terms of the given @var{COMMODITY}. If multiple +commodities are given, values in a listed commodity will remain as-is, +and others will be displayed in the first listed commodity they can be +converted to. + +@smallexample +$ ledger balance assets +@end smallexample +@smallexample + 100 EUR + 100 PHP + 100 USD Assets + 100 EUR EUR Bank + 100 PHP PHP Bank + 100 USD USD Bank +-------------------- + 100 EUR + 100 PHP + 100 USD +@end smallexample +@smallexample +$ ledger balance assets --exchange PHP +@end smallexample +@smallexample + 11382 PHP Assets + 5801 PHP EUR Bank + 100 PHP PHP Bank + 5481 PHP USD Bank +-------------------- + 11382 PHP +@end smallexample +@smallexample +$ ledger balance assets --exchange "PHP, EUR" +@end smallexample +@smallexample + 100 EUR + 5581 PHP Assets + 100 EUR EUR Bank + 100 PHP PHP Bank + 5481 PHP USD Bank +-------------------- + 100 EUR + 5581 PHP +@end smallexample + +The latest available price is used. The syntax @option{-X @var{COMMODITY1}:@var{COMMODITY2}} displays values in @var{COMMODITY1} in terms of @var{COMMODITY2} using the latest available price, but will not automatically covert any other commodities to @@ -7502,7 +7546,7 @@ etc. @findex --now @var{DATE} @findex --market -@findex --exchange @var{COMMODITY} +@findex --exchange "@var{COMMODITY} [, @var{COMMODITY}, ...]" When you specify @option{--market (-V)}, or @option{--exchange @var{COMMODITY} (-X)}, you are requesting that some or all of the @@ -7600,7 +7644,7 @@ valuated in another currency. For example: @cindex LIFO/FIFO @findex --lots @findex --lot-prices -@findex --exchange @var{COMMODITY} +@findex --exchange "@var{COMMODITY} [, @var{COMMODITY}, ...]" @findex --historical @findex --basis @findex --price -- cgit v1.2.3