From 4bf0d76a1f64aaa09d5e90cdd3e7a601f9cce55b Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 21 Dec 2021 10:53:19 -1000 Subject: [PATCH] ;doc: update manuals --- hledger/hledger.1 | 182 +++- hledger/hledger.info | 1743 ++++++++++++++++++++---------------- hledger/hledger.txt | 2029 ++++++++++++++++++++++-------------------- 3 files changed, 2233 insertions(+), 1721 deletions(-) diff --git a/hledger/hledger.1 b/hledger/hledger.1 index 1bae4ae5d..2ccac782a 100644 --- a/hledger/hledger.1 +++ b/hledger/hledger.1 @@ -1529,12 +1529,171 @@ not the old one, and \f[C]amt:\f[R] matches the new quantity, and not the old one. Note: this changed in hledger 1.22, previously it was the reverse, see the discussion at #1625. -.SH COSTING +.SS CONVERSION & COST .PP -The \f[C]-B/--cost\f[R] flag converts amounts to their cost or sale -amount at transaction time, if they have a transaction price specified. -If this flag is supplied, hledger will perform cost conversion first, -and will apply any market price valuations (if requested) afterwards. +This section is about converting between commodities. +Some definitions: +.IP \[bu] 2 +A \[dq]commodity conversion\[dq] is an exchange of one currency or +commodity for another. +Eg a foreign currency exchange, or a purchase or sale of stock or +cryptocurrency. +.IP \[bu] 2 +A \[dq]conversion transaction\[dq] is a transaction involving one or +more such conversions. +.IP \[bu] 2 +\[dq]Conversion rate\[dq] is the exchange rate in a conversion - the +cost per unit of one commodity in the other. +.IP \[bu] 2 +\[dq]Cost\[dq] is how much of one commodity was paid to acquire the +other (when buying), or how much was received in exchange for the other +(when selling). +We call both of these \[dq]cost\[dq] for convenience (after all, it is +cost for one party or the other). +.SS Recording conversions +.PP +As a concrete example, let\[aq]s assume 100 EUR was converted to 120 +USD. +There are several ways to record this in the journal, each with pros and +cons which will be explained in more detail below. +(Also, these examples use journal format which is properly explained +much further below; sorry about that, you may want to read some of that +first.) +.SS Implicit conversion +.PP +You can just record the outflow (100 EUR) and inflow (120 USD) in the +appropriate asset account: +.IP +.nf +\f[C] +2021-01-01 + assets:cash -100 EUR + assets:cash 120 USD +\f[R] +.fi +.PP +hledger will assume this transaction is balanced, inferring that the +conversion rate must be 1 EUR = 1.20 USD. +You can see the inferred rate by using \f[C]hledger print -x\f[R]. +.PP +Pro: - Easy, concise - hledger can do cost reporting +.PP +Con: - Less error checking - typos in amounts or commodity symbols may +not be detected - conversion rate is not clear - disturbs the accounting +equation +.PP +You can prevent accidental implicit conversions due to a mistyped +commodity symbol, by using \f[C]hledger check commodities\f[R]. +You can prevent implicit conversions entirely, by using +\f[C]hledger check balancednoautoconversion\f[R], or +\f[C]-s/--strict\f[R]. +.SS Priced conversion +.PP +You can add the conversion rate using \[at] notation: +.IP +.nf +\f[C] +2021-01-01 + assets:cash -100 EUR \[at] 1.20 USD + assets:cash 120 USD +\f[R] +.fi +.PP +Now hledger will check that 100 * 1.20 = 120, and would report an error +otherwise. +.PP +Pro: - Still concise - makes the conversion rate clear - provides some +error checking - hledger can do cost reporting +.PP +Con: - Disturbs the accounting equation +.SS Equity conversion +.PP +In strict double entry bookkeeping, the above transaction is not +balanced in EUR or in USD, since some EUR disappears, and some USD +appears. +This violates the accounting equation (A+L+E=0), and prevents reports +like \f[C]balancesheetequity\f[R] from showing a zero total. +.PP +The proper way to make it balance is to add a balancing posting for each +commodity, using an equity account: +.IP +.nf +\f[C] +2021-01-01 + assets:cash -100 EUR + equity:conversion 100 EUR + equity:conversion -120 USD + assets:cash 120 USD +\f[R] +.fi +.PP +Pro: - Preserves the accounting equation - keeps track of conversions +and related gains/losses in one place - works in any double entry +accounting system +.PP +Con: - More verbose - conversion rate is not clear - hledger can not do +cost reporting +.SS Priced equity conversion +.PP +Another possible notation would be to record both the conversion rate +and the equity postings: +.IP +.nf +\f[C] +2021-01-01 + assets:cash -100 EUR \[at] 1.20 USD + equity:conversion 100 EUR + equity:conversion -120 USD + assets:cash 120 USD +\f[R] +.fi +.PP +hledger currently does not allow this; instead, you can record the +conversion rate as a comment. +.SS Inferring missing conversion rates +.PP +hledger will do this automatically for implicit conversions. +Currently it can not do this for equity conversions. +.SS Inferring missing equity postings +.PP +With the \f[C]--infer-equity\f[R] flag, hledger will add equity postings +to priced and implicit conversions (and move the conversion rate into a +comment). +.SS Cost reporting +.PP +With the \f[C]-B/--cost\f[R] flag, hledger will convert the amounts in +priced and implicit conversions to their cost in the other commodity. +This is useful to see a report of what you paid for things (or how much +you sold things for). +Currently \f[C]-B/--cost\f[R] does not work on equity conversions, and +it disables \f[C]--infer-equity\f[R]. +.PP +These operations are transient, only affecting reports. +If you want to change the journal file permanently, you could pipe each +entry through \f[C]hledger -f- -I print [-x] [--infer-equity] [-B]\f[R] +.SS Conversion summary +.IP \[bu] 2 +Recording the conversion rate is good because it makes that clear and +allows cost reporting. +.IP \[bu] 2 +Recording equity postings is good because it balances the accounting +equation and is correct bookkeeping. +.IP \[bu] 2 +Combining these is not yet supported, so you have to choose. +For now, priced conversions are a good compromise, so that: +.RS 2 +.IP \[bu] 2 +When you want to see the cost (or sale proceeds) of things, use +\f[C]-B/--cost\f[R]. +.IP \[bu] 2 +When you want to see a balanced balance sheet or correct journal +entries, use \f[C]--infer-equity\f[R]. +.IP \[bu] 2 +Combining these is not yet supported; \f[C]-B/--cost\f[R] will take +precedence. +.RE +.IP \[bu] 2 +Conversion/cost operations are performed before valuation. .SH VALUATION .PP Instead of reporting amounts in their original commodity, hledger can @@ -7579,9 +7738,10 @@ account ACCTNAME [ACCTTYPE] [;COMMENT] .PP By adding a \f[C]type\f[R] tag to the account directive, with value \f[C]A\f[R], \f[C]L\f[R], \f[C]E\f[R], \f[C]R\f[R], \f[C]X\f[R], -\f[C]C\f[R] (or if you prefer: \f[C]Asset\f[R], \f[C]Liability\f[R], -\f[C]Equity\f[R], \f[C]Revenue\f[R], \f[C]Expense\f[R], \f[C]Cash\f[R]), -you can declare hledger accounts to be of a certain type: +\f[C]C\f[R], \f[C]V\f[R] (or if you prefer: \f[C]Asset\f[R], +\f[C]Liability\f[R], \f[C]Equity\f[R], \f[C]Revenue\f[R], +\f[C]Expense\f[R], \f[C]Cash\f[R], \f[C]Conversion\f[R]), you can +declare hledger accounts to be of a certain type: .IP \[bu] 2 \f[B]asset\f[R], \f[B]liability\f[R], \f[B]equity\f[R], \f[B]revenue\f[R], \f[B]expense\f[R] @@ -7595,6 +7755,12 @@ the standard types in accounting, or .P .PD a subtype of asset, used for liquid assets. +.IP \[bu] 2 +\f[B]conversion\f[R] +.PD 0 +.P +.PD +a subtype of equity, used for conversion postings .PP Declaring account types is a good idea, since it helps enable the easy balancesheet, balancesheetequity, incomestatement and cashflow reports, diff --git a/hledger/hledger.info b/hledger/hledger.info index 72d9e5653..6cbd3d455 100644 --- a/hledger/hledger.info +++ b/hledger/hledger.info @@ -66,7 +66,6 @@ try some commands like 'hledger print' or 'hledger balance'. Run * TIME PERIODS:: * DEPTH:: * QUERIES:: -* COSTING:: * VALUATION:: * PIVOTING:: * OUTPUT:: @@ -1027,7 +1026,7 @@ with less detail. This flag has the same effect as a 'depth:' query argument: 'depth:2', '--depth=2' or '-2' are equivalent.  -File: hledger.info, Node: QUERIES, Next: COSTING, Prev: DEPTH, Up: Top +File: hledger.info, Node: QUERIES, Next: VALUATION, Prev: DEPTH, Up: Top 6 QUERIES ********* @@ -1067,6 +1066,7 @@ arguments to restrict their scope. The syntax is as follows: * Queries and valuation:: * Querying with account aliases:: * Querying with cost or value:: +* CONVERSION & COST::  File: hledger.info, Node: Query types, Next: Combining query terms, Up: QUERIES @@ -1214,7 +1214,7 @@ When account names are rewritten with '--alias' or 'alias', note that 'acct:' will match either the old or the new account name.  -File: hledger.info, Node: Querying with cost or value, Prev: Querying with account aliases, Up: QUERIES +File: hledger.info, Node: Querying with cost or value, Next: CONVERSION & COST, Prev: Querying with account aliases, Up: QUERIES 6.7 Querying with cost or value =============================== @@ -1226,20 +1226,208 @@ Note: this changed in hledger 1.22, previously it was the reverse, see the discussion at #1625.  -File: hledger.info, Node: COSTING, Next: VALUATION, Prev: QUERIES, Up: Top +File: hledger.info, Node: CONVERSION & COST, Prev: Querying with cost or value, Up: QUERIES -7 COSTING -********* +6.8 CONVERSION & COST +===================== -The '-B/--cost' flag converts amounts to their cost or sale amount at -transaction time, if they have a transaction price specified. If this -flag is supplied, hledger will perform cost conversion first, and will -apply any market price valuations (if requested) afterwards. +This section is about converting between commodities. Some definitions: + + * A "commodity conversion" is an exchange of one currency or + commodity for another. Eg a foreign currency exchange, or a + purchase or sale of stock or cryptocurrency. + + * A "conversion transaction" is a transaction involving one or more + such conversions. + + * "Conversion rate" is the exchange rate in a conversion - the cost + per unit of one commodity in the other. + + * "Cost" is how much of one commodity was paid to acquire the other + (when buying), or how much was received in exchange for the other + (when selling). We call both of these "cost" for convenience + (after all, it is cost for one party or the other). + +* Menu: + +* Recording conversions:: +* Inferring missing conversion rates:: +* Inferring missing equity postings:: +* Cost reporting:: +* Conversion summary::  -File: hledger.info, Node: VALUATION, Next: PIVOTING, Prev: COSTING, Up: Top +File: hledger.info, Node: Recording conversions, Next: Inferring missing conversion rates, Up: CONVERSION & COST -8 VALUATION +6.8.1 Recording conversions +--------------------------- + +As a concrete example, let's assume 100 EUR was converted to 120 USD. +There are several ways to record this in the journal, each with pros and +cons which will be explained in more detail below. (Also, these +examples use journal format which is properly explained much further +below; sorry about that, you may want to read some of that first.) + +* Menu: + +* Implicit conversion:: +* Priced conversion:: +* Equity conversion:: +* Priced equity conversion:: + + +File: hledger.info, Node: Implicit conversion, Next: Priced conversion, Up: Recording conversions + +6.8.1.1 Implicit conversion +........................... + +You can just record the outflow (100 EUR) and inflow (120 USD) in the +appropriate asset account: + +2021-01-01 + assets:cash -100 EUR + assets:cash 120 USD + + hledger will assume this transaction is balanced, inferring that the +conversion rate must be 1 EUR = 1.20 USD. You can see the inferred rate +by using 'hledger print -x'. + + Pro: - Easy, concise - hledger can do cost reporting + + Con: - Less error checking - typos in amounts or commodity symbols +may not be detected - conversion rate is not clear - disturbs the +accounting equation + + You can prevent accidental implicit conversions due to a mistyped +commodity symbol, by using 'hledger check commodities'. You can prevent +implicit conversions entirely, by using 'hledger check +balancednoautoconversion', or '-s/--strict'. + + +File: hledger.info, Node: Priced conversion, Next: Equity conversion, Prev: Implicit conversion, Up: Recording conversions + +6.8.1.2 Priced conversion +......................... + +You can add the conversion rate using @ notation: + +2021-01-01 + assets:cash -100 EUR @ 1.20 USD + assets:cash 120 USD + + Now hledger will check that 100 * 1.20 = 120, and would report an +error otherwise. + + Pro: - Still concise - makes the conversion rate clear - provides +some error checking - hledger can do cost reporting + + Con: - Disturbs the accounting equation + + +File: hledger.info, Node: Equity conversion, Next: Priced equity conversion, Prev: Priced conversion, Up: Recording conversions + +6.8.1.3 Equity conversion +......................... + +In strict double entry bookkeeping, the above transaction is not +balanced in EUR or in USD, since some EUR disappears, and some USD +appears. This violates the accounting equation (A+L+E=0), and prevents +reports like 'balancesheetequity' from showing a zero total. + + The proper way to make it balance is to add a balancing posting for +each commodity, using an equity account: + +2021-01-01 + assets:cash -100 EUR + equity:conversion 100 EUR + equity:conversion -120 USD + assets:cash 120 USD + + Pro: - Preserves the accounting equation - keeps track of conversions +and related gains/losses in one place - works in any double entry +accounting system + + Con: - More verbose - conversion rate is not clear - hledger can not +do cost reporting + + +File: hledger.info, Node: Priced equity conversion, Prev: Equity conversion, Up: Recording conversions + +6.8.1.4 Priced equity conversion +................................ + +Another possible notation would be to record both the conversion rate +and the equity postings: + +2021-01-01 + assets:cash -100 EUR @ 1.20 USD + equity:conversion 100 EUR + equity:conversion -120 USD + assets:cash 120 USD + + hledger currently does not allow this; instead, you can record the +conversion rate as a comment. + + +File: hledger.info, Node: Inferring missing conversion rates, Next: Inferring missing equity postings, Prev: Recording conversions, Up: CONVERSION & COST + +6.8.2 Inferring missing conversion rates +---------------------------------------- + +hledger will do this automatically for implicit conversions. Currently +it can not do this for equity conversions. + + +File: hledger.info, Node: Inferring missing equity postings, Next: Cost reporting, Prev: Inferring missing conversion rates, Up: CONVERSION & COST + +6.8.3 Inferring missing equity postings +--------------------------------------- + +With the '--infer-equity' flag, hledger will add equity postings to +priced and implicit conversions (and move the conversion rate into a +comment). + + +File: hledger.info, Node: Cost reporting, Next: Conversion summary, Prev: Inferring missing equity postings, Up: CONVERSION & COST + +6.8.4 Cost reporting +-------------------- + +With the '-B/--cost' flag, hledger will convert the amounts in priced +and implicit conversions to their cost in the other commodity. This is +useful to see a report of what you paid for things (or how much you sold +things for). Currently '-B/--cost' does not work on equity conversions, +and it disables '--infer-equity'. + + These operations are transient, only affecting reports. If you want +to change the journal file permanently, you could pipe each entry +through 'hledger -f- -I print [-x] [--infer-equity] [-B]' + + +File: hledger.info, Node: Conversion summary, Prev: Cost reporting, Up: CONVERSION & COST + +6.8.5 Conversion summary +------------------------ + + * Recording the conversion rate is good because it makes that clear + and allows cost reporting. + * Recording equity postings is good because it balances the + accounting equation and is correct bookkeeping. + * Combining these is not yet supported, so you have to choose. For + now, priced conversions are a good compromise, so that: + * When you want to see the cost (or sale proceeds) of things, + use '-B/--cost'. + * When you want to see a balanced balance sheet or correct + journal entries, use '--infer-equity'. + * Combining these is not yet supported; '-B/--cost' will take + precedence. + + * Conversion/cost operations are performed before valuation. + + +File: hledger.info, Node: VALUATION, Next: PIVOTING, Prev: QUERIES, Up: Top + +7 VALUATION *********** Instead of reporting amounts in their original commodity, hledger can @@ -1266,7 +1454,7 @@ and '-X COMMODITY' options, and often one of these is all you need:  File: hledger.info, Node: -V Value, Next: -X Value in specified commodity, Up: VALUATION -8.1 -V: Value +7.1 -V: Value ============= The '-V/--market' flag converts amounts to market value in their default @@ -1276,7 +1464,7 @@ _valuation date(s)_, if any. More on these in a minute.  File: hledger.info, Node: -X Value in specified commodity, Next: Valuation date, Prev: -V Value, Up: VALUATION -8.2 -X: Value in specified commodity +7.2 -X: Value in specified commodity ==================================== The '-X/--exchange=COMM' option is like '-V', except you tell it which @@ -1286,7 +1474,7 @@ that.  File: hledger.info, Node: Valuation date, Next: Market prices, Prev: -X Value in specified commodity, Up: VALUATION -8.3 Valuation date +7.3 Valuation date ================== Since market prices can change from day to day, market value reports @@ -1303,7 +1491,7 @@ of the period, by default.  File: hledger.info, Node: Market prices, Next: --infer-market-prices market prices from transactions, Prev: Valuation date, Up: VALUATION -8.4 Market prices +7.4 Market prices ================= To convert a commodity A to its market value in another commodity B, @@ -1337,7 +1525,7 @@ converted.  File: hledger.info, Node: --infer-market-prices market prices from transactions, Next: Valuation commodity, Prev: Market prices, Up: VALUATION -8.5 -infer-market-prices: market prices from transactions +7.5 -infer-market-prices: market prices from transactions ========================================================= Normally, market value in hledger is fully controlled by, and requires, @@ -1371,7 +1559,7 @@ you, read all of this Valuation section carefully, and try adding  File: hledger.info, Node: Valuation commodity, Next: Simple valuation examples, Prev: --infer-market-prices market prices from transactions, Up: VALUATION -8.6 Valuation commodity +7.6 Valuation commodity ======================= *When you specify a valuation commodity ('-X COMM' or '--value @@ -1410,7 +1598,7 @@ converted.  File: hledger.info, Node: Simple valuation examples, Next: --value Flexible valuation, Prev: Valuation commodity, Up: VALUATION -8.7 Simple valuation examples +7.7 Simple valuation examples ============================= Here are some quick examples of '-V': @@ -1445,7 +1633,7 @@ $ hledger -f t.j bal -N euros -V  File: hledger.info, Node: --value Flexible valuation, Next: More valuation examples, Prev: Simple valuation examples, Up: VALUATION -8.8 -value: Flexible valuation +7.8 -value: Flexible valuation ============================== '-V' and '-X' are special cases of the more general '--value' option: @@ -1487,7 +1675,7 @@ this commodity, deducing market prices as described above.  File: hledger.info, Node: More valuation examples, Next: Interaction of valuation and queries, Prev: --value Flexible valuation, Up: VALUATION -8.9 More valuation examples +7.9 More valuation examples =========================== Here are some examples showing the effect of '--value', as seen with @@ -1601,7 +1789,7 @@ $ hledger print -X A  File: hledger.info, Node: Interaction of valuation and queries, Next: Effect of valuation on reports, Prev: More valuation examples, Up: VALUATION -8.10 Interaction of valuation and queries +7.10 Interaction of valuation and queries ========================================= When matching postings based on queries in the presence of valuation, @@ -1622,7 +1810,7 @@ the following happens.  File: hledger.info, Node: Effect of valuation on reports, Prev: Interaction of valuation and queries, Up: VALUATION -8.11 Effect of valuation on reports +7.11 Effect of valuation on reports =================================== Here is a reference for how valuation is supposed to affect each part of @@ -1771,7 +1959,7 @@ _report interval_  File: hledger.info, Node: PIVOTING, Next: OUTPUT, Prev: VALUATION, Up: Top -9 PIVOTING +8 PIVOTING ********** Normally hledger sums amounts, and organizes them in a hierarchy, based @@ -1828,8 +2016,8 @@ $ hledger balance --pivot member acct:.  File: hledger.info, Node: OUTPUT, Next: COMMANDS, Prev: PIVOTING, Up: Top -10 OUTPUT -********* +9 OUTPUT +******** * Menu: @@ -1841,8 +2029,8 @@ File: hledger.info, Node: OUTPUT, Next: COMMANDS, Prev: PIVOTING, Up: Top  File: hledger.info, Node: Output destination, Next: Output styling, Up: OUTPUT -10.1 Output destination -======================= +9.1 Output destination +====================== hledger commands send their output to the terminal by default. You can of course redirect this, eg into a file, using standard shell syntax: @@ -1864,8 +2052,8 @@ $ hledger print -o - # write to stdout (the default)  File: hledger.info, Node: Output styling, Next: Output format, Prev: Output destination, Up: OUTPUT -10.2 Output styling -=================== +9.2 Output styling +================== hledger commands can produce colour output when the terminal supports it. This is controlled by the '--color/--colour' option: - if the @@ -1884,8 +2072,8 @@ be used; - otherwise, unicode characters will not be used.  File: hledger.info, Node: Output format, Next: Commodity styles, Prev: Output styling, Up: OUTPUT -10.3 Output format -================== +9.3 Output format +================= Some commands offer additional output formats, other than the usual plain text terminal output. Here are those commands and the formats @@ -1930,8 +2118,8 @@ $ hledger balancesheet -o foo.txt -O csv # write CSV to foo.txt  File: hledger.info, Node: CSV output, Next: HTML output, Up: Output format -10.3.1 CSV output ------------------ +9.3.1 CSV output +---------------- * In CSV output, digit group marks (such as thousands separators) are disabled automatically. @@ -1939,8 +2127,8 @@ File: hledger.info, Node: CSV output, Next: HTML output, Up: Output format  File: hledger.info, Node: HTML output, Next: JSON output, Prev: CSV output, Up: Output format -10.3.2 HTML output ------------------- +9.3.2 HTML output +----------------- * HTML output can be styled by an optional 'hledger.css' file in the same directory. @@ -1948,8 +2136,8 @@ File: hledger.info, Node: HTML output, Next: JSON output, Prev: CSV output,  File: hledger.info, Node: JSON output, Next: SQL output, Prev: HTML output, Up: Output format -10.3.3 JSON output ------------------- +9.3.3 JSON output +----------------- * Not yet much used; real-world feedback is welcome. @@ -1970,8 +2158,8 @@ File: hledger.info, Node: JSON output, Next: SQL output, Prev: HTML output,  File: hledger.info, Node: SQL output, Prev: JSON output, Up: Output format -10.3.4 SQL output ------------------ +9.3.4 SQL output +---------------- * Not yet much used; real-world feedback is welcome. @@ -1987,8 +2175,8 @@ File: hledger.info, Node: SQL output, Prev: JSON output, Up: Output format  File: hledger.info, Node: Commodity styles, Prev: Output format, Up: OUTPUT -10.4 Commodity styles -===================== +9.4 Commodity styles +==================== The display style of a commodity/currency is inferred according to the rules described in Commodity display style. The inferred display style @@ -2008,7 +2196,7 @@ multiple commodity/currency symbols.  File: hledger.info, Node: COMMANDS, Next: JOURNAL FORMAT, Prev: OUTPUT, Up: Top -11 COMMANDS +10 COMMANDS *********** hledger provides a number of commands for producing reports and managing @@ -2123,7 +2311,7 @@ these are maintained and released with hledger:  File: hledger.info, Node: accounts, Next: activity, Up: COMMANDS -11.1 accounts +10.1 accounts ============= accounts @@ -2153,7 +2341,7 @@ liabilities:debts  File: hledger.info, Node: activity, Next: add, Prev: accounts, Up: COMMANDS -11.2 activity +10.2 activity ============= activity @@ -2174,7 +2362,7 @@ $ hledger activity --quarterly  File: hledger.info, Node: add, Next: aregister, Prev: activity, Up: COMMANDS -11.3 add +10.3 add ======== add @@ -2245,7 +2433,7 @@ file path ends with a period, as that would cause problems (#1056).  File: hledger.info, Node: aregister, Next: balance, Prev: add, Up: COMMANDS -11.4 aregister +10.4 aregister ============== aregister, areg @@ -2309,7 +2497,7 @@ options. The output formats supported are 'txt', 'csv', and 'json'.  File: hledger.info, Node: aregister and custom posting dates, Up: aregister -11.4.1 aregister and custom posting dates +10.4.1 aregister and custom posting dates ----------------------------------------- Transactions whose date is outside the report period can still be shown, @@ -2325,7 +2513,7 @@ it's probably best to assume the running balance is wrong.  File: hledger.info, Node: balance, Next: balancesheet, Prev: aregister, Up: COMMANDS -11.5 balance +10.5 balance ============ balance, bal @@ -2363,7 +2551,7 @@ more control, then use 'balance'.  File: hledger.info, Node: balance features, Next: Simple balance report, Up: balance -11.5.1 balance features +10.5.1 balance features ----------------------- Here's a quick overview of the 'balance' command's features, followed by @@ -2425,7 +2613,7 @@ in the transactions of the postings which would normally be shown.  File: hledger.info, Node: Simple balance report, Next: Filtered balance report, Prev: balance features, Up: balance -11.5.2 Simple balance report +10.5.2 Simple balance report ---------------------------- With no arguments, 'balance' shows a list of all accounts and their @@ -2471,7 +2659,7 @@ $ hledger -f examples/sample.journal bal -E  File: hledger.info, Node: Filtered balance report, Next: List or tree mode, Prev: Simple balance report, Up: balance -11.5.3 Filtered balance report +10.5.3 Filtered balance report ------------------------------ You can show fewer accounts, a different time period, totals from @@ -2486,7 +2674,7 @@ $ hledger -f examples/sample.journal bal --cleared assets date:200806  File: hledger.info, Node: List or tree mode, Next: Depth limiting, Prev: Filtered balance report, Up: balance -11.5.4 List or tree mode +10.5.4 List or tree mode ------------------------ By default, or with '-l/--flat', accounts are shown as a flat list with @@ -2529,7 +2717,7 @@ $ hledger -f examples/sample.journal balance  File: hledger.info, Node: Depth limiting, Next: Dropping top-level accounts, Prev: List or tree mode, Up: balance -11.5.5 Depth limiting +10.5.5 Depth limiting --------------------- With a 'depth:NUM' query, or '--depth NUM' option, or just '-NUM' (eg: @@ -2551,7 +2739,7 @@ $ hledger -f examples/sample.journal balance -1  File: hledger.info, Node: Dropping top-level accounts, Next: Multi-period balance report, Prev: Depth limiting, Up: balance -11.5.6 Dropping top-level accounts +10.5.6 Dropping top-level accounts ---------------------------------- You can also hide one or more top-level account name parts, using @@ -2567,7 +2755,7 @@ $ hledger -f examples/sample.journal bal expenses --drop 1  File: hledger.info, Node: Multi-period balance report, Next: Showing declared accounts, Prev: Dropping top-level accounts, Up: balance -11.5.7 Multi-period balance report +10.5.7 Multi-period balance report ---------------------------------- With a report interval (set by the '-D/--daily', '-W/--weekly', @@ -2622,7 +2810,7 @@ viewing in the terminal. Here are some ways to handle that:  File: hledger.info, Node: Showing declared accounts, Next: Data layout, Prev: Multi-period balance report, Up: balance -11.5.8 Showing declared accounts +10.5.8 Showing declared accounts -------------------------------- With '--declared', accounts which have been declared with an account @@ -2640,7 +2828,7 @@ accounts yet.  File: hledger.info, Node: Data layout, Next: Sorting by amount, Prev: Showing declared accounts, Up: balance -11.5.9 Data layout +10.5.9 Data layout ------------------ The '--layout' option affects how multi-commodity amounts are displayed, @@ -2774,7 +2962,7 @@ tidy Y  File: hledger.info, Node: Sorting by amount, Next: Percentages, Prev: Data layout, Up: balance -11.5.10 Sorting by amount +10.5.10 Sorting by amount ------------------------- With '-S/--sort-amount', accounts with the largest (most positive) @@ -2792,7 +2980,7 @@ which flip the sign automatically. Eg: 'hledger incomestatement -MAS').  File: hledger.info, Node: Percentages, Next: Balance change end balance, Prev: Sorting by amount, Up: balance -11.5.11 Percentages +10.5.11 Percentages ------------------- With '-%/--percent', balance reports show each account's value expressed @@ -2825,7 +3013,7 @@ $ hledger bal -% cur:€  File: hledger.info, Node: Balance change end balance, Next: Balance report types, Prev: Percentages, Up: balance -11.5.12 Balance change, end balance +10.5.12 Balance change, end balance ----------------------------------- It's important to be clear on the meaning of the numbers shown in @@ -2862,7 +3050,7 @@ historical end balances:  File: hledger.info, Node: Balance report types, Next: Useful balance reports, Prev: Balance change end balance, Up: balance -11.5.13 Balance report types +10.5.13 Balance report types ---------------------------- For more flexible reporting, there are three important option groups: @@ -2959,7 +3147,7 @@ v /now'  File: hledger.info, Node: Useful balance reports, Next: Budget report, Prev: Balance report types, Up: balance -11.5.14 Useful balance reports +10.5.14 Useful balance reports ------------------------------ Some frequently used 'balance' options/reports are: @@ -2999,7 +3187,7 @@ Some frequently used 'balance' options/reports are:  File: hledger.info, Node: Budget report, Next: Customising single-period balance reports, Prev: Useful balance reports, Up: balance -11.5.15 Budget report +10.5.15 Budget report --------------------- The '--budget' report type activates extra columns showing any budget @@ -3123,7 +3311,7 @@ Budget performance in 2017/11/01-2017/12/31:  File: hledger.info, Node: Budget report start date, Next: Budgets and subaccounts, Up: Budget report -11.5.15.1 Budget report start date +10.5.15.1 Budget report start date .................................. This might be a bug, but for now: when making budget reports, it's a @@ -3167,7 +3355,7 @@ Budget performance in 2020-01-01..2020-01-15:  File: hledger.info, Node: Budgets and subaccounts, Next: Selecting budget goals, Prev: Budget report start date, Up: Budget report -11.5.15.2 Budgets and subaccounts +10.5.15.2 Budgets and subaccounts ................................. You can add budgets to any account in your account hierarchy. If you @@ -3255,7 +3443,7 @@ Budget performance in 2019/01:  File: hledger.info, Node: Selecting budget goals, Prev: Budgets and subaccounts, Up: Budget report -11.5.15.3 Selecting budget goals +10.5.15.3 Selecting budget goals ................................ The budget report evaluates periodic transaction rules to generate @@ -3281,7 +3469,7 @@ select from multiple budgets defined in your journal.  File: hledger.info, Node: Customising single-period balance reports, Prev: Budget report, Up: balance -11.5.16 Customising single-period balance reports +10.5.16 Customising single-period balance reports ------------------------------------------------- For single-period balance reports displayed in the terminal (only), you @@ -3344,7 +3532,7 @@ may be needed to get pleasing results.  File: hledger.info, Node: balancesheet, Next: balancesheetequity, Prev: balance, Up: COMMANDS -11.6 balancesheet +10.6 balancesheet ================= balancesheet, bs @@ -3392,7 +3580,7 @@ options The output formats supported are 'txt', 'csv', 'html', and  File: hledger.info, Node: balancesheetequity, Next: cashflow, Prev: balancesheet, Up: COMMANDS -11.7 balancesheetequity +10.7 balancesheetequity ======================= balancesheetequity, bse @@ -3444,7 +3632,7 @@ options The output formats supported are 'txt', 'csv', 'html', and  File: hledger.info, Node: cashflow, Next: check, Prev: balancesheetequity, Up: COMMANDS -11.8 cashflow +10.8 cashflow ============= cashflow, cf @@ -3485,7 +3673,7 @@ options The output formats supported are 'txt', 'csv', 'html', and  File: hledger.info, Node: check, Next: close, Prev: cashflow, Up: COMMANDS -11.9 check +10.9 check ========== check @@ -3515,7 +3703,7 @@ hledger check ordereddates payees # basic + two other checks  File: hledger.info, Node: Basic checks, Next: Strict checks, Up: check -11.9.1 Basic checks +10.9.1 Basic checks ------------------- These checks are always run automatically, by (almost) all hledger @@ -3535,7 +3723,7 @@ commands, including 'check':  File: hledger.info, Node: Strict checks, Next: Other checks, Prev: Basic checks, Up: check -11.9.2 Strict checks +10.9.2 Strict checks -------------------- These additional checks are run when the '-s'/'--strict' (strict mode) @@ -3553,7 +3741,7 @@ flag is used. Or, they can be run by giving their names as arguments to  File: hledger.info, Node: Other checks, Next: Custom checks, Prev: Strict checks, Up: check -11.9.3 Other checks +10.9.3 Other checks ------------------- These checks can be run only by giving their names as arguments to @@ -3569,7 +3757,7 @@ therefore optional:  File: hledger.info, Node: Custom checks, Prev: Other checks, Up: check -11.9.4 Custom checks +10.9.4 Custom checks -------------------- A few more checks are are available as separate add-on commands, in @@ -3587,7 +3775,7 @@ See: Cookbook -> Scripting.  File: hledger.info, Node: close, Next: codes, Prev: check, Up: COMMANDS -11.10 close +10.10 close =========== close, equity @@ -3641,7 +3829,7 @@ posting it balances (good for troubleshooting).  File: hledger.info, Node: close and prices, Next: close date, Up: close -11.10.1 close and prices +10.10.1 close and prices ------------------------ Transaction prices are ignored (and discarded) by closing/opening @@ -3654,7 +3842,7 @@ will generate very large journal entries.  File: hledger.info, Node: close date, Next: Example close asset/liability accounts for file transition, Prev: close and prices, Up: close -11.10.2 close date +10.10.2 close date ------------------ The default closing date is yesterday, or the journal's end date, @@ -3678,7 +3866,7 @@ argument  File: hledger.info, Node: Example close asset/liability accounts for file transition, Next: Hiding opening/closing transactions, Prev: close date, Up: close -11.10.3 Example: close asset/liability accounts for file transition +10.10.3 Example: close asset/liability accounts for file transition ------------------------------------------------------------------- Carrying asset/liability balances from 2020.journal into a new file for @@ -3703,7 +3891,7 @@ $ hledger bs -f 2020.journal # just old files - balances are z  File: hledger.info, Node: Hiding opening/closing transactions, Next: close and balance assertions, Prev: Example close asset/liability accounts for file transition, Up: close -11.10.4 Hiding opening/closing transactions +10.10.4 Hiding opening/closing transactions ------------------------------------------- Although the closing/opening transactions cancel out, they will be @@ -3754,7 +3942,7 @@ $ hledger -f all.journal bs -p 2020 not:tag:clopen=2020  File: hledger.info, Node: close and balance assertions, Next: Example close revenue/expense accounts to retained earnings, Prev: Hiding opening/closing transactions, Up: close -11.10.5 close and balance assertions +10.10.5 close and balance assertions ------------------------------------ The closing and opening transactions will include balance assertions, @@ -3793,7 +3981,7 @@ single-day transactions):  File: hledger.info, Node: Example close revenue/expense accounts to retained earnings, Prev: close and balance assertions, Up: close -11.10.6 Example: close revenue/expense accounts to retained earnings +10.10.6 Example: close revenue/expense accounts to retained earnings -------------------------------------------------------------------- For this, use '--close' to suppress the opening transaction, as it's not @@ -3824,7 +4012,7 @@ $ hledger is -p Q1 not:desc:'closing balances'  File: hledger.info, Node: codes, Next: commodities, Prev: close, Up: COMMANDS -11.11 codes +10.11 codes =========== codes @@ -3870,7 +4058,7 @@ $ hledger codes -E  File: hledger.info, Node: commodities, Next: descriptions, Prev: codes, Up: COMMANDS -11.12 commodities +10.12 commodities ================= commodities @@ -3879,7 +4067,7 @@ List all commodity/currency symbols used or declared in the journal.  File: hledger.info, Node: descriptions, Next: diff, Prev: commodities, Up: COMMANDS -11.13 descriptions +10.13 descriptions ================== descriptions @@ -3899,7 +4087,7 @@ Person A  File: hledger.info, Node: diff, Next: files, Prev: descriptions, Up: COMMANDS -11.14 diff +10.14 diff ========== diff @@ -3934,7 +4122,7 @@ These transactions are in the second file only:  File: hledger.info, Node: files, Next: help, Prev: diff, Up: COMMANDS -11.15 files +10.15 files =========== files @@ -3944,7 +4132,7 @@ file names matching the regular expression (case sensitive) are shown.  File: hledger.info, Node: help, Next: import, Prev: files, Up: COMMANDS -11.16 help +10.16 help ========== help @@ -3970,7 +4158,7 @@ select a particular viewer with the '-i' (info), '-m' (man), or '-p'  File: hledger.info, Node: import, Next: incomestatement, Prev: help, Up: COMMANDS -11.17 import +10.17 import ============ import @@ -3998,7 +4186,7 @@ most common import source, and these docs focus on that case.  File: hledger.info, Node: Deduplication, Next: Import testing, Up: import -11.17.1 Deduplication +10.17.1 Deduplication --------------------- As a convenience 'import' does _deduplication_ while reading @@ -4042,7 +4230,7 @@ certain date.  File: hledger.info, Node: Import testing, Next: Importing balance assignments, Prev: Deduplication, Up: import -11.17.2 Import testing +10.17.2 Import testing ---------------------- With '--dry-run', the transactions that will be imported are printed to @@ -4060,7 +4248,7 @@ $ ls bank.csv* | entr bash -c 'echo ====; hledger import --dry bank.csv | hledge  File: hledger.info, Node: Importing balance assignments, Next: Commodity display styles, Prev: Import testing, Up: import -11.17.3 Importing balance assignments +10.17.3 Importing balance assignments ------------------------------------- Entries added by import will have their posting amounts made explicit @@ -4079,7 +4267,7 @@ please test it and send a pull request.)  File: hledger.info, Node: Commodity display styles, Prev: Importing balance assignments, Up: import -11.17.4 Commodity display styles +10.17.4 Commodity display styles -------------------------------- Imported amounts will be formatted according to the canonical commodity @@ -4088,7 +4276,7 @@ styles (declared or inferred) in the main journal file.  File: hledger.info, Node: incomestatement, Next: notes, Prev: import, Up: COMMANDS -11.18 incomestatement +10.18 incomestatement ===================== incomestatement, is @@ -4138,7 +4326,7 @@ options The output formats supported are 'txt', 'csv', 'html', and  File: hledger.info, Node: notes, Next: payees, Prev: incomestatement, Up: COMMANDS -11.19 notes +10.19 notes =========== notes @@ -4158,7 +4346,7 @@ Snacks  File: hledger.info, Node: payees, Next: prices, Prev: notes, Up: COMMANDS -11.20 payees +10.20 payees ============ payees @@ -4184,7 +4372,7 @@ Person A  File: hledger.info, Node: prices, Next: print, Prev: payees, Up: COMMANDS -11.21 prices +10.21 prices ============ prices @@ -4198,7 +4386,7 @@ displayed with their full precision.  File: hledger.info, Node: print, Next: print-unique, Prev: prices, Up: COMMANDS -11.22 print +10.22 print =========== print @@ -4321,7 +4509,7 @@ $ hledger print -Ocsv  File: hledger.info, Node: print-unique, Next: register, Prev: print, Up: COMMANDS -11.23 print-unique +10.23 print-unique ================== print-unique @@ -4342,7 +4530,7 @@ $ LEDGER_FILE=unique.journal hledger print-unique  File: hledger.info, Node: register, Next: register-match, Prev: print-unique, Up: COMMANDS -11.24 register +10.24 register ============== register, reg @@ -4440,7 +4628,7 @@ length and comparable to the others in the report.  File: hledger.info, Node: Custom register output, Up: register -11.24.1 Custom register output +10.24.1 Custom register output ------------------------------ register uses the full terminal width by default, except on windows. @@ -4472,7 +4660,7 @@ options The output formats supported are 'txt', 'csv', and  File: hledger.info, Node: register-match, Next: rewrite, Prev: register, Up: COMMANDS -11.25 register-match +10.25 register-match ==================== register-match @@ -4485,7 +4673,7 @@ ledger-autosync detect already-seen transactions when importing.  File: hledger.info, Node: rewrite, Next: roi, Prev: register-match, Up: COMMANDS -11.26 rewrite +10.26 rewrite ============= rewrite @@ -4539,7 +4727,7 @@ commodity.  File: hledger.info, Node: Re-write rules in a file, Next: Diff output format, Up: rewrite -11.26.1 Re-write rules in a file +10.26.1 Re-write rules in a file -------------------------------- During the run this tool will execute so called "Automated Transactions" @@ -4577,7 +4765,7 @@ postings.  File: hledger.info, Node: Diff output format, Next: rewrite vs print --auto, Prev: Re-write rules in a file, Up: rewrite -11.26.2 Diff output format +10.26.2 Diff output format -------------------------- To use this tool for batch modification of your journal files you may @@ -4618,7 +4806,7 @@ output from 'hledger print'.  File: hledger.info, Node: rewrite vs print --auto, Prev: Diff output format, Up: rewrite -11.26.3 rewrite vs. print -auto +10.26.3 rewrite vs. print -auto ------------------------------- This command predates print -auto, and currently does much the same @@ -4638,7 +4826,7 @@ thing, but with these differences:  File: hledger.info, Node: roi, Next: stats, Prev: rewrite, Up: COMMANDS -11.27 roi +10.27 roi ========= roi @@ -4687,7 +4875,7 @@ display, regardless of the length of reporting interval.  File: hledger.info, Node: Spaces and special characters in --inv and --pnl, Next: Semantics of --inv and --pnl, Up: roi -11.27.1 Spaces and special characters in '--inv' and +10.27.1 Spaces and special characters in '--inv' and ---------------------------------------------------- '--pnl' Note that '--inv' and '--pnl''s argument is a query, and queries @@ -4706,7 +4894,7 @@ $ hledger roi --inv="'Assets:Test 1'" --pnl="'Equity:Unrealized Profit and Loss'  File: hledger.info, Node: Semantics of --inv and --pnl, Next: IRR and TWR explained, Prev: Spaces and special characters in --inv and --pnl, Up: roi -11.27.2 Semantics of '--inv' and '--pnl' +10.27.2 Semantics of '--inv' and '--pnl' ---------------------------------------- Query supplied to '--inv' has to match all transactions that are related @@ -4760,7 +4948,7 @@ postings in the example below would be classifed as:  File: hledger.info, Node: IRR and TWR explained, Prev: Semantics of --inv and --pnl, Up: roi -11.27.3 IRR and TWR explained +10.27.3 IRR and TWR explained ----------------------------- "ROI" stands for "return on investment". Traditionally this was @@ -4823,7 +5011,7 @@ the limitations of both metrics  File: hledger.info, Node: stats, Next: tags, Prev: roi, Up: COMMANDS -11.28 stats +10.28 stats =========== stats @@ -4864,7 +5052,7 @@ selection.  File: hledger.info, Node: tags, Next: test, Prev: stats, Up: COMMANDS -11.29 tags +10.29 tags ========== tags @@ -4884,7 +5072,7 @@ they are omitted.  File: hledger.info, Node: test, Next: About add-on commands, Prev: tags, Up: COMMANDS -11.30 test +10.30 test ========== test @@ -4911,7 +5099,7 @@ $ hledger test -- -pData.Amount --color=never  File: hledger.info, Node: About add-on commands, Prev: test, Up: COMMANDS -11.31 About add-on commands +10.31 About add-on commands =========================== Add-on commands are programs or scripts in your PATH @@ -4950,7 +5138,7 @@ $ hledger-web --serve  File: hledger.info, Node: JOURNAL FORMAT, Next: CSV FORMAT, Prev: COMMANDS, Up: Top -12 JOURNAL FORMAT +11 JOURNAL FORMAT ***************** hledger's default file format, representing a General Journal. @@ -5019,7 +5207,7 @@ that looks unnecessary right now.  File: hledger.info, Node: Transactions, Next: Dates, Up: JOURNAL FORMAT -12.1 Transactions +11.1 Transactions ================= Transactions are the main unit of information in a journal file. They @@ -5048,7 +5236,7 @@ optional fields, separated by spaces:  File: hledger.info, Node: Dates, Next: Status, Prev: Transactions, Up: JOURNAL FORMAT -12.2 Dates +11.2 Dates ========== * Menu: @@ -5060,7 +5248,7 @@ File: hledger.info, Node: Dates, Next: Status, Prev: Transactions, Up: JOURN  File: hledger.info, Node: Simple dates, Next: Secondary dates, Up: Dates -12.2.1 Simple dates +11.2.1 Simple dates ------------------- Dates in the journal file use _simple dates_ format: 'YYYY-MM-DD' or @@ -5076,7 +5264,7 @@ dates documented in the hledger manual.)  File: hledger.info, Node: Secondary dates, Next: Posting dates, Prev: Simple dates, Up: Dates -12.2.2 Secondary dates +11.2.2 Secondary dates ---------------------- Real-life transactions sometimes involve more than one date - eg the @@ -5112,7 +5300,7 @@ $ hledger register checking --date2  File: hledger.info, Node: Posting dates, Prev: Secondary dates, Up: Dates -12.2.3 Posting dates +11.2.3 Posting dates -------------------- You can give individual postings a different date from their parent @@ -5147,7 +5335,7 @@ transaction and DATE2 infers its year from DATE.  File: hledger.info, Node: Status, Next: Code, Prev: Dates, Up: JOURNAL FORMAT -12.3 Status +11.3 Status =========== Transactions, or individual postings within a transaction, can have a @@ -5197,7 +5385,7 @@ your finances.  File: hledger.info, Node: Code, Next: Description, Prev: Status, Up: JOURNAL FORMAT -12.4 Code +11.4 Code ========= After the status mark, but before the description, you can optionally @@ -5208,7 +5396,7 @@ or reference number.  File: hledger.info, Node: Description, Next: Comments, Prev: Code, Up: JOURNAL FORMAT -12.5 Description +11.5 Description ================ A transaction's description is the rest of the line following the date @@ -5224,7 +5412,7 @@ comments.  File: hledger.info, Node: Payee and note, Up: Description -12.5.1 Payee and note +11.5.1 Payee and note --------------------- You can optionally include a '|' (pipe) character in descriptions to @@ -5236,7 +5424,7 @@ precise querying and pivoting by payee or by note.  File: hledger.info, Node: Comments, Next: Tags, Prev: Description, Up: JOURNAL FORMAT -12.6 Comments +11.6 Comments ============= Lines in the journal beginning with a semicolon (';') or hash ('#') or @@ -5276,7 +5464,7 @@ end comment  File: hledger.info, Node: Tags, Next: Postings, Prev: Comments, Up: JOURNAL FORMAT -12.7 Tags +11.7 Tags ========= Tags are a way to add extra labels or labelled data to postings and @@ -5319,7 +5507,7 @@ are simple strings.  File: hledger.info, Node: Postings, Next: Account names, Prev: Tags, Up: JOURNAL FORMAT -12.8 Postings +11.8 Postings ============= A posting is an addition of some amount to, or removal of some amount @@ -5351,7 +5539,7 @@ the amount, the amount will be considered part of the account name.  File: hledger.info, Node: Virtual postings, Up: Postings -12.8.1 Virtual postings +11.8.1 Virtual postings ----------------------- A posting with a parenthesised account name is called a _virtual @@ -5386,7 +5574,7 @@ postings_. You can exclude virtual postings from reports with the  File: hledger.info, Node: Account names, Next: Amounts, Prev: Postings, Up: JOURNAL FORMAT -12.9 Account names +11.9 Account names ================== Account names typically have several parts separated by a full colon, @@ -5404,7 +5592,7 @@ more spaces* (or newline).  File: hledger.info, Node: Amounts, Next: Transaction prices, Prev: Account names, Up: JOURNAL FORMAT -12.10 Amounts +11.10 Amounts ============= After the account name, there is usually an amount. (Important: between @@ -5453,7 +5641,7 @@ EUR 1E3  File: hledger.info, Node: Decimal marks digit group marks, Next: Commodity, Up: Amounts -12.10.1 Decimal marks, digit group marks +11.10.1 Decimal marks, digit group marks ---------------------------------------- A _decimal mark_ can be written as a period or a comma: @@ -5489,7 +5677,7 @@ directives will also work. These are described detail below.  File: hledger.info, Node: Commodity, Next: Directives influencing number parsing and display, Prev: Decimal marks digit group marks, Up: Amounts -12.10.2 Commodity +11.10.2 Commodity ----------------- Amounts in hledger have both a "quantity", which is a signed decimal @@ -5515,7 +5703,7 @@ these are the 'Amount' and 'MixedAmount' types.)  File: hledger.info, Node: Directives influencing number parsing and display, Next: Commodity display style, Prev: Commodity, Up: Amounts -12.10.3 Directives influencing number parsing and display +11.10.3 Directives influencing number parsing and display --------------------------------------------------------- You can add 'decimal-mark' and 'commodity' directives to the journal, to @@ -5535,7 +5723,7 @@ commodity 1 000 000.9455  File: hledger.info, Node: Commodity display style, Next: Rounding, Prev: Directives influencing number parsing and display, Up: Amounts -12.10.4 Commodity display style +11.10.4 Commodity display style ------------------------------- For the amounts in each commodity, hledger chooses a consistent display @@ -5593,7 +5781,7 @@ line option.  File: hledger.info, Node: Rounding, Prev: Commodity display style, Up: Amounts -12.10.5 Rounding +11.10.5 Rounding ---------------- Amounts are stored internally as decimal numbers with up to 255 decimal @@ -5606,7 +5794,7 @@ this could vary if hledger was built with Decimal < 0.5.1.)  File: hledger.info, Node: Transaction prices, Next: Lot prices lot dates, Prev: Amounts, Up: JOURNAL FORMAT -12.11 Transaction prices +11.11 Transaction prices ======================== Within a transaction, you can note an amount's price in another @@ -5673,7 +5861,7 @@ $ hledger bal -N --flat -B  File: hledger.info, Node: Lot prices lot dates, Next: Balance assertions, Prev: Transaction prices, Up: JOURNAL FORMAT -12.12 Lot prices, lot dates +11.12 Lot prices, lot dates =========================== Ledger allows another kind of price, lot price (four variants: @@ -5688,7 +5876,7 @@ assertion if any.  File: hledger.info, Node: Balance assertions, Next: Balance assignments, Prev: Lot prices lot dates, Up: JOURNAL FORMAT -12.13 Balance assertions +11.13 Balance assertions ======================== hledger supports Ledger-style balance assertions in journal files. @@ -5726,7 +5914,7 @@ does not disable balance assignments, below).  File: hledger.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance assertions -12.13.1 Assertions and ordering +11.13.1 Assertions and ordering ------------------------------- hledger sorts an account's postings and assertions first by date and @@ -5745,7 +5933,7 @@ can assert intra-day balances.  File: hledger.info, Node: Assertions and included files, Next: Assertions and multiple -f options, Prev: Assertions and ordering, Up: Balance assertions -12.13.2 Assertions and included files +11.13.2 Assertions and included files ------------------------------------- With included files, things are a little more complicated. Including @@ -5757,7 +5945,7 @@ you'll have to put the assertion in the right file.  File: hledger.info, Node: Assertions and multiple -f options, Next: Assertions and commodities, Prev: Assertions and included files, Up: Balance assertions -12.13.3 Assertions and multiple -f options +11.13.3 Assertions and multiple -f options ------------------------------------------ Balance assertions don't work well across files specified with multiple @@ -5766,7 +5954,7 @@ Balance assertions don't work well across files specified with multiple  File: hledger.info, Node: Assertions and commodities, Next: Assertions and prices, Prev: Assertions and multiple -f options, Up: Balance assertions -12.13.4 Assertions and commodities +11.13.4 Assertions and commodities ---------------------------------- The asserted balance must be a simple single-commodity amount, and in @@ -5814,7 +6002,7 @@ commodity into its own subaccount:  File: hledger.info, Node: Assertions and prices, Next: Assertions and subaccounts, Prev: Assertions and commodities, Up: Balance assertions -12.13.5 Assertions and prices +11.13.5 Assertions and prices ----------------------------- Balance assertions ignore transaction prices, and should normally be @@ -5832,7 +6020,7 @@ _assignments_ do use them (see below).  File: hledger.info, Node: Assertions and subaccounts, Next: Assertions and virtual postings, Prev: Assertions and prices, Up: Balance assertions -12.13.6 Assertions and subaccounts +11.13.6 Assertions and subaccounts ---------------------------------- The balance assertions above ('=' and '==') do not count the balance @@ -5849,7 +6037,7 @@ eg:  File: hledger.info, Node: Assertions and virtual postings, Next: Assertions and precision, Prev: Assertions and subaccounts, Up: Balance assertions -12.13.7 Assertions and virtual postings +11.13.7 Assertions and virtual postings --------------------------------------- Balance assertions are checked against all postings, both real and @@ -5859,7 +6047,7 @@ query.  File: hledger.info, Node: Assertions and precision, Prev: Assertions and virtual postings, Up: Balance assertions -12.13.8 Assertions and precision +11.13.8 Assertions and precision -------------------------------- Balance assertions compare the exactly calculated amounts, which are not @@ -5870,7 +6058,7 @@ assertion failure messages show exact amounts.  File: hledger.info, Node: Balance assignments, Next: Directives, Prev: Balance assertions, Up: JOURNAL FORMAT -12.14 Balance assignments +11.14 Balance assignments ========================= Ledger-style balance assignments are also supported. These are like @@ -5907,7 +6095,7 @@ hledger or do the calculations yourself, instead of just reading it.  File: hledger.info, Node: Balance assignments and prices, Up: Balance assignments -12.14.1 Balance assignments and prices +11.14.1 Balance assignments and prices -------------------------------------- A transaction price in a balance assignment will cause the calculated @@ -5923,7 +6111,7 @@ $ hledger print --explicit  File: hledger.info, Node: Directives, Next: Directives and multiple files, Prev: Balance assignments, Up: JOURNAL FORMAT -12.15 Directives +11.15 Directives ================ A directive is a line in the journal beginning with a special keyword, @@ -6018,7 +6206,7 @@ account'*following entries until end of current file or 'end apply  File: hledger.info, Node: Directives and multiple files, Next: Comment blocks, Prev: Directives, Up: JOURNAL FORMAT -12.16 Directives and multiple files +11.16 Directives and multiple files =================================== If you use multiple '-f'/'--file' options, or the 'include' directive, @@ -6038,7 +6226,7 @@ directives do not affect parent or sibling files (see below).  File: hledger.info, Node: Comment blocks, Next: Including other files, Prev: Directives and multiple files, Up: JOURNAL FORMAT -12.17 Comment blocks +11.17 Comment blocks ==================== A line containing just 'comment' starts a commented region of the file, @@ -6048,7 +6236,7 @@ file) ends it. See also comments.  File: hledger.info, Node: Including other files, Next: Default year, Prev: Comment blocks, Up: JOURNAL FORMAT -12.18 Including other files +11.18 Including other files =========================== You can pull in the content of additional files by writing an include @@ -6079,7 +6267,7 @@ files): 'include timedot:~/notes/2020*.md'.  File: hledger.info, Node: Default year, Next: Declaring payees, Prev: Including other files, Up: JOURNAL FORMAT -12.19 Default year +11.19 Default year ================== You can set a default year to be used for subsequent dates which don't @@ -6105,7 +6293,7 @@ Y2010 ; change default year to 2010  File: hledger.info, Node: Declaring payees, Next: Declaring the decimal mark, Prev: Default year, Up: JOURNAL FORMAT -12.20 Declaring payees +11.20 Declaring payees ====================== The 'payee' directive can be used to declare a limited set of payees @@ -6118,7 +6306,7 @@ payee Whole Foods  File: hledger.info, Node: Declaring the decimal mark, Next: Declaring commodities, Prev: Declaring payees, Up: JOURNAL FORMAT -12.21 Declaring the decimal mark +11.21 Declaring the decimal mark ================================ You can use a 'decimal-mark' directive - usually one per file, at the @@ -6138,7 +6326,7 @@ thousands separators).  File: hledger.info, Node: Declaring commodities, Next: Default commodity, Prev: Declaring the decimal mark, Up: JOURNAL FORMAT -12.22 Declaring commodities +11.22 Declaring commodities =========================== You can use 'commodity' directives to declare your commodities. In fact @@ -6214,7 +6402,7 @@ style can still be overridden by supplying a command line option.  File: hledger.info, Node: Commodity error checking, Up: Declaring commodities -12.22.1 Commodity error checking +11.22.1 Commodity error checking -------------------------------- In strict mode, enabled with the '-s'/'--strict' flag, hledger will @@ -6225,7 +6413,7 @@ checking, see the notes there for more details.  File: hledger.info, Node: Default commodity, Next: Declaring market prices, Prev: Declaring commodities, Up: JOURNAL FORMAT -12.23 Default commodity +11.23 Default commodity ======================= The 'D' directive sets a default commodity, to be used for any @@ -6258,7 +6446,7 @@ commodities' command expects 'commodity' directives, and ignores 'D').  File: hledger.info, Node: Declaring market prices, Next: Declaring accounts, Prev: Default commodity, Up: JOURNAL FORMAT -12.24 Declaring market prices +11.24 Declaring market prices ============================= The 'P' directive declares a market price, which is an exchange rate @@ -6287,7 +6475,7 @@ amount values in another commodity. See Valuation.  File: hledger.info, Node: Declaring accounts, Next: Rewriting accounts, Prev: Declaring market prices, Up: JOURNAL FORMAT -12.25 Declaring accounts +11.25 Declaring accounts ======================== 'account' directives can be used to declare accounts (ie, the places @@ -6325,7 +6513,7 @@ account assets:bank:checking  File: hledger.info, Node: Account error checking, Next: Account comments, Up: Declaring accounts -12.25.1 Account error checking +11.25.1 Account error checking ------------------------------ By default, accounts come into existence when a transaction references @@ -6353,7 +6541,7 @@ been declared by an account directive. Some notes:  File: hledger.info, Node: Account comments, Next: Account subdirectives, Prev: Account error checking, Up: Declaring accounts -12.25.2 Account comments +11.25.2 Account comments ------------------------ Comments, beginning with a semicolon, can be added: @@ -6373,7 +6561,7 @@ account assets:bank:checking ; same-line comment, note 2+ spaces before ;  File: hledger.info, Node: Account subdirectives, Next: Account types, Prev: Account comments, Up: Declaring accounts -12.25.3 Account subdirectives +11.25.3 Account subdirectives ----------------------------- We also allow (and ignore) Ledger-style indented subdirectives, just for @@ -6391,13 +6579,13 @@ account ACCTNAME [ACCTTYPE] [;COMMENT]  File: hledger.info, Node: Account types, Next: Account display order, Prev: Account subdirectives, Up: Declaring accounts -12.25.4 Account types +11.25.4 Account types --------------------- By adding a 'type' tag to the account directive, with value 'A', 'L', -'E', 'R', 'X', 'C' (or if you prefer: 'Asset', 'Liability', 'Equity', -'Revenue', 'Expense', 'Cash'), you can declare hledger accounts to be of -a certain type: +'E', 'R', 'X', 'C', 'V' (or if you prefer: 'Asset', 'Liability', +'Equity', 'Revenue', 'Expense', 'Cash', 'Conversion'), you can declare +hledger accounts to be of a certain type: * *asset*, *liability*, *equity*, *revenue*, *expense* the standard types in accounting, or @@ -6405,6 +6593,9 @@ a certain type: * *cash* a subtype of asset, used for liquid assets. + * *conversion* + a subtype of equity, used for conversion postings + Declaring account types is a good idea, since it helps enable the easy balancesheet, balancesheetequity, incomestatement and cashflow reports, and probably other things in future. As a convenience, when @@ -6435,7 +6626,7 @@ they are different from the parent, but this is not common.)  File: hledger.info, Node: Auto-detected account types, Up: Account types -12.25.4.1 Auto-detected account types +11.25.4.1 Auto-detected account types ..................................... More about "guessing" account types: hledger tries to find at least one @@ -6461,7 +6652,7 @@ a mix of declared and auto-detected types can cause confusing results.  File: hledger.info, Node: Account display order, Prev: Account types, Up: Declaring accounts -12.25.5 Account display order +11.25.5 Account display order ----------------------------- Account directives also set the order in which accounts are displayed, @@ -6507,7 +6698,7 @@ means:  File: hledger.info, Node: Rewriting accounts, Next: Default parent account, Prev: Declaring accounts, Up: JOURNAL FORMAT -12.26 Rewriting accounts +11.26 Rewriting accounts ======================== You can define account alias rules which rewrite your account names, or @@ -6537,7 +6728,7 @@ hledger-web.  File: hledger.info, Node: Basic aliases, Next: Regex aliases, Up: Rewriting accounts -12.26.1 Basic aliases +11.26.1 Basic aliases --------------------- To set an account alias, use the 'alias' directive in your journal file. @@ -6561,7 +6752,7 @@ alias checking = assets:bank:wells fargo:checking  File: hledger.info, Node: Regex aliases, Next: Combining aliases, Prev: Basic aliases, Up: Rewriting accounts -12.26.2 Regex aliases +11.26.2 Regex aliases --------------------- There is also a more powerful variant that uses a regular expression, @@ -6586,7 +6777,7 @@ whitespace.  File: hledger.info, Node: Combining aliases, Next: Aliases and multiple files, Prev: Regex aliases, Up: Rewriting accounts -12.26.3 Combining aliases +11.26.3 Combining aliases ------------------------- You can define as many aliases as you like, using journal directives @@ -6623,7 +6814,7 @@ which aliases are being applied when.  File: hledger.info, Node: Aliases and multiple files, Next: end aliases, Prev: Combining aliases, Up: Rewriting accounts -12.26.4 Aliases and multiple files +11.26.4 Aliases and multiple files ---------------------------------- As explained at Directives and multiple files, 'alias' directives do not @@ -6655,7 +6846,7 @@ include c.journal ; also affected  File: hledger.info, Node: end aliases, Prev: Aliases and multiple files, Up: Rewriting accounts -12.26.5 'end aliases' +11.26.5 'end aliases' --------------------- You can clear (forget) all currently defined aliases (seen in the @@ -6666,7 +6857,7 @@ end aliases  File: hledger.info, Node: Default parent account, Next: Periodic transactions, Prev: Rewriting accounts, Up: JOURNAL FORMAT -12.27 Default parent account +11.27 Default parent account ============================ You can specify a parent account which will be prepended to all accounts @@ -6707,7 +6898,7 @@ parent account.  File: hledger.info, Node: Periodic transactions, Next: Auto postings, Prev: Default parent account, Up: JOURNAL FORMAT -12.28 Periodic transactions +11.28 Periodic transactions =========================== Periodic transaction rules describe transactions that recur. They allow @@ -6754,7 +6945,7 @@ to define budget goals, shown in budget reports.  File: hledger.info, Node: Periodic rule syntax, Next: Two spaces between period expression and description!, Up: Periodic transactions -12.28.1 Periodic rule syntax +11.28.1 Periodic rule syntax ---------------------------- A periodic transaction rule looks like a normal journal entry, with the @@ -6777,7 +6968,7 @@ will be relative to Y/1/1.  File: hledger.info, Node: Two spaces between period expression and description!, Next: Forecasting with periodic transactions, Prev: Periodic rule syntax, Up: Periodic transactions -12.28.2 Two spaces between period expression and description! +11.28.2 Two spaces between period expression and description! ------------------------------------------------------------- If the period expression is followed by a transaction description, these @@ -6802,7 +6993,7 @@ accidentally alter their meaning, as in this example:  File: hledger.info, Node: Forecasting with periodic transactions, Next: Budgeting with periodic transactions, Prev: Two spaces between period expression and description!, Up: Periodic transactions -12.28.3 Forecasting with periodic transactions +11.28.3 Forecasting with periodic transactions ---------------------------------------------- The '--forecast' flag activates any periodic transaction rules in the @@ -6870,7 +7061,7 @@ you can get around it in two ways:  File: hledger.info, Node: Budgeting with periodic transactions, Prev: Forecasting with periodic transactions, Up: Periodic transactions -12.28.4 Budgeting with periodic transactions +11.28.4 Budgeting with periodic transactions -------------------------------------------- With the '--budget' flag, currently supported by the balance command, @@ -6885,7 +7076,7 @@ compared in budget reports.  File: hledger.info, Node: Auto postings, Prev: Periodic transactions, Up: JOURNAL FORMAT -12.29 Auto postings +11.29 Auto postings =================== "Automated postings" or "auto postings" are extra postings which get @@ -6963,7 +7154,7 @@ $ hledger print --auto  File: hledger.info, Node: Auto postings and multiple files, Next: Auto postings and dates, Up: Auto postings -12.29.1 Auto postings and multiple files +11.29.1 Auto postings and multiple files ---------------------------------------- An auto posting rule can affect any transaction in the current file, or @@ -6973,7 +7164,7 @@ sibling files (when multiple '-f'/'--file' are used - see #1212).  File: hledger.info, Node: Auto postings and dates, Next: Auto postings and transaction balancing / inferred amounts / balance assertions, Prev: Auto postings and multiple files, Up: Auto postings -12.29.2 Auto postings and dates +11.29.2 Auto postings and dates ------------------------------- A posting date (or secondary date) in the matched posting, or (taking @@ -6983,7 +7174,7 @@ used in the generated posting.  File: hledger.info, Node: Auto postings and transaction balancing / inferred amounts / balance assertions, Next: Auto posting tags, Prev: Auto postings and dates, Up: Auto postings -12.29.3 Auto postings and transaction balancing / inferred amounts / +11.29.3 Auto postings and transaction balancing / inferred amounts / -------------------------------------------------------------------- balance assertions Currently, auto postings are added: @@ -7003,7 +7194,7 @@ infer amounts.  File: hledger.info, Node: Auto posting tags, Prev: Auto postings and transaction balancing / inferred amounts / balance assertions, Up: Auto postings -12.29.4 Auto posting tags +11.29.4 Auto posting tags ------------------------- Automated postings will have some extra tags: @@ -7025,7 +7216,7 @@ will have these tags added:  File: hledger.info, Node: CSV FORMAT, Next: TIMECLOCK FORMAT, Prev: JOURNAL FORMAT, Up: Top -13 CSV FORMAT +12 CSV FORMAT ************* How hledger reads CSV data, and the CSV rules file format. @@ -7090,7 +7281,7 @@ below.  File: hledger.info, Node: Examples, Next: CSV rules, Up: CSV FORMAT -13.1 Examples +12.1 Examples ============= Here are some sample hledger CSV rules files. See also the full @@ -7107,7 +7298,7 @@ https://github.com/simonmichael/hledger/tree/master/examples/csv  File: hledger.info, Node: Basic, Next: Bank of Ireland, Up: Examples -13.1.1 Basic +12.1.1 Basic ------------ At minimum, the rules file must identify the date and amount fields, and @@ -7132,7 +7323,7 @@ $ hledger print -f basic.csv  File: hledger.info, Node: Bank of Ireland, Next: Amazon, Prev: Basic, Up: Examples -13.1.2 Bank of Ireland +12.1.2 Bank of Ireland ---------------------- Here's a CSV with two amount fields (Debit and Credit), and a balance @@ -7185,7 +7376,7 @@ imported into a journal file.  File: hledger.info, Node: Amazon, Next: Paypal, Prev: Bank of Ireland, Up: Examples -13.1.3 Amazon +12.1.3 Amazon ------------- Here we convert amazon.com order history, and use an if block to @@ -7243,7 +7434,7 @@ $ hledger -f amazon-orders.csv print  File: hledger.info, Node: Paypal, Prev: Amazon, Up: Examples -13.1.4 Paypal +12.1.4 Paypal ------------- Here's a real-world rules file for (customised) Paypal CSV, with some @@ -7397,7 +7588,7 @@ $ hledger -f paypal-custom.csv print  File: hledger.info, Node: CSV rules, Next: Tips, Prev: Examples, Up: CSV FORMAT -13.2 CSV rules +12.2 CSV rules ============== The following kinds of rule can appear in the rules file, in any order. @@ -7422,7 +7613,7 @@ Blank lines and lines beginning with '#' or ';' are ignored.  File: hledger.info, Node: skip, Next: fields list, Up: CSV rules -13.2.1 'skip' +12.2.1 'skip' ------------- skip N @@ -7438,7 +7629,7 @@ ignore certain CSV records (described below).  File: hledger.info, Node: fields list, Next: field assignment, Prev: skip, Up: CSV rules -13.2.2 'fields' list +12.2.2 'fields' list -------------------- fields FIELDNAME1, FIELDNAME2, ... @@ -7481,7 +7672,7 @@ fields date, description, , amount, , , somefield, anotherfield  File: hledger.info, Node: field assignment, Next: Field names, Prev: fields list, Up: CSV rules -13.2.3 field assignment +12.2.3 field assignment ----------------------- HLEDGERFIELDNAME FIELDVALUE @@ -7515,7 +7706,7 @@ comment note: %somefield - %anotherfield, date: %1  File: hledger.info, Node: Field names, Next: separator, Prev: field assignment, Up: CSV rules -13.2.4 Field names +12.2.4 Field names ------------------ Here are the standard hledger field (and pseudo-field) names, which you @@ -7538,7 +7729,7 @@ transaction parts they refer to, see Transactions.  File: hledger.info, Node: date field, Next: date2 field, Up: Field names -13.2.4.1 date field +12.2.4.1 date field ................... Assigning to 'date' sets the transaction date. @@ -7546,7 +7737,7 @@ Assigning to 'date' sets the transaction date.  File: hledger.info, Node: date2 field, Next: status field, Prev: date field, Up: Field names -13.2.4.2 date2 field +12.2.4.2 date2 field .................... 'date2' sets the transaction's secondary date, if any. @@ -7554,7 +7745,7 @@ File: hledger.info, Node: date2 field, Next: status field, Prev: date field,  File: hledger.info, Node: status field, Next: code field, Prev: date2 field, Up: Field names -13.2.4.3 status field +12.2.4.3 status field ..................... 'status' sets the transaction's status, if any. @@ -7562,7 +7753,7 @@ File: hledger.info, Node: status field, Next: code field, Prev: date2 field,  File: hledger.info, Node: code field, Next: description field, Prev: status field, Up: Field names -13.2.4.4 code field +12.2.4.4 code field ................... 'code' sets the transaction's code, if any. @@ -7570,7 +7761,7 @@ File: hledger.info, Node: code field, Next: description field, Prev: status f  File: hledger.info, Node: description field, Next: comment field, Prev: code field, Up: Field names -13.2.4.5 description field +12.2.4.5 description field .......................... 'description' sets the transaction's description, if any. @@ -7578,7 +7769,7 @@ File: hledger.info, Node: description field, Next: comment field, Prev: code  File: hledger.info, Node: comment field, Next: account field, Prev: description field, Up: Field names -13.2.4.6 comment field +12.2.4.6 comment field ...................... 'comment' sets the transaction's comment, if any. @@ -7594,7 +7785,7 @@ File: hledger.info, Node: comment field, Next: account field, Prev: descripti  File: hledger.info, Node: account field, Next: amount field, Prev: comment field, Up: Field names -13.2.4.7 account field +12.2.4.7 account field ...................... Assigning to 'accountN', where N is 1 to 99, sets the account name of @@ -7612,7 +7803,7 @@ or "income:unknown").  File: hledger.info, Node: amount field, Next: currency field, Prev: account field, Up: Field names -13.2.4.8 amount field +12.2.4.8 amount field ..................... 'amountN' sets the amount of the Nth posting, and causes that posting to @@ -7642,7 +7833,7 @@ avoiding conflicts.  File: hledger.info, Node: currency field, Next: balance field, Prev: amount field, Up: Field names -13.2.4.9 currency field +12.2.4.9 currency field ....................... 'currency' sets a currency symbol, to be prepended to all postings' @@ -7655,7 +7846,7 @@ amount.  File: hledger.info, Node: balance field, Prev: currency field, Up: Field names -13.2.4.10 balance field +12.2.4.10 balance field ....................... 'balanceN' sets a balance assertion amount (or if the posting amount is @@ -7672,7 +7863,7 @@ equivalent to 'balance1'.  File: hledger.info, Node: separator, Next: if block, Prev: Field names, Up: CSV rules -13.2.5 'separator' +12.2.5 'separator' ------------------ You can use the 'separator' rule to read other kinds of @@ -7697,7 +7888,7 @@ inferred automatically, and you won't need this rule.  File: hledger.info, Node: if block, Next: if table, Prev: separator, Up: CSV rules -13.2.6 'if' block +12.2.6 'if' block ----------------- if MATCHER @@ -7725,7 +7916,7 @@ descriptions.  File: hledger.info, Node: Matching the whole record, Next: Matching individual fields, Up: if block -13.2.6.1 Matching the whole record +12.2.6.1 Matching the whole record .................................. Each MATCHER can be a record matcher, which looks like this: @@ -7748,7 +7939,7 @@ actually see '2020-01-01,Acme, Inc., 1,000').  File: hledger.info, Node: Matching individual fields, Next: Combining matchers, Prev: Matching the whole record, Up: if block -13.2.6.2 Matching individual fields +12.2.6.2 Matching individual fields ................................... Or, MATCHER can be a field matcher, like this: @@ -7762,7 +7953,7 @@ is a percent sign followed by the field's name or column number, like  File: hledger.info, Node: Combining matchers, Next: Rules applied on successful match, Prev: Matching individual fields, Up: if block -13.2.6.3 Combining matchers +12.2.6.3 Combining matchers ........................... A single matcher can be written on the same line as the "if"; or @@ -7779,7 +7970,7 @@ MATCHER  File: hledger.info, Node: Rules applied on successful match, Prev: Combining matchers, Up: if block -13.2.6.4 Rules applied on successful match +12.2.6.4 Rules applied on successful match .......................................... After the patterns there should be one or more rules to apply, all @@ -7807,7 +7998,7 @@ banking thru software  File: hledger.info, Node: if table, Next: end, Prev: if block, Up: CSV rules -13.2.7 'if' table +12.2.7 'if' table ----------------- if,CSVFIELDNAME1,CSVFIELDNAME2,...,CSVFIELDNAMEn @@ -7868,7 +8059,7 @@ atm transaction fee,expenses:business:banking,deductible? check it  File: hledger.info, Node: end, Next: date-format, Prev: if table, Up: CSV rules -13.2.8 'end' +12.2.8 'end' ------------ This rule can be used inside if blocks (only), to make hledger stop @@ -7882,7 +8073,7 @@ if ,,,,  File: hledger.info, Node: date-format, Next: decimal-mark, Prev: end, Up: CSV rules -13.2.9 'date-format' +12.2.9 'date-format' -------------------- date-format DATEFMT @@ -7918,7 +8109,7 @@ time zone, dates can be "off by one".  File: hledger.info, Node: decimal-mark, Next: newest-first, Prev: date-format, Up: CSV rules -13.2.10 'decimal-mark' +12.2.10 'decimal-mark' ---------------------- decimal-mark . @@ -7936,7 +8127,7 @@ misparsed numbers.  File: hledger.info, Node: newest-first, Next: include, Prev: decimal-mark, Up: CSV rules -13.2.11 'newest-first' +12.2.11 'newest-first' ---------------------- hledger always sorts the generated transactions by date. Transactions @@ -7958,7 +8149,7 @@ newest-first  File: hledger.info, Node: include, Next: balance-type, Prev: newest-first, Up: CSV rules -13.2.12 'include' +12.2.12 'include' ----------------- include RULESFILE @@ -7981,7 +8172,7 @@ include categorisation.rules  File: hledger.info, Node: balance-type, Prev: include, Up: CSV rules -13.2.13 'balance-type' +12.2.13 'balance-type' ---------------------- Balance assertions generated by assigning to balanceN are of the simple @@ -8004,7 +8195,7 @@ balance-type ==*  File: hledger.info, Node: Tips, Prev: CSV rules, Up: CSV FORMAT -13.3 Tips +12.3 Tips ========= * Menu: @@ -8025,7 +8216,7 @@ File: hledger.info, Node: Tips, Prev: CSV rules, Up: CSV FORMAT  File: hledger.info, Node: Rapid feedback, Next: Valid CSV, Up: Tips -13.3.1 Rapid feedback +12.3.1 Rapid feedback --------------------- It's a good idea to get rapid feedback while creating/troubleshooting @@ -8041,7 +8232,7 @@ output.  File: hledger.info, Node: Valid CSV, Next: File Extension, Prev: Rapid feedback, Up: Tips -13.3.2 Valid CSV +12.3.2 Valid CSV ---------------- hledger accepts CSV conforming to RFC 4180. When CSV values are @@ -8053,7 +8244,7 @@ enclosed in quotes, note:  File: hledger.info, Node: File Extension, Next: Reading multiple CSV files, Prev: Valid CSV, Up: Tips -13.3.3 File Extension +12.3.3 File Extension --------------------- To help hledger identify the format and show the right error messages, @@ -8073,7 +8264,7 @@ See also: Input files in the hledger manual.  File: hledger.info, Node: Reading multiple CSV files, Next: Valid transactions, Prev: File Extension, Up: Tips -13.3.4 Reading multiple CSV files +12.3.4 Reading multiple CSV files --------------------------------- If you use multiple '-f' options to read multiple CSV files at once, @@ -8084,7 +8275,7 @@ used for all the CSV files.  File: hledger.info, Node: Valid transactions, Next: Deduplicating importing, Prev: Reading multiple CSV files, Up: Tips -13.3.5 Valid transactions +12.3.5 Valid transactions ------------------------- After reading a CSV file, hledger post-processes and validates the @@ -8103,7 +8294,7 @@ $ hledger -f file.csv print | hledger -f- print  File: hledger.info, Node: Deduplicating importing, Next: Setting amounts, Prev: Valid transactions, Up: Tips -13.3.6 Deduplicating, importing +12.3.6 Deduplicating, importing ------------------------------- When you download a CSV file periodically, eg to get your latest bank @@ -8133,7 +8324,7 @@ CSV data. See:  File: hledger.info, Node: Setting amounts, Next: Amount signs, Prev: Deduplicating importing, Up: Tips -13.3.7 Setting amounts +12.3.7 Setting amounts ---------------------- Some tips on using the amount-setting rules discussed above. @@ -8204,7 +8395,7 @@ Some tips on using the amount-setting rules discussed above.  File: hledger.info, Node: Amount signs, Next: Setting currency/commodity, Prev: Setting amounts, Up: Tips -13.3.8 Amount signs +12.3.8 Amount signs ------------------- There is some special handling for amount signs, to simplify parsing and @@ -8230,7 +8421,7 @@ sign-flipping:  File: hledger.info, Node: Setting currency/commodity, Next: Amount decimal places, Prev: Amount signs, Up: Tips -13.3.9 Setting currency/commodity +12.3.9 Setting currency/commodity --------------------------------- If the currency/commodity symbol is included in the CSV's amount @@ -8278,7 +8469,7 @@ that would trigger the prepending effect, which we don't want here.  File: hledger.info, Node: Amount decimal places, Next: Referencing other fields, Prev: Setting currency/commodity, Up: Tips -13.3.10 Amount decimal places +12.3.10 Amount decimal places ----------------------------- Like amounts in a journal file, the amounts generated by CSV rules like @@ -8291,7 +8482,7 @@ style (because we don't yet reliably know their commodity).  File: hledger.info, Node: Referencing other fields, Next: How CSV rules are evaluated, Prev: Amount decimal places, Up: Tips -13.3.11 Referencing other fields +12.3.11 Referencing other fields -------------------------------- In field assignments, you can interpolate only CSV fields, not hledger @@ -8328,7 +8519,7 @@ if something  File: hledger.info, Node: How CSV rules are evaluated, Prev: Referencing other fields, Up: Tips -13.3.12 How CSV rules are evaluated +12.3.12 How CSV rules are evaluated ----------------------------------- Here's how to think of CSV rules being evaluated (if you really need @@ -8369,7 +8560,7 @@ command the user specified.  File: hledger.info, Node: TIMECLOCK FORMAT, Next: TIMEDOT FORMAT, Prev: CSV FORMAT, Up: Top -14 TIMECLOCK FORMAT +13 TIMECLOCK FORMAT ******************* The time logging format of timeclock.el, as read by hledger. @@ -8423,7 +8614,7 @@ $ hledger -f sample.timeclock register -p weekly --depth 1 --empty # time summa  File: hledger.info, Node: TIMEDOT FORMAT, Next: COMMON TASKS, Prev: TIMECLOCK FORMAT, Up: Top -15 TIMEDOT FORMAT +14 TIMEDOT FORMAT ***************** 'timedot' format is hledger's human-friendly time logging format. @@ -8585,7 +8776,7 @@ $ hledger -f a.timedot --alias /\\./=: bal --tree  File: hledger.info, Node: COMMON TASKS, Next: LIMITATIONS, Prev: TIMEDOT FORMAT, Up: Top -16 COMMON TASKS +15 COMMON TASKS *************** Here are some quick examples of how to do some basic tasks with hledger. @@ -8607,7 +8798,7 @@ https://hledger.org.  File: hledger.info, Node: Getting help, Next: Constructing command lines, Up: COMMON TASKS -16.1 Getting help +15.1 Getting help ================= $ hledger # show available commands @@ -8624,7 +8815,7 @@ https://hledger.org#help-feedback  File: hledger.info, Node: Constructing command lines, Next: Starting a journal file, Prev: Getting help, Up: COMMON TASKS -16.2 Constructing command lines +15.2 Constructing command lines =============================== hledger has an extensive and powerful command line interface. We strive @@ -8644,7 +8835,7 @@ happens, here are some tips that may help:  File: hledger.info, Node: Starting a journal file, Next: Setting opening balances, Prev: Constructing command lines, Up: COMMON TASKS -16.3 Starting a journal file +15.3 Starting a journal file ============================ hledger looks for your accounting data in a journal file, @@ -8683,7 +8874,7 @@ Market prices : 0 ()  File: hledger.info, Node: Setting opening balances, Next: Recording transactions, Prev: Starting a journal file, Up: COMMON TASKS -16.4 Setting opening balances +15.4 Setting opening balances ============================= Pick a starting date for which you can look up the balances of some @@ -8766,7 +8957,7 @@ $ git commit -m 'initial balances' 2020.journal  File: hledger.info, Node: Recording transactions, Next: Reconciling, Prev: Setting opening balances, Up: COMMON TASKS -16.5 Recording transactions +15.5 Recording transactions =========================== As you spend or receive money, you can record these transactions using @@ -8792,7 +8983,7 @@ and hledger.org for more ideas:  File: hledger.info, Node: Reconciling, Next: Reporting, Prev: Recording transactions, Up: COMMON TASKS -16.6 Reconciling +15.6 Reconciling ================ Periodically you should reconcile - compare your hledger-reported @@ -8847,7 +9038,7 @@ $ git commit -m 'txns' 2020.journal  File: hledger.info, Node: Reporting, Next: Migrating to a new file, Prev: Reconciling, Up: COMMON TASKS -16.7 Reporting +15.7 Reporting ============== Here are some basic reports. @@ -8995,7 +9186,7 @@ $ hledger activity -W  File: hledger.info, Node: Migrating to a new file, Prev: Reporting, Up: COMMON TASKS -16.8 Migrating to a new file +15.8 Migrating to a new file ============================ At the end of the year, you may want to continue your journal in a new @@ -9008,7 +9199,7 @@ close command.  File: hledger.info, Node: LIMITATIONS, Next: TROUBLESHOOTING, Prev: COMMON TASKS, Up: Top -17 LIMITATIONS +16 LIMITATIONS ************** The need to precede add-on command options with '--' when invoked from @@ -9036,7 +9227,7 @@ Ledger.  File: hledger.info, Node: TROUBLESHOOTING, Prev: LIMITATIONS, Up: Top -18 TROUBLESHOOTING +17 TROUBLESHOOTING ****************** Here are some issues you might encounter when you run hledger (and @@ -9109,526 +9300,544 @@ $ LANG=en_US.UTF-8 hledger -f my.journal print  Tag Table: Node: Top208 -Node: OPTIONS2605 -Ref: #options2706 -Node: General options2848 -Ref: #general-options2973 -Node: Command options7186 -Ref: #command-options7337 -Node: Command arguments7737 -Ref: #command-arguments7895 -Node: Special characters8775 -Ref: #special-characters8938 -Node: Single escaping shell metacharacters9101 -Ref: #single-escaping-shell-metacharacters9342 -Node: Double escaping regular expression metacharacters9945 -Ref: #double-escaping-regular-expression-metacharacters10256 -Node: Triple escaping for add-on commands10782 -Ref: #triple-escaping-for-add-on-commands11042 -Node: Less escaping11686 -Ref: #less-escaping11840 -Node: Unicode characters12164 -Ref: #unicode-characters12329 -Node: Regular expressions13741 -Ref: #regular-expressions13881 -Node: ENVIRONMENT15617 -Ref: #environment15733 -Node: DATA FILES17225 -Ref: #data-files17344 -Node: Data formats17883 -Ref: #data-formats18001 -Node: Multiple files19395 -Ref: #multiple-files19537 -Node: Strict mode20006 -Ref: #strict-mode20121 -Node: TIME PERIODS20827 -Ref: #time-periods20944 -Node: Smart dates21042 -Ref: #smart-dates21168 -Node: Report start & end date22705 -Ref: #report-start-end-date22880 -Node: Report intervals24547 -Ref: #report-intervals24715 -Node: Period expressions26454 -Ref: #period-expressions26594 -Node: Period expressions with a report interval28325 -Ref: #period-expressions-with-a-report-interval28557 -Node: More complex report intervals29638 -Ref: #more-complex-report-intervals29887 -Node: Intervals with custom start date30522 -Ref: #intervals-with-custom-start-date30754 -Node: Periods or dates ?32328 -Ref: #periods-or-dates32530 -Node: Events on multiple weekdays32972 -Ref: #events-on-multiple-weekdays33151 -Node: DEPTH34014 -Ref: #depth34114 -Node: QUERIES34448 -Ref: #queries34547 -Node: Query types35488 -Ref: #query-types35607 -Node: Combining query terms38279 -Ref: #combining-query-terms38454 -Node: Queries and command options39257 -Ref: #queries-and-command-options39460 -Node: Queries and account aliases39709 -Ref: #queries-and-account-aliases39912 -Node: Queries and valuation40032 -Ref: #queries-and-valuation40225 -Node: Querying with account aliases40454 -Ref: #querying-with-account-aliases40663 -Node: Querying with cost or value40793 -Ref: #querying-with-cost-or-value40968 -Node: COSTING41269 -Ref: #costing41372 -Node: VALUATION41646 -Ref: #valuation41754 -Node: -V Value42521 -Ref: #v-value42645 -Node: -X Value in specified commodity42840 -Ref: #x-value-in-specified-commodity43033 -Node: Valuation date43182 -Ref: #valuation-date43344 -Node: Market prices43781 -Ref: #market-prices43963 -Node: --infer-market-prices market prices from transactions45146 -Ref: #infer-market-prices-market-prices-from-transactions45413 -Node: Valuation commodity46769 -Ref: #valuation-commodity46980 -Node: Simple valuation examples48206 -Ref: #simple-valuation-examples48402 -Node: --value Flexible valuation49061 -Ref: #value-flexible-valuation49263 -Node: More valuation examples50907 -Ref: #more-valuation-examples51114 -Node: Interaction of valuation and queries53113 -Ref: #interaction-of-valuation-and-queries53352 -Node: Effect of valuation on reports53824 -Ref: #effect-of-valuation-on-reports54019 -Node: PIVOTING61716 -Ref: #pivoting61821 -Node: OUTPUT63497 -Ref: #output63599 -Node: Output destination63690 -Ref: #output-destination63824 -Node: Output styling64481 -Ref: #output-styling64629 -Node: Output format65386 -Ref: #output-format65530 -Node: CSV output66894 -Ref: #csv-output67012 -Node: HTML output67115 -Ref: #html-output67255 -Node: JSON output67349 -Ref: #json-output67489 -Node: SQL output68406 -Ref: #sql-output68524 -Node: Commodity styles69025 -Ref: #commodity-styles69152 -Node: COMMANDS69928 -Ref: #commands70040 -Node: accounts73405 -Ref: #accounts73505 -Node: activity74201 -Ref: #activity74313 -Node: add74696 -Ref: #add74799 -Node: aregister77592 -Ref: #aregister77706 -Node: aregister and custom posting dates80071 -Ref: #aregister-and-custom-posting-dates80237 -Node: balance80789 -Ref: #balance80908 -Node: balance features81901 -Ref: #balance-features82041 -Node: Simple balance report83965 -Ref: #simple-balance-report84147 -Node: Filtered balance report85627 -Ref: #filtered-balance-report85814 -Node: List or tree mode86141 -Ref: #list-or-tree-mode86309 -Node: Depth limiting87654 -Ref: #depth-limiting87820 -Node: Dropping top-level accounts88421 -Ref: #dropping-top-level-accounts88623 -Node: Multi-period balance report88933 -Ref: #multi-period-balance-report89146 -Node: Showing declared accounts91421 -Ref: #showing-declared-accounts91614 -Node: Data layout92145 -Ref: #data-layout92300 -Node: Sorting by amount100240 -Ref: #sorting-by-amount100395 -Node: Percentages101065 -Ref: #percentages101223 -Node: Balance change end balance102184 -Ref: #balance-change-end-balance102377 -Node: Balance report types103805 -Ref: #balance-report-types103995 -Node: Useful balance reports108274 -Ref: #useful-balance-reports108455 -Node: Budget report109540 -Ref: #budget-report109724 -Node: Budget report start date114999 -Ref: #budget-report-start-date115177 -Node: Budgets and subaccounts116509 -Ref: #budgets-and-subaccounts116716 -Node: Selecting budget goals120156 -Ref: #selecting-budget-goals120328 -Node: Customising single-period balance reports121362 -Ref: #customising-single-period-balance-reports121571 -Node: balancesheet123746 -Ref: #balancesheet123884 -Node: balancesheetequity125183 -Ref: #balancesheetequity125334 -Node: cashflow126714 -Ref: #cashflow126838 -Node: check127984 -Ref: #check128089 -Node: Basic checks128723 -Ref: #basic-checks128841 -Node: Strict checks129392 -Ref: #strict-checks129533 -Node: Other checks129969 -Ref: #other-checks130109 -Node: Custom checks130466 -Ref: #custom-checks130586 -Node: close131003 -Ref: #close131107 -Node: close and prices133198 -Ref: #close-and-prices133327 -Node: close date133722 -Ref: #close-date133906 -Node: Example close asset/liability accounts for file transition134663 -Ref: #example-close-assetliability-accounts-for-file-transition134964 -Node: Hiding opening/closing transactions135823 -Ref: #hiding-openingclosing-transactions136094 -Node: close and balance assertions137471 -Ref: #close-and-balance-assertions137729 -Node: Example close revenue/expense accounts to retained earnings139083 -Ref: #example-close-revenueexpense-accounts-to-retained-earnings139361 -Node: codes140251 -Ref: #codes140361 -Node: commodities141073 -Ref: #commodities141202 -Node: descriptions141284 -Ref: #descriptions141414 -Node: diff141718 -Ref: #diff141826 -Node: files142873 -Ref: #files142975 -Node: help143122 -Ref: #help143224 -Node: import144042 -Ref: #import144158 -Node: Deduplication145023 -Ref: #deduplication145148 -Node: Import testing147042 -Ref: #import-testing147207 -Node: Importing balance assignments147695 -Ref: #importing-balance-assignments147901 -Node: Commodity display styles148550 -Ref: #commodity-display-styles148723 -Node: incomestatement148852 -Ref: #incomestatement148987 -Node: notes150292 -Ref: #notes150407 -Node: payees150775 -Ref: #payees150883 -Node: prices151409 -Ref: #prices151517 -Node: print151886 -Ref: #print151998 -Node: print-unique157313 -Ref: #print-unique157441 -Node: register157726 -Ref: #register157855 -Node: Custom register output162301 -Ref: #custom-register-output162432 -Node: register-match163769 -Ref: #register-match163905 -Node: rewrite164256 -Ref: #rewrite164373 -Node: Re-write rules in a file166279 -Ref: #re-write-rules-in-a-file166442 -Node: Diff output format167591 -Ref: #diff-output-format167774 -Node: rewrite vs print --auto168866 -Ref: #rewrite-vs.-print---auto169026 -Node: roi169582 -Ref: #roi169682 -Node: Spaces and special characters in --inv and --pnl171368 -Ref: #spaces-and-special-characters-in---inv-and---pnl171608 -Node: Semantics of --inv and --pnl172096 -Ref: #semantics-of---inv-and---pnl172335 -Node: IRR and TWR explained174185 -Ref: #irr-and-twr-explained174345 -Node: stats177413 -Ref: #stats177514 -Node: tags178894 -Ref: #tags178994 -Node: test179513 -Ref: #test179629 -Node: About add-on commands180376 -Ref: #about-add-on-commands180513 -Node: JOURNAL FORMAT181644 -Ref: #journal-format181772 -Node: Transactions183999 -Ref: #transactions184114 -Node: Dates185128 -Ref: #dates185244 -Node: Simple dates185309 -Ref: #simple-dates185429 -Node: Secondary dates185938 -Ref: #secondary-dates186086 -Node: Posting dates187422 -Ref: #posting-dates187545 -Node: Status188917 -Ref: #status189027 -Node: Code190735 -Ref: #code190847 -Node: Description191079 -Ref: #description191207 -Node: Payee and note191527 -Ref: #payee-and-note191635 -Node: Comments191970 -Ref: #comments192092 -Node: Tags193286 -Ref: #tags-1193397 -Node: Postings194790 -Ref: #postings194914 -Node: Virtual postings195940 -Ref: #virtual-postings196051 -Node: Account names197356 -Ref: #account-names197493 -Node: Amounts197981 -Ref: #amounts198118 -Node: Decimal marks digit group marks199103 -Ref: #decimal-marks-digit-group-marks199280 -Node: Commodity200301 -Ref: #commodity200490 -Node: Directives influencing number parsing and display201442 -Ref: #directives-influencing-number-parsing-and-display201703 -Node: Commodity display style202196 -Ref: #commodity-display-style202404 -Node: Rounding204599 -Ref: #rounding204719 -Node: Transaction prices205131 -Ref: #transaction-prices205297 -Node: Lot prices lot dates207728 -Ref: #lot-prices-lot-dates207911 -Node: Balance assertions208399 -Ref: #balance-assertions208577 -Node: Assertions and ordering209610 -Ref: #assertions-and-ordering209792 -Node: Assertions and included files210492 -Ref: #assertions-and-included-files210729 -Node: Assertions and multiple -f options211062 -Ref: #assertions-and-multiple--f-options211312 -Node: Assertions and commodities211444 -Ref: #assertions-and-commodities211670 -Node: Assertions and prices212827 -Ref: #assertions-and-prices213035 -Node: Assertions and subaccounts213475 -Ref: #assertions-and-subaccounts213698 -Node: Assertions and virtual postings214022 -Ref: #assertions-and-virtual-postings214258 -Node: Assertions and precision214400 -Ref: #assertions-and-precision214587 -Node: Balance assignments214854 -Ref: #balance-assignments215024 -Node: Balance assignments and prices216188 -Ref: #balance-assignments-and-prices216354 -Node: Directives216578 -Ref: #directives216741 -Node: Directives and multiple files221233 -Ref: #directives-and-multiple-files221429 -Node: Comment blocks222121 -Ref: #comment-blocks222298 -Node: Including other files222474 -Ref: #including-other-files222648 -Node: Default year223572 -Ref: #default-year223730 -Node: Declaring payees224137 -Ref: #declaring-payees224308 -Node: Declaring the decimal mark224554 -Ref: #declaring-the-decimal-mark224754 -Node: Declaring commodities225151 -Ref: #declaring-commodities225342 -Node: Commodity error checking227860 -Ref: #commodity-error-checking228010 -Node: Default commodity228267 -Ref: #default-commodity228447 -Node: Declaring market prices229563 -Ref: #declaring-market-prices229752 -Node: Declaring accounts230565 -Ref: #declaring-accounts230745 -Node: Account error checking231947 -Ref: #account-error-checking232113 -Node: Account comments233292 -Ref: #account-comments233476 -Node: Account subdirectives233900 -Ref: #account-subdirectives234085 -Node: Account types234398 -Ref: #account-types234572 -Node: Auto-detected account types235895 -Ref: #auto-detected-account-types236050 -Node: Account display order237285 -Ref: #account-display-order237445 -Node: Rewriting accounts238596 -Ref: #rewriting-accounts238775 -Node: Basic aliases239532 -Ref: #basic-aliases239668 -Node: Regex aliases240412 -Ref: #regex-aliases240574 -Node: Combining aliases241293 -Ref: #combining-aliases241476 -Node: Aliases and multiple files242752 -Ref: #aliases-and-multiple-files242951 -Node: end aliases243530 -Ref: #end-aliases243677 -Node: Default parent account243826 -Ref: #default-parent-account244016 -Node: Periodic transactions244900 -Ref: #periodic-transactions245083 -Node: Periodic rule syntax247000 -Ref: #periodic-rule-syntax247200 -Node: Two spaces between period expression and description!247904 -Ref: #two-spaces-between-period-expression-and-description248217 -Node: Forecasting with periodic transactions248901 -Ref: #forecasting-with-periodic-transactions249200 -Node: Budgeting with periodic transactions251971 -Ref: #budgeting-with-periodic-transactions252204 -Node: Auto postings252613 -Ref: #auto-postings252749 -Node: Auto postings and multiple files254928 -Ref: #auto-postings-and-multiple-files255126 -Node: Auto postings and dates255335 -Ref: #auto-postings-and-dates255603 -Node: Auto postings and transaction balancing / inferred amounts / balance assertions255778 -Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions256123 -Node: Auto posting tags256626 -Ref: #auto-posting-tags256835 -Node: CSV FORMAT257471 -Ref: #csv-format257599 -Node: Examples260228 -Ref: #examples260331 -Node: Basic260539 -Ref: #basic260641 -Node: Bank of Ireland261183 -Ref: #bank-of-ireland261320 -Node: Amazon262782 -Ref: #amazon262902 -Node: Paypal264621 -Ref: #paypal264717 -Node: CSV rules272361 -Ref: #csv-rules272479 -Node: skip272812 -Ref: #skip272912 -Node: fields list273287 -Ref: #fields-list273426 -Node: field assignment274992 -Ref: #field-assignment275144 -Node: Field names276179 -Ref: #field-names276319 -Node: date field276699 -Ref: #date-field276819 -Node: date2 field276867 -Ref: #date2-field277010 -Node: status field277066 -Ref: #status-field277211 -Node: code field277260 -Ref: #code-field277407 -Node: description field277452 -Ref: #description-field277614 -Node: comment field277673 -Ref: #comment-field277830 -Node: account field278141 -Ref: #account-field278293 -Node: amount field278868 -Ref: #amount-field279019 -Node: currency field280264 -Ref: #currency-field280419 -Node: balance field280676 -Ref: #balance-field280810 -Node: separator281182 -Ref: #separator281314 -Node: if block281854 -Ref: #if-block281981 -Node: Matching the whole record282382 -Ref: #matching-the-whole-record282559 -Node: Matching individual fields283362 -Ref: #matching-individual-fields283568 -Node: Combining matchers283792 -Ref: #combining-matchers283990 -Node: Rules applied on successful match284303 -Ref: #rules-applied-on-successful-match284496 -Node: if table285150 -Ref: #if-table285271 -Node: end287009 -Ref: #end287123 -Node: date-format287347 -Ref: #date-format287481 -Node: decimal-mark288477 -Ref: #decimal-mark288624 -Node: newest-first288963 -Ref: #newest-first289106 -Node: include289789 -Ref: #include289922 -Node: balance-type290366 -Ref: #balance-type290488 -Node: Tips291188 -Ref: #tips291279 -Node: Rapid feedback291578 -Ref: #rapid-feedback291697 -Node: Valid CSV292149 -Ref: #valid-csv292281 -Node: File Extension292473 -Ref: #file-extension292627 -Node: Reading multiple CSV files293056 -Ref: #reading-multiple-csv-files293243 -Node: Valid transactions293484 -Ref: #valid-transactions293664 -Node: Deduplicating importing294292 -Ref: #deduplicating-importing294473 -Node: Setting amounts295506 -Ref: #setting-amounts295663 -Node: Amount signs298104 -Ref: #amount-signs298258 -Node: Setting currency/commodity298945 -Ref: #setting-currencycommodity299133 -Node: Amount decimal places300307 -Ref: #amount-decimal-places300499 -Node: Referencing other fields300811 -Ref: #referencing-other-fields301010 -Node: How CSV rules are evaluated301907 -Ref: #how-csv-rules-are-evaluated302082 -Node: TIMECLOCK FORMAT303533 -Ref: #timeclock-format303673 -Node: TIMEDOT FORMAT305734 -Ref: #timedot-format305872 -Node: COMMON TASKS310434 -Ref: #common-tasks310563 -Node: Getting help310970 -Ref: #getting-help311104 -Node: Constructing command lines311657 -Ref: #constructing-command-lines311851 -Node: Starting a journal file312548 -Ref: #starting-a-journal-file312748 -Node: Setting opening balances313936 -Ref: #setting-opening-balances314134 -Node: Recording transactions317275 -Ref: #recording-transactions317457 -Node: Reconciling318013 -Ref: #reconciling318158 -Node: Reporting320415 -Ref: #reporting320557 -Node: Migrating to a new file324556 -Ref: #migrating-to-a-new-file324706 -Node: LIMITATIONS325005 -Ref: #limitations325133 -Node: TROUBLESHOOTING325876 -Ref: #troubleshooting325991 +Node: OPTIONS2593 +Ref: #options2694 +Node: General options2836 +Ref: #general-options2961 +Node: Command options7174 +Ref: #command-options7325 +Node: Command arguments7725 +Ref: #command-arguments7883 +Node: Special characters8763 +Ref: #special-characters8926 +Node: Single escaping shell metacharacters9089 +Ref: #single-escaping-shell-metacharacters9330 +Node: Double escaping regular expression metacharacters9933 +Ref: #double-escaping-regular-expression-metacharacters10244 +Node: Triple escaping for add-on commands10770 +Ref: #triple-escaping-for-add-on-commands11030 +Node: Less escaping11674 +Ref: #less-escaping11828 +Node: Unicode characters12152 +Ref: #unicode-characters12317 +Node: Regular expressions13729 +Ref: #regular-expressions13869 +Node: ENVIRONMENT15605 +Ref: #environment15721 +Node: DATA FILES17213 +Ref: #data-files17332 +Node: Data formats17871 +Ref: #data-formats17989 +Node: Multiple files19383 +Ref: #multiple-files19525 +Node: Strict mode19994 +Ref: #strict-mode20109 +Node: TIME PERIODS20815 +Ref: #time-periods20932 +Node: Smart dates21030 +Ref: #smart-dates21156 +Node: Report start & end date22693 +Ref: #report-start-end-date22868 +Node: Report intervals24535 +Ref: #report-intervals24703 +Node: Period expressions26442 +Ref: #period-expressions26582 +Node: Period expressions with a report interval28313 +Ref: #period-expressions-with-a-report-interval28545 +Node: More complex report intervals29626 +Ref: #more-complex-report-intervals29875 +Node: Intervals with custom start date30510 +Ref: #intervals-with-custom-start-date30742 +Node: Periods or dates ?32316 +Ref: #periods-or-dates32518 +Node: Events on multiple weekdays32960 +Ref: #events-on-multiple-weekdays33139 +Node: DEPTH34002 +Ref: #depth34102 +Node: QUERIES34436 +Ref: #queries34537 +Node: Query types35500 +Ref: #query-types35619 +Node: Combining query terms38291 +Ref: #combining-query-terms38466 +Node: Queries and command options39269 +Ref: #queries-and-command-options39472 +Node: Queries and account aliases39721 +Ref: #queries-and-account-aliases39924 +Node: Queries and valuation40044 +Ref: #queries-and-valuation40237 +Node: Querying with account aliases40466 +Ref: #querying-with-account-aliases40675 +Node: Querying with cost or value40805 +Ref: #querying-with-cost-or-value41006 +Node: CONVERSION & COST41307 +Ref: #conversion-cost41450 +Node: Recording conversions42339 +Ref: #recording-conversions42515 +Node: Implicit conversion42967 +Ref: #implicit-conversion43128 +Node: Priced conversion43925 +Ref: #priced-conversion44108 +Node: Equity conversion44499 +Ref: #equity-conversion44687 +Node: Priced equity conversion45455 +Ref: #priced-equity-conversion45631 +Node: Inferring missing conversion rates45979 +Ref: #inferring-missing-conversion-rates46223 +Node: Inferring missing equity postings46339 +Ref: #inferring-missing-equity-postings46574 +Node: Cost reporting46722 +Ref: #cost-reporting46903 +Node: Conversion summary47423 +Ref: #conversion-summary47570 +Node: VALUATION48292 +Ref: #valuation48400 +Node: -V Value49167 +Ref: #v-value49291 +Node: -X Value in specified commodity49486 +Ref: #x-value-in-specified-commodity49679 +Node: Valuation date49828 +Ref: #valuation-date49990 +Node: Market prices50427 +Ref: #market-prices50609 +Node: --infer-market-prices market prices from transactions51792 +Ref: #infer-market-prices-market-prices-from-transactions52059 +Node: Valuation commodity53415 +Ref: #valuation-commodity53626 +Node: Simple valuation examples54852 +Ref: #simple-valuation-examples55048 +Node: --value Flexible valuation55707 +Ref: #value-flexible-valuation55909 +Node: More valuation examples57553 +Ref: #more-valuation-examples57760 +Node: Interaction of valuation and queries59759 +Ref: #interaction-of-valuation-and-queries59998 +Node: Effect of valuation on reports60470 +Ref: #effect-of-valuation-on-reports60665 +Node: PIVOTING68362 +Ref: #pivoting68467 +Node: OUTPUT70143 +Ref: #output70243 +Node: Output destination70334 +Ref: #output-destination70466 +Node: Output styling71123 +Ref: #output-styling71269 +Node: Output format72026 +Ref: #output-format72168 +Node: CSV output73532 +Ref: #csv-output73648 +Node: HTML output73751 +Ref: #html-output73889 +Node: JSON output73983 +Ref: #json-output74121 +Node: SQL output75038 +Ref: #sql-output75154 +Node: Commodity styles75655 +Ref: #commodity-styles75780 +Node: COMMANDS76556 +Ref: #commands76668 +Node: accounts80033 +Ref: #accounts80133 +Node: activity80829 +Ref: #activity80941 +Node: add81324 +Ref: #add81427 +Node: aregister84220 +Ref: #aregister84334 +Node: aregister and custom posting dates86699 +Ref: #aregister-and-custom-posting-dates86865 +Node: balance87417 +Ref: #balance87536 +Node: balance features88529 +Ref: #balance-features88669 +Node: Simple balance report90593 +Ref: #simple-balance-report90775 +Node: Filtered balance report92255 +Ref: #filtered-balance-report92442 +Node: List or tree mode92769 +Ref: #list-or-tree-mode92937 +Node: Depth limiting94282 +Ref: #depth-limiting94448 +Node: Dropping top-level accounts95049 +Ref: #dropping-top-level-accounts95251 +Node: Multi-period balance report95561 +Ref: #multi-period-balance-report95774 +Node: Showing declared accounts98049 +Ref: #showing-declared-accounts98242 +Node: Data layout98773 +Ref: #data-layout98928 +Node: Sorting by amount106868 +Ref: #sorting-by-amount107023 +Node: Percentages107693 +Ref: #percentages107851 +Node: Balance change end balance108812 +Ref: #balance-change-end-balance109005 +Node: Balance report types110433 +Ref: #balance-report-types110623 +Node: Useful balance reports114902 +Ref: #useful-balance-reports115083 +Node: Budget report116168 +Ref: #budget-report116352 +Node: Budget report start date121627 +Ref: #budget-report-start-date121805 +Node: Budgets and subaccounts123137 +Ref: #budgets-and-subaccounts123344 +Node: Selecting budget goals126784 +Ref: #selecting-budget-goals126956 +Node: Customising single-period balance reports127990 +Ref: #customising-single-period-balance-reports128199 +Node: balancesheet130374 +Ref: #balancesheet130512 +Node: balancesheetequity131811 +Ref: #balancesheetequity131962 +Node: cashflow133342 +Ref: #cashflow133466 +Node: check134612 +Ref: #check134717 +Node: Basic checks135351 +Ref: #basic-checks135469 +Node: Strict checks136020 +Ref: #strict-checks136161 +Node: Other checks136597 +Ref: #other-checks136737 +Node: Custom checks137094 +Ref: #custom-checks137214 +Node: close137631 +Ref: #close137735 +Node: close and prices139826 +Ref: #close-and-prices139955 +Node: close date140350 +Ref: #close-date140534 +Node: Example close asset/liability accounts for file transition141291 +Ref: #example-close-assetliability-accounts-for-file-transition141592 +Node: Hiding opening/closing transactions142451 +Ref: #hiding-openingclosing-transactions142722 +Node: close and balance assertions144099 +Ref: #close-and-balance-assertions144357 +Node: Example close revenue/expense accounts to retained earnings145711 +Ref: #example-close-revenueexpense-accounts-to-retained-earnings145989 +Node: codes146879 +Ref: #codes146989 +Node: commodities147701 +Ref: #commodities147830 +Node: descriptions147912 +Ref: #descriptions148042 +Node: diff148346 +Ref: #diff148454 +Node: files149501 +Ref: #files149603 +Node: help149750 +Ref: #help149852 +Node: import150670 +Ref: #import150786 +Node: Deduplication151651 +Ref: #deduplication151776 +Node: Import testing153670 +Ref: #import-testing153835 +Node: Importing balance assignments154323 +Ref: #importing-balance-assignments154529 +Node: Commodity display styles155178 +Ref: #commodity-display-styles155351 +Node: incomestatement155480 +Ref: #incomestatement155615 +Node: notes156920 +Ref: #notes157035 +Node: payees157403 +Ref: #payees157511 +Node: prices158037 +Ref: #prices158145 +Node: print158514 +Ref: #print158626 +Node: print-unique163941 +Ref: #print-unique164069 +Node: register164354 +Ref: #register164483 +Node: Custom register output168929 +Ref: #custom-register-output169060 +Node: register-match170397 +Ref: #register-match170533 +Node: rewrite170884 +Ref: #rewrite171001 +Node: Re-write rules in a file172907 +Ref: #re-write-rules-in-a-file173070 +Node: Diff output format174219 +Ref: #diff-output-format174402 +Node: rewrite vs print --auto175494 +Ref: #rewrite-vs.-print---auto175654 +Node: roi176210 +Ref: #roi176310 +Node: Spaces and special characters in --inv and --pnl177996 +Ref: #spaces-and-special-characters-in---inv-and---pnl178236 +Node: Semantics of --inv and --pnl178724 +Ref: #semantics-of---inv-and---pnl178963 +Node: IRR and TWR explained180813 +Ref: #irr-and-twr-explained180973 +Node: stats184041 +Ref: #stats184142 +Node: tags185522 +Ref: #tags185622 +Node: test186141 +Ref: #test186257 +Node: About add-on commands187004 +Ref: #about-add-on-commands187141 +Node: JOURNAL FORMAT188272 +Ref: #journal-format188400 +Node: Transactions190627 +Ref: #transactions190742 +Node: Dates191756 +Ref: #dates191872 +Node: Simple dates191937 +Ref: #simple-dates192057 +Node: Secondary dates192566 +Ref: #secondary-dates192714 +Node: Posting dates194050 +Ref: #posting-dates194173 +Node: Status195545 +Ref: #status195655 +Node: Code197363 +Ref: #code197475 +Node: Description197707 +Ref: #description197835 +Node: Payee and note198155 +Ref: #payee-and-note198263 +Node: Comments198598 +Ref: #comments198720 +Node: Tags199914 +Ref: #tags-1200025 +Node: Postings201418 +Ref: #postings201542 +Node: Virtual postings202568 +Ref: #virtual-postings202679 +Node: Account names203984 +Ref: #account-names204121 +Node: Amounts204609 +Ref: #amounts204746 +Node: Decimal marks digit group marks205731 +Ref: #decimal-marks-digit-group-marks205908 +Node: Commodity206929 +Ref: #commodity207118 +Node: Directives influencing number parsing and display208070 +Ref: #directives-influencing-number-parsing-and-display208331 +Node: Commodity display style208824 +Ref: #commodity-display-style209032 +Node: Rounding211227 +Ref: #rounding211347 +Node: Transaction prices211759 +Ref: #transaction-prices211925 +Node: Lot prices lot dates214356 +Ref: #lot-prices-lot-dates214539 +Node: Balance assertions215027 +Ref: #balance-assertions215205 +Node: Assertions and ordering216238 +Ref: #assertions-and-ordering216420 +Node: Assertions and included files217120 +Ref: #assertions-and-included-files217357 +Node: Assertions and multiple -f options217690 +Ref: #assertions-and-multiple--f-options217940 +Node: Assertions and commodities218072 +Ref: #assertions-and-commodities218298 +Node: Assertions and prices219455 +Ref: #assertions-and-prices219663 +Node: Assertions and subaccounts220103 +Ref: #assertions-and-subaccounts220326 +Node: Assertions and virtual postings220650 +Ref: #assertions-and-virtual-postings220886 +Node: Assertions and precision221028 +Ref: #assertions-and-precision221215 +Node: Balance assignments221482 +Ref: #balance-assignments221652 +Node: Balance assignments and prices222816 +Ref: #balance-assignments-and-prices222982 +Node: Directives223206 +Ref: #directives223369 +Node: Directives and multiple files227861 +Ref: #directives-and-multiple-files228057 +Node: Comment blocks228749 +Ref: #comment-blocks228926 +Node: Including other files229102 +Ref: #including-other-files229276 +Node: Default year230200 +Ref: #default-year230358 +Node: Declaring payees230765 +Ref: #declaring-payees230936 +Node: Declaring the decimal mark231182 +Ref: #declaring-the-decimal-mark231382 +Node: Declaring commodities231779 +Ref: #declaring-commodities231970 +Node: Commodity error checking234488 +Ref: #commodity-error-checking234638 +Node: Default commodity234895 +Ref: #default-commodity235075 +Node: Declaring market prices236191 +Ref: #declaring-market-prices236380 +Node: Declaring accounts237193 +Ref: #declaring-accounts237373 +Node: Account error checking238575 +Ref: #account-error-checking238741 +Node: Account comments239920 +Ref: #account-comments240104 +Node: Account subdirectives240528 +Ref: #account-subdirectives240713 +Node: Account types241026 +Ref: #account-types241200 +Node: Auto-detected account types242616 +Ref: #auto-detected-account-types242771 +Node: Account display order244006 +Ref: #account-display-order244166 +Node: Rewriting accounts245317 +Ref: #rewriting-accounts245496 +Node: Basic aliases246253 +Ref: #basic-aliases246389 +Node: Regex aliases247133 +Ref: #regex-aliases247295 +Node: Combining aliases248014 +Ref: #combining-aliases248197 +Node: Aliases and multiple files249473 +Ref: #aliases-and-multiple-files249672 +Node: end aliases250251 +Ref: #end-aliases250398 +Node: Default parent account250547 +Ref: #default-parent-account250737 +Node: Periodic transactions251621 +Ref: #periodic-transactions251804 +Node: Periodic rule syntax253721 +Ref: #periodic-rule-syntax253921 +Node: Two spaces between period expression and description!254625 +Ref: #two-spaces-between-period-expression-and-description254938 +Node: Forecasting with periodic transactions255622 +Ref: #forecasting-with-periodic-transactions255921 +Node: Budgeting with periodic transactions258692 +Ref: #budgeting-with-periodic-transactions258925 +Node: Auto postings259334 +Ref: #auto-postings259470 +Node: Auto postings and multiple files261649 +Ref: #auto-postings-and-multiple-files261847 +Node: Auto postings and dates262056 +Ref: #auto-postings-and-dates262324 +Node: Auto postings and transaction balancing / inferred amounts / balance assertions262499 +Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions262844 +Node: Auto posting tags263347 +Ref: #auto-posting-tags263556 +Node: CSV FORMAT264192 +Ref: #csv-format264320 +Node: Examples266949 +Ref: #examples267052 +Node: Basic267260 +Ref: #basic267362 +Node: Bank of Ireland267904 +Ref: #bank-of-ireland268041 +Node: Amazon269503 +Ref: #amazon269623 +Node: Paypal271342 +Ref: #paypal271438 +Node: CSV rules279082 +Ref: #csv-rules279200 +Node: skip279533 +Ref: #skip279633 +Node: fields list280008 +Ref: #fields-list280147 +Node: field assignment281713 +Ref: #field-assignment281865 +Node: Field names282900 +Ref: #field-names283040 +Node: date field283420 +Ref: #date-field283540 +Node: date2 field283588 +Ref: #date2-field283731 +Node: status field283787 +Ref: #status-field283932 +Node: code field283981 +Ref: #code-field284128 +Node: description field284173 +Ref: #description-field284335 +Node: comment field284394 +Ref: #comment-field284551 +Node: account field284862 +Ref: #account-field285014 +Node: amount field285589 +Ref: #amount-field285740 +Node: currency field286985 +Ref: #currency-field287140 +Node: balance field287397 +Ref: #balance-field287531 +Node: separator287903 +Ref: #separator288035 +Node: if block288575 +Ref: #if-block288702 +Node: Matching the whole record289103 +Ref: #matching-the-whole-record289280 +Node: Matching individual fields290083 +Ref: #matching-individual-fields290289 +Node: Combining matchers290513 +Ref: #combining-matchers290711 +Node: Rules applied on successful match291024 +Ref: #rules-applied-on-successful-match291217 +Node: if table291871 +Ref: #if-table291992 +Node: end293730 +Ref: #end293844 +Node: date-format294068 +Ref: #date-format294202 +Node: decimal-mark295198 +Ref: #decimal-mark295345 +Node: newest-first295684 +Ref: #newest-first295827 +Node: include296510 +Ref: #include296643 +Node: balance-type297087 +Ref: #balance-type297209 +Node: Tips297909 +Ref: #tips298000 +Node: Rapid feedback298299 +Ref: #rapid-feedback298418 +Node: Valid CSV298870 +Ref: #valid-csv299002 +Node: File Extension299194 +Ref: #file-extension299348 +Node: Reading multiple CSV files299777 +Ref: #reading-multiple-csv-files299964 +Node: Valid transactions300205 +Ref: #valid-transactions300385 +Node: Deduplicating importing301013 +Ref: #deduplicating-importing301194 +Node: Setting amounts302227 +Ref: #setting-amounts302384 +Node: Amount signs304825 +Ref: #amount-signs304979 +Node: Setting currency/commodity305666 +Ref: #setting-currencycommodity305854 +Node: Amount decimal places307028 +Ref: #amount-decimal-places307220 +Node: Referencing other fields307532 +Ref: #referencing-other-fields307731 +Node: How CSV rules are evaluated308628 +Ref: #how-csv-rules-are-evaluated308803 +Node: TIMECLOCK FORMAT310254 +Ref: #timeclock-format310394 +Node: TIMEDOT FORMAT312455 +Ref: #timedot-format312593 +Node: COMMON TASKS317155 +Ref: #common-tasks317284 +Node: Getting help317691 +Ref: #getting-help317825 +Node: Constructing command lines318378 +Ref: #constructing-command-lines318572 +Node: Starting a journal file319269 +Ref: #starting-a-journal-file319469 +Node: Setting opening balances320657 +Ref: #setting-opening-balances320855 +Node: Recording transactions323996 +Ref: #recording-transactions324178 +Node: Reconciling324734 +Ref: #reconciling324879 +Node: Reporting327136 +Ref: #reporting327278 +Node: Migrating to a new file331277 +Ref: #migrating-to-a-new-file331427 +Node: LIMITATIONS331726 +Ref: #limitations331854 +Node: TROUBLESHOOTING332597 +Ref: #troubleshooting332712  End Tag Table diff --git a/hledger/hledger.txt b/hledger/hledger.txt index 31d17e911..b63e1a97b 100644 --- a/hledger/hledger.txt +++ b/hledger/hledger.txt @@ -1033,86 +1033,220 @@ QUERIES this changed in hledger 1.22, previously it was the reverse, see the discussion at #1625. -COSTING - The -B/--cost flag converts amounts to their cost or sale amount at - transaction time, if they have a transaction price specified. If this - flag is supplied, hledger will perform cost conversion first, and will - apply any market price valuations (if requested) afterwards. + CONVERSION & COST + This section is about converting between commodities. Some defini- + tions: + + o A "commodity conversion" is an exchange of one currency or commodity + for another. Eg a foreign currency exchange, or a purchase or sale + of stock or cryptocurrency. + + o A "conversion transaction" is a transaction involving one or more + such conversions. + + o "Conversion rate" is the exchange rate in a conversion - the cost per + unit of one commodity in the other. + + o "Cost" is how much of one commodity was paid to acquire the other + (when buying), or how much was received in exchange for the other + (when selling). We call both of these "cost" for convenience (after + all, it is cost for one party or the other). + + Recording conversions + As a concrete example, let's assume 100 EUR was converted to 120 USD. + There are several ways to record this in the journal, each with pros + and cons which will be explained in more detail below. (Also, these + examples use journal format which is properly explained much further + below; sorry about that, you may want to read some of that first.) + + Implicit conversion + You can just record the outflow (100 EUR) and inflow (120 USD) in the + appropriate asset account: + + 2021-01-01 + assets:cash -100 EUR + assets:cash 120 USD + + hledger will assume this transaction is balanced, inferring that the + conversion rate must be 1 EUR = 1.20 USD. You can see the inferred + rate by using hledger print -x. + + Pro: - Easy, concise - hledger can do cost reporting + + Con: - Less error checking - typos in amounts or commodity symbols may + not be detected - conversion rate is not clear - disturbs the account- + ing equation + + You can prevent accidental implicit conversions due to a mistyped com- + modity symbol, by using hledger check commodities. You can prevent + implicit conversions entirely, by using hledger check balancednoauto- + conversion, or -s/--strict. + + Priced conversion + You can add the conversion rate using @ notation: + + 2021-01-01 + assets:cash -100 EUR @ 1.20 USD + assets:cash 120 USD + + Now hledger will check that 100 * 1.20 = 120, and would report an error + otherwise. + + Pro: - Still concise - makes the conversion rate clear - provides some + error checking - hledger can do cost reporting + + Con: - Disturbs the accounting equation + + Equity conversion + In strict double entry bookkeeping, the above transaction is not bal- + anced in EUR or in USD, since some EUR disappears, and some USD + appears. This violates the accounting equation (A+L+E=0), and prevents + reports like balancesheetequity from showing a zero total. + + The proper way to make it balance is to add a balancing posting for + each commodity, using an equity account: + + 2021-01-01 + assets:cash -100 EUR + equity:conversion 100 EUR + equity:conversion -120 USD + assets:cash 120 USD + + Pro: - Preserves the accounting equation - keeps track of conversions + and related gains/losses in one place - works in any double entry + accounting system + + Con: - More verbose - conversion rate is not clear - hledger can not do + cost reporting + + Priced equity conversion + Another possible notation would be to record both the conversion rate + and the equity postings: + + 2021-01-01 + assets:cash -100 EUR @ 1.20 USD + equity:conversion 100 EUR + equity:conversion -120 USD + assets:cash 120 USD + + hledger currently does not allow this; instead, you can record the con- + version rate as a comment. + + Inferring missing conversion rates + hledger will do this automatically for implicit conversions. Currently + it can not do this for equity conversions. + + Inferring missing equity postings + With the --infer-equity flag, hledger will add equity postings to + priced and implicit conversions (and move the conversion rate into a + comment). + + Cost reporting + With the -B/--cost flag, hledger will convert the amounts in priced and + implicit conversions to their cost in the other commodity. This is + useful to see a report of what you paid for things (or how much you + sold things for). Currently -B/--cost does not work on equity conver- + sions, and it disables --infer-equity. + + These operations are transient, only affecting reports. If you want to + change the journal file permanently, you could pipe each entry through + hledger -f- -I print [-x] [--infer-equity] [-B] + + Conversion summary + o Recording the conversion rate is good because it makes that clear and + allows cost reporting. + + o Recording equity postings is good because it balances the accounting + equation and is correct bookkeeping. + + o Combining these is not yet supported, so you have to choose. For + now, priced conversions are a good compromise, so that: + + o When you want to see the cost (or sale proceeds) of things, use + -B/--cost. + + o When you want to see a balanced balance sheet or correct journal + entries, use --infer-equity. + + o Combining these is not yet supported; -B/--cost will take prece- + dence. + + o Conversion/cost operations are performed before valuation. VALUATION - Instead of reporting amounts in their original commodity, hledger can + Instead of reporting amounts in their original commodity, hledger can convert them to cost/sale amount (using the conversion rate recorded in - the transaction), and/or to market value (using some market price on a - certain date). This is controlled by the --value=TYPE[,COMMODITY] - option, which will be described below. We also provide the simpler -V + the transaction), and/or to market value (using some market price on a + certain date). This is controlled by the --value=TYPE[,COMMODITY] + option, which will be described below. We also provide the simpler -V and -X COMMODITY options, and often one of these is all you need: -V: Value - The -V/--market flag converts amounts to market value in their default + The -V/--market flag converts amounts to market value in their default valuation commodity, using the market prices in effect on the valuation date(s), if any. More on these in a minute. -X: Value in specified commodity The -X/--exchange=COMM option is like -V, except you tell it which cur- - rency you want to convert to, and it tries to convert everything to + rency you want to convert to, and it tries to convert everything to that. Valuation date - Since market prices can change from day to day, market value reports + Since market prices can change from day to day, market value reports have a valuation date (or more than one), which determines which market prices will be used. For single period reports, if an explicit report end date is specified, - that will be used as the valuation date; otherwise the valuation date + that will be used as the valuation date; otherwise the valuation date is the journal's end date. - For multiperiod reports, each column/period is valued on the last day + For multiperiod reports, each column/period is valued on the last day of the period, by default. Market prices - To convert a commodity A to its market value in another commodity B, - hledger looks for a suitable market price (exchange rate) as follows, + To convert a commodity A to its market value in another commodity B, + hledger looks for a suitable market price (exchange rate) as follows, in this order of preference : - 1. A declared market price or inferred market price: A's latest market + 1. A declared market price or inferred market price: A's latest market price in B on or before the valuation date as declared by a P direc- - tive, or (with the --infer-market-prices flag) inferred from trans- + tive, or (with the --infer-market-prices flag) inferred from trans- action prices. 2. A reverse market price: the inverse of a declared or inferred market price from B to A. - 3. A forward chain of market prices: a synthetic price formed by com- + 3. A forward chain of market prices: a synthetic price formed by com- bining the shortest chain of "forward" (only 1 above) market prices, leading from A to B. - 4. Any chain of market prices: a chain of any market prices, including - both forward and reverse prices (1 and 2 above), leading from A to + 4. Any chain of market prices: a chain of any market prices, including + both forward and reverse prices (1 and 2 above), leading from A to B. - There is a limit to the length of these price chains; if hledger - reaches that length without finding a complete chain or exhausting all - possibilities, it will give up (with a "gave up" message visible in + There is a limit to the length of these price chains; if hledger + reaches that length without finding a complete chain or exhausting all + possibilities, it will give up (with a "gave up" message visible in --debug=2 output). That limit is currently 1000. - Amounts for which no suitable market price can be found, are not con- + Amounts for which no suitable market price can be found, are not con- verted. --infer-market-prices: market prices from transactions Normally, market value in hledger is fully controlled by, and requires, P directives in your journal. Since adding and updating those can be a - chore, and since transactions usually take place at close to market + chore, and since transactions usually take place at close to market value, why not use the recorded transaction prices as additional market prices (as Ledger does) ? We could produce value reports without need- ing P directives at all. - Adding the --infer-market-prices flag to -V, -X or --value enables - this. So for example, hledger bs -V --infer-market-prices will get - market prices both from P directives and from transactions. (And if + Adding the --infer-market-prices flag to -V, -X or --value enables + this. So for example, hledger bs -V --infer-market-prices will get + market prices both from P directives and from transactions. (And if both occur on the same day, the P directive takes precedence). There is a downside: value reports can sometimes be affected in confus- - ing/undesired ways by your journal entries. If this happens to you, + ing/undesired ways by your journal entries. If this happens to you, read all of this Valuation section carefully, and try adding --debug or --debug=2 to troubleshoot. @@ -1120,43 +1254,43 @@ VALUATION o multicommodity transactions with explicit prices (@/@@) - o multicommodity transactions with implicit prices (no @, two commodi- - ties, unbalanced). (With these, the order of postings matters. + o multicommodity transactions with implicit prices (no @, two commodi- + ties, unbalanced). (With these, the order of postings matters. hledger print -x can be useful for troubleshooting.) - o but not, currently, from "more correct" multicommodity transactions + o but not, currently, from "more correct" multicommodity transactions (no @, multiple commodities, balanced). Valuation commodity When you specify a valuation commodity (-X COMM or --value TYPE,COMM): - hledger will convert all amounts to COMM, wherever it can find a suit- + hledger will convert all amounts to COMM, wherever it can find a suit- able market price (including by reversing or chaining prices). - When you leave the valuation commodity unspecified (-V or --value + When you leave the valuation commodity unspecified (-V or --value TYPE): - For each commodity A, hledger picks a default valuation commodity as + For each commodity A, hledger picks a default valuation commodity as follows, in this order of preference: 1. The price commodity from the latest P-declared market price for A on or before valuation date. 2. The price commodity from the latest P-declared market price for A on - any date. (Allows conversion to proceed when there are inferred + any date. (Allows conversion to proceed when there are inferred prices before the valuation date.) - 3. If there are no P directives at all (any commodity or date) and the - --infer-market-prices flag is used: the price commodity from the + 3. If there are no P directives at all (any commodity or date) and the + --infer-market-prices flag is used: the price commodity from the latest transaction-inferred price for A on or before valuation date. This means: - o If you have P directives, they determine which commodities -V will + o If you have P directives, they determine which commodities -V will convert, and to what. - o If you have no P directives, and use the --infer-market-prices flag, + o If you have no P directives, and use the --infer-market-prices flag, transaction prices determine it. - Amounts for which no valuation commodity can be found are not con- + Amounts for which no valuation commodity can be found are not con- verted. Simple valuation examples @@ -1183,7 +1317,7 @@ VALUATION $ hledger -f t.j bal -N euros -V -e 2016/11/4 $110.00 assets:euros - What are they worth after 2016/12/21 ? (no report end date specified, + What are they worth after 2016/12/21 ? (no report end date specified, defaults to today) $ hledger -f t.j bal -N euros -V @@ -1203,31 +1337,31 @@ VALUATION The TYPE part selects cost or value and valuation date: --value=then - Convert amounts to their value in the default valuation commod- + Convert amounts to their value in the default valuation commod- ity, using market prices on each posting's date. --value=end - Convert amounts to their value in the default valuation commod- - ity, using market prices on the last day of the report period - (or if unspecified, the journal's end date); or in multiperiod + Convert amounts to their value in the default valuation commod- + ity, using market prices on the last day of the report period + (or if unspecified, the journal's end date); or in multiperiod reports, market prices on the last day of each subperiod. --value=now - Convert amounts to their value in the default valuation commod- - ity using current market prices (as of when report is gener- + Convert amounts to their value in the default valuation commod- + ity using current market prices (as of when report is gener- ated). --value=YYYY-MM-DD - Convert amounts to their value in the default valuation commod- + Convert amounts to their value in the default valuation commod- ity using market prices on this date. To select a different valuation commodity, add the optional ,COMM part: - a comma, then the target commodity's symbol. Eg: --value=now,EUR. + a comma, then the target commodity's symbol. Eg: --value=now,EUR. hledger will do its best to convert amounts to this commodity, deducing market prices as described above. More valuation examples - Here are some examples showing the effect of --value, as seen with + Here are some examples showing the effect of --value, as seen with print: P 2000-01-01 A 1 B @@ -1265,7 +1399,7 @@ VALUATION 2000-02-01 (a) 2 B - With no report period specified, that shows the value as of the last + With no report period specified, that shows the value as of the last day of the journal (2000-03-01): $ hledger -f- print --value=end @@ -1302,7 +1436,7 @@ VALUATION 2000-03-01 (a) 1 B - You may need to explicitly set a commodity's display style, when + You may need to explicitly set a commodity's display style, when reverse prices are used. Eg this output might be surprising: P 2000-01-01 A 2B @@ -1316,10 +1450,10 @@ VALUATION a 0 b 0 - Explanation: because there's no amount or commodity directive specify- - ing a display style for A, 0.5A gets the default style, which shows no + Explanation: because there's no amount or commodity directive specify- + ing a display style for A, 0.5A gets the default style, which shows no decimal digits. Because the displayed amount looks like zero, the com- - modity symbol and minus sign are not displayed either. Adding a com- + modity symbol and minus sign are not displayed either. Adding a com- modity directive sets a more useful display style for A: P 2000-01-01 A 2B @@ -1335,7 +1469,7 @@ VALUATION b -0.50A Interaction of valuation and queries - When matching postings based on queries in the presence of valuation, + When matching postings based on queries in the presence of valuation, the following happens. 1. The query is separated into two parts: @@ -1349,16 +1483,16 @@ VALUATION 3. Valuation is applied to the postings. - 4. The postings are matched to the other parts of the query based on + 4. The postings are matched to the other parts of the query based on post-valued amounts. See: 1625 Effect of valuation on reports - Here is a reference for how valuation is supposed to affect each part - of hledger's reports (and a glossary). (It's wide, you'll have to - scroll sideways.) It may be useful when troubleshooting. If you find - problems, please report them, ideally with a reproducible example. + Here is a reference for how valuation is supposed to affect each part + of hledger's reports (and a glossary). (It's wide, you'll have to + scroll sideways.) It may be useful when troubleshooting. If you find + problems, please report them, ideally with a reproducible example. Related: #329, #1083. @@ -1366,7 +1500,7 @@ VALUATION type --value=now ----------------------------------------------------------------------------------------------- print - posting cost value at value at posting value at value at + posting cost value at value at posting value at value at amounts report end date report or DATE/today or today journal end balance unchanged unchanged unchanged unchanged unchanged @@ -1378,17 +1512,18 @@ VALUATION starting bal- cost value at valued at day value at value at ance (-H) report or each historical report or DATE/today journal end posting was made journal end - - - starting bal- cost value at day valued at day value at day value at ance (-H) before each historical before DATE/today with report report or posting was made report or interval journal journal start start - posting cost value at value at posting value at value at + posting cost value at value at posting value at value at amounts report or date report or DATE/today journal end journal end + + + + summary post- summarised value at sum of postings value at value at ing amounts cost period ends in interval, val- period ends DATE/today with report ued at interval @@ -1399,20 +1534,20 @@ VALUATION balance (bs, bse, cf, is) - balance sums of value at value at posting value at value at + balance sums of value at value at posting value at value at changes costs report end date report or DATE/today of - or today of journal end sums of post- + or today of journal end sums of post- sums of of sums of ings postings postings budget like balance like balance like balance like bal- like balance amounts changes changes changes ances changes (--budget) - grand total sum of dis- sum of dis- sum of displayed sum of dis- sum of dis- + grand total sum of dis- sum of dis- sum of displayed sum of dis- sum of dis- played val- played val- valued played val- played values ues ues ues balance (bs, - bse, cf, is) + bse, cf, is) with report interval starting bal- sums of value at sums of values of value at sums of post- @@ -1437,10 +1572,10 @@ VALUATION amounts changes/end changes/end changes/end bal- ances changes/end (--budget) balances balances ances balances row totals, sums, aver- sums, aver- sums, averages of sums, aver- sums, aver- - row averages ages of dis- ages of dis- displayed values ages of dis- ages of dis- + row averages ages of dis- ages of dis- displayed values ages of dis- ages of dis- (-T, -A) played val- played val- played val- played values ues ues ues - column totals sums of dis- sums of dis- sums of displayed sums of dis- sums of dis- + column totals sums of dis- sums of dis- sums of displayed sums of dis- sums of dis- played val- played val- values played val- played values ues ues ues grand total, sum, average sum, average sum, average of sum, average sum, average @@ -1455,43 +1590,43 @@ VALUATION cost calculated using price(s) recorded in the transaction(s). - value market value using available market price declarations, or the + value market value using available market price declarations, or the unchanged amount if no conversion rate can be found. report start - the first day of the report period specified with -b or -p or + the first day of the report period specified with -b or -p or date:, otherwise today. report or journal start - the first day of the report period specified with -b or -p or - date:, otherwise the earliest transaction date in the journal, + the first day of the report period specified with -b or -p or + date:, otherwise the earliest transaction date in the journal, otherwise today. report end - the last day of the report period specified with -e or -p or + the last day of the report period specified with -e or -p or date:, otherwise today. report or journal end - the last day of the report period specified with -e or -p or - date:, otherwise the latest transaction date in the journal, + the last day of the report period specified with -e or -p or + date:, otherwise the latest transaction date in the journal, otherwise today. report interval - a flag (-D/-W/-M/-Q/-Y) or period expression that activates the + a flag (-D/-W/-M/-Q/-Y) or period expression that activates the report's multi-period mode (whether showing one or many subperi- ods). PIVOTING Normally hledger sums amounts, and organizes them in a hierarchy, based - on account name. The --pivot FIELD option causes it to sum and orga- - nize hierarchy based on the value of some other field instead. FIELD + on account name. The --pivot FIELD option causes it to sum and orga- + nize hierarchy based on the value of some other field instead. FIELD can be: code, description, payee, note, or the full name (case insensi- tive) of any tag. As with account names, values containing colon:sepa- rated:parts will be displayed hierarchically in reports. - --pivot is a general option affecting all reports; you can think of + --pivot is a general option affecting all reports; you can think of hledger transforming the journal before any other processing, replacing - every posting's account name with the value of the specified field on + every posting's account name with the value of the specified field on that posting, inheriting it from the transaction or using a blank value if it's not present. @@ -1517,7 +1652,7 @@ PIVOTING -------------------- 0 - One way to show only amounts with a member: value (using a query, + One way to show only amounts with a member: value (using a query, described below): $ hledger balance --pivot member tag:member=. @@ -1525,7 +1660,7 @@ PIVOTING -------------------- -2 EUR - Another way (the acct: query matches against the pivoted "account + Another way (the acct: query matches against the pivoted "account name"): $ hledger balance --pivot member acct:. @@ -1540,35 +1675,35 @@ OUTPUT $ hledger print > foo.txt - Some commands (print, register, stats, the balance commands) also pro- - vide the -o/--output-file option, which does the same thing without + Some commands (print, register, stats, the balance commands) also pro- + vide the -o/--output-file option, which does the same thing without needing the shell. Eg: $ hledger print -o foo.txt $ hledger print -o - # write to stdout (the default) - hledger can optionally produce debug output (if enabled with - --debug=N); this goes to stderr, and is not affected by -o/--output- - file. If you need to capture it, use shell redirects, eg: hledger bal + hledger can optionally produce debug output (if enabled with + --debug=N); this goes to stderr, and is not affected by -o/--output- + file. If you need to capture it, use shell redirects, eg: hledger bal --debug=3 >file 2>&1. Output styling - hledger commands can produce colour output when the terminal supports - it. This is controlled by the --color/--colour option: - if the - --color/--colour option is given a value of yes or always (or no or + hledger commands can produce colour output when the terminal supports + it. This is controlled by the --color/--colour option: - if the + --color/--colour option is given a value of yes or always (or no or never), colour will (or will not) be used; - otherwise, if the NO_COLOR - environment variable is set, colour will not be used; - otherwise, + environment variable is set, colour will not be used; - otherwise, colour will be used if the output (terminal or file) supports it. hledger commands can also use unicode box-drawing characters to produce prettier tables and output. This is controlled by the --pretty option: - - if the --pretty option is given a value of yes or always (or no or - never), unicode characters will (or will not) be used; - otherwise, + - if the --pretty option is given a value of yes or always (or no or + never), unicode characters will (or will not) be used; - otherwise, unicode characters will not be used. Output format - Some commands offer additional output formats, other than the usual - plain text terminal output. Here are those commands and the formats + Some commands offer additional output formats, other than the usual + plain text terminal output. Here are those commands and the formats currently supported: @@ -1589,25 +1724,25 @@ OUTPUT o 1 Also affected by the balance commands' --layout option. - o 2 balance does not support html output without a report interval or + o 2 balance does not support html output without a report interval or with --budget. The output format is selected by the -O/--output-format=FMT option: $ hledger print -O csv # print CSV on stdout - or by the filename extension of an output file specified with the + or by the filename extension of an output file specified with the -o/--output-file=FILE.FMT option: $ hledger balancesheet -o foo.csv # write CSV to foo.csv - The -O option can be combined with -o to override the file extension, + The -O option can be combined with -o to override the file extension, if needed: $ hledger balancesheet -o foo.txt -O csv # write CSV to foo.txt CSV output - o In CSV output, digit group marks (such as thousands separators) are + o In CSV output, digit group marks (such as thousands separators) are disabled automatically. HTML output @@ -1617,19 +1752,19 @@ OUTPUT JSON output o Not yet much used; real-world feedback is welcome. - o Our JSON is rather large and verbose, as it is quite a faithful rep- - resentation of hledger's internal data types. To understand the + o Our JSON is rather large and verbose, as it is quite a faithful rep- + resentation of hledger's internal data types. To understand the JSON, read the Haskell type definitions, which are mostly in https://github.com/simonmichael/hledger/blob/master/hledger- lib/Hledger/Data/Types.hs. - o hledger represents quantities as Decimal values storing up to 255 - significant digits, eg for repeating decimals. Such numbers can + o hledger represents quantities as Decimal values storing up to 255 + significant digits, eg for repeating decimals. Such numbers can arise in practice (from automatically-calculated transaction prices), - and would break most JSON consumers. So in JSON, we show quantities + and would break most JSON consumers. So in JSON, we show quantities as simple Numbers with at most 10 decimal places. We don't limit the - number of integer digits, but that part is under your control. We - hope this approach will not cause problems in practice; if you find + number of integer digits, but that part is under your control. We + hope this approach will not cause problems in practice; if you find otherwise, please let us know. (Cf #1195) SQL output @@ -1637,33 +1772,33 @@ OUTPUT o SQL output is expected to work with sqlite, MySQL and PostgreSQL - o SQL output is structured with the expectations that statements will - be executed in the empty database. If you already have tables cre- - ated via SQL output of hledger, you would probably want to either + o SQL output is structured with the expectations that statements will + be executed in the empty database. If you already have tables cre- + ated via SQL output of hledger, you would probably want to either clear tables of existing data (via delete or truncate SQL statements) or drop tables completely as otherwise your postings will be duped. Commodity styles - The display style of a commodity/currency is inferred according to the + The display style of a commodity/currency is inferred according to the rules described in Commodity display style. The inferred display style - can be overridden by an optional -c/--commodity-style option (Excep- - tions: as is the case for inferred styles, price amounts, and all - amounts displayed by the print command, will be displayed with all of - their decimal digits visible, regardless of the specified precision). + can be overridden by an optional -c/--commodity-style option (Excep- + tions: as is the case for inferred styles, price amounts, and all + amounts displayed by the print command, will be displayed with all of + their decimal digits visible, regardless of the specified precision). For example, the following will override the display style for dollars. $ hledger print -c '$1.000,0' - The format specification of the style is identical to the commodity - display style specification for the commodity directive. The command - line option can be supplied repeatedly to override the display style + The format specification of the style is identical to the commodity + display style specification for the commodity directive. The command + line option can be supplied repeatedly to override the display style for multiple commodity/currency symbols. COMMANDS - hledger provides a number of commands for producing reports and manag- - ing your data. Run hledger with no arguments to list the commands - available, and hledger CMD to run a command. CMD can be the full com- - mand name, or its standard abbreviation shown in the commands list, or + hledger provides a number of commands for producing reports and manag- + ing your data. Run hledger with no arguments to list the commands + available, and hledger CMD to run a command. CMD can be the full com- + mand name, or its standard abbreviation shown in the commands list, or any unambiguous prefix of the name. Eg: hledger bal. Here are the built-in commands, with the most often-used in bold: @@ -1707,7 +1842,7 @@ COMMANDS o activity - show postings-per-interval bar charts - o balance (bal) - show balance changes/end balances/budgets in any + o balance (bal) - show balance changes/end balances/budgets in any accounts o codes - show transaction codes @@ -1730,10 +1865,10 @@ COMMANDS o print-unique - show only transactions with unique descriptions - o register (reg) - show postings in one or more accounts & running + o register (reg) - show postings in one or more accounts & running total - o register-match - show a recent posting that best matches a descrip- + o register-match - show a recent posting that best matches a descrip- tion o stats - show journal statistics @@ -1744,8 +1879,8 @@ COMMANDS Add-on commands: - Programs or scripts named hledger-SOMETHING in your PATH are add-on - commands; these appear in the commands list with a + mark. Two of + Programs or scripts named hledger-SOMETHING in your PATH are add-on + commands; these appear in the commands list with a + mark. Two of these are maintained and released with hledger: o ui - an efficient terminal interface (TUI) for hledger @@ -1756,10 +1891,10 @@ COMMANDS o iadd - a more interactive alternative for the add command - o interest - generates interest transactions according to various + o interest - generates interest transactions according to various schemes - o stockquotes - downloads market prices for your commodities from + o stockquotes - downloads market prices for your commodities from AlphaVantage (experimental) Next, the detailed command docs, in alphabetical order. @@ -1768,13 +1903,13 @@ COMMANDS accounts Show account names. - This command lists account names, either declared with account direc- - tives (--declared), posted to (--used), or both (the default). With - query arguments, only matched account names and account names refer- - enced by matched postings are shown. It shows a flat list by default. - With --tree, it uses indentation to show the account hierarchy. In - flat mode you can add --drop N to omit the first few account name com- - ponents. Account names can be depth-clipped with depth:N or --depth N + This command lists account names, either declared with account direc- + tives (--declared), posted to (--used), or both (the default). With + query arguments, only matched account names and account names refer- + enced by matched postings are shown. It shows a flat list by default. + With --tree, it uses indentation to show the account hierarchy. In + flat mode you can add --drop N to omit the first few account name com- + ponents. Account names can be depth-clipped with depth:N or --depth N or -N. Examples: @@ -1793,8 +1928,8 @@ COMMANDS activity Show an ascii barchart of posting counts per interval. - The activity command displays an ascii histogram showing transaction - counts by day, week, month or other reporting interval (by day is the + The activity command displays an ascii histogram showing transaction + counts by day, week, month or other reporting interval (by day is the default). With query arguments, it counts only matched transactions. Examples: @@ -1807,25 +1942,25 @@ COMMANDS add add - Prompt for transactions and add them to the journal. Any arguments + Prompt for transactions and add them to the journal. Any arguments will be used as default inputs for the first N prompts. - Many hledger users edit their journals directly with a text editor, or - generate them from CSV. For more interactive data entry, there is the - add command, which prompts interactively on the console for new trans- + Many hledger users edit their journals directly with a text editor, or + generate them from CSV. For more interactive data entry, there is the + add command, which prompts interactively on the console for new trans- actions, and appends them to the journal file (if there are multiple -f - FILE options, the first file is used.) Existing transactions are not - changed. This is the only hledger command that writes to the journal + FILE options, the first file is used.) Existing transactions are not + changed. This is the only hledger command that writes to the journal file. To use it, just run hledger add and follow the prompts. You can add as - many transactions as you like; when you are finished, enter . or press + many transactions as you like; when you are finished, enter . or press control-d or control-c to exit. Features: - o add tries to provide useful defaults, using the most similar (by - description) recent transaction (filtered by the query, if any) as a + o add tries to provide useful defaults, using the most similar (by + description) recent transaction (filtered by the query, if any) as a template. o You can also set the initial defaults with command line arguments. @@ -1833,10 +1968,10 @@ COMMANDS o Readline-style edit keys can be used during data entry. o The tab key will auto-complete whenever possible - accounts, descrip- - tions, dates (yesterday, today, tomorrow). If the input area is + tions, dates (yesterday, today, tomorrow). If the input area is empty, it will insert the default value. - o If the journal defines a default commodity, it will be added to any + o If the journal defines a default commodity, it will be added to any bare numbers entered. o A parenthesised transaction code may be entered following a date. @@ -1845,7 +1980,7 @@ COMMANDS o If you make a mistake, enter < at any prompt to go one step backward. - o Input prompts are displayed in a different colour when the terminal + o Input prompts are displayed in a different colour when the terminal supports it. Example (see the tutorial for a detailed explanation): @@ -1875,91 +2010,91 @@ COMMANDS Starting the next transaction (. or ctrl-D/ctrl-C to quit) Date [2015/05/22]: $ - On Microsoft Windows, the add command makes sure that no part of the + On Microsoft Windows, the add command makes sure that no part of the file path ends with a period, as that would cause problems (#1056). aregister aregister, areg - Show the transactions and running historical balance of a single + Show the transactions and running historical balance of a single account, with each transaction displayed as one line. aregister shows the overall transactions affecting a particular account - (and any subaccounts). Each report line represents one transaction in - this account. Transactions before the report start date are always + (and any subaccounts). Each report line represents one transaction in + this account. Transactions before the report start date are always included in the running balance (--historical mode is always on). - This is a more "real world", bank-like view than the register command - (which shows individual postings, possibly from multiple accounts, not + This is a more "real world", bank-like view than the register command + (which shows individual postings, possibly from multiple accounts, not necessarily in historical mode). As a quick rule of thumb: - use areg- ister for reviewing and reconciling real-world asset/liability accounts - use register for reviewing detailed revenues/expenses. - aregister requires one argument: the account to report on. You can - write either the full account name, or a case-insensitive regular - expression which will select the alphabetically first matched account. - (Eg if you have assets:aaa:checking and assets:bbb:checking accounts, + aregister requires one argument: the account to report on. You can + write either the full account name, or a case-insensitive regular + expression which will select the alphabetically first matched account. + (Eg if you have assets:aaa:checking and assets:bbb:checking accounts, hledger areg checking would select assets:aaa:checking.) - Transactions involving subaccounts of this account will also be shown. - aregister ignores depth limits, so its final total will always match a + Transactions involving subaccounts of this account will also be shown. + aregister ignores depth limits, so its final total will always match a balance report with similar arguments. - Any additional arguments form a query which will filter the transac- + Any additional arguments form a query which will filter the transac- tions shown. Note some queries will disturb the running balance, caus- ing it to be different from the account's real-world running balance. - An example: this shows the transactions and historical running balance + An example: this shows the transactions and historical running balance during july, in the first account whose name contains "checking": $ hledger areg checking date:jul Each aregister line item shows: - o the transaction's date (or the relevant posting's date if different, + o the transaction's date (or the relevant posting's date if different, see below) - o the names of all the other account(s) involved in this transaction + o the names of all the other account(s) involved in this transaction (probably abbreviated) o the total change to this account's balance from this transaction o the account's historical running balance after this transaction. - Transactions making a net change of zero are not shown by default; add + Transactions making a net change of zero are not shown by default; add the -E/--empty flag to show them. - This command also supports the output destination and output format + This command also supports the output destination and output format options. The output formats supported are txt, csv, and json. aregister and custom posting dates - Transactions whose date is outside the report period can still be - shown, if they have a posting to this account dated inside the report - period. (And in this case it's the posting date that is shown.) This + Transactions whose date is outside the report period can still be + shown, if they have a posting to this account dated inside the report + period. (And in this case it's the posting date that is shown.) This ensures that aregister can show an accurate historical running balance, matching the one shown by register -H with the same arguments. - To filter strictly by transaction date instead, add the --txn-dates - flag. If you use this flag and some of your postings have custom + To filter strictly by transaction date instead, add the --txn-dates + flag. If you use this flag and some of your postings have custom dates, it's probably best to assume the running balance is wrong. balance balance, bal Show accounts and their balances. - balance is one of hledger's oldest and most versatile commands, for - listing account balances, balance changes, values, value changes and + balance is one of hledger's oldest and most versatile commands, for + listing account balances, balance changes, values, value changes and more, during one time period or many. Generally it shows a table, with rows representing accounts, and columns representing periods. - Note there are some higher-level variants of the balance command with - convenient defaults, which can be simpler to use: balancesheet, bal- + Note there are some higher-level variants of the balance command with + convenient defaults, which can be simpler to use: balancesheet, bal- ancesheetequity, cashflow and incomestatement. When you need more con- trol, then use balance. balance features - Here's a quick overview of the balance command's features, followed by - more detailed descriptions and examples. Many of these work with the + Here's a quick overview of the balance command's features, followed by + more detailed descriptions and examples. Many of these work with the higher-level commands as well. balance can show.. @@ -2010,7 +2145,7 @@ COMMANDS ..with.. - o totals (-T), averages (-A), percentages (-%), inverted sign + o totals (-T), averages (-A), percentages (-%), inverted sign (--invert) o rows and columns swapped (--transpose) @@ -2022,21 +2157,21 @@ COMMANDS o commodities displayed on the same line or multiple lines (--layout) This command supports the output destination and output format options, - with output formats txt, csv, json, and (multi-period reports only:) - html. In txt output in a colour-supporting terminal, negative amounts + with output formats txt, csv, json, and (multi-period reports only:) + html. In txt output in a colour-supporting terminal, negative amounts are shown in red. - The --related/-r flag shows the balance of the other postings in the + The --related/-r flag shows the balance of the other postings in the transactions of the postings which would normally be shown. Simple balance report - With no arguments, balance shows a list of all accounts and their - change of balance - ie, the sum of posting amounts, both inflows and - outflows - during the entire period of the journal. For real-world - accounts, this should also match their end balance at the end of the + With no arguments, balance shows a list of all accounts and their + change of balance - ie, the sum of posting amounts, both inflows and + outflows - during the entire period of the journal. For real-world + accounts, this should also match their end balance at the end of the journal period (more on this below). - Accounts are sorted by declaration order if any, and then alphabeti- + Accounts are sorted by declaration order if any, and then alphabeti- cally by account name. For instance (using examples/sample.journal): $ hledger -f examples/sample.journal bal @@ -2051,7 +2186,7 @@ COMMANDS 0 Accounts with a zero balance (and no non-zero subaccounts, in tree mode - - see below) are hidden by default. Use -E/--empty to show them + - see below) are hidden by default. Use -E/--empty to show them (revealing assets:bank:checking here): $ hledger -f examples/sample.journal bal -E @@ -2066,11 +2201,11 @@ COMMANDS -------------------- 0 - The total of the amounts displayed is shown as the last line, unless + The total of the amounts displayed is shown as the last line, unless -N/--no-total is used. Filtered balance report - You can show fewer accounts, a different time period, totals from + You can show fewer accounts, a different time period, totals from cleared transactions only, etc. by using query arguments or options to limit the postings being matched. Eg: @@ -2080,10 +2215,10 @@ COMMANDS $-2 List or tree mode - By default, or with -l/--flat, accounts are shown as a flat list with + By default, or with -l/--flat, accounts are shown as a flat list with their full names visible, as in the examples above. - With -t/--tree, the account hierarchy is shown, with subaccounts' + With -t/--tree, the account hierarchy is shown, with subaccounts' "leaf" names indented below their parent: $ hledger -f examples/sample.journal balance @@ -2103,26 +2238,26 @@ COMMANDS Notes: o "Boring" accounts are combined with their subaccount for more compact - output, unless --no-elide is used. Boring accounts have no balance - of their own and just one subaccount (eg assets:bank and liabilities + output, unless --no-elide is used. Boring accounts have no balance + of their own and just one subaccount (eg assets:bank and liabilities above). - o All balances shown are "inclusive", ie including the balances from - all subaccounts. Note this means some repetition in the output, + o All balances shown are "inclusive", ie including the balances from + all subaccounts. Note this means some repetition in the output, which requires explanation when sharing reports with non-plaintextac- - counting-users. A tree mode report's final total is the sum of the + counting-users. A tree mode report's final total is the sum of the top-level balances shown, not of all the balances shown. - o Each group of sibling accounts (ie, under a common parent) is sorted + o Each group of sibling accounts (ie, under a common parent) is sorted separately. Depth limiting - With a depth:NUM query, or --depth NUM option, or just -NUM (eg: -3) - balance reports will show accounts only to the specified depth, hiding - the deeper subaccounts. This can be useful for getting an overview + With a depth:NUM query, or --depth NUM option, or just -NUM (eg: -3) + balance reports will show accounts only to the specified depth, hiding + the deeper subaccounts. This can be useful for getting an overview without too much detail. - Account balances at the depth limit always include the balances from + Account balances at the depth limit always include the balances from any deeper subaccounts (even in list mode). Eg, limiting to depth 1: $ hledger -f examples/sample.journal balance -1 @@ -2134,7 +2269,7 @@ COMMANDS 0 Dropping top-level accounts - You can also hide one or more top-level account name parts, using + You can also hide one or more top-level account name parts, using --drop NUM. This can be useful for hiding repetitive top-level account names: @@ -2146,9 +2281,9 @@ COMMANDS Multi-period balance report - With a report interval (set by the -D/--daily, -W/--weekly, - -M/--monthly, -Q/--quarterly, -Y/--yearly, or -p/--period flag), bal- - ance shows a tabular report, with columns representing successive time + With a report interval (set by the -D/--daily, -W/--weekly, + -M/--monthly, -Q/--quarterly, -Y/--yearly, or -p/--period flag), bal- + ance shows a tabular report, with columns representing successive time periods (and a title): $ hledger -f examples/sample.journal bal --quarterly income expenses -E @@ -2169,21 +2304,21 @@ COMMANDS encompass the displayed subperiods (so that the first and last subpe- riods have the same duration as the others). - o Leading and trailing periods (columns) containing all zeroes are not + o Leading and trailing periods (columns) containing all zeroes are not shown, unless -E/--empty is used. - o Accounts (rows) containing all zeroes are not shown, unless + o Accounts (rows) containing all zeroes are not shown, unless -E/--empty is used. - o Amounts with many commodities are shown in abbreviated form, unless + o Amounts with many commodities are shown in abbreviated form, unless --no-elide is used. (experimental) - o Average and/or total columns can be added with the -A/--average and + o Average and/or total columns can be added with the -A/--average and -T/--row-total flags. o The --transpose flag can be used to exchange rows and columns. - o The --pivot FIELD option causes a different transaction field to be + o The --pivot FIELD option causes a different transaction field to be used as "account name". See PIVOTING. Multi-period reports with many periods can be too wide for easy viewing @@ -2197,32 +2332,32 @@ COMMANDS o Reduce the terminal's font size - o View with a pager like less, eg: hledger bal -D --color=yes | less + o View with a pager like less, eg: hledger bal -D --color=yes | less -RS - o Output as CSV and use a CSV viewer like visidata (hledger bal -D -O - csv | vd -f csv), Emacs' csv-mode (M-x csv-mode, C-c C-a), or a + o Output as CSV and use a CSV viewer like visidata (hledger bal -D -O + csv | vd -f csv), Emacs' csv-mode (M-x csv-mode, C-c C-a), or a spreadsheet (hledger bal -D -o a.csv && open a.csv) - o Output as HTML and view with a browser: hledger bal -D -o a.html && + o Output as HTML and view with a browser: hledger bal -D -o a.html && open a.html Showing declared accounts - With --declared, accounts which have been declared with an account - directive will be included in the balance report, even if they have no + With --declared, accounts which have been declared with an account + directive will be included in the balance report, even if they have no transactions. (Since they will have a zero balance, you will also need -E/--empty to see them.) - More precisely, leaf declared accounts (with no subaccounts) will be + More precisely, leaf declared accounts (with no subaccounts) will be included, since those are usually the more useful in reports. - The idea of this is to be able to see a useful "complete" balance - report, even when you don't have transactions in all of your declared + The idea of this is to be able to see a useful "complete" balance + report, even when you don't have transactions in all of your declared accounts yet. Data layout - The --layout option affects how multi-commodity amounts are displayed, - and some other things, influencing the overall layout of the report + The --layout option affects how multi-commodity amounts are displayed, + and some other things, influencing the overall layout of the report data: o --layout=wide[,WIDTH]: commodities are shown on a single line, possi- @@ -2234,11 +2369,11 @@ COMMANDS bols in a separate column o --layout=tidy: data is normalised to tidy form, with one row per data - value. We currently support this with CSV output only. In tidy - mode, totals and row averages are disabled (-N/--no-total is implied + value. We currently support this with CSV output only. In tidy + mode, totals and row averages are disabled (-N/--no-total is implied and -T/--row-total and -A/--average will be ignored). - These --layout modes are supported with some but not all of the output + These --layout modes are supported with some but not all of the output formats: @@ -2247,7 +2382,6 @@ COMMANDS wide Y Y Y tall Y Y Y bare Y Y Y - tidy Y Examples: @@ -2263,7 +2397,7 @@ COMMANDS ------------------++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT - o Limited wide layout. A width limit reduces the width, but some com- + o Limited wide layout. A width limit reduces the width, but some com- modities will be hidden: $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide,32 @@ -2275,7 +2409,7 @@ COMMANDS ------------------++--------------------------------------------------------------------------------------------------------------------------- || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. - o Tall layout. Each commodity gets a new line (may be different in + o Tall layout. Each commodity gets a new line (may be different in each column), and account names are repeated: $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=tall @@ -2295,7 +2429,7 @@ COMMANDS || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA || 18.00 VHT 294.00 VHT - o Bare layout. Commodity symbols are kept in one column, each commod- + o Bare layout. Commodity symbols are kept in one column, each commod- ity gets its own report row, account names are repeated: $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=bare @@ -2315,7 +2449,7 @@ COMMANDS || VEA 12.00 10.00 14.00 36.00 || VHT 106.00 18.00 170.00 294.00 - o Bare layout also affects CSV output, which is useful for producing + o Bare layout also affects CSV output, which is useful for producing data that is easier to consume, eg when making charts: $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare @@ -2331,10 +2465,10 @@ COMMANDS "total","VEA","36.00" "total","VHT","294.00" - o Tidy layout produces normalised "tidy data", where every variable is - a column and each row represents a single data point (see + o Tidy layout produces normalised "tidy data", where every variable is + a column and each row represents a single data point (see https://cran.r-project.org/web/packages/tidyr/vignettes/tidy- - data.html). This kind of data is the easiest to process with other + data.html). This kind of data is the easiest to process with other software: $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -Y -O csv --layout=tidy @@ -2356,21 +2490,21 @@ COMMANDS "Assets:US:ETrade","2014","2014-01-01","2014-12-31","VHT","170.00" Sorting by amount - With -S/--sort-amount, accounts with the largest (most positive) bal- - ances are shown first. Eg: hledger bal expenses -MAS shows your big- - gest averaged monthly expenses first. When more than one commodity is - present, they will be sorted by the alphabetically earliest commodity - first, and then by subsequent commodities (if an amount is missing a + With -S/--sort-amount, accounts with the largest (most positive) bal- + ances are shown first. Eg: hledger bal expenses -MAS shows your big- + gest averaged monthly expenses first. When more than one commodity is + present, they will be sorted by the alphabetically earliest commodity + first, and then by subsequent commodities (if an amount is missing a commodity, it is treated as 0). - Revenues and liability balances are typically negative, however, so -S - shows these in reverse order. To work around this, you can add - --invert to flip the signs. (Or, use one of the higher-level reports, - which flip the sign automatically. Eg: hledger incomestatement -MAS). + Revenues and liability balances are typically negative, however, so -S + shows these in reverse order. To work around this, you can add + --invert to flip the signs. (Or, use one of the higher-level reports, + which flip the sign automatically. Eg: hledger incomestatement -MAS). Percentages - With -%/--percent, balance reports show each account's value expressed + With -%/--percent, balance reports show each account's value expressed as a percentage of the (column) total: $ hledger -f examples/sample.journal bal expenses -Q -% @@ -2384,62 +2518,62 @@ COMMANDS || 0 100.0 % 0 0 Note it is not useful to calculate percentages if the amounts in a col- - umn have mixed signs. In this case, make a separate report for each + umn have mixed signs. In this case, make a separate report for each sign, eg: $ hledger bal -% amt:`>0` $ hledger bal -% amt:`<0` - Similarly, if the amounts in a column have mixed commodities, convert - them to one commodity with -B, -V, -X or --value, or make a separate + Similarly, if the amounts in a column have mixed commodities, convert + them to one commodity with -B, -V, -X or --value, or make a separate report for each commodity: $ hledger bal -% cur:\\$ $ hledger bal -% cur:EUR Balance change, end balance - It's important to be clear on the meaning of the numbers shown in bal- + It's important to be clear on the meaning of the numbers shown in bal- ance reports. Here is some terminology we use: - A balance change is the net amount added to, or removed from, an + A balance change is the net amount added to, or removed from, an account during some period. - An end balance is the amount accumulated in an account as of some date - (and some time, but hledger doesn't store that; assume end of day in + An end balance is the amount accumulated in an account as of some date + (and some time, but hledger doesn't store that; assume end of day in your timezone). It is the sum of previous balance changes. - We call it a historical end balance if it includes all balance changes + We call it a historical end balance if it includes all balance changes since the account was created. For a real world account, this means it - will match the "historical record", eg the balances reported in your + will match the "historical record", eg the balances reported in your bank statements or bank web UI. (If they are correct!) - In general, balance changes are what you want to see when reviewing + In general, balance changes are what you want to see when reviewing revenues and expenses, and historical end balances are what you want to see when reviewing or reconciling asset, liability and equity accounts. - balance shows balance changes by default. To see accurate historical + balance shows balance changes by default. To see accurate historical end balances: - 1. Initialise account starting balances with an "opening balances" - transaction (a transfer from equity to the account), unless the + 1. Initialise account starting balances with an "opening balances" + transaction (a transfer from equity to the account), unless the journal covers the account's full lifetime. 2. Include all of of the account's prior postings in the report, by not - specifying a report start date, or by using the -H/--historical + specifying a report start date, or by using the -H/--historical flag. (-H causes report start date to be ignored when summing post- ings.) Balance report types For more flexible reporting, there are three important option groups: - hledger balance [CALCULATIONTYPE] [ACCUMULATIONTYPE] [VALUATIONTYPE] + hledger balance [CALCULATIONTYPE] [ACCUMULATIONTYPE] [VALUATIONTYPE] ... - The first two are the most important: calculation type selects the - basic calculation to perform for each table cell, while accumulation + The first two are the most important: calculation type selects the + basic calculation to perform for each table cell, while accumulation type says which postings should be included in each cell's calculation. - Typically one or both of these are selected by default, so you don't - need to write them explicitly. A valuation type can be added if you + Typically one or both of these are selected by default, so you don't + need to write them explicitly. A valuation type can be added if you want to convert the basic report to value or cost. Calculation type: @@ -2450,27 +2584,27 @@ COMMANDS o --budget : like --sum but also show a goal amount o --valuechange : show the change in period-end historical balance val- - ues (caused by deposits, withdrawals, and/or market price fluctua- + ues (caused by deposits, withdrawals, and/or market price fluctua- tions) - o --gain : show the unrealised capital gain/loss, (the current valued + o --gain : show the unrealised capital gain/loss, (the current valued balance minus each amount's original cost) Accumulation type: - Which postings should be included in each cell's calculation. It is + Which postings should be included in each cell's calculation. It is one of: - o --change : postings from column start to column end, ie within the - cell's period. Typically used to see revenues/expenses. (default + o --change : postings from column start to column end, ie within the + cell's period. Typically used to see revenues/expenses. (default for balance, incomestatement) - o --cumulative : postings from report start to column end, eg to show + o --cumulative : postings from report start to column end, eg to show changes accumulated since the report's start date. Rarely used. - o --historical/-H : postings from journal start to column end, ie all + o --historical/-H : postings from journal start to column end, ie all postings from account creation to the end of the cell's period. Typ- ically used to see historical end balances of assets/liabili- - ties/equity. (default for balancesheet, balancesheetequity, cash- + ties/equity. (default for balancesheet, balancesheetequity, cash- flow) Valuation type: @@ -2483,7 +2617,7 @@ COMMANDS o --value=then[,COMM] : show value at transaction dates - o --value=end[,COMM] : show value at period end date(s) (default with + o --value=end[,COMM] : show value at period end date(s) (default with --valuechange, --gain) o --value=now[,COMM] : show value at today's date @@ -2492,13 +2626,13 @@ COMMANDS or one of their aliases: --cost/-B, --market/-V or --exchange/-X. - Most combinations of these options should produce reasonable reports, - but if you find any that seem wrong or misleading, let us know. The + Most combinations of these options should produce reasonable reports, + but if you find any that seem wrong or misleading, let us know. The following restrictions are applied: o --valuechange implies --value=end - o --valuechange makes --change the default when used with the bal- + o --valuechange makes --change the default when used with the bal- ancesheet/balancesheetequity commands o --cumulative or --historical disables --row-total/-T @@ -2514,16 +2648,16 @@ COMMANDS v ------------------------------------------------------------------------------------ --change change in period sum of posting- period-end DATE-value of - date market val- value of change change in + date market val- value of change change in ues in period in period period --cumu- change from sum of posting- period-end DATE-value of - lative report start to date market val- value of change change from + lative report start to date market val- value of change change from period end ues from report from report report start start to period start to period to period end end end --his- change from sum of posting- period-end DATE-value of - torical journal start to date market val- value of change change from - /-H period end (his- ues from journal from journal journal start + torical journal start to date market val- value of change change from + /-H period end (his- ues from journal from journal journal start torical end bal- start to period start to period to period end ance) end end @@ -2531,25 +2665,25 @@ COMMANDS Some frequently used balance options/reports are: o bal -M revenues expenses - Show revenues/expenses in each month. Also available as the incomes- + Show revenues/expenses in each month. Also available as the incomes- tatement command. o bal -M -H assets liabilities - Show historical asset/liability balances at each month end. Also + Show historical asset/liability balances at each month end. Also available as the balancesheet command. o bal -M -H assets liabilities equity - Show historical asset/liability/equity balances at each month end. + Show historical asset/liability/equity balances at each month end. Also available as the balancesheetequity command. o bal -M assets not:receivable - Show changes to liquid assets in each month. Also available as the + Show changes to liquid assets in each month. Also available as the cashflow command. Also: o bal -M expenses -2 -SA - Show monthly expenses summarised to depth 2 and sorted by average + Show monthly expenses summarised to depth 2 and sorted by average amount. o bal -M --budget expenses @@ -2563,12 +2697,12 @@ COMMANDS Show top gainers [or losers] last week Budget report - The --budget report type activates extra columns showing any budget - goals for each account and period. The budget goals are defined by - periodic transactions. This is very useful for comparing planned and + The --budget report type activates extra columns showing any budget + goals for each account and period. The budget goals are defined by + periodic transactions. This is very useful for comparing planned and actual income, expenses, time usage, etc. - For example, you can take average monthly expenses in the common + For example, you can take average monthly expenses in the common expense categories to construct a minimal monthly budget: ;; Budget @@ -2615,26 +2749,26 @@ COMMANDS This is different from a normal balance report in several ways: - o Only accounts with budget goals during the report period are shown, + o Only accounts with budget goals during the report period are shown, by default. - o In each column, in square brackets after the actual amount, budget - goal amounts are shown, and the actual/goal percentage. (Note: bud- + o In each column, in square brackets after the actual amount, budget + goal amounts are shown, and the actual/goal percentage. (Note: bud- get goals should be in the same commodity as the actual amount.) - o All parent accounts are always shown, even in list mode. Eg assets, + o All parent accounts are always shown, even in list mode. Eg assets, assets:bank, and expenses above. - o Amounts always include all subaccounts, budgeted or unbudgeted, even + o Amounts always include all subaccounts, budgeted or unbudgeted, even in list mode. This means that the numbers displayed will not always add up! Eg above, - the expenses actual amount includes the gifts and supplies transac- - tions, but the expenses:gifts and expenses:supplies accounts are not + the expenses actual amount includes the gifts and supplies transac- + tions, but the expenses:gifts and expenses:supplies accounts are not shown, as they have no budget amounts declared. - This can be confusing. When you need to make things clearer, use the - -E/--empty flag, which will reveal all accounts including unbudgeted + This can be confusing. When you need to make things clearer, use the + -E/--empty flag, which will reveal all accounts including unbudgeted ones, giving the full picture. Eg: $ hledger balance -M --budget --empty @@ -2676,12 +2810,12 @@ COMMANDS For more examples and notes, see Budgeting. Budget report start date - This might be a bug, but for now: when making budget reports, it's a + This might be a bug, but for now: when making budget reports, it's a good idea to explicitly set the report's start date to the first day of - a reporting period, because a periodic rule like ~ monthly generates - its transactions on the 1st of each month, and if your journal has no - regular transactions on the 1st, the default report start date could - exclude that budget goal, which can be a little surprising. Eg here + a reporting period, because a periodic rule like ~ monthly generates + its transactions on the 1st of each month, and if your journal has no + regular transactions on the 1st, the default report start date could + exclude that budget goal, which can be a little surprising. Eg here the default report period is just the day of 2020-01-15: ~ monthly in 2020 @@ -2700,9 +2834,9 @@ COMMANDS --------------++------------ || $400 - To avoid this, specify the budget report's period, or at least the - start date, with -b/-e/-p/date:, to ensure it includes the budget goal - transactions (periodic transactions) that you want. Eg, adding -b + To avoid this, specify the budget report's period, or at least the + start date, with -b/-e/-p/date:, to ensure it includes the budget goal + transactions (periodic transactions) that you want. Eg, adding -b 2020/1/1 to the above: $ hledger bal expenses --budget -b 2020/1/1 @@ -2715,12 +2849,12 @@ COMMANDS || $400 [80% of $500] Budgets and subaccounts - You can add budgets to any account in your account hierarchy. If you + You can add budgets to any account in your account hierarchy. If you have budgets on both parent account and some of its children, then bud- - get(s) of the child account(s) would be added to the budget of their + get(s) of the child account(s) would be added to the budget of their parent, much like account balances behave. - In the most simple case this means that once you add a budget to any + In the most simple case this means that once you add a budget to any account, all its parents would have budget as well. To illustrate this, consider the following budget: @@ -2730,13 +2864,13 @@ COMMANDS expenses:personal:electronics $100.00 liabilities - With this, monthly budget for electronics is defined to be $100 and - budget for personal expenses is an additional $1000, which implicitly + With this, monthly budget for electronics is defined to be $100 and + budget for personal expenses is an additional $1000, which implicitly means that budget for both expenses:personal and expenses is $1100. - Transactions in expenses:personal:electronics will be counted both - towards its $100 budget and $1100 of expenses:personal , and transac- - tions in any other subaccount of expenses:personal would be counted + Transactions in expenses:personal:electronics will be counted both + towards its $100 budget and $1100 of expenses:personal , and transac- + tions in any other subaccount of expenses:personal would be counted towards only towards the budget of expenses:personal. For example, let's consider these transactions: @@ -2762,9 +2896,9 @@ COMMANDS expenses:personal $30.00 liabilities - As you can see, we have transactions in expenses:personal:electron- - ics:upgrades and expenses:personal:train tickets, and since both of - these accounts are without explicitly defined budget, these transac- + As you can see, we have transactions in expenses:personal:electron- + ics:upgrades and expenses:personal:train tickets, and since both of + these accounts are without explicitly defined budget, these transac- tions would be counted towards budgets of expenses:personal:electronics and expenses:personal accordingly: @@ -2780,7 +2914,7 @@ COMMANDS -------------------------------++------------------------------- || 0 [ 0] - And with --empty, we can get a better picture of budget allocation and + And with --empty, we can get a better picture of budget allocation and consumption: $ hledger balance --budget -M --empty @@ -2799,28 +2933,28 @@ COMMANDS Selecting budget goals The budget report evaluates periodic transaction rules to generate spe- - cial "goal transactions", which generate the goal amounts for each - account in each report subperiod. When troubleshooting, you can use + cial "goal transactions", which generate the goal amounts for each + account in each report subperiod. When troubleshooting, you can use the print command to show these as forecasted transactions: $ hledger print --forecast=BUDGETREPORTPERIOD tag:generated - By default, the budget report uses all available periodic transaction - rules to generate goals. This includes rules with a different report - interval from your report. Eg if you have daily, weekly and monthly - periodic rules, all of these will contribute to the goals in a monthly + By default, the budget report uses all available periodic transaction + rules to generate goals. This includes rules with a different report + interval from your report. Eg if you have daily, weekly and monthly + periodic rules, all of these will contribute to the goals in a monthly budget report. - You can select a subset of periodic rules by providing an argument to - the --budget flag. --budget=DESCPAT will match all periodic rules + You can select a subset of periodic rules by providing an argument to + the --budget flag. --budget=DESCPAT will match all periodic rules whose description contains DESCPAT, a case-insensitive substring (not a - regular expression or query). This means you can give your periodic - rules descriptions (remember that two spaces are needed), and then + regular expression or query). This means you can give your periodic + rules descriptions (remember that two spaces are needed), and then select from multiple budgets defined in your journal. Customising single-period balance reports For single-period balance reports displayed in the terminal (only), you - can use --format FMT to customise the format and content of each line. + can use --format FMT to customise the format and content of each line. Eg: $ hledger -f examples/sample.journal balance --format "%20(account) %12(total)" @@ -2838,7 +2972,7 @@ COMMANDS 0 The FMT format string (plus a newline) specifies the formatting applied - to each account/balance pair. It may contain any suitable text, with + to each account/balance pair. It may contain any suitable text, with data fields interpolated like so: %[MIN][.MAX](FIELDNAME) @@ -2849,14 +2983,14 @@ COMMANDS o FIELDNAME must be enclosed in parentheses, and can be one of: - o depth_spacer - a number of spaces equal to the account's depth, or + o depth_spacer - a number of spaces equal to the account's depth, or if MIN is specified, MIN * depth spaces. o account - the account's name o total - the account's balance/posted total, right justified - Also, FMT can begin with an optional prefix to control how multi-com- + Also, FMT can begin with an optional prefix to control how multi-com- modity amounts are rendered: o %_ - render on multiple lines, bottom-aligned (the default) @@ -2865,34 +2999,34 @@ COMMANDS o %, - render on one line, comma-separated - There are some quirks. Eg in one-line mode, %(depth_spacer) has no - effect, instead %(account) has indentation built in. Experimentation + There are some quirks. Eg in one-line mode, %(depth_spacer) has no + effect, instead %(account) has indentation built in. Experimentation may be needed to get pleasing results. Some example formats: o %(total) - the account's total - o %-20.20(account) - the account's name, left justified, padded to 20 + o %-20.20(account) - the account's name, left justified, padded to 20 characters and clipped at 20 characters - o %,%-50(account) %25(total) - account name padded to 50 characters, - total padded to 20 characters, with multiple commodities rendered on + o %,%-50(account) %25(total) - account name padded to 50 characters, + total padded to 20 characters, with multiple commodities rendered on one line - o %20(total) %2(depth_spacer)%-(account) - the default format for the + o %20(total) %2(depth_spacer)%-(account) - the default format for the single-column balance report balancesheet balancesheet, bs - This command displays a balance sheet, showing historical ending bal- + This command displays a balance sheet, showing historical ending bal- ances of asset and liability accounts. (To see equity as well, use the - balancesheetequity command.) Amounts are shown with normal positive + balancesheetequity command.) Amounts are shown with normal positive sign, as in conventional financial statements. The asset and liability accounts shown are those accounts declared with - the Asset or Cash or Liability type, or otherwise all accounts under a - top-level asset or liability account (case insensitive, plurals + the Asset or Cash or Liability type, or otherwise all accounts under a + top-level asset or liability account (case insensitive, plurals allowed). Example: @@ -2917,23 +3051,23 @@ COMMANDS 0 This command is a higher-level variant of the balance command, and sup- - ports many of that command's features, such as multi-period reports. - It is similar to hledger balance -H assets liabilities, but with - smarter account detection, and liabilities displayed with their sign + ports many of that command's features, such as multi-period reports. + It is similar to hledger balance -H assets liabilities, but with + smarter account detection, and liabilities displayed with their sign flipped. - This command also supports the output destination and output format - options The output formats supported are txt, csv, html, and (experi- + This command also supports the output destination and output format + options The output formats supported are txt, csv, html, and (experi- mental) json. balancesheetequity balancesheetequity, bse - This command displays a balance sheet, showing historical ending bal- - ances of asset, liability and equity accounts. Amounts are shown with + This command displays a balance sheet, showing historical ending bal- + ances of asset, liability and equity accounts. Amounts are shown with normal positive sign, as in conventional financial statements. - The asset, liability and equity accounts shown are those accounts - declared with the Asset, Cash, Liability or Equity type, or otherwise + The asset, liability and equity accounts shown are those accounts + declared with the Asset, Cash, Liability or Equity type, or otherwise all accounts under a top-level asset, liability or equity account (case insensitive, plurals allowed). @@ -2964,24 +3098,24 @@ COMMANDS 0 This command is a higher-level variant of the balance command, and sup- - ports many of that command's features, such as multi-period reports. + ports many of that command's features, such as multi-period reports. It is similar to hledger balance -H assets liabilities equity, but with - smarter account detection, and liabilities/equity displayed with their + smarter account detection, and liabilities/equity displayed with their sign flipped. - This command also supports the output destination and output format - options The output formats supported are txt, csv, html, and (experi- + This command also supports the output destination and output format + options The output formats supported are txt, csv, html, and (experi- mental) json. cashflow cashflow, cf - This command displays a cashflow statement, showing the inflows and - outflows affecting "cash" (ie, liquid) assets. Amounts are shown with + This command displays a cashflow statement, showing the inflows and + outflows affecting "cash" (ie, liquid) assets. Amounts are shown with normal positive sign, as in conventional financial statements. - The "cash" accounts shown are those accounts declared with the Cash - type, or otherwise all accounts under a top-level asset account (case - insensitive, plural allowed) which do not have fixed, investment, + The "cash" accounts shown are those accounts declared with the Cash + type, or otherwise all accounts under a top-level asset account (case + insensitive, plural allowed) which do not have fixed, investment, receivable or A/R in their name. Example: @@ -3001,22 +3135,22 @@ COMMANDS $-1 This command is a higher-level variant of the balance command, and sup- - ports many of that command's features, such as multi-period reports. - It is similar to hledger balance assets not:fixed not:investment + ports many of that command's features, such as multi-period reports. + It is similar to hledger balance assets not:fixed not:investment not:receivable, but with smarter account detection. - This command also supports the output destination and output format - options The output formats supported are txt, csv, html, and (experi- + This command also supports the output destination and output format + options The output formats supported are txt, csv, html, and (experi- mental) json. check check Check for various kinds of errors in your data. - hledger provides a number of built-in error checks to help prevent - problems in your data. Some of these are run automatically; or, you - can use this check command to run them on demand, with no output and a - zero exit code if all is well. Specify their names (or a prefix) as + hledger provides a number of built-in error checks to help prevent + problems in your data. Some of these are run automatically; or, you + can use this check command to run them on demand, with no output and a + zero exit code if all is well. Specify their names (or a prefix) as argument(s). Some examples: @@ -3034,27 +3168,27 @@ COMMANDS o parseable - data files are well-formed and can be successfully parsed o balancedwithautoconversion - all transactions are balanced, inferring - missing amounts where necessary, and possibly converting commodities + missing amounts where necessary, and possibly converting commodities using transaction prices or automatically-inferred transaction prices - o assertions - all balance assertions in the journal are passing. + o assertions - all balance assertions in the journal are passing. (This check can be disabled with -I/--ignore-assertions.) Strict checks These additional checks are run when the -s/--strict (strict mode) flag - is used. Or, they can be run by giving their names as arguments to + is used. Or, they can be run by giving their names as arguments to check: o accounts - all account names used by transactions have been declared o commodities - all commodity symbols used have been declared - o balancednoautoconversion - transactions are balanced, possibly using + o balancednoautoconversion - transactions are balanced, possibly using explicit transaction prices but not inferred ones Other checks - These checks can be run only by giving their names as arguments to - check. They are more specialised and not desirable for everyone, + These checks can be run only by giving their names as arguments to + check. They are more specialised and not desirable for everyone, therefore optional: o ordereddates - transactions are ordered by date within each file @@ -3064,13 +3198,13 @@ COMMANDS o uniqueleafnames - all account leaf names are unique Custom checks - A few more checks are are available as separate add-on commands, in + A few more checks are are available as separate add-on commands, in https://github.com/simonmichael/hledger/tree/master/bin: - o hledger-check-tagfiles - all tag values containing / (a forward + o hledger-check-tagfiles - all tag values containing / (a forward slash) exist as file paths - o hledger-check-fancyassertions - more complex balance assertions are + o hledger-check-fancyassertions - more complex balance assertions are passing You could make similar scripts to perform your own custom checks. See: @@ -3078,38 +3212,38 @@ COMMANDS close close, equity - Prints a sample "closing" transaction bringing specified account bal- - ances to zero, and an inverse "opening" transaction restoring the same + Prints a sample "closing" transaction bringing specified account bal- + ances to zero, and an inverse "opening" transaction restoring the same account balances. - If like most people you split your journal files by time, eg by year: - at the end of the year you can use this command to "close out" your - asset and liability (and perhaps equity) balances in the old file, and - reinitialise them in the new file. This helps ensure that report bal- - ances remain correct whether you are including old files or not. - (Because all closing/opening transactions except the very first will + If like most people you split your journal files by time, eg by year: + at the end of the year you can use this command to "close out" your + asset and liability (and perhaps equity) balances in the old file, and + reinitialise them in the new file. This helps ensure that report bal- + ances remain correct whether you are including old files or not. + (Because all closing/opening transactions except the very first will cancel out - see example below.) Some people also use this command to close out revenue and expense bal- - ances at the end of an accounting period. This properly records the - period's profit/loss as "retained earnings" (part of equity), and + ances at the end of an accounting period. This properly records the + period's profit/loss as "retained earnings" (part of equity), and allows the accounting equation (A-L=E) to balance, which you could then check by the bse report's zero total. - You can print just the closing transaction by using the --close flag, + You can print just the closing transaction by using the --close flag, or just the opening transaction with the --open flag. Their descriptions are closing balances and opening balances by - default; you can customise these with the --close-desc and --open-desc + default; you can customise these with the --close-desc and --open-desc options. - Just one balancing equity posting is used by default, with the amount + Just one balancing equity posting is used by default, with the amount left implicit. The default account name is equity:opening/closing bal- - ances. You can customise the account name(s) with --close-acct and - --open-acct. (If you specify only one of these, it will be used for + ances. You can customise the account name(s) with --close-acct and + --open-acct. (If you specify only one of these, it will be used for both.) - With --x/--explicit, the equity posting's amount will be shown explic- + With --x/--explicit, the equity posting's amount will be shown explic- itly, and if it involves multiple commodities, there will be a separate equity posting for each commodity (as in the print command). @@ -3117,29 +3251,29 @@ COMMANDS balances (good for troubleshooting). close and prices - Transaction prices are ignored (and discarded) by closing/opening + Transaction prices are ignored (and discarded) by closing/opening transactions, by default. With --show-costs, they are preserved; there - will be a separate equity posting for each cost in each commodity. - This means balance -B reports will look the same after the transition. + will be a separate equity posting for each cost in each commodity. + This means balance -B reports will look the same after the transition. Note if you have many foreign currency or investment transactions, this will generate very large journal entries. close date - The default closing date is yesterday, or the journal's end date, + The default closing date is yesterday, or the journal's end date, whichever is later. - Unless you are running close on exactly the first day of the new - period, you'll want to override the closing date. This is done by - specifying a report end date, where "last day of the report period" - will be the closing date. The opening date is always the following - day. So to close on (end of) 2020-12-31 and open on (start of) + Unless you are running close on exactly the first day of the new + period, you'll want to override the closing date. This is done by + specifying a report end date, where "last day of the report period" + will be the closing date. The opening date is always the following + day. So to close on (end of) 2020-12-31 and open on (start of) 2021-01-01, any of these will work: end date argument explanation ----------------------------------------------- -e 2021-01-01 end dates are exclusive - -e 2021 equivalent, per smart + -e 2021 equivalent, per smart dates -p 2020 equivalent, the period's begin date is ignored @@ -3167,17 +3301,17 @@ COMMANDS Hiding opening/closing transactions Although the closing/opening transactions cancel out, they will be vis- - ible in reports like print and register, creating some visual clutter. + ible in reports like print and register, creating some visual clutter. You can exclude them all with a query, like: $ hledger print not:desc:'opening|closing' # less typing $ hledger print not:'equity:opening/closing balances' # more precise - But when reporting on multiple files, this can get a bit tricky; you + But when reporting on multiple files, this can get a bit tricky; you may need to keep the earliest opening balances, for a historical regis- - ter report; or you may need to suppress a closing transaction, to see - year-end balances. If you find yourself needing more precise queries, - here's one solution: add more easily-matched tags to opening/closing + ter report; or you may need to suppress a closing transaction, to see + year-end balances. If you find yourself needing more precise queries, + here's one solution: add more easily-matched tags to opening/closing transactions, like this: ; 2019.journal @@ -3212,18 +3346,18 @@ COMMANDS # 2020 year end balances, suppressing 2020 closing txn close and balance assertions - The closing and opening transactions will include balance assertions, - verifying that the accounts have first been reset to zero and then - restored to their previous balance. These provide valuable error - checking, alerting you when things get out of line, but you can ignore + The closing and opening transactions will include balance assertions, + verifying that the accounts have first been reset to zero and then + restored to their previous balance. These provide valuable error + checking, alerting you when things get out of line, but you can ignore them temporarily with -I or just remove them if you prefer. You probably shouldn't use status or realness filters (like -C or -R or status:) with close, or the generated balance assertions will depend on - these flags. Likewise, if you run this command with --auto, the bal- + these flags. Likewise, if you run this command with --auto, the bal- ance assertions would probably always require --auto. - Multi-day transactions (where some postings have a different date) + Multi-day transactions (where some postings have a different date) break the balance assertions, because the money is temporarily "invisi- ble" while in transit: @@ -3231,8 +3365,8 @@ COMMANDS expenses:food 5 assets:bank:checking -5 ; date: 2021/1/2 - To fix the assertions, you can add a temporary account to track such - in-transit money (splitting the multi-day transaction into two single- + To fix the assertions, you can add a temporary account to track such + in-transit money (splitting the multi-day transaction into two single- day transactions): ; in 2020.journal: @@ -3246,8 +3380,8 @@ COMMANDS assets:bank:checking Example: close revenue/expense accounts to retained earnings - For this, use --close to suppress the opening transaction, as it's not - needed. Also you'll want to change the equity account name to your + For this, use --close to suppress the opening transaction, as it's not + needed. Also you'll want to change the equity account name to your equivalent of "equity:retained earnings". Closing 2021's first quarter revenues/expenses: @@ -3260,13 +3394,13 @@ COMMANDS $ hledger close --close revenues expenses -p Q1 \ --close-acct='equity:retained earnings' >> $LEDGER_FILE - Now, the first quarter's balance sheet should show a zero (unless you + Now, the first quarter's balance sheet should show a zero (unless you are using @/@@ notation without equity postings): $ hledger bse -p Q1 And we must suppress the closing transaction to see the first quarter's - income statement (using the description; not:'retained earnings' won't + income statement (using the description; not:'retained earnings' won't work here): $ hledger is -p Q1 not:desc:'closing balances' @@ -3275,13 +3409,13 @@ COMMANDS codes List the codes seen in transactions, in the order parsed. - This command prints the value of each transaction's code field, in the - order transactions were parsed. The transaction code is an optional - value written in parentheses between the date and description, often + This command prints the value of each transaction's code field, in the + order transactions were parsed. The transaction code is an optional + value written in parentheses between the date and description, often used to store a cheque number, order number or similar. Transactions aren't required to have a code, and missing or empty codes - will not be shown by default. With the -E/--empty flag, they will be + will not be shown by default. With the -E/--empty flag, they will be printed as blank lines. You can add a query to select a subset of transactions. @@ -3321,7 +3455,7 @@ COMMANDS List the unique descriptions that appear in transactions. This command lists the unique descriptions that appear in transactions, - in alphabetic order. You can add a query to select a subset of trans- + in alphabetic order. You can add a query to select a subset of trans- actions. Example: @@ -3333,18 +3467,18 @@ COMMANDS diff diff - Compares a particular account's transactions in two input files. It + Compares a particular account's transactions in two input files. It shows any transactions to this account which are in one file but not in the other. More precisely, for each posting affecting this account in either file, - it looks for a corresponding posting in the other file which posts the - same amount to the same account (ignoring date, description, etc.) + it looks for a corresponding posting in the other file which posts the + same amount to the same account (ignoring date, description, etc.) Since postings not transactions are compared, this also works when mul- tiple bank transactions have been combined into a single journal entry. This is useful eg if you have downloaded an account's transactions from - your bank (eg as CSV data). When hledger and your bank disagree about + your bank (eg as CSV data). When hledger and your bank disagree about the account balance, you can compare the bank data with your journal to find out the cause. @@ -3362,22 +3496,22 @@ COMMANDS files files - List all files included in the journal. With a REGEX argument, only - file names matching the regular expression (case sensitive) are shown. + List all files included in the journal. With a REGEX argument, only + file names matching the regular expression (case sensitive) are shown. help help - Show the hledger user manual in one of several formats, optionally + Show the hledger user manual in one of several formats, optionally positioned at a given TOPIC (if possible). - TOPIC is any heading in the manual, or the start of any heading (but + TOPIC is any heading in the manual, or the start of any heading (but not the middle). It is case insensitive. - Some examples: commands, print, forecast, "auto postings", "commodity + Some examples: commands, print, forecast, "auto postings", "commodity column". - This command shows the user manual built in to this hledger version. - It can be useful if the correct version of the hledger manual, or the + This command shows the user manual built in to this hledger version. + It can be useful if the correct version of the hledger manual, or the usual viewing tools, are not installed on your system. By default it uses the best viewer it can find in $PATH, in this order: @@ -3387,66 +3521,66 @@ COMMANDS import import - Read new transactions added to each FILE since last run, and add them - to the main journal file. Or with --dry-run, just print the transac- - tions that would be added. Or with --catchup, just mark all of the + Read new transactions added to each FILE since last run, and add them + to the main journal file. Or with --dry-run, just print the transac- + tions that would be added. Or with --catchup, just mark all of the FILEs' transactions as imported, without actually importing any. - Unlike other hledger commands, with import the journal file is an out- + Unlike other hledger commands, with import the journal file is an out- put file, and will be modified, though only by appending (existing data - will not be changed). The input files are specified as arguments, so - to import one or more CSV files to your main journal, you will run + will not be changed). The input files are specified as arguments, so + to import one or more CSV files to your main journal, you will run hledger import bank.csv or perhaps hledger import *.csv. Note you can import from any file format, though CSV files are the most common import source, and these docs focus on that case. Deduplication - As a convenience import does deduplication while reading transactions. + As a convenience import does deduplication while reading transactions. This does not mean "ignore transactions that look the same", but rather "ignore transactions that have been seen before". This is intended for - when you are periodically importing foreign data which may contain - already-imported transactions. So eg, if every day you download bank - CSV files containing redundant data, you can safely run hledger import - bank.csv and only new transactions will be imported. (import is idem- + when you are periodically importing foreign data which may contain + already-imported transactions. So eg, if every day you download bank + CSV files containing redundant data, you can safely run hledger import + bank.csv and only new transactions will be imported. (import is idem- potent.) - Since the items being read (CSV records, eg) often do not come with - unique identifiers, hledger detects new transactions by date, assuming + Since the items being read (CSV records, eg) often do not come with + unique identifiers, hledger detects new transactions by date, assuming that: 1. new items always have the newest dates 2. item dates do not change across reads - 3. and items with the same date remain in the same relative order + 3. and items with the same date remain in the same relative order across reads. - These are often true of CSV files representing transactions, or true - enough so that it works pretty well in practice. 1 is important, but + These are often true of CSV files representing transactions, or true + enough so that it works pretty well in practice. 1 is important, but violations of 2 and 3 amongst the old transactions won't matter (and if - you import often, the new transactions will be few, so less likely to + you import often, the new transactions will be few, so less likely to be the ones affected). - hledger remembers the latest date processed in each input file by sav- + hledger remembers the latest date processed in each input file by sav- ing a hidden ".latest" state file in the same directory. Eg when read- - ing finance/bank.csv, it will look for and update the finance/.lat- - est.bank.csv state file. The format is simple: one or more lines con- - taining the same ISO-format date (YYYY-MM-DD), meaning "I have pro- - cessed transactions up to this date, and this many of them on that + ing finance/bank.csv, it will look for and update the finance/.lat- + est.bank.csv state file. The format is simple: one or more lines con- + taining the same ISO-format date (YYYY-MM-DD), meaning "I have pro- + cessed transactions up to this date, and this many of them on that date." Normally you won't see or manipulate these state files yourself. - But if needed, you can delete them to reset the state (making all - transactions "new"), or you can construct them to "catch up" to a cer- + But if needed, you can delete them to reset the state (making all + transactions "new"), or you can construct them to "catch up" to a cer- tain date. - Note deduplication (and updating of state files) can also be done by + Note deduplication (and updating of state files) can also be done by print --new, but this is less often used. Import testing - With --dry-run, the transactions that will be imported are printed to + With --dry-run, the transactions that will be imported are printed to the terminal, without updating your journal or state files. The output - is valid journal format, like the print command, so you can re-parse - it. Eg, to see any importable transactions which CSV rules have not + is valid journal format, like the print command, so you can re-parse + it. Eg, to see any importable transactions which CSV rules have not categorised: $ hledger import --dry bank.csv | hledger -f- -I print unknown @@ -3456,17 +3590,17 @@ COMMANDS $ ls bank.csv* | entr bash -c 'echo ====; hledger import --dry bank.csv | hledger -f- -I print unknown' Importing balance assignments - Entries added by import will have their posting amounts made explicit - (like hledger print -x). This means that any balance assignments in - imported files must be evaluated; but, imported files don't get to see - the main file's account balances. As a result, importing entries with + Entries added by import will have their posting amounts made explicit + (like hledger print -x). This means that any balance assignments in + imported files must be evaluated; but, imported files don't get to see + the main file's account balances. As a result, importing entries with balance assignments (eg from an institution that provides only balances - and not posting amounts) will probably generate incorrect posting + and not posting amounts) will probably generate incorrect posting amounts. To avoid this problem, use print instead of import: $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE - (If you think import should leave amounts implicit like print does, + (If you think import should leave amounts implicit like print does, please test it and send a pull request.) Commodity display styles @@ -3477,12 +3611,12 @@ COMMANDS incomestatement, is This command displays an income statement, showing revenues and - expenses during one or more periods. Amounts are shown with normal + expenses during one or more periods. Amounts are shown with normal positive sign, as in conventional financial statements. The revenue and expense accounts shown are those accounts declared with - the Revenue or Expense type, or otherwise all accounts under a top- - level revenue or income or expense account (case insensitive, plurals + the Revenue or Expense type, or otherwise all accounts under a top- + level revenue or income or expense account (case insensitive, plurals allowed). Example: @@ -3509,22 +3643,22 @@ COMMANDS 0 This command is a higher-level variant of the balance command, and sup- - ports many of that command's features, such as multi-period reports. + ports many of that command's features, such as multi-period reports. It is similar to hledger balance '(revenues|income)' expenses, but with - smarter account detection, and revenues/income displayed with their + smarter account detection, and revenues/income displayed with their sign flipped. - This command also supports the output destination and output format - options The output formats supported are txt, csv, html, and (experi- + This command also supports the output destination and output format + options The output formats supported are txt, csv, html, and (experi- mental) json. notes notes List the unique notes that appear in transactions. - This command lists the unique notes that appear in transactions, in - alphabetic order. You can add a query to select a subset of transac- - tions. The note is the part of the transaction description after a | + This command lists the unique notes that appear in transactions, in + alphabetic order. You can add a query to select a subset of transac- + tions. The note is the part of the transaction description after a | character (or if there is no |, the whole description). Example: @@ -3537,14 +3671,14 @@ COMMANDS payees List the unique payee/payer names that appear in transactions. - This command lists unique payee/payer names which have been declared - with payee directives (--declared), used in transaction descriptions + This command lists unique payee/payer names which have been declared + with payee directives (--declared), used in transaction descriptions (--used), or both (the default). - The payee/payer is the part of the transaction description before a | + The payee/payer is the part of the transaction description before a | character (or if there is no |, the whole description). - You can add query arguments to select a subset of transactions. This + You can add query arguments to select a subset of transactions. This implies --used. Example: @@ -3556,11 +3690,11 @@ COMMANDS prices prices - Print market price directives from the journal. With --infer-market- - prices, generate additional market prices from transaction prices. - With --infer-reverse-prices, also generate market prices by inverting + Print market price directives from the journal. With --infer-market- + prices, generate additional market prices from transaction prices. + With --infer-reverse-prices, also generate market prices by inverting transaction prices. Prices (and postings providing transaction prices) - can be filtered by a query. Price amounts are displayed with their + can be filtered by a query. Price amounts are displayed with their full precision. print @@ -3570,17 +3704,17 @@ COMMANDS The print command displays full journal entries (transactions) from the journal file, sorted by date (or with --date2, by secondary date). - Amounts are shown mostly normalised to commodity display style, eg the - placement of commodity symbols will be consistent. All of their deci- + Amounts are shown mostly normalised to commodity display style, eg the + placement of commodity symbols will be consistent. All of their deci- mal places are shown, as in the original journal entry (with one alter- ation: in some cases trailing zeroes are added.) Amounts are shown right-aligned within each transaction (but not across all transactions). - Directives and inter-transaction comments are not shown, currently. + Directives and inter-transaction comments are not shown, currently. This means the print command is somewhat lossy, and if you are using it - to reformat your journal you should take care to also copy over the + to reformat your journal you should take care to also copy over the directives and file-level comments. Eg: @@ -3607,7 +3741,7 @@ COMMANDS liabilities:debts $1 assets:bank:checking $-1 - print's output is usually a valid hledger journal, and you can process + print's output is usually a valid hledger journal, and you can process it again with a second hledger command. This can be useful for certain kinds of search, eg: @@ -3617,39 +3751,39 @@ COMMANDS There are some situations where print's output can become unparseable: - o Valuation affects posting amounts but not balance assertion or bal- + o Valuation affects posting amounts but not balance assertion or bal- ance assignment amounts, potentially causing those to fail. o Auto postings can generate postings with too many missing amounts. Normally, the journal entry's explicit or implicit amount style is pre- served. For example, when an amount is omitted in the journal, it will - not appear in the output. Similarly, when a transaction price is + not appear in the output. Similarly, when a transaction price is implied but not written, it will not appear in the output. You can use - the -x/--explicit flag to make all amounts and transaction prices - explicit, which can be useful for troubleshooting or for making your + the -x/--explicit flag to make all amounts and transaction prices + explicit, which can be useful for troubleshooting or for making your journal more readable and robust against data entry errors. -x is also implied by using any of -B,-V,-X,--value. - Note, -x/--explicit will cause postings with a multi-commodity amount - (these can arise when a multi-commodity transaction has an implicit - amount) to be split into multiple single-commodity postings, keeping + Note, -x/--explicit will cause postings with a multi-commodity amount + (these can arise when a multi-commodity transaction has an implicit + amount) to be split into multiple single-commodity postings, keeping the output parseable. - With -B/--cost, amounts with transaction prices are converted to cost + With -B/--cost, amounts with transaction prices are converted to cost using that price. This can be used for troubleshooting. - With -m/--match and a STR argument, print will show at most one trans- - action: the one one whose description is most similar to STR, and is - most recent. STR should contain at least two characters. If there is + With -m/--match and a STR argument, print will show at most one trans- + action: the one one whose description is most similar to STR, and is + most recent. STR should contain at least two characters. If there is no similar-enough match, no transaction will be shown. - With --new, hledger prints only transactions it has not seen on a pre- - vious run. This uses the same deduplication system as the import com- + With --new, hledger prints only transactions it has not seen on a pre- + vious run. This uses the same deduplication system as the import com- mand. (See import's docs for details.) - This command also supports the output destination and output format - options The output formats supported are txt, csv, and (experimental) + This command also supports the output destination and output format + options The output formats supported are txt, csv, and (experimental) json and sql. Here's an example of print's CSV output: @@ -3668,20 +3802,20 @@ COMMANDS "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","","" "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" - o There is one CSV record per posting, with the parent transaction's + o There is one CSV record per posting, with the parent transaction's fields repeated. o The "txnidx" (transaction index) field shows which postings belong to - the same transaction. (This number might change if transactions are - reordered within the file, files are parsed/included in a different + the same transaction. (This number might change if transactions are + reordered within the file, files are parsed/included in a different order, etc.) - o The amount is separated into "commodity" (the symbol) and "amount" + o The amount is separated into "commodity" (the symbol) and "amount" (numeric quantity) fields. o The numeric amount is repeated in either the "credit" or "debit" col- - umn, for convenience. (Those names are not accurate in the account- - ing sense; it just puts negative amounts under credit and zero or + umn, for convenience. (Those names are not accurate in the account- + ing sense; it just puts negative amounts under credit and zero or greater amounts under debit.) print-unique @@ -3705,14 +3839,14 @@ COMMANDS Show postings and their running total. The register command displays matched postings, across all accounts, in - date order, with their running total or running historical balance. - (See also the aregister command, which shows matched transactions in a + date order, with their running total or running historical balance. + (See also the aregister command, which shows matched transactions in a specific account.) register normally shows line per posting, but note that multi-commodity amounts will occupy multiple lines (one line per commodity). - It is typically used with a query selecting a particular account, to + It is typically used with a query selecting a particular account, to see that account's activity: $ hledger register checking @@ -3723,8 +3857,8 @@ COMMANDS With --date2, it shows and sorts by secondary date instead. - The --historical/-H flag adds the balance from any undisplayed prior - postings to the running total. This is useful when you want to see + The --historical/-H flag adds the balance from any undisplayed prior + postings to the running total. This is useful when you want to see only recent activity, with a historically accurate running balance: $ hledger register checking -b 2008/6 --historical @@ -3734,30 +3868,30 @@ COMMANDS The --depth option limits the amount of sub-account detail displayed. - The --average/-A flag shows the running average posting amount instead + The --average/-A flag shows the running average posting amount instead of the running total (so, the final number displayed is the average for - the whole report period). This flag implies --empty (see below). It - is affected by --historical. It works best when showing just one + the whole report period). This flag implies --empty (see below). It + is affected by --historical. It works best when showing just one account and one commodity. - The --related/-r flag shows the other postings in the transactions of + The --related/-r flag shows the other postings in the transactions of the postings which would normally be shown. - The --invert flag negates all amounts. For example, it can be used on + The --invert flag negates all amounts. For example, it can be used on an income account where amounts are normally displayed as negative num- - bers. It's also useful to show postings on the checking account + bers. It's also useful to show postings on the checking account together with the related account: $ hledger register --related --invert assets:checking - With a reporting interval, register shows summary postings, one per + With a reporting interval, register shows summary postings, one per interval, aggregating the postings to each account: $ hledger register --monthly income 2008/01 income:salary $-1 $-1 2008/06 income:gifts $-1 $-2 - Periods with no activity, and summary postings with a zero amount, are + Periods with no activity, and summary postings with a zero amount, are not shown by default; use the --empty/-E flag to see them: $ hledger register --monthly income -E @@ -3774,7 +3908,7 @@ COMMANDS 2008/11 0 $-2 2008/12 0 $-2 - Often, you'll want to see just one line per interval. The --depth + Often, you'll want to see just one line per interval. The --depth option helps with this, causing subaccounts to be aggregated: $ hledger register --monthly assets --depth 1h @@ -3782,19 +3916,19 @@ COMMANDS 2008/06 assets $-1 0 2008/12 assets $-1 $-1 - Note when using report intervals, if you specify start/end dates these - will be adjusted outward if necessary to contain a whole number of - intervals. This ensures that the first and last intervals are full + Note when using report intervals, if you specify start/end dates these + will be adjusted outward if necessary to contain a whole number of + intervals. This ensures that the first and last intervals are full length and comparable to the others in the report. Custom register output - register uses the full terminal width by default, except on windows. - You can override this by setting the COLUMNS environment variable (not + register uses the full terminal width by default, except on windows. + You can override this by setting the COLUMNS environment variable (not a bash shell variable) or by using the --width/-w option. - The description and account columns normally share the space equally - (about half of (width - 40) each). You can adjust this by adding a - description width as part of --width's argument, comma-separated: + The description and account columns normally share the space equally + (about half of (width - 40) each). You can adjust this by adding a + description width as part of --width's argument, comma-separated: --width W,D . Here's a diagram (won't display correctly in --help): <--------------------------------- width (W) ----------------------------------> @@ -3810,28 +3944,28 @@ COMMANDS $ hledger reg -w 100,40 # set overall width 100, description width 40 $ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 - This command also supports the output destination and output format - options The output formats supported are txt, csv, and (experimental) + This command also supports the output destination and output format + options The output formats supported are txt, csv, and (experimental) json. register-match register-match Print the one posting whose transaction description is closest to DESC, - in the style of the register command. If there are multiple equally - good matches, it shows the most recent. Query options (options, not - arguments) can be used to restrict the search space. Helps ledger- + in the style of the register command. If there are multiple equally + good matches, it shows the most recent. Query options (options, not + arguments) can be used to restrict the search space. Helps ledger- autosync detect already-seen transactions when importing. rewrite rewrite Print all transactions, rewriting the postings of matched transactions. - For now the only rewrite available is adding new postings, like print + For now the only rewrite available is adding new postings, like print --auto. This is a start at a generic rewriter of transaction entries. It reads - the default journal and prints the transactions, like print, but adds + the default journal and prints the transactions, like print, but adds one or more specified postings to any transactions matching QUERY. The - posting amounts can be fixed, or a multiplier of the existing transac- + posting amounts can be fixed, or a multiplier of the existing transac- tion's first posting amount. Examples: @@ -3847,7 +3981,7 @@ COMMANDS (reserve:grocery) *0.25 ; reserve 25% for grocery (reserve:) *0.25 ; reserve 25% for grocery - Note the single quotes to protect the dollar sign from bash, and the + Note the single quotes to protect the dollar sign from bash, and the two spaces between account and amount. More: @@ -3857,16 +3991,16 @@ COMMANDS $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"' $ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify' - Argument for --add-posting option is a usual posting of transaction - with an exception for amount specification. More precisely, you can + Argument for --add-posting option is a usual posting of transaction + with an exception for amount specification. More precisely, you can use '*' (star symbol) before the amount to indicate that that this is a - factor for an amount of original matched posting. If the amount - includes a commodity name, the new posting amount will be in the new - commodity; otherwise, it will be in the matched posting amount's com- + factor for an amount of original matched posting. If the amount + includes a commodity name, the new posting amount will be in the new + commodity; otherwise, it will be in the matched posting amount's com- modity. Re-write rules in a file - During the run this tool will execute so called "Automated Transac- + During the run this tool will execute so called "Automated Transac- tions" found in any journal it process. I.e instead of specifying this operations in command line you can put them in a journal file. @@ -3881,7 +4015,7 @@ COMMANDS budget:gifts *-1 assets:budget *1 - Note that '=' (equality symbol) that is used instead of date in trans- + Note that '=' (equality symbol) that is used instead of date in trans- actions you usually write. It indicates the query by which you want to match the posting to add new ones. @@ -3894,12 +4028,12 @@ COMMANDS --add-posting 'assets:budget *1' \ > rewritten-tidy-output.journal - It is important to understand that relative order of such entries in - journal is important. You can re-use result of previously added post- + It is important to understand that relative order of such entries in + journal is important. You can re-use result of previously added post- ings. Diff output format - To use this tool for batch modification of your journal files you may + To use this tool for batch modification of your journal files you may find useful output in form of unified diff. $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33' @@ -3923,10 +4057,10 @@ COMMANDS If you'll pass this through patch tool you'll get transactions contain- ing the posting that matches your query be updated. Note that multiple - files might be update according to list of input files specified via + files might be update according to list of input files specified via --file options and include directives inside of these files. - Be careful. Whole transaction being re-formatted in a style of output + Be careful. Whole transaction being re-formatted in a style of output from hledger print. See also: @@ -3934,54 +4068,54 @@ COMMANDS https://github.com/simonmichael/hledger/issues/99 rewrite vs. print --auto - This command predates print --auto, and currently does much the same + This command predates print --auto, and currently does much the same thing, but with these differences: - o with multiple files, rewrite lets rules in any file affect all other - files. print --auto uses standard directive scoping; rules affect + o with multiple files, rewrite lets rules in any file affect all other + files. print --auto uses standard directive scoping; rules affect only child files. - o rewrite's query limits which transactions can be rewritten; all are + o rewrite's query limits which transactions can be rewritten; all are printed. print --auto's query limits which transactions are printed. - o rewrite applies rules specified on command line or in the journal. + o rewrite applies rules specified on command line or in the journal. print --auto applies rules specified in the journal. roi roi - Shows the time-weighted (TWR) and money-weighted (IRR) rate of return + Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on your investments. - At a minimum, you need to supply a query (which could be just an - account name) to select your investment(s) with --inv, and another + At a minimum, you need to supply a query (which could be just an + account name) to select your investment(s) with --inv, and another query to identify your profit and loss transactions with --pnl. - If you do not record changes in the value of your investment manually, - or do not require computation of time-weighted return (TWR), --pnl + If you do not record changes in the value of your investment manually, + or do not require computation of time-weighted return (TWR), --pnl could be an empty query (--pnl "" or --pnl STR where STR does not match any of your accounts). - This command will compute and display the internalized rate of return - (IRR) and time-weighted rate of return (TWR) for your investments for - the time period requested. Both rates of return are annualized before + This command will compute and display the internalized rate of return + (IRR) and time-weighted rate of return (TWR) for your investments for + the time period requested. Both rates of return are annualized before display, regardless of the length of reporting interval. - Price directives will be taken into account if you supply appropriate + Price directives will be taken into account if you supply appropriate --cost or --value flags (see VALUATION). Note, in some cases this report can fail, for these reasons: - o Error (NotBracketed): No solution for Internal Rate of Return (IRR). - Possible causes: IRR is huge (>1000000%), balance of investment + o Error (NotBracketed): No solution for Internal Rate of Return (IRR). + Possible causes: IRR is huge (>1000000%), balance of investment becomes negative at some point in time. - o Error (SearchFailed): Failed to find solution for Internal Rate of + o Error (SearchFailed): Failed to find solution for Internal Rate of Return (IRR). Either search does not converge to a solution, or con- verges too slowly. Examples: - o Using roi to compute total return of investment in stocks: + o Using roi to compute total return of investment in stocks: https://github.com/simonmichael/hledger/blob/master/examples/roi- unrealised.ledger @@ -3991,27 +4125,27 @@ COMMANDS Note that --inv and --pnl's argument is a query, and queries could have several space-separated terms (see QUERIES). - To indicate that all search terms form single command-line argument, + To indicate that all search terms form single command-line argument, you will need to put them in quotes (see Special characters): $ hledger roi --inv 'term1 term2 term3 ...' - If any query terms contain spaces themselves, you will need an extra + If any query terms contain spaces themselves, you will need an extra level of nested quoting, eg: $ hledger roi --inv="'Assets:Test 1'" --pnl="'Equity:Unrealized Profit and Loss'" Semantics of --inv and --pnl - Query supplied to --inv has to match all transactions that are related + Query supplied to --inv has to match all transactions that are related to your investment. Transactions not matching --inv will be ignored. In these transactions, ROI will conside postings that match --inv to be - "investment postings" and other postings (not matching --inv) will be - sorted into two categories: "cash flow" and "profit and loss", as ROI - needs to know which part of the investment value is your contributions + "investment postings" and other postings (not matching --inv) will be + sorted into two categories: "cash flow" and "profit and loss", as ROI + needs to know which part of the investment value is your contributions and which is due to the return on investment. - o "Cash flow" is depositing or withdrawing money, buying or selling + o "Cash flow" is depositing or withdrawing money, buying or selling assets, or otherwise converting between your investment commodity and any other commodity. Example: @@ -4029,12 +4163,12 @@ COMMANDS investment:snake oil = $57 equity:unrealized profit or loss - All non-investment postings are assumed to be "cash flow", unless they - match --pnl query. Changes in value of your investment due to "profit - and loss" postings will be considered as part of your investment + All non-investment postings are assumed to be "cash flow", unless they + match --pnl query. Changes in value of your investment due to "profit + and loss" postings will be considered as part of your investment return. - Example: if you use --inv snake --pnl equity:unrealized, then postings + Example: if you use --inv snake --pnl equity:unrealized, then postings in the example below would be classifed as: 2019-01-01 Snake Oil #1 @@ -4051,76 +4185,76 @@ COMMANDS snake oil $50 ; investment posting IRR and TWR explained - "ROI" stands for "return on investment". Traditionally this was com- - puted as a difference between current value of investment and its ini- + "ROI" stands for "return on investment". Traditionally this was com- + puted as a difference between current value of investment and its ini- tial value, expressed in percentage of the initial value. However, this approach is only practical in simple cases, where invest- - ments receives no in-flows or out-flows of money, and where rate of + ments receives no in-flows or out-flows of money, and where rate of growth is fixed over time. For more complex scenarios you need differ- - ent ways to compute rate of return, and this command implements two of + ent ways to compute rate of return, and this command implements two of them: IRR and TWR. - Internal rate of return, or "IRR" (also called "money-weighted rate of - return") takes into account effects of in-flows and out-flows. + Internal rate of return, or "IRR" (also called "money-weighted rate of + return") takes into account effects of in-flows and out-flows. Naively, if you are withdrawing from your investment, your future gains - would be smaller (in absolute numbers), and will be a smaller percent- - age of your initial investment, and if you are adding to your invest- - ment, you will receive bigger absolute gains (but probably at the same - rate of return). IRR is a way to compute rate of return for each + would be smaller (in absolute numbers), and will be a smaller percent- + age of your initial investment, and if you are adding to your invest- + ment, you will receive bigger absolute gains (but probably at the same + rate of return). IRR is a way to compute rate of return for each period between in-flow or out-flow of money, and then combine them in a - way that gives you a compound annual rate of return that investment is + way that gives you a compound annual rate of return that investment is expected to generate. - As mentioned before, in-flows and out-flows would be any cash that you + As mentioned before, in-flows and out-flows would be any cash that you personally put in or withdraw, and for the "roi" command, these are the - postings that match the query in the--inv argument and NOT match the + postings that match the query in the--inv argument and NOT match the query in the--pnl argument. - If you manually record changes in the value of your investment as - transactions that balance them against "profit and loss" (or "unreal- - ized gains") account or use price directives, then in order for IRR to - compute the precise effect of your in-flows and out-flows on the rate - of return, you will need to record the value of your investement on or + If you manually record changes in the value of your investment as + transactions that balance them against "profit and loss" (or "unreal- + ized gains") account or use price directives, then in order for IRR to + compute the precise effect of your in-flows and out-flows on the rate + of return, you will need to record the value of your investement on or close to the days when in- or out-flows occur. - In technical terms, IRR uses the same approach as computation of net + In technical terms, IRR uses the same approach as computation of net present value, and tries to find a discount rate that makes net present value of all the cash flows of your investment to add up to zero. This - could be hard to wrap your head around, especially if you haven't done + could be hard to wrap your head around, especially if you haven't done discounted cash flow analysis before. Implementation of IRR in hledger should produce results that match the XIRR formula in Excel. - Second way to compute rate of return that roi command implements is + Second way to compute rate of return that roi command implements is called "time-weighted rate of return" or "TWR". Like IRR, it will also - break the history of your investment into periods between in-flows, - out-flows and value changes, to compute rate of return per each period - and then a compound rate of return. However, internal workings of TWR + break the history of your investment into periods between in-flows, + out-flows and value changes, to compute rate of return per each period + and then a compound rate of return. However, internal workings of TWR are quite different. - TWR represents your investment as an imaginary "unit fund" where in- - flows/ out-flows lead to buying or selling "units" of your investment + TWR represents your investment as an imaginary "unit fund" where in- + flows/ out-flows lead to buying or selling "units" of your investment and changes in its value change the value of "investment unit". Change - in "unit price" over the reporting period gives you rate of return of + in "unit price" over the reporting period gives you rate of return of your investment. - References: * Explanation of rate of return * Explanation of IRR * - Explanation of TWR * Examples of computing IRR and TWR and discussion + References: * Explanation of rate of return * Explanation of IRR * + Explanation of TWR * Examples of computing IRR and TWR and discussion of the limitations of both metrics stats stats Show journal and performance statistics. - The stats command displays summary information for the whole journal, - or a matched part of it. With a reporting interval, it shows a report + The stats command displays summary information for the whole journal, + or a matched part of it. With a reporting interval, it shows a report for each report period. - At the end, it shows (in the terminal) the overall run time and number - of transactions processed per second. Note these are approximate and - will vary based on machine, current load, data size, hledger version, - haskell lib versions, GHC version.. but they may be of interest. The - stats command's run time is similar to that of a single-column balance + At the end, it shows (in the terminal) the overall run time and number + of transactions processed per second. Note these are approximate and + will vary based on machine, current load, data size, hledger version, + haskell lib versions, GHC version.. but they may be of interest. The + stats command's run time is similar to that of a single-column balance report. Example: @@ -4141,35 +4275,35 @@ COMMANDS Run time : 0.12 s Throughput : 8342 txns/s - This command also supports output destination and output format selec- + This command also supports output destination and output format selec- tion. tags tags - List the unique tag names used in the journal. With a TAGREGEX argu- + List the unique tag names used in the journal. With a TAGREGEX argu- ment, only tag names matching the regular expression (case insensitive) - are shown. With QUERY arguments, only transactions matching the query + are shown. With QUERY arguments, only transactions matching the query are considered. With the --values flag, the tags' unique values are listed instead. - With --parsed flag, all tags or values are shown in the order they are + With --parsed flag, all tags or values are shown in the order they are parsed from the input data, including duplicates. - With -E/--empty, any blank/empty values will also be shown, otherwise + With -E/--empty, any blank/empty values will also be shown, otherwise they are omitted. test test Run built-in unit tests. - This command runs the unit tests built in to hledger and hledger-lib, - printing the results on stdout. If any test fails, the exit code will + This command runs the unit tests built in to hledger and hledger-lib, + printing the results on stdout. If any test fails, the exit code will be non-zero. - This is mainly used by hledger developers, but you can also use it to - sanity-check the installed hledger executable on your platform. All - tests are expected to pass - if you ever see a failure, please report + This is mainly used by hledger developers, but you can also use it to + sanity-check the installed hledger executable on your platform. All + tests are expected to pass - if you ever see a failure, please report as a bug! This command also accepts tasty test runner options, written after a -- @@ -4178,7 +4312,7 @@ COMMANDS $ hledger test -- -pData.Amount --color=never - For help on these, see https://github.com/feuerbach/tasty#options (-- + For help on these, see https://github.com/feuerbach/tasty#options (-- --help currently doesn't show them). About add-on commands @@ -4186,16 +4320,16 @@ COMMANDS o whose name starts with hledger- - o whose name ends with a recognised file extension: .bat,.com,.exe, + o whose name ends with a recognised file extension: .bat,.com,.exe, .hs,.lhs,.pl,.py,.rb,.rkt,.sh or none o and (on unix, mac) which are executable by the current user. - Add-ons are a relatively easy way to add local features or experiment - with new ideas. They can be written in any language, but haskell - scripts have a big advantage: they can use the same hledger library - functions that built-in commands use for command-line options, parsing - and reporting. Some experimental/example add-on scripts can be found + Add-ons are a relatively easy way to add local features or experiment + with new ideas. They can be written in any language, but haskell + scripts have a big advantage: they can use the same hledger library + functions that built-in commands use for command-line options, parsing + and reporting. Some experimental/example add-on scripts can be found in the hledger repo's bin/ directory. Note in a hledger command line, add-on command flags must have a double @@ -4219,17 +4353,17 @@ COMMANDS JOURNAL FORMAT hledger's default file format, representing a General Journal. - hledger's usual data source is a plain text file containing journal - entries in hledger journal format. This file represents a standard - accounting general journal. I use file names ending in .journal, but + hledger's usual data source is a plain text file containing journal + entries in hledger journal format. This file represents a standard + accounting general journal. I use file names ending in .journal, but that's not required. The journal file contains a number of transaction entries, each describing a transfer of money (or any commodity) between two or more named accounts, in a simple format readable by both hledger and humans. - hledger's journal format is a compatible subset, mostly, of ledger's - journal format, so hledger can work with compatible ledger journal - files as well. It's safe, and encouraged, to run both hledger and + hledger's journal format is a compatible subset, mostly, of ledger's + journal format, so hledger can work with compatible ledger journal + files as well. It's safe, and encouraged, to run both hledger and ledger on the same journal file, eg to validate the results you're get- ting. @@ -4237,25 +4371,25 @@ JOURNAL FORMAT the add or web or import commands to create and update it. Many users, though, edit the journal file with a text editor, and track - changes with a version control system such as git. Editor addons such - as ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, and + changes with a version control system such as git. Editor addons such + as ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, and hledger-vscode for Visual Studio Code, make this easier, adding colour, formatting, tab completion, and useful commands. See Editor configura- tion at hledger.org for the full list. - Here's a description of each part of the file format (and hledger's - data model). These are mostly in the order you'll use them, but in - some cases related concepts have been grouped together for easy refer- - ence, or linked before they are introduced, so feel free to skip over + Here's a description of each part of the file format (and hledger's + data model). These are mostly in the order you'll use them, but in + some cases related concepts have been grouped together for easy refer- + ence, or linked before they are introduced, so feel free to skip over anything that looks unnecessary right now. Transactions - Transactions are the main unit of information in a journal file. They - represent events, typically a movement of some quantity of commodities + Transactions are the main unit of information in a journal file. They + represent events, typically a movement of some quantity of commodities between two or more named accounts. - Each transaction is recorded as a journal entry, beginning with a sim- - ple date in column 0. This can be followed by any of the following + Each transaction is recorded as a journal entry, beginning with a sim- + ple date in column 0. This can be followed by any of the following optional fields, separated by spaces: o a status character (empty, !, or *) @@ -4264,11 +4398,11 @@ JOURNAL FORMAT o a description (any remaining text until end of line or a semicolon) - o a comment (any remaining text following a semicolon until end of + o a comment (any remaining text following a semicolon until end of line, and any following indented lines beginning with a semicolon) o 0 or more indented posting lines, describing what was transferred and - the accounts involved (indented comment lines are also allowed, but + the accounts involved (indented comment lines are also allowed, but not blank lines or non-indented lines). Here's a simple journal file containing one transaction: @@ -4279,35 +4413,35 @@ JOURNAL FORMAT Dates Simple dates - Dates in the journal file use simple dates format: YYYY-MM-DD or + Dates in the journal file use simple dates format: YYYY-MM-DD or YYYY/MM/DD or YYYY.MM.DD, with leading zeros optional. The year may be - omitted, in which case it will be inferred from the context: the cur- - rent transaction, the default year set with a default year directive, - or the current date when the command is run. Some examples: + omitted, in which case it will be inferred from the context: the cur- + rent transaction, the default year set with a default year directive, + or the current date when the command is run. Some examples: 2010-01-31, 2010/01/31, 2010.1.31, 1/31. - (The UI also accepts simple dates, as well as the more flexible smart + (The UI also accepts simple dates, as well as the more flexible smart dates documented in the hledger manual.) Secondary dates - Real-life transactions sometimes involve more than one date - eg the + Real-life transactions sometimes involve more than one date - eg the date you write a cheque, and the date it clears in your bank. When you - want to model this, for more accurate daily balances, you can specify + want to model this, for more accurate daily balances, you can specify individual posting dates. - Or, you can use the older secondary date feature (Ledger calls it aux- - iliary date or effective date). Note: we support this for compatibil- - ity, but I usually recommend avoiding this feature; posting dates are + Or, you can use the older secondary date feature (Ledger calls it aux- + iliary date or effective date). Note: we support this for compatibil- + ity, but I usually recommend avoiding this feature; posting dates are almost always clearer and simpler. A secondary date is written after the primary date, following an equals - sign. If the year is omitted, the primary date's year is assumed. - When running reports, the primary (left) date is used by default, but - with the --date2 flag (or --aux-date or --effective), the secondary + sign. If the year is omitted, the primary date's year is assumed. + When running reports, the primary (left) date is used by default, but + with the --date2 flag (or --aux-date or --effective), the secondary (right) date will be used instead. - The meaning of secondary dates is up to you, but it's best to follow a - consistent rule. Eg "primary = the bank's clearing date, secondary = + The meaning of secondary dates is up to you, but it's best to follow a + consistent rule. Eg "primary = the bank's clearing date, secondary = date the transaction was initiated, if different", as shown here: 2010/2/23=2/19 movie ticket @@ -4321,11 +4455,11 @@ JOURNAL FORMAT 2010-02-19 movie ticket assets:checking $-10 $-10 Posting dates - You can give individual postings a different date from their parent - transaction, by adding a posting comment containing a tag (see below) + You can give individual postings a different date from their parent + transaction, by adding a posting comment containing a tag (see below) like date:DATE. This is probably the best way to control posting dates - precisely. Eg in this example the expense should appear in May - reports, and the deduction from checking should be reported on 6/1 for + precisely. Eg in this example the expense should appear in May + reports, and the deduction from checking should be reported on 6/1 for easy bank reconciliation: 2015/5/30 @@ -4338,22 +4472,22 @@ JOURNAL FORMAT $ hledger -f t.j register checking 2015-06-01 assets:checking $-10 $-10 - DATE should be a simple date; if the year is not specified it will use - the year of the transaction's date. You can set the secondary date - similarly, with date2:DATE2. The date: or date2: tags must have a - valid simple date value if they are present, eg a date: tag with no + DATE should be a simple date; if the year is not specified it will use + the year of the transaction's date. You can set the secondary date + similarly, with date2:DATE2. The date: or date2: tags must have a + valid simple date value if they are present, eg a date: tag with no value is not allowed. Ledger's earlier, more compact bracketed date syntax is also supported: - [DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any + [DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any square-bracketed sequence of the 0123456789/-.= characters in this way. - With this syntax, DATE infers its year from the transaction and DATE2 + With this syntax, DATE infers its year from the transaction and DATE2 infers its year from DATE. Status - Transactions, or individual postings within a transaction, can have a - status mark, which is a single character before the transaction - description or posting account name, separated from it by a space, + Transactions, or individual postings within a transaction, can have a + status mark, which is a single character before the transaction + description or posting account name, separated from it by a space, indicating one of three statuses: @@ -4363,23 +4497,23 @@ JOURNAL FORMAT ! pending * cleared - When reporting, you can filter by status with the -U/--unmarked, - -P/--pending, and -C/--cleared flags; or the status:, status:!, and + When reporting, you can filter by status with the -U/--unmarked, + -P/--pending, and -C/--cleared flags; or the status:, status:!, and status:* queries; or the U, P, C keys in hledger-ui. - Note, in Ledger and in older versions of hledger, the "unmarked" state - is called "uncleared". As of hledger 1.3 we have renamed it to + Note, in Ledger and in older versions of hledger, the "unmarked" state + is called "uncleared". As of hledger 1.3 we have renamed it to unmarked for clarity. - To replicate Ledger and old hledger's behaviour of also matching pend- + To replicate Ledger and old hledger's behaviour of also matching pend- ing, combine -U and -P. - Status marks are optional, but can be helpful eg for reconciling with + Status marks are optional, but can be helpful eg for reconciling with real-world accounts. Some editor modes provide highlighting and short- - cuts for working with status. Eg in Emacs ledger-mode, you can toggle + cuts for working with status. Eg in Emacs ledger-mode, you can toggle transaction status with C-c C-e, or posting status with C-c C-c. - What "uncleared", "pending", and "cleared" actually mean is up to you. + What "uncleared", "pending", and "cleared" actually mean is up to you. Here's one suggestion: @@ -4391,41 +4525,41 @@ JOURNAL FORMAT cleared complete, reconciled as far as possible, and considered cor- rect - With this scheme, you would use -PC to see the current balance at your - bank, -U to see things which will probably hit your bank soon (like + With this scheme, you would use -PC to see the current balance at your + bank, -U to see things which will probably hit your bank soon (like uncashed checks), and no flags to see the most up-to-date state of your finances. Code - After the status mark, but before the description, you can optionally - write a transaction "code", enclosed in parentheses. This is a good - place to record a check number, or some other important transaction id + After the status mark, but before the description, you can optionally + write a transaction "code", enclosed in parentheses. This is a good + place to record a check number, or some other important transaction id or reference number. Description - A transaction's description is the rest of the line following the date - and status mark (or until a comment begins). Sometimes called the + A transaction's description is the rest of the line following the date + and status mark (or until a comment begins). Sometimes called the "narration" in traditional bookkeeping, it can be used for whatever you - wish, or left blank. Transaction descriptions can be queried, unlike + wish, or left blank. Transaction descriptions can be queried, unlike comments. Payee and note You can optionally include a | (pipe) character in descriptions to sub- divide the description into separate fields for payee/payer name on the - left (up to the first |) and an additional note field on the right - (after the first |). This may be worthwhile if you need to do more + left (up to the first |) and an additional note field on the right + (after the first |). This may be worthwhile if you need to do more precise querying and pivoting by payee or by note. Comments Lines in the journal beginning with a semicolon (;) or hash (#) or star - (*) are comments, and will be ignored. (Star comments cause org-mode - nodes to be ignored, allowing emacs users to fold and navigate their + (*) are comments, and will be ignored. (Star comments cause org-mode + nodes to be ignored, allowing emacs users to fold and navigate their journals with org-mode or orgstruct-mode.) - You can attach comments to a transaction by writing them after the - description and/or indented on the following lines (before the post- - ings). Similarly, you can attach comments to an individual posting by - writing them after the amount and/or indented on the following lines. + You can attach comments to a transaction by writing them after the + description and/or indented on the following lines (before the post- + ings). Similarly, you can attach comments to an individual posting by + writing them after the amount and/or indented on the following lines. Transaction and posting comments must begin with a semicolon (;). Some examples: @@ -4448,24 +4582,24 @@ JOURNAL FORMAT ; another comment line for posting 2 ; a file comment (because not indented) - You can also comment larger regions of a file using comment and end + You can also comment larger regions of a file using comment and end comment directives. Tags - Tags are a way to add extra labels or labelled data to postings and + Tags are a way to add extra labels or labelled data to postings and transactions, which you can then search or pivot on. - A simple tag is a word (which may contain hyphens) followed by a full + A simple tag is a word (which may contain hyphens) followed by a full colon, written inside a transaction or posting comment line: 2017/1/16 bought groceries ; sometag: - Tags can have a value, which is the text after the colon, up to the + Tags can have a value, which is the text after the colon, up to the next comma or end of line, with leading/trailing whitespace removed: expenses:food $10 ; a-posting-tag: the tag value - Note this means hledger's tag values can not contain commas or new- + Note this means hledger's tag values can not contain commas or new- lines. Ending at commas means you can write multiple short tags on one line, comma separated: @@ -4479,57 +4613,57 @@ JOURNAL FORMAT o "tag2" is another tag, whose value is "some value ..." - Tags in a transaction comment affect the transaction and all of its - postings, while tags in a posting comment affect only that posting. - For example, the following transaction has three tags (A, TAG2, third- + Tags in a transaction comment affect the transaction and all of its + postings, while tags in a posting comment affect only that posting. + For example, the following transaction has three tags (A, TAG2, third- tag) and the posting has four (those plus posting-tag): 1/1 a transaction ; A:, TAG2: ; third-tag: a third transaction tag, <- with a value (a) $1 ; posting-tag: - Tags are like Ledger's metadata feature, except hledger's tag values + Tags are like Ledger's metadata feature, except hledger's tag values are simple strings. Postings - A posting is an addition of some amount to, or removal of some amount - from, an account. Each posting line begins with at least one space or + A posting is an addition of some amount to, or removal of some amount + from, an account. Each posting line begins with at least one space or tab (2 or 4 spaces is common), followed by: o (optional) a status character (empty, !, or *), followed by a space - o (required) an account name (any text, optionally containing single + o (required) an account name (any text, optionally containing single spaces, until end of line or a double space) o (optional) two or more spaces or tabs followed by an amount. - Positive amounts are being added to the account, negative amounts are + Positive amounts are being added to the account, negative amounts are being removed. The amounts within a transaction must always sum up to zero. As a con- - venience, one amount may be left blank; it will be inferred so as to + venience, one amount may be left blank; it will be inferred so as to balance the transaction. - Be sure to note the unusual two-space delimiter between account name - and amount. This makes it easy to write account names containing spa- - ces. But if you accidentally leave only one space (or tab) before the + Be sure to note the unusual two-space delimiter between account name + and amount. This makes it easy to write account names containing spa- + ces. But if you accidentally leave only one space (or tab) before the amount, the amount will be considered part of the account name. Virtual postings A posting with a parenthesised account name is called a virtual posting - or unbalanced posting, which means it is exempt from the usual rule + or unbalanced posting, which means it is exempt from the usual rule that a transaction's postings must balance add up to zero. - This is not part of double entry accounting, so you might choose to - avoid this feature. Or you can use it sparingly for certain special - cases where it can be convenient. Eg, you could set opening balances + This is not part of double entry accounting, so you might choose to + avoid this feature. Or you can use it sparingly for certain special + cases where it can be convenient. Eg, you could set opening balances without using a balancing equity account: 1/1 opening balances (assets:checking) $1000 (assets:savings) $2000 - A posting with a bracketed account name is called a balanced virtual + A posting with a bracketed account name is called a balanced virtual posting. The balanced virtual postings in a transaction must add up to zero (separately from other postings). Eg: @@ -4541,34 +4675,34 @@ JOURNAL FORMAT [assets:checking:available] $10 ; <- (something:else) $5 ; <- not required to balance - Ordinary non-parenthesised, non-bracketed postings are called real - postings. You can exclude virtual postings from reports with the + Ordinary non-parenthesised, non-bracketed postings are called real + postings. You can exclude virtual postings from reports with the -R/--real flag or real:1 query. Account names - Account names typically have several parts separated by a full colon, - from which hledger derives a hierarchical chart of accounts. They can - be anything you like, but in finance there are traditionally five top- + Account names typically have several parts separated by a full colon, + from which hledger derives a hierarchical chart of accounts. They can + be anything you like, but in finance there are traditionally five top- level accounts: assets, liabilities, revenue, expenses, and equity. - Account names may contain single spaces, eg: assets:accounts receiv- - able. Because of this, they must always be followed by two or more + Account names may contain single spaces, eg: assets:accounts receiv- + able. Because of this, they must always be followed by two or more spaces (or newline). Account names can be aliased. Amounts - After the account name, there is usually an amount. (Important: + After the account name, there is usually an amount. (Important: between account name and amount, there must be two or more spaces.) - hledger's amount format is flexible, supporting several international - formats. Here are some examples. Amounts have a number (the "quan- + hledger's amount format is flexible, supporting several international + formats. Here are some examples. Amounts have a number (the "quan- tity"): 1 ..and usually a currency symbol or commodity name (more on this below), - to the left or right of the quantity, with or without a separating + to the left or right of the quantity, with or without a separating space: $1 @@ -4576,13 +4710,13 @@ JOURNAL FORMAT 3 "green apples" Amounts can be preceded by a minus sign (or a plus sign, though plus is - the default), The sign can be written before or after a left-side com- + the default), The sign can be written before or after a left-side com- modity symbol: -$1 $-1 - One or more spaces between the sign and the number are acceptable when + One or more spaces between the sign and the number are acceptable when parsing (but they won't be displayed in output): + $1 @@ -4599,8 +4733,8 @@ JOURNAL FORMAT 1.23 1,23456780000009 - In the integer part of the quantity (left of the decimal mark), groups - of digits can optionally be separated by a digit group mark - a space, + In the integer part of the quantity (left of the decimal mark), groups + of digits can optionally be separated by a digit group mark - a space, comma, or period (different from the decimal mark): $1,000,000.00 @@ -4614,41 +4748,41 @@ JOURNAL FORMAT 1,000 1.000 - If you don't tell it otherwise, hledger will assume both of the above + If you don't tell it otherwise, hledger will assume both of the above are decimal marks, parsing both numbers as 1. - To prevent confusing parsing mistakes and undetected typos, especially - if your data contains digit group marks (eg, thousands separators), we + To prevent confusing parsing mistakes and undetected typos, especially + if your data contains digit group marks (eg, thousands separators), we recommend explicitly declaring the decimal mark character in each jour- - nal file, using a directive at the top of the file. The decimal-mark - directive is best, otherwise commodity directives will also work. + nal file, using a directive at the top of the file. The decimal-mark + directive is best, otherwise commodity directives will also work. These are described detail below. Commodity - Amounts in hledger have both a "quantity", which is a signed decimal + Amounts in hledger have both a "quantity", which is a signed decimal number, and a "commodity", which is a currency symbol, stock ticker, or any word or phrase describing something you are tracking. If the commodity name contains non-letters (spaces, numbers, or punctu- - ation), you must always write it inside double quotes ("green apples", + ation), you must always write it inside double quotes ("green apples", "ABC123"). - If you write just a bare number, that too will have a commodity, with + If you write just a bare number, that too will have a commodity, with name ""; we call that the "no-symbol commodity". - Actually, hledger combines these single-commodity amounts into more - powerful multi-commodity amounts, which are what it works with most of - the time. A multi-commodity amount could be, eg: 1 USD, 2 EUR, 3.456 - TSLA. In practice, you will only see multi-commodity amounts in + Actually, hledger combines these single-commodity amounts into more + powerful multi-commodity amounts, which are what it works with most of + the time. A multi-commodity amount could be, eg: 1 USD, 2 EUR, 3.456 + TSLA. In practice, you will only see multi-commodity amounts in hledger's output; you can't write them directly in the journal file. - (If you are writing scripts or working with hledger's internals, these + (If you are writing scripts or working with hledger's internals, these are the Amount and MixedAmount types.) Directives influencing number parsing and display - You can add decimal-mark and commodity directives to the journal, to - declare and control these things more explicitly and precisely. These - are described below, in JOURNAL FORMAT -> Declaring commodities. + You can add decimal-mark and commodity directives to the journal, to + declare and control these things more explicitly and precisely. These + are described below, in JOURNAL FORMAT -> Declaring commodities. Here's a quick example: # the decimal mark character used by all amounts in this file (all commodities) @@ -4663,48 +4797,48 @@ JOURNAL FORMAT Commodity display style For the amounts in each commodity, hledger chooses a consistent display - style to use in most reports. (Exceptions: price amounts, and all + style to use in most reports. (Exceptions: price amounts, and all amounts displayed by the print command, are displayed with all of their decimal digits visible.) A commodity's display style is inferred as follows. - First, if a default commodity is declared with D, this commodity and + First, if a default commodity is declared with D, this commodity and its style is applied to any no-symbol amounts in the journal. - Then each commodity's style is inferred from one of the following, in + Then each commodity's style is inferred from one of the following, in order of preference: - o The commodity directive for that commodity (including the no-symbol + o The commodity directive for that commodity (including the no-symbol commodity), if any. - o The amounts in that commodity seen in the journal's transactions. + o The amounts in that commodity seen in the journal's transactions. (Posting amounts only; prices and periodic or auto rules are ignored, currently.) - o The built-in fallback style, which looks like this: $1000.00. (Sym- + o The built-in fallback style, which looks like this: $1000.00. (Sym- bol on the left, period decimal mark, two decimal places.) A style is inferred from journal amounts as follows: - o Use the general style (decimal mark, symbol placement) of the first + o Use the general style (decimal mark, symbol placement) of the first amount - o Use the first-seen digit group style (digit group mark, digit group + o Use the first-seen digit group style (digit group mark, digit group sizes), if any o Use the maximum number of decimal places of all. - Transaction price amounts don't affect the commodity display style - directly, but occasionally they can do so indirectly (eg when a post- - ing's amount is inferred using a transaction price). If you find this + Transaction price amounts don't affect the commodity display style + directly, but occasionally they can do so indirectly (eg when a post- + ing's amount is inferred using a transaction price). If you find this causing problems, use a commodity directive to fix the display style. - To summarise: each commodity's amounts will be normalised to (a) the - style declared by a commodity directive, or (b) the style of the first - posting amount in the journal, with the first-seen digit group style - and the maximum-seen number of decimal places. So if your reports are - showing amounts in a way you don't like, eg with too many decimal + To summarise: each commodity's amounts will be normalised to (a) the + style declared by a commodity directive, or (b) the style of the first + posting amount in the journal, with the first-seen digit group style + and the maximum-seen number of decimal places. So if your reports are + showing amounts in a way you don't like, eg with too many decimal places, use a commodity directive. Some examples: # declare euro, dollar, bitcoin and no-symbol commodities and set their @@ -4714,22 +4848,22 @@ JOURNAL FORMAT commodity 1000.00000000 BTC commodity 1 000. - The inferred commodity style can be overridden by supplying a command + The inferred commodity style can be overridden by supplying a command line option. Rounding Amounts are stored internally as decimal numbers with up to 255 decimal - places, and displayed with the number of decimal places specified by - the commodity display style. Note, hledger uses banker's rounding: it - rounds to the nearest even number, eg 0.5 displayed with zero decimal - places is "0"). (Guaranteed since hledger 1.17.1; in older versions + places, and displayed with the number of decimal places specified by + the commodity display style. Note, hledger uses banker's rounding: it + rounds to the nearest even number, eg 0.5 displayed with zero decimal + places is "0"). (Guaranteed since hledger 1.17.1; in older versions this could vary if hledger was built with Decimal < 0.5.1.) Transaction prices Within a transaction, you can note an amount's price in another commod- - ity. This can be used to document the cost (in a purchase) or selling - price (in a sale). For example, transaction prices are useful to - record purchases of a foreign currency. Note transaction prices are + ity. This can be used to document the cost (in a purchase) or selling + price (in a sale). For example, transaction prices are useful to + record purchases of a foreign currency. Note transaction prices are fixed at the time of the transaction, and do not change over time. See also market prices, which represent prevailing exchange rates on a cer- tain date. @@ -4755,14 +4889,14 @@ JOURNAL FORMAT assets:euros EUR100 ; one hundred euros purchased assets:dollars $-135 ; for $135 - 4. Like 1, but the @ is parenthesised, i.e. (@); this is for compati- - bility with Ledger journals (Virtual posting costs), and is equiva- + 4. Like 1, but the @ is parenthesised, i.e. (@); this is for compati- + bility with Ledger journals (Virtual posting costs), and is equiva- lent to 1 in hledger. 5. Like 2, but as in 4 the @@ is parenthesised, i.e. (@@); in hledger, this is equivalent to 2. - Use the -B/--cost flag to convert amounts to their transaction price's + Use the -B/--cost flag to convert amounts to their transaction price's commodity, if any. (mnemonic: "B" is from "cost Basis", as in Ledger). Eg here is how -B affects the balance report for the example above: @@ -4773,8 +4907,8 @@ JOURNAL FORMAT $-135 assets:dollars $135 assets:euros # <- the euros' cost - Note -B is sensitive to the order of postings when a transaction price - is inferred: the inferred price will be in the commodity of the last + Note -B is sensitive to the order of postings when a transaction price + is inferred: the inferred price will be in the commodity of the last amount. So if example 3's postings are reversed, while the transaction is equivalent, -B shows something different: @@ -4787,18 +4921,18 @@ JOURNAL FORMAT EUR100 assets:euros Lot prices, lot dates - Ledger allows another kind of price, lot price (four variants: {UNIT- + Ledger allows another kind of price, lot price (four variants: {UNIT- PRICE}, {{TOTALPRICE}}, {=FIXEDUNITPRICE}, {{=FIXEDTOTALPRICE}}), and/or a lot date ([DATE]) to be specified. These are normally used to - select a lot when selling investments. hledger will parse these, for - compatibility with Ledger journals, but currently ignores them. A - transaction price, lot price and/or lot date may appear in any order, + select a lot when selling investments. hledger will parse these, for + compatibility with Ledger journals, but currently ignores them. A + transaction price, lot price and/or lot date may appear in any order, after the posting amount and before the balance assertion if any. Balance assertions - hledger supports Ledger-style balance assertions in journal files. - These look like, for example, = EXPECTEDBALANCE following a posting's - amount. Eg here we assert the expected dollar balance in accounts a + hledger supports Ledger-style balance assertions in journal files. + These look like, for example, = EXPECTEDBALANCE following a posting's + amount. Eg here we assert the expected dollar balance in accounts a and b after each posting: 2013/1/1 @@ -4810,32 +4944,32 @@ JOURNAL FORMAT b $-1 =$-2 After reading a journal file, hledger will check all balance assertions - and report an error if any of them fail. Balance assertions can pro- - tect you from, eg, inadvertently disrupting reconciled balances while - cleaning up old entries. You can disable them temporarily with the + and report an error if any of them fail. Balance assertions can pro- + tect you from, eg, inadvertently disrupting reconciled balances while + cleaning up old entries. You can disable them temporarily with the -I/--ignore-assertions flag, which can be useful for troubleshooting or - for reading Ledger files. (Note: this flag currently does not disable + for reading Ledger files. (Note: this flag currently does not disable balance assignments, below). Assertions and ordering - hledger sorts an account's postings and assertions first by date and - then (for postings on the same day) by parse order. Note this is dif- + hledger sorts an account's postings and assertions first by date and + then (for postings on the same day) by parse order. Note this is dif- ferent from Ledger, which sorts assertions only by parse order. (Also, - Ledger assertions do not see the accumulated effect of repeated post- + Ledger assertions do not see the accumulated effect of repeated post- ings to the same account within a transaction.) So, hledger balance assertions keep working if you reorder differently- - dated transactions within the journal. But if you reorder same-dated - transactions or postings, assertions might break and require updating. + dated transactions within the journal. But if you reorder same-dated + transactions or postings, assertions might break and require updating. This order dependence does bring an advantage: precise control over the order of postings and assertions within a day, so you can assert intra- day balances. Assertions and included files - With included files, things are a little more complicated. Including - preserves the ordering of postings and assertions. If you have multi- - ple postings to an account on the same day, split across different - files, and you also want to assert the account's balance on the same + With included files, things are a little more complicated. Including + preserves the ordering of postings and assertions. If you have multi- + ple postings to an account on the same day, split across different + files, and you also want to assert the account's balance on the same day, you'll have to put the assertion in the right file. Assertions and multiple -f options @@ -4843,15 +4977,15 @@ JOURNAL FORMAT -f options. Use include or concatenate the files instead. Assertions and commodities - The asserted balance must be a simple single-commodity amount, and in - fact the assertion checks only this commodity's balance within the - (possibly multi-commodity) account balance. This is how assertions + The asserted balance must be a simple single-commodity amount, and in + fact the assertion checks only this commodity's balance within the + (possibly multi-commodity) account balance. This is how assertions work in Ledger also. We could call this a "partial" balance assertion. To assert the balance of more than one commodity in an account, you can write multiple postings, each asserting one commodity's balance. - You can make a stronger "total" balance assertion by writing a double + You can make a stronger "total" balance assertion by writing a double equals sign (== EXPECTEDBALANCE). This asserts that there are no other unasserted commodities in the account (or, that their balance is 0). @@ -4871,7 +5005,7 @@ JOURNAL FORMAT a 0 == $1 It's not yet possible to make a complete assertion about a balance that - has multiple commodities. One workaround is to isolate each commodity + has multiple commodities. One workaround is to isolate each commodity into its own subaccount: 2013/1/1 @@ -4885,21 +5019,21 @@ JOURNAL FORMAT a:euro 0 == 1EUR Assertions and prices - Balance assertions ignore transaction prices, and should normally be + Balance assertions ignore transaction prices, and should normally be written without one: 2019/1/1 (a) $1 @ EUR1 = $1 - We do allow prices to be written there, however, and print shows them, - even though they don't affect whether the assertion passes or fails. - This is for backward compatibility (hledger's close command used to - generate balance assertions with prices), and because balance assign- + We do allow prices to be written there, however, and print shows them, + even though they don't affect whether the assertion passes or fails. + This is for backward compatibility (hledger's close command used to + generate balance assertions with prices), and because balance assign- ments do use them (see below). Assertions and subaccounts - The balance assertions above (= and ==) do not count the balance from - subaccounts; they check the account's exclusive balance only. You can + The balance assertions above (= and ==) do not count the balance from + subaccounts; they check the account's exclusive balance only. You can assert the balance including subaccounts by writing =* or ==*, eg: 2019/1/1 @@ -4913,16 +5047,16 @@ JOURNAL FORMAT tual. They are not affected by the --real/-R flag or real: query. Assertions and precision - Balance assertions compare the exactly calculated amounts, which are - not always what is shown by reports. Eg a commodity directive may - limit the display precision, but this will not affect balance asser- + Balance assertions compare the exactly calculated amounts, which are + not always what is shown by reports. Eg a commodity directive may + limit the display precision, but this will not affect balance asser- tions. Balance assertion failure messages show exact amounts. Balance assignments - Ledger-style balance assignments are also supported. These are like - balance assertions, but with no posting amount on the left side of the - equals sign; instead it is calculated automatically so as to satisfy - the assertion. This can be a convenience during data entry, eg when + Ledger-style balance assignments are also supported. These are like + balance assertions, but with no posting amount on the left side of the + equals sign; instead it is calculated automatically so as to satisfy + the assertion. This can be a convenience during data entry, eg when setting opening balances: ; starting a new journal, set asset account balances @@ -4940,14 +5074,14 @@ JOURNAL FORMAT expenses:misc The calculated amount depends on the account's balance in the commodity - at that point (which depends on the previously-dated postings of the - commodity to that account since the last balance assertion or assign- + at that point (which depends on the previously-dated postings of the + commodity to that account since the last balance assertion or assign- ment). Note that using balance assignments makes your journal a little less explicit; to know the exact amount posted, you have to run hledger or do the calculations yourself, instead of just reading it. Balance assignments and prices - A transaction price in a balance assignment will cause the calculated + A transaction price in a balance assignment will cause the calculated amount to have that price attached: 2019/1/1 @@ -4958,24 +5092,24 @@ JOURNAL FORMAT (a) $1 @ EUR2 = $1 @ EUR2 Directives - A directive is a line in the journal beginning with a special keyword, + A directive is a line in the journal beginning with a special keyword, that influences how the journal is processed, how things are displayed, - and so on. hledger's directives are based on (a subset of) Ledger's, - but there are many differences, and also some differences between + and so on. hledger's directives are based on (a subset of) Ledger's, + but there are many differences, and also some differences between hledger versions. Here are some more definitions: - o subdirective - Some directives support subdirectives, written + o subdirective - Some directives support subdirectives, written indented below the parent directive. - o decimal mark - The character to interpret as a decimal mark (period + o decimal mark - The character to interpret as a decimal mark (period or comma) when parsing amounts of a commodity. o display style - How to display amounts of a commodity in output: sym- bol side and spacing, digit groups, decimal mark, and number of deci- mal places. - Directives are not required when starting out with hledger, but you - will probably add some as your needs grow. Here is an overview of + Directives are not required when starting out with hledger, but you + will probably add some as your needs grow. Here is an overview of directives by purpose: @@ -4985,17 +5119,17 @@ JOURNAL FORMAT ----------------------------------------------------------------------------- READING/GENERATING DATA: Declare a commodity's or file's commodity, D, decimal- - decimal mark to help parse mark + decimal mark to help parse mark amounts accurately - Apply changes to the data while alias, apply account, --alias + Apply changes to the data while alias, apply account, --alias parsing comment, D, Y Inline extra data files include multiple -f/--file's - Generate extra transactions or ~ + Generate extra transactions or ~ budget goals Generate extra postings = CHECKING FOR ERRORS: - Define valid entities to allow account, commodity, + Define valid entities to allow account, commodity, stricter error checking payee DISPLAYING REPORTS: Declare accounts' display order account @@ -5006,79 +5140,78 @@ JOURNAL FORMAT And here are all the directives and their precise effects: - direc- effects ends tive at file end? ---------------------------------------------------------------------------------- - account Declares an account, for checking all entries in all files; - and its display order and type, for reports. Subdirectives: + account Declares an account, for checking all entries in all files; + and its display order and type, for reports. Subdirectives: any text, ignored. - alias Rewrites account names, in following entries until end of Y + alias Rewrites account names, in following entries until end of Y current file or end aliases. - apply Prepends a common parent account to all account names, in Y - account following entries until end of current file or end apply + apply Prepends a common parent account to all account names, in Y + account following entries until end of current file or end apply account. - comment Ignores part of the journal file, until end of current file Y + comment Ignores part of the journal file, until end of current file Y or end comment. - commod- Declares a commodity, for checking all entries in all files; N, Y - ity the decimal mark for parsing amounts of this commodity, for - following entries until end of current file; and its display + commod- Declares a commodity, for checking all entries in all files; N, Y + ity the decimal mark for parsing amounts of this commodity, for + following entries until end of current file; and its display style, for reports. Takes precedence over D. Subdirectives: format (alternate syntax). - D Sets a default commodity to use for no-symbol amounts, and Y - its decimal mark for parsing amounts of this commodity in - following entries until end of current file; and its display + D Sets a default commodity to use for no-symbol amounts, and Y + its decimal mark for parsing amounts of this commodity in + following entries until end of current file; and its display style, for reports. - deci- Declares the decimal mark, for parsing amounts of all com- Y - mal- modities in following entries until next decimal-mark or end - mark of current file. Included files can override. Takes prece- + deci- Declares the decimal mark, for parsing amounts of all com- Y + mal- modities in following entries until next decimal-mark or end + mark of current file. Included files can override. Takes prece- dence over commodity and D. include Includes entries and directives from another file, as if they were written inline. payee Declares a payee name, for checking all entries in all files. - P Declares a market price for a commodity on some date, for + P Declares a market price for a commodity on some date, for valuation reports. - Y Declares a year for yearless dates, for following entries Y + Y Declares a year for yearless dates, for following entries Y until end of current file. - ~ Declares a periodic transaction rule that generates future - (tilde) transactions with --forecast and budget goals with balance + ~ Declares a periodic transaction rule that generates future + (tilde) transactions with --forecast and budget goals with balance --budget. - = Declares an auto posting rule that generates extra postings partly - (equals) on matched transactions with --auto, in current, parent, and + = Declares an auto posting rule that generates extra postings partly + (equals) on matched transactions with --auto, in current, parent, and child files (but not sibling files, see #1212). Directives and multiple files - If you use multiple -f/--file options, or the include directive, + If you use multiple -f/--file options, or the include directive, hledger will process multiple input files. But directives which affect - input typically have effect only until the end of the file in which + input typically have effect only until the end of the file in which they occur (and on any included files in that region). This may seem inconvenient, but it's intentional; it makes reports sta- - ble and deterministic, independent of the order of input. Otherwise - you could see different numbers if you happened to write -f options in - a different order, or if you moved includes around while cleaning up + ble and deterministic, independent of the order of input. Otherwise + you could see different numbers if you happened to write -f options in + a different order, or if you moved includes around while cleaning up your files. - It can be surprising though; for example, it means that alias direc- + It can be surprising though; for example, it means that alias direc- tives do not affect parent or sibling files (see below). Comment blocks - A line containing just comment starts a commented region of the file, + A line containing just comment starts a commented region of the file, and a line containing just end comment (or the end of the current file) ends it. See also comments. Including other files - You can pull in the content of additional files by writing an include + You can pull in the content of additional files by writing an include directive, like this: include FILEPATH - Only journal files can include, and only journal, timeclock or timedot + Only journal files can include, and only journal, timeclock or timedot files can be included (not CSV files, currently). - If the file path does not begin with a slash, it is relative to the + If the file path does not begin with a slash, it is relative to the current file's folder. A tilde means home directory, eg: include ~/main.journal. @@ -5086,18 +5219,18 @@ JOURNAL FORMAT The path may contain glob patterns to match multiple files, eg: include *.journal. - There is limited support for recursive wildcards: **/ (the slash is - required) matches 0 or more subdirectories. It's not super convenient - since you have to avoid include cycles and including directories, but + There is limited support for recursive wildcards: **/ (the slash is + required) matches 0 or more subdirectories. It's not super convenient + since you have to avoid include cycles and including directories, but this can be done, eg: include */**/*.journal. The path may also be prefixed to force a specific file format, overrid- - ing the file extension (as described in hledger.1 -> Input files): + ing the file extension (as described in hledger.1 -> Input files): include timedot:~/notes/2020*.md. Default year - You can set a default year to be used for subsequent dates which don't - specify a year. This is a line beginning with Y followed by the year. + You can set a default year to be used for subsequent dates which don't + specify a year. This is a line beginning with Y followed by the year. Eg: Y2009 ; set default year to 2009 @@ -5117,9 +5250,9 @@ JOURNAL FORMAT assets Declaring payees - The payee directive can be used to declare a limited set of payees - which may appear in transaction descriptions. The "payees" check will - report an error if any transaction refers to a payee that has not been + The payee directive can be used to declare a limited set of payees + which may appear in transaction descriptions. The "payees" check will + report an error if any transaction refers to a payee that has not been declared. Eg: payee Whole Foods @@ -5135,36 +5268,36 @@ JOURNAL FORMAT decimal-mark , - This prevents any ambiguity when parsing numbers in the file, so we - recommend it, especially if the file contains digit group marks (eg + This prevents any ambiguity when parsing numbers in the file, so we + recommend it, especially if the file contains digit group marks (eg thousands separators). Declaring commodities - You can use commodity directives to declare your commodities. In fact + You can use commodity directives to declare your commodities. In fact the commodity directive performs several functions at once: - 1. It declares commodities which may be used in the journal. This can - optionally be enforced, providing useful error checking. (Cf Com- + 1. It declares commodities which may be used in the journal. This can + optionally be enforced, providing useful error checking. (Cf Com- modity error checking) - 2. It declares which decimal mark character (period or comma), to - expect when parsing input - useful to disambiguate international - number formats in your data. Without this, hledger will parse both + 2. It declares which decimal mark character (period or comma), to + expect when parsing input - useful to disambiguate international + number formats in your data. Without this, hledger will parse both 1,000 and 1.000 as 1. (Cf Amounts) - 3. It declares how to render the commodity's amounts when displaying + 3. It declares how to render the commodity's amounts when displaying output - the decimal mark, any digit group marks, the number of dec- - imal places, symbol placement and so on. (Cf Commodity display + imal places, symbol placement and so on. (Cf Commodity display style) - You will run into one of the problems solved by commodity directives + You will run into one of the problems solved by commodity directives sooner or later, so we recommend using them, for robust and predictable parsing and display. - Generally you should put them at the top of your journal file (since + Generally you should put them at the top of your journal file (since for function 2, they affect only following amounts, cf #793). - A commodity directive is just the word commodity followed by a sample + A commodity directive is just the word commodity followed by a sample amount, like this: ;commodity SAMPLEAMOUNT @@ -5172,8 +5305,8 @@ JOURNAL FORMAT commodity $1000.00 commodity 1,000.0000 AAAA ; optional same-line comment - It may also be written on multiple lines, and use the format subdirec- - tive, as in Ledger. Note in this case the commodity symbol appears + It may also be written on multiple lines, and use the format subdirec- + tive, as in Ledger. Note in this case the commodity symbol appears twice; it must be the same in both places: ;commodity SYMBOL @@ -5185,11 +5318,11 @@ JOURNAL FORMAT commodity INR format INR 1,00,00,000.00 - Remember that if the commodity symbol contains spaces, numbers, or + Remember that if the commodity symbol contains spaces, numbers, or punctuation, it must be enclosed in double quotes (cf Commodity). - The amount's quantity does not matter; only the format is significant. - It must include a decimal mark - either a period or a comma - followed + The amount's quantity does not matter; only the format is significant. + It must include a decimal mark - either a period or a comma - followed by 0 or more decimal digits. A few more examples: @@ -5200,29 +5333,29 @@ JOURNAL FORMAT commodity INR 9,99,99,999.0 commodity 1 000 000. - Note hledger normally uses banker's rounding, so 0.5 displayed with + Note hledger normally uses banker's rounding, so 0.5 displayed with zero decimal digits is "0". (More at Commodity display style.) - Even in the presence of commodity directives, the commodity display + Even in the presence of commodity directives, the commodity display style can still be overridden by supplying a command line option. Commodity error checking - In strict mode, enabled with the -s/--strict flag, hledger will report - an error if a commodity symbol is used that has not been declared by a - commodity directive. This works similarly to account error checking, + In strict mode, enabled with the -s/--strict flag, hledger will report + an error if a commodity symbol is used that has not been declared by a + commodity directive. This works similarly to account error checking, see the notes there for more details. Default commodity The D directive sets a default commodity, to be used for any subsequent - commodityless amounts (ie, plain numbers) seen while parsing the jour- - nal. This effect lasts until the next D directive, or the end of the + commodityless amounts (ie, plain numbers) seen while parsing the jour- + nal. This effect lasts until the next D directive, or the end of the journal. - For compatibility/historical reasons, D also acts like a commodity + For compatibility/historical reasons, D also acts like a commodity directive (setting the commodity's decimal mark for parsing and display style for output). - The syntax is D AMOUNT. As with commodity, the amount must include a + The syntax is D AMOUNT. As with commodity, the amount must include a decimal mark (either period or comma). Eg: ; commodity-less amounts should be treated as dollars @@ -5236,23 +5369,23 @@ JOURNAL FORMAT If both commodity and D directives are found for a commodity, commodity takes precedence for setting decimal mark and display style. - If you are using D and also checking commodities, you will need to add + If you are using D and also checking commodities, you will need to add a commodity directive similar to the D. (The hledger check commodities command expects commodity directives, and ignores D). Declaring market prices - The P directive declares a market price, which is an exchange rate + The P directive declares a market price, which is an exchange rate between two commodities on a certain date. (In Ledger, they are called - "historical prices".) These are often obtained from a stock exchange, + "historical prices".) These are often obtained from a stock exchange, cryptocurrency exchange, or the foreign exchange market. The format is: P DATE COMMODITY1SYMBOL COMMODITY2AMOUNT - DATE is a simple date, COMMODITY1SYMBOL is the symbol of the commodity - being priced, and COMMODITY2AMOUNT is the amount (symbol and quantity) - of commodity 2 that one unit of commodity 1 is worth on this date. + DATE is a simple date, COMMODITY1SYMBOL is the symbol of the commodity + being priced, and COMMODITY2AMOUNT is the amount (symbol and quantity) + of commodity 2 that one unit of commodity 1 is worth on this date. Examples: # one euro was worth $1.35 from 2009-01-01 onward: @@ -5261,69 +5394,69 @@ JOURNAL FORMAT # and $1.40 from 2010-01-01 onward: P 2010-01-01 EUR $1.40 - The -V, -X and --value flags use these market prices to show amount + The -V, -X and --value flags use these market prices to show amount values in another commodity. See Valuation. Declaring accounts account directives can be used to declare accounts (ie, the places that - amounts are transferred from and to). Though not required, these dec- + amounts are transferred from and to). Though not required, these dec- larations can provide several benefits: o They can document your intended chart of accounts, providing a refer- ence. - o They can help hledger know your accounts' types (asset, liability, - equity, revenue, expense), useful for reports like balancesheet and + o They can help hledger know your accounts' types (asset, liability, + equity, revenue, expense), useful for reports like balancesheet and incomestatement. - o They control account display order in reports, allowing non-alpha- + o They control account display order in reports, allowing non-alpha- betic sorting (eg Revenues to appear above Expenses). - o They can store extra information about accounts (account numbers, + o They can store extra information about accounts (account numbers, notes, etc.) - o They help with account name completion in the add command, hledger- + o They help with account name completion in the add command, hledger- iadd, hledger-web, ledger-mode etc. - o In strict mode, they restrict which accounts may be posted to by + o In strict mode, they restrict which accounts may be posted to by transactions, which helps detect typos. - The simplest form is just the word account followed by a hledger-style + The simplest form is just the word account followed by a hledger-style account name, eg this account directive declares the assets:bank:check- ing account: account assets:bank:checking Account error checking - By default, accounts come into existence when a transaction references - them by name. This is convenient, but it means hledger can't warn you + By default, accounts come into existence when a transaction references + them by name. This is convenient, but it means hledger can't warn you when you mis-spell an account name in the journal. Usually you'll find - the error later, as an extra account in balance reports, or an incor- + the error later, as an extra account in balance reports, or an incor- rect balance when reconciling. - In strict mode, enabled with the -s/--strict flag, hledger will report - an error if any transaction uses an account name that has not been + In strict mode, enabled with the -s/--strict flag, hledger will report + an error if any transaction uses an account name that has not been declared by an account directive. Some notes: - o The declaration is case-sensitive; transactions must use the correct + o The declaration is case-sensitive; transactions must use the correct account name capitalisation. - o The account directive's scope is "whole file and below" (see direc- + o The account directive's scope is "whole file and below" (see direc- tives). This means it affects all of the current file, and any files - it includes, but not parent or sibling files. The position of + it includes, but not parent or sibling files. The position of account directives within the file does not matter, though it's usual to put them at the top. - o Accounts can only be declared in journal files (but will affect + o Accounts can only be declared in journal files (but will affect included files in other formats). - o It's currently not possible to declare "all possible subaccounts" + o It's currently not possible to declare "all possible subaccounts" with a wildcard; every account posted to must be declared. Account comments Comments, beginning with a semicolon, can be added: - o on the same line, after two or more spaces (because ; is allowed in + o on the same line, after two or more spaces (because ; is allowed in account names) o on the next lines, indented @@ -5337,7 +5470,7 @@ JOURNAL FORMAT Same-line comments are not supported by Ledger, or hledger <1.13. Account subdirectives - We also allow (and ignore) Ledger-style indented subdirectives, just + We also allow (and ignore) Ledger-style indented subdirectives, just for compatibility.: account assets:bank:checking @@ -5350,9 +5483,10 @@ JOURNAL FORMAT [LEDGER-STYLE SUBDIRECTIVES, IGNORED] Account types - By adding a type tag to the account directive, with value A, L, E, R, - X, C (or if you prefer: Asset, Liability, Equity, Revenue, Expense, - Cash), you can declare hledger accounts to be of a certain type: + By adding a type tag to the account directive, with value A, L, E, R, + X, C, V (or if you prefer: Asset, Liability, Equity, Revenue, Expense, + Cash, Conversion), you can declare hledger accounts to be of a certain + type: o asset, liability, equity, revenue, expense the standard types in accounting, or @@ -5360,6 +5494,9 @@ JOURNAL FORMAT o cash a subtype of asset, used for liquid assets. + o conversion + a subtype of equity, used for conversion postings + Declaring account types is a good idea, since it helps enable the easy balancesheet, balancesheetequity, incomestatement and cashflow reports, and probably other things in future. As a convenience, when account