From c008903d1e553c0065e9871fcce4f3f1644f866a Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 31 May 2023 18:57:53 -1000 Subject: [PATCH] ;doc: update manuals --- hledger-ui/hledger-ui.1 | 7 +- hledger-ui/hledger-ui.info | 84 +- hledger-ui/hledger-ui.txt | 5 +- hledger-web/hledger-web.1 | 11 +- hledger-web/hledger-web.info | 56 +- hledger-web/hledger-web.txt | 224 ++-- hledger/hledger.1 | 99 +- hledger/hledger.info | 1336 +++++++++--------- hledger/hledger.txt | 2451 +++++++++++++++++----------------- 9 files changed, 2094 insertions(+), 2179 deletions(-) diff --git a/hledger-ui/hledger-ui.1 b/hledger-ui/hledger-ui.1 index 37bbc1b76..048c9c22d 100644 --- a/hledger-ui/hledger-ui.1 +++ b/hledger-ui/hledger-ui.1 @@ -8,11 +8,14 @@ hledger-ui - robust, friendly plain text accounting (TUI version) .SH SYNOPSIS .PP -\f[V]hledger-ui [OPTIONS] [QUERYARGS]\f[R] +\f[V]hledger-ui [OPTS] [QUERYARGS] # run directly\f[R] +.PD 0 +.P +.PD +\f[V]hledger ui -- [OPTS] [QUERYARGS] # run from hledger\f[R] .PD 0 .P .PD -\f[V]hledger ui -- [OPTIONS] [QUERYARGS]\f[R] .SH DESCRIPTION .PP This manual is for hledger\[aq]s terminal interface, version 1.29.99. diff --git a/hledger-ui/hledger-ui.info b/hledger-ui/hledger-ui.info index 29a66eec5..4d1855bed 100644 --- a/hledger-ui/hledger-ui.info +++ b/hledger-ui/hledger-ui.info @@ -13,8 +13,8 @@ hledger-ui(1) hledger-ui - robust, friendly plain text accounting (TUI version) - 'hledger-ui [OPTIONS] [QUERYARGS]' -'hledger ui -- [OPTIONS] [QUERYARGS]' + 'hledger-ui [OPTS] [QUERYARGS] # run directly' +'hledger ui -- [OPTS] [QUERYARGS] # run from hledger' This manual is for hledger's terminal interface, version 1.29.99. See also the hledger manual for common concepts and file formats. @@ -665,46 +665,46 @@ above).  Tag Table: Node: Top223 -Node: OPTIONS1838 -Ref: #options1936 -Node: General help options2959 -Ref: #general-help-options3108 -Node: General input options3390 -Ref: #general-input-options3575 -Node: General reporting options4277 -Ref: #general-reporting-options4441 -Node: MOUSE7831 -Ref: #mouse7926 -Node: KEYS8163 -Ref: #keys8256 -Node: SCREENS12769 -Ref: #screens12867 -Node: Menu13447 -Ref: #menu13540 -Node: Cash accounts13735 -Ref: #cash-accounts13877 -Node: Balance sheet accounts14061 -Ref: #balance-sheet-accounts14242 -Node: Income statement accounts14362 -Ref: #income-statement-accounts14548 -Node: All accounts14712 -Ref: #all-accounts14858 -Node: Register15040 -Ref: #register15164 -Node: Transaction17126 -Ref: #transaction17249 -Node: Error18666 -Ref: #error18760 -Node: TIPS19004 -Ref: #tips19103 -Node: Watch mode19145 -Ref: #watch-mode19252 -Node: Debug output20711 -Ref: #debug-output20822 -Node: ENVIRONMENT21034 -Ref: #environment21144 -Node: BUGS21335 -Ref: #bugs21418 +Node: OPTIONS1866 +Ref: #options1964 +Node: General help options2987 +Ref: #general-help-options3136 +Node: General input options3418 +Ref: #general-input-options3603 +Node: General reporting options4305 +Ref: #general-reporting-options4469 +Node: MOUSE7859 +Ref: #mouse7954 +Node: KEYS8191 +Ref: #keys8284 +Node: SCREENS12797 +Ref: #screens12895 +Node: Menu13475 +Ref: #menu13568 +Node: Cash accounts13763 +Ref: #cash-accounts13905 +Node: Balance sheet accounts14089 +Ref: #balance-sheet-accounts14270 +Node: Income statement accounts14390 +Ref: #income-statement-accounts14576 +Node: All accounts14740 +Ref: #all-accounts14886 +Node: Register15068 +Ref: #register15192 +Node: Transaction17154 +Ref: #transaction17277 +Node: Error18694 +Ref: #error18788 +Node: TIPS19032 +Ref: #tips19131 +Node: Watch mode19173 +Ref: #watch-mode19280 +Node: Debug output20739 +Ref: #debug-output20850 +Node: ENVIRONMENT21062 +Ref: #environment21172 +Node: BUGS21363 +Ref: #bugs21446  End Tag Table diff --git a/hledger-ui/hledger-ui.txt b/hledger-ui/hledger-ui.txt index 2cc8d4cb2..702fd0188 100644 --- a/hledger-ui/hledger-ui.txt +++ b/hledger-ui/hledger-ui.txt @@ -7,9 +7,8 @@ NAME hledger-ui - robust, friendly plain text accounting (TUI version) SYNOPSIS - hledger-ui [OPTIONS] [QUERYARGS] - hledger ui -- [OPTIONS] [QUERYARGS] - + hledger-ui [OPTS] [QUERYARGS] # run directly + hledger ui -- [OPTS] [QUERYARGS] # run from hledger DESCRIPTION This manual is for hledger's terminal interface, version 1.29.99. See also the hledger manual for common concepts and file formats. diff --git a/hledger-web/hledger-web.1 b/hledger-web/hledger-web.1 index 9ebb3ac81..2412e86c6 100644 --- a/hledger-web/hledger-web.1 +++ b/hledger-web/hledger-web.1 @@ -8,19 +8,22 @@ hledger-web - robust, friendly plain text accounting (Web version) .SH SYNOPSIS .PP -\f[V]hledger-web [OPTIONS] # run temporarily & browse\f[R] +\f[V]hledger-web [OPTS] [ARGS] # run temporarily & open browser\f[R] .PD 0 .P .PD -\f[V]hledger-web --serve [OPTIONS] # run without stopping\f[R] +\f[V]hledger-web --serve [OPTS] [ARGS] # run without stopping\f[R] .PD 0 .P .PD -\f[V]hledger-web --serve-api [OPTIONS] # run JSON server only\f[R] +\f[V]hledger-web --serve-api [OPTS] [ARGS] # run HTTP JSON server only\f[R] +.PD 0 +.P +.PD +\f[V]hledger web -- [OPTS] [ARGS] # run from hledger\f[R] .PD 0 .P .PD -\f[V]hledger web -- [OPTIONS] [QUERYARGS]\f[R] # start from hledger .SH DESCRIPTION .PP This manual is for hledger\[aq]s web interface, version 1.29.99. diff --git a/hledger-web/hledger-web.info b/hledger-web/hledger-web.info index d25b9666b..43144d31e 100644 --- a/hledger-web/hledger-web.info +++ b/hledger-web/hledger-web.info @@ -13,10 +13,10 @@ hledger-web(1) hledger-web - robust, friendly plain text accounting (Web version) - 'hledger-web [OPTIONS] # run temporarily & browse' -'hledger-web --serve [OPTIONS] # run without stopping' -'hledger-web --serve-api [OPTIONS] # run JSON server only' -'hledger web -- [OPTIONS] [QUERYARGS]' # start from hledger + 'hledger-web [OPTS] [ARGS] # run temporarily & open browser' +'hledger-web --serve [OPTS] [ARGS] # run without stopping' +'hledger-web --serve-api [OPTS] [ARGS] # run HTTP JSON server only' +'hledger web -- [OPTS] [ARGS] # run from hledger' This manual is for hledger's web interface, version 1.29.99. See also the hledger manual for common concepts and file formats. @@ -648,30 +648,30 @@ http://bugs.hledger.org), or on the #hledger chat or hledger mail list  Tag Table: Node: Top225 -Node: OPTIONS2702 -Ref: #options2807 -Node: General help options6118 -Ref: #general-help-options6268 -Node: General input options6550 -Ref: #general-input-options6736 -Node: General reporting options7438 -Ref: #general-reporting-options7603 -Node: PERMISSIONS10993 -Ref: #permissions11132 -Node: EDITING UPLOADING DOWNLOADING12344 -Ref: #editing-uploading-downloading12525 -Node: RELOADING13359 -Ref: #reloading13493 -Node: JSON API13926 -Ref: #json-api14041 -Node: DEBUG OUTPUT19529 -Ref: #debug-output19654 -Node: Debug output19681 -Ref: #debug-output-119782 -Node: ENVIRONMENT20199 -Ref: #environment20318 -Node: BUGS20435 -Ref: #bugs20519 +Node: OPTIONS2715 +Ref: #options2820 +Node: General help options6131 +Ref: #general-help-options6281 +Node: General input options6563 +Ref: #general-input-options6749 +Node: General reporting options7451 +Ref: #general-reporting-options7616 +Node: PERMISSIONS11006 +Ref: #permissions11145 +Node: EDITING UPLOADING DOWNLOADING12357 +Ref: #editing-uploading-downloading12538 +Node: RELOADING13372 +Ref: #reloading13506 +Node: JSON API13939 +Ref: #json-api14054 +Node: DEBUG OUTPUT19542 +Ref: #debug-output19667 +Node: Debug output19694 +Ref: #debug-output-119795 +Node: ENVIRONMENT20212 +Ref: #environment20331 +Node: BUGS20448 +Ref: #bugs20532  End Tag Table diff --git a/hledger-web/hledger-web.txt b/hledger-web/hledger-web.txt index 0347e4d3e..de49b9624 100644 --- a/hledger-web/hledger-web.txt +++ b/hledger-web/hledger-web.txt @@ -7,47 +7,47 @@ NAME hledger-web - robust, friendly plain text accounting (Web version) SYNOPSIS - hledger-web [OPTIONS] # run temporarily & browse - hledger-web --serve [OPTIONS] # run without stopping - hledger-web --serve-api [OPTIONS] # run JSON server only - hledger web -- [OPTIONS] [QUERYARGS] # start from hledger - + hledger-web [OPTS] [ARGS] # run temporarily & open + browser + hledger-web --serve [OPTS] [ARGS] # run without stopping + hledger-web --serve-api [OPTS] [ARGS] # run HTTP JSON server only + hledger web -- [OPTS] [ARGS] # run from hledger DESCRIPTION - This manual is for hledger's web interface, version 1.29.99. See also + This manual is for hledger's web interface, version 1.29.99. See also the hledger manual for common concepts and file formats. - hledger is a robust, user-friendly, cross-platform set of programs for - tracking money, time, or any other commodity, using double-entry ac- - counting and a simple, editable file format. hledger is inspired by - and largely compatible with ledger(1), and largely interconvertible + hledger is a robust, user-friendly, cross-platform set of programs for + tracking money, time, or any other commodity, using double-entry ac- + counting and a simple, editable file format. hledger is inspired by + and largely compatible with ledger(1), and largely interconvertible with beancount(1). - hledger-web is a simple web application for browsing and adding trans- - actions. It provides a more user-friendly UI than the hledger CLI or - hledger-ui TUI, showing more at once (accounts, the current account + hledger-web is a simple web application for browsing and adding trans- + actions. It provides a more user-friendly UI than the hledger CLI or + hledger-ui TUI, showing more at once (accounts, the current account register, balance charts) and allowing history-aware data entry, inter- active searching, and bookmarking. - hledger-web also lets you share a journal with multiple users, or even - the public web. There is no access control, so if you need that you - should put it behind a suitable web proxy. As a small protection - against data loss when running an unprotected instance, it writes a + hledger-web also lets you share a journal with multiple users, or even + the public web. There is no access control, so if you need that you + should put it behind a suitable web proxy. As a small protection + against data loss when running an unprotected instance, it writes a numbered backup of the main journal file (only) on every edit. - Like hledger, it reads from (and appends to) a journal file specified - by the LEDGER_FILE environment variable (defaulting to - $HOME/.hledger.journal); or you can specify files with -f options. It - can also read timeclock files, timedot files, or any CSV/SSV/TSV file + Like hledger, it reads from (and appends to) a journal file specified + by the LEDGER_FILE environment variable (defaulting to + $HOME/.hledger.journal); or you can specify files with -f options. It + can also read timeclock files, timedot files, or any CSV/SSV/TSV file with a date field. (See hledger(1) -> Input for details.) hledger-web can be run in three modes: o Transient mode (the default): your default web browser will be opened - to show the app if possible, and the app exits automatically after - two minutes of inactivity (no requests received and no open browser + to show the app if possible, and the app exits automatically after + two minutes of inactivity (no requests received and no open browser windows viewing it). - o With --serve: the app runs without stopping, and without opening a + o With --serve: the app runs without stopping, and without opening a browser. o With --serve-api: only the JSON API is served. @@ -57,7 +57,7 @@ DESCRIPTION OPTIONS Command-line options and arguments may be used to set an initial filter - on the data. These filter options are not shown in the web UI, but it + on the data. These filter options are not shown in the web UI, but it will be applied in addition to any search query entered there. hledger-web provides the following options: @@ -66,7 +66,7 @@ OPTIONS serve and log requests, don't browse or auto-exit after timeout --serve-api - like --serve, but serve only the JSON web API, without the + like --serve, but serve only the JSON web API, without the server-side web UI --host=IPADDR @@ -76,61 +76,61 @@ OPTIONS listen on this TCP port (default: 5000) --socket=SOCKETFILE - use a unix domain socket file to listen for requests instead of - a TCP socket. Implies --serve. It can only be used if the op- + use a unix domain socket file to listen for requests instead of + a TCP socket. Implies --serve. It can only be used if the op- erating system can provide this type of socket. --base-url=URL - set the base url (default: http://IPADDR:PORT). Note: affects - url generation but not route parsing. Can be useful if running + set the base url (default: http://IPADDR:PORT). Note: affects + url generation but not route parsing. Can be useful if running behind a reverse web proxy that does path rewriting. --file-url=URL set the static files url (default: BASEURL/static). hledger-web - normally serves static files itself, but if you wanted to serve - them from another server for efficiency, you would set the url + normally serves static files itself, but if you wanted to serve + them from another server for efficiency, you would set the url with this. --capabilities=CAP[,CAP..] - enable the view, add, and/or manage capabilities (default: + enable the view, add, and/or manage capabilities (default: view,add) --capabilities-header=HTTPHEADER - read capabilities to enable from a HTTP header, like X-Sand- + read capabilities to enable from a HTTP header, like X-Sand- storm-Permissions (default: disabled) - --test run hledger-web's tests and exit. hspec test runner args may + --test run hledger-web's tests and exit. hspec test runner args may follow a --, eg: hledger-web --test -- --help - By default the server listens on IP address 127.0.0.1, accessible only - to local requests. You can use --host to change this, eg --host + By default the server listens on IP address 127.0.0.1, accessible only + to local requests. You can use --host to change this, eg --host 0.0.0.0 to listen on all configured addresses. - Similarly, use --port to set a TCP port other than 5000, eg if you are + Similarly, use --port to set a TCP port other than 5000, eg if you are running multiple hledger-web instances. Both of these options are ignored when --socket is used. In this case, - it creates an AF_UNIX socket file at the supplied path and uses that - for communication. This is an alternative way of running multiple - hledger-web instances behind a reverse proxy that handles authentica- - tion for different users. The path can be derived in a predictable + it creates an AF_UNIX socket file at the supplied path and uses that + for communication. This is an alternative way of running multiple + hledger-web instances behind a reverse proxy that handles authentica- + tion for different users. The path can be derived in a predictable way, eg by using the username within the path. As an example, nginx as - reverse proxy can use the variable $remote_user to derive a path from - the username used in a HTTP basic authentication. The following - proxy_pass directive allows access to all hledger-web instances that + reverse proxy can use the variable $remote_user to derive a path from + the username used in a HTTP basic authentication. The following + proxy_pass directive allows access to all hledger-web instances that created a socket in /tmp/hledger/: proxy_pass http://unix:/tmp/hledger/${remote_user}.socket; - You can use --base-url to change the protocol, hostname, port and path + You can use --base-url to change the protocol, hostname, port and path that appear in hyperlinks, useful eg for integrating hledger-web within - a larger website. The default is http://HOST:PORT/ using the server's + a larger website. The default is http://HOST:PORT/ using the server's configured host address and TCP port (or http://HOST if PORT is 80). - With --file-url you can set a different base url for static files, eg + With --file-url you can set a different base url for static files, eg for better caching or cookie-less serving on high performance websites. - hledger-web also supports many of hledger's general options (and the + hledger-web also supports many of hledger's general options (and the hledger manual's command line tips also apply here): General help options @@ -153,7 +153,7 @@ OPTIONS $LEDGER_FILE or $HOME/.hledger.journal) --rules-file=RULESFILE - Conversion rules file to use when reading CSV (default: + Conversion rules file to use when reading CSV (default: FILE.rules) --separator=CHAR @@ -172,7 +172,7 @@ OPTIONS assignments) -s --strict - do extra error checking (check that all posted accounts are de- + do extra error checking (check that all posted accounts are de- clared) General reporting options @@ -200,7 +200,7 @@ OPTIONS multiperiod/multicolumn report by year -p --period=PERIODEXP - set start date, end date, and/or reporting interval all at once + set start date, end date, and/or reporting interval all at once using period expressions syntax --date2 @@ -208,7 +208,7 @@ OPTIONS fects) --today=DATE - override today's date (affects relative smart dates, for + override today's date (affects relative smart dates, for tests/examples) -U --unmarked @@ -227,21 +227,21 @@ OPTIONS hide/aggregate accounts or postings more than NUM levels deep -E --empty - show items with zero amount, normally hidden (and vice-versa in + show items with zero amount, normally hidden (and vice-versa in hledger-ui/hledger-web) -B --cost convert amounts to their cost/selling amount at transaction time -V --market - convert amounts to their market value in default valuation com- + convert amounts to their market value in default valuation com- modities -X --exchange=COMM convert amounts to their market value in commodity COMM --value - convert amounts to cost or market value, more flexibly than + convert amounts to cost or market value, more flexibly than -B/-V/-X --infer-equity @@ -251,38 +251,38 @@ OPTIONS infer costs from conversion equity postings --infer-market-prices - use costs as additional market prices, as if they were P direc- + use costs as additional market prices, as if they were P direc- tives --forecast - generate transactions from periodic rules, between the latest - recorded txn and 6 months from today, or during the specified - PERIOD (= is required). Auto posting rules will be applied to - these transactions as well. Also, in hledger-ui make future- + generate transactions from periodic rules, between the latest + recorded txn and 6 months from today, or during the specified + PERIOD (= is required). Auto posting rules will be applied to + these transactions as well. Also, in hledger-ui make future- dated transactions visible. - --auto generate extra postings by applying auto posting rules to all + --auto generate extra postings by applying auto posting rules to all txns (not just forecast txns) --verbose-tags - add visible tags indicating transactions or postings which have + add visible tags indicating transactions or postings which have been generated/modified --commodity-style - Override the commodity style in the output for the specified + Override the commodity style in the output for the specified commodity. For example 'EUR1.000,00'. --color=WHEN (or --colour=WHEN) - Should color-supporting commands use ANSI color codes in text - output. 'auto' (default): whenever stdout seems to be a color- - supporting terminal. 'always' or 'yes': always, useful eg when - piping output into 'less -R'. 'never' or 'no': never. A + Should color-supporting commands use ANSI color codes in text + output. 'auto' (default): whenever stdout seems to be a color- + supporting terminal. 'always' or 'yes': always, useful eg when + piping output into 'less -R'. 'never' or 'no': never. A NO_COLOR environment variable overrides this. --pretty[=WHEN] - Show prettier output, e.g. using unicode box-drawing charac- - ters. Accepts 'yes' (the default) or 'no' ('y', 'n', 'always', - 'never' also work). If you provide an argument you must use + Show prettier output, e.g. using unicode box-drawing charac- + ters. Accepts 'yes' (the default) or 'no' ('y', 'n', 'always', + 'never' also work). If you provide an argument you must use '=', e.g. '--pretty=yes'. When a reporting option appears more than once in the command line, the @@ -291,13 +291,13 @@ OPTIONS Some reporting options can also be written as query arguments. PERMISSIONS - By default, hledger-web allows anyone who can reach it to view the + By default, hledger-web allows anyone who can reach it to view the journal and to add new transactions, but not to change existing data. You can restrict who can reach it by - o setting the IP address it listens on (see --host above). By default - it listens on 127.0.0.1, accessible to all users on the local ma- + o setting the IP address it listens on (see --host above). By default + it listens on 127.0.0.1, accessible to all users on the local ma- chine. o putting it behind an authenticating proxy, using eg apache or nginx @@ -307,44 +307,44 @@ PERMISSIONS You can restrict what the users who reach it can do, by o using the --capabilities=CAP[,CAP..] flag when you start it, enabling - one or more of the following capabilities. The default value is + one or more of the following capabilities. The default value is view,add: o view - allows viewing the journal file and all included files o add - allows adding new transactions to the main journal file - o manage - allows editing, uploading or downloading the main or in- + o manage - allows editing, uploading or downloading the main or in- cluded files - o using the --capabilities-header=HTTPHEADER flag to specify a HTTP - header from which it will read capabilities to enable. hledger-web - on Sandstorm uses the X-Sandstorm-Permissions header to integrate + o using the --capabilities-header=HTTPHEADER flag to specify a HTTP + header from which it will read capabilities to enable. hledger-web + on Sandstorm uses the X-Sandstorm-Permissions header to integrate with Sandstorm's permissions. This is disabled by default. EDITING, UPLOADING, DOWNLOADING - If you enable the manage capability mentioned above, you'll see a new - "spanner" button to the right of the search form. Clicking this will - let you edit, upload, or download the journal file or any files it in- + If you enable the manage capability mentioned above, you'll see a new + "spanner" button to the right of the search form. Clicking this will + let you edit, upload, or download the journal file or any files it in- cludes. - Note, unlike any other hledger command, in this mode you (or any visi- + Note, unlike any other hledger command, in this mode you (or any visi- tor) can alter or wipe the data files. - Normally whenever a file is changed in this way, hledger-web saves a - numbered backup (assuming file permissions allow it, the disk is not - full, etc.) hledger-web is not aware of version control systems, cur- - rently; if you use one, you'll have to arrange to commit the changes + Normally whenever a file is changed in this way, hledger-web saves a + numbered backup (assuming file permissions allow it, the disk is not + full, etc.) hledger-web is not aware of version control systems, cur- + rently; if you use one, you'll have to arrange to commit the changes yourself (eg with a cron job or a file watcher like entr). - Changes which would leave the journal file(s) unparseable or non-valid - (eg with failing balance assertions) are prevented. (Probably. This + Changes which would leave the journal file(s) unparseable or non-valid + (eg with failing balance assertions) are prevented. (Probably. This needs re-testing.) RELOADING hledger-web detects changes made to the files by other means (eg if you - edit it directly, outside of hledger-web), and it will show the new - data when you reload the page or navigate to a new page. If a change + edit it directly, outside of hledger-web), and it will show the new + data when you reload the page or navigate to a new page. If a change makes a file unparseable, hledger-web will display an error message un- til the file has been fixed. @@ -352,8 +352,8 @@ RELOADING that both machine clocks are roughly in step.) JSON API - In addition to the web UI, hledger-web also serves a JSON API that can - be used to get data or add new transactions. If you want the JSON API + In addition to the web UI, hledger-web also serves a JSON API that can + be used to get data or add new transactions. If you want the JSON API only, you can use the --serve-api flag. Eg: $ hledger-web -f examples/sample.journal --serve-api @@ -370,7 +370,7 @@ JSON API /accounttransactions/ACCOUNTNAME Eg, all account names in the journal (similar to the accounts command). - (hledger-web's JSON does not include newlines, here we use python to + (hledger-web's JSON does not include newlines, here we use python to prettify it): $ curl -s http://127.0.0.1:5000/accountnames | python -m json.tool @@ -411,25 +411,25 @@ JSON API "aprice": null, ... - Most of the JSON corresponds to hledger's data types; for details of - what the fields mean, see the Hledger.Data.Json haddock docs and click - on the various data types, eg Transaction. And for a higher level un- + Most of the JSON corresponds to hledger's data types; for details of + what the fields mean, see the Hledger.Data.Json haddock docs and click + on the various data types, eg Transaction. And for a higher level un- derstanding, see the journal docs. In some cases there is outer JSON corresponding to a "Report" type. To - understand that, go to the Hledger.Web.Handler.MiscR haddock and look - at the source for the appropriate handler to see what it returns. Eg + understand that, go to the Hledger.Web.Handler.MiscR haddock and look + at the source for the appropriate handler to see what it returns. Eg for /accounttransactions it's getAccounttransactionsR, returning a "ac- - countTransactionsReport ...". Looking up the haddock for that we can - see that /accounttransactions returns an AccountTransactionsReport, - which consists of a report title and a list of AccountTransactionsRe- + countTransactionsReport ...". Looking up the haddock for that we can + see that /accounttransactions returns an AccountTransactionsReport, + which consists of a report title and a list of AccountTransactionsRe- portItem (etc). - You can add a new transaction to the journal with a PUT request to - /add, if hledger-web was started with the add capability (enabled by + You can add a new transaction to the journal with a PUT request to + /add, if hledger-web was started with the add capability (enabled by default). The payload must be the full, exact JSON representation of a - hledger transaction (partial data won't do). You can get sample JSON - from hledger-web's /transactions or /accounttransactions, or you can + hledger transaction (partial data won't do). You can get sample JSON + from hledger-web's /transactions or /accounttransactions, or you can export it with hledger-lib, eg like so: .../hledger$ stack ghci hledger-lib @@ -525,28 +525,28 @@ JSON API "tstatus": "Unmarked" } - And here's how to test adding it with curl. This should add a new en- + And here's how to test adding it with curl. This should add a new en- try to your journal: $ curl http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.json DEBUG OUTPUT Debug output - You can add --debug[=N] to the command line to log debug output. N + You can add --debug[=N] to the command line to log debug output. N ranges from 1 (least output, the default) to 9 (maximum output). Typi- - cally you would start with 1 and increase until you are seeing enough. - Debug output goes to stderr, interleaved with the requests logged on + cally you would start with 1 and increase until you are seeing enough. + Debug output goes to stderr, interleaved with the requests logged on stdout. To capture debug output in a log file instead, you can usually redirect stderr, eg: hledger-web --debug=3 2>hledger-web.log. ENVIRONMENT - LEDGER_FILE The main journal file to use when not specified with + LEDGER_FILE The main journal file to use when not specified with -f/--file. Default: $HOME/.hledger.journal. BUGS We welcome bug reports in the hledger issue tracker (shortcut: - http://bugs.hledger.org), or on the #hledger chat or hledger mail list + http://bugs.hledger.org), or on the #hledger chat or hledger mail list (https://hledger.org/support). Some known issues: diff --git a/hledger/hledger.1 b/hledger/hledger.1 index 388ef1825..1a97f402e 100644 --- a/hledger/hledger.1 +++ b/hledger/hledger.1 @@ -9,16 +9,19 @@ hledger - robust, friendly plain text accounting (CLI version) .SH SYNOPSIS .PP -\f[V]hledger\f[R] +\f[V]hledger # show commmands list\f[R] .PD 0 .P .PD -\f[V]hledger [-f FILE] COMMAND [OPTS] [ARGS]\f[R] +\f[V]hledger COMMAND [OPTS] [ARGS] # run built-in command\f[R] .PD 0 .P .PD -\f[V]hledger [-f FILE] ADDONCMD -- [OPTS] [ARGS]\f[R] -.SH INTRODUCTION +\f[V]hledger ADDONCMD -- [OPTS] [ARGS] # run add-on command from PATH\f[R] +.PD 0 +.P +.PD +.SH DESCRIPTION .PP hledger is a robust, user-friendly, cross-platform set of programs for tracking money, time, or any other commodity, using double-entry @@ -728,45 +731,10 @@ Eg: \f[V]hledger bal \[at]foo.args\f[R]. .PP Inside the argument file, each line should contain just one option or argument. -Also, don\[aq]t use spaces except inside quotes (or you\[aq]ll see a -confusing error). -Ie, write = (or nothing) between a flag and its argument. -Eg, bad: -.IP -.nf -\f[C] -assets -X USD -\f[R] -.fi -.PP -Good: -.IP -.nf -\f[C] -assets --X=USD -\f[R] -.fi -.PP +Don\[aq]t use spaces except inside quotes (or you\[aq]ll see a confusing +error); write \f[V]=\f[R] (or nothing) between a flag and its argument. For the special characters mentioned above, use one less level of quoting than you would at the command prompt. -Eg, bad: -.IP -.nf -\f[C] --X\[dq]$\[dq] -\f[R] -.fi -.PP -Good: -.IP -.nf -\f[C] --X$ -\f[R] -.fi -.PP -See also: Save frequently used options. .SH Output .SS Output destination .PP @@ -3719,31 +3687,24 @@ parentheses after an amount. hledger ignores these. .SS Virtual postings .PP -A posting with parentheses around the account name is called a -\f[I]virtual posting\f[R] or \f[I]unbalanced posting\f[R], which means -it is exempt from the usual rule that a transaction\[aq]s postings must -balance add up to zero. +A posting with parentheses around the account name +(\f[V](some:account)\f[R]) is called a \f[I]unbalanced virtual +posting\f[R]. +Such postings do not participate in transaction balancing. +(And if you write them without an amount, a zero amount is always +inferred.) +These can occasionally be convenient for special circumstances, but they +violate double entry bookkeeping and make your data less portable across +applications, so many people avoid using them at all. .PP -This is not part of double entry bookkeeping, 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: -.IP -.nf -\f[C] -2022-01-01 opening balances - (assets:checking) $1000 - (assets:savings) $2000 -\f[R] -.fi -.PP -A posting with brackets around the account name is called a -\f[I]balanced virtual posting\f[R]. -The balanced virtual postings in a transaction must add up to zero -(separately from other postings). -Eg: +A posting with brackets around the account name +(\f[V][some:account]\f[R]) is called a \f[I]balanced virtual +posting\f[R]. +The balanced virtual postings in a transaction must add up to zero, just +like ordinary postings, but separately from them. +These are not part of double entry bookkeeping either, but they are at +least balanced. +An example: .IP .nf \f[C] @@ -3757,14 +3718,10 @@ Eg: \f[R] .fi .PP -Postings whose account names are neither parenthesised nor bracketed are -called \f[I]real postings\f[R]. +Ordinary postings, whose account names are neither parenthesised nor +bracketed, are called \f[I]real postings\f[R]. You can exclude virtual postings from reports with the \f[V]-R/--real\f[R] flag or a \f[V]real:1\f[R] query. -.PP -Downsides: violates double entry bookkeeping, can be used to avoid -figuring out correct entries, makes your financial data less portable -and less trustworthy in an audit. .SS Other Ledger directives .PP These other Ledger directives are currently accepted but ignored. diff --git a/hledger/hledger.info b/hledger/hledger.info index f579d7c41..8dfed47da 100644 --- a/hledger/hledger.info +++ b/hledger/hledger.info @@ -13,9 +13,9 @@ hledger(1) hledger - robust, friendly plain text accounting (CLI version) - 'hledger' -'hledger [-f FILE] COMMAND [OPTS] [ARGS]' -'hledger [-f FILE] ADDONCMD -- [OPTS] [ARGS]' + 'hledger # show commmands list' +'hledger COMMAND [OPTS] [ARGS] # run built-in command' +'hledger ADDONCMD -- [OPTS] [ARGS] # run add-on command from PATH' hledger is a robust, user-friendly, cross-platform set of programs for tracking money, time, or any other commodity, using double-entry @@ -720,27 +720,10 @@ then reuse them by writing '@FILENAME' as a command line argument. Eg: 'hledger bal @foo.args'. Inside the argument file, each line should contain just one option or -argument. Also, don't use spaces except inside quotes (or you'll see a -confusing error). Ie, write = (or nothing) between a flag and its -argument. Eg, bad: - -assets -X USD - - Good: - -assets --X=USD - - For the special characters mentioned above, use one less level of -quoting than you would at the command prompt. Eg, bad: - --X"$" - - Good: - --X$ - - See also: Save frequently used options. +argument. Don't use spaces except inside quotes (or you'll see a +confusing error); write '=' (or nothing) between a flag and its +argument. For the special characters mentioned above, use one less +level of quoting than you would at the command prompt.  File: hledger.info, Node: Output, Next: Environment, Prev: Command line tips, Up: Top @@ -3428,22 +3411,19 @@ File: hledger.info, Node: Virtual postings, Next: Other Ledger directives, Pr 9.28.9 Virtual postings ----------------------- -A posting with parentheses around the account name is called a _virtual -posting_ or _unbalanced posting_, which means it is exempt from the -usual rule that a transaction's postings must balance add up to zero. +A posting with parentheses around the account name ('(some:account)') is +called a _unbalanced virtual posting_. Such postings do not participate +in transaction balancing. (And if you write them without an amount, a +zero amount is always inferred.) These can occasionally be convenient +for special circumstances, but they violate double entry bookkeeping and +make your data less portable across applications, so many people avoid +using them at all. - This is not part of double entry bookkeeping, 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: - -2022-01-01 opening balances - (assets:checking) $1000 - (assets:savings) $2000 - - A posting with brackets around the 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: + A posting with brackets around the account name ('[some:account]') is +called a _balanced virtual posting_. The balanced virtual postings in a +transaction must add up to zero, just like ordinary postings, but +separately from them. These are not part of double entry bookkeeping +either, but they are at least balanced. An example: 2022-01-01 buy food with cash, update budget envelope subaccounts, & something else assets:cash $-10 ; <- these balance each other @@ -3453,13 +3433,9 @@ add up to zero (separately from other postings). Eg: [assets:checking:available] $10 ; <- (something:else) $5 ; <- this is not required to balance - Postings whose account names are neither parenthesised nor bracketed -are called _real postings_. You can exclude virtual postings from -reports with the '-R/--real' flag or a 'real:1' query. - - Downsides: violates double entry bookkeeping, can be used to avoid -figuring out correct entries, makes your financial data less portable -and less trustworthy in an audit. + Ordinary postings, whose account names are neither parenthesised nor +bracketed, are called _real postings_. You can exclude virtual postings +from reports with the '-R/--real' flag or a 'real:1' query.  File: hledger.info, Node: Other Ledger directives, Prev: Virtual postings, Up: Other syntax @@ -10719,640 +10695,640 @@ See hledger and Ledger for full details.  Tag Table: Node: Top210 -Node: PART 1 USER INTERFACE3802 -Ref: #part-1-user-interface3941 -Node: Input3941 -Ref: #input4051 -Node: Data formats5000 -Ref: #data-formats5113 -Node: Standard input6546 -Ref: #standard-input6686 -Node: Multiple files6913 -Ref: #multiple-files7052 -Node: Strict mode7650 -Ref: #strict-mode7760 -Node: Commands8484 -Ref: #commands8586 -Node: Add-on commands9653 -Ref: #add-on-commands9755 -Node: Options10871 -Ref: #options10983 -Node: General help options11311 -Ref: #general-help-options11457 -Node: General input options11739 -Ref: #general-input-options11921 -Node: General reporting options12623 -Ref: #general-reporting-options12784 -Node: Command line tips16174 -Ref: #command-line-tips16304 -Node: Option repetition16563 -Ref: #option-repetition16707 -Node: Special characters17026 -Ref: #special-characters17199 -Node: Single escaping shell metacharacters17362 -Ref: #single-escaping-shell-metacharacters17603 -Node: Double escaping regular expression metacharacters18206 -Ref: #double-escaping-regular-expression-metacharacters18517 -Node: Triple escaping for add-on commands19043 -Ref: #triple-escaping-for-add-on-commands19303 -Node: Less escaping19947 -Ref: #less-escaping20101 -Node: Unicode characters20425 -Ref: #unicode-characters20600 -Node: Regular expressions22012 -Ref: #regular-expressions22185 -Node: Argument files23929 -Ref: #argument-files24065 -Node: Output24700 -Ref: #output24812 -Node: Output destination24939 -Ref: #output-destination25070 -Node: Output format25495 -Ref: #output-format25641 -Node: CSV output27179 -Ref: #csv-output27295 -Node: HTML output27398 -Ref: #html-output27536 -Node: JSON output27630 -Ref: #json-output27768 -Node: SQL output28690 -Ref: #sql-output28806 -Node: Commodity styles29541 -Ref: #commodity-styles29681 -Node: Colour30280 -Ref: #colour30398 -Node: Box-drawing30802 -Ref: #box-drawing30920 -Node: Paging31210 -Ref: #paging31324 -Node: Debug output32277 -Ref: #debug-output32383 -Node: Environment33046 -Ref: #environment33170 -Node: PART 2 DATA FORMATS33714 -Ref: #part-2-data-formats33857 -Node: Journal33857 -Ref: #journal33966 -Node: Journal cheatsheet34623 -Ref: #journal-cheatsheet34762 -Node: About journal format38747 -Ref: #about-journal-format38907 -Node: Comments40523 -Ref: #comments40653 -Node: Transactions41469 -Ref: #transactions41592 -Node: Dates42606 -Ref: #dates42713 -Node: Simple dates42758 -Ref: #simple-dates42874 -Node: Posting dates43374 -Ref: #posting-dates43492 -Node: Status44461 -Ref: #status44562 -Node: Code46270 -Ref: #code46373 -Node: Description46605 -Ref: #description46736 -Node: Payee and note47056 -Ref: #payee-and-note47162 -Node: Transaction comments47497 -Ref: #transaction-comments47650 -Node: Postings48013 -Ref: #postings48146 -Node: Account names49141 -Ref: #account-names49271 -Node: Amounts50945 -Ref: #amounts51060 -Node: Decimal marks digit group marks52045 -Ref: #decimal-marks-digit-group-marks52220 -Node: Commodity53234 -Ref: #commodity53421 -Node: Directives influencing number parsing and display54373 -Ref: #directives-influencing-number-parsing-and-display54632 -Node: Commodity display style55084 -Ref: #commodity-display-style55290 -Node: Rounding57459 -Ref: #rounding57577 -Node: Costs57876 -Ref: #costs57992 -Node: Other cost/lot notations60190 -Ref: #other-costlot-notations60322 -Node: Balance assertions62911 -Ref: #balance-assertions63062 -Node: Assertions and ordering64145 -Ref: #assertions-and-ordering64334 -Node: Assertions and multiple included files65034 -Ref: #assertions-and-multiple-included-files65294 -Node: Assertions and multiple -f files65794 -Ref: #assertions-and-multiple--f-files66045 -Node: Assertions and commodities66442 -Ref: #assertions-and-commodities66664 -Node: Assertions and prices67844 -Ref: #assertions-and-prices68050 -Node: Assertions and subaccounts68477 -Ref: #assertions-and-subaccounts68698 -Node: Assertions and virtual postings69022 -Ref: #assertions-and-virtual-postings69260 -Node: Assertions and auto postings69392 -Ref: #assertions-and-auto-postings69622 -Node: Assertions and precision70267 -Ref: #assertions-and-precision70449 -Node: Posting comments70716 -Ref: #posting-comments70862 -Node: Tags71239 -Ref: #tags71353 -Node: Tag values72546 -Ref: #tag-values72635 -Node: Directives73394 -Ref: #directives73521 -Node: Directives and multiple files74851 -Ref: #directives-and-multiple-files75029 -Node: Directive effects75796 -Ref: #directive-effects75950 -Node: account directive78963 -Ref: #account-directive79119 -Node: Account comments80517 -Ref: #account-comments80667 -Node: Account subdirectives81175 -Ref: #account-subdirectives81366 -Node: Account error checking81508 -Ref: #account-error-checking81706 -Node: Account display order82895 -Ref: #account-display-order83083 -Node: Account types84184 -Ref: #account-types84325 -Node: alias directive87952 -Ref: #alias-directive88113 -Node: Basic aliases89163 -Ref: #basic-aliases89294 -Node: Regex aliases90038 -Ref: #regex-aliases90195 -Node: Combining aliases91085 -Ref: #combining-aliases91263 -Node: Aliases and multiple files92539 -Ref: #aliases-and-multiple-files92743 -Node: end aliases directive93322 -Ref: #end-aliases-directive93541 -Node: Aliases can generate bad account names93690 -Ref: #aliases-can-generate-bad-account-names93938 -Node: Aliases and account types94523 -Ref: #aliases-and-account-types94715 -Node: commodity directive95411 -Ref: #commodity-directive95585 -Node: Commodity error checking98159 -Ref: #commodity-error-checking98305 -Node: decimal-mark directive98820 -Ref: #decimal-mark-directive99002 -Node: include directive99399 -Ref: #include-directive99563 -Node: P directive100487 -Ref: #p-directive100632 -Node: payee directive101515 -Ref: #payee-directive101664 -Node: tag directive101980 -Ref: #tag-directive102135 -Node: Periodic transactions102603 -Ref: #periodic-transactions102768 -Node: Periodic rule syntax104474 -Ref: #periodic-rule-syntax104652 -Node: Periodic rules and relative dates105297 -Ref: #periodic-rules-and-relative-dates105563 -Node: Two spaces between period expression and description!106074 -Ref: #two-spaces-between-period-expression-and-description106351 -Node: Auto postings107035 -Ref: #auto-postings107183 -Node: Auto postings and multiple files109620 -Ref: #auto-postings-and-multiple-files109784 -Node: Auto postings and dates110185 -Ref: #auto-postings-and-dates110433 -Node: Auto postings and transaction balancing / inferred amounts / balance assertions110608 -Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions110964 -Node: Auto posting tags111467 -Ref: #auto-posting-tags111749 -Node: Auto postings on forecast transactions only112385 -Ref: #auto-postings-on-forecast-transactions-only112631 -Node: Other syntax112878 -Ref: #other-syntax112994 -Node: Balance assignments113621 -Ref: #balance-assignments113777 -Node: Balance assignments and prices115107 -Ref: #balance-assignments-and-prices115275 -Node: Bracketed posting dates115486 -Ref: #bracketed-posting-dates115670 -Node: D directive116184 -Ref: #d-directive116352 -Node: apply account directive117952 -Ref: #apply-account-directive118132 -Node: Y directive118819 -Ref: #y-directive118979 -Node: Secondary dates119807 -Ref: #secondary-dates119961 -Node: Star comments120775 -Ref: #star-comments120935 -Node: Valuation expressions121467 -Ref: #valuation-expressions121644 -Node: Virtual postings121766 -Ref: #virtual-postings121943 -Node: Other Ledger directives123505 -Ref: #other-ledger-directives123668 -Node: CSV124234 -Ref: #csv124327 -Node: CSV rules cheatsheet126407 -Ref: #csv-rules-cheatsheet126536 -Node: source128334 -Ref: #source128457 -Node: separator129337 -Ref: #separator129450 -Node: skip129990 -Ref: #skip130098 -Node: date-format130642 -Ref: #date-format130763 -Node: timezone131487 -Ref: #timezone131610 -Node: newest-first132615 -Ref: #newest-first132753 -Node: intra-day-reversed133331 -Ref: #intra-day-reversed133485 -Node: decimal-mark133978 -Ref: #decimal-mark134119 -Node: fields list134458 -Ref: #fields-list134597 -Node: Field assignment136268 -Ref: #field-assignment136412 -Node: Field names137439 -Ref: #field-names137570 -Node: date field138773 -Ref: #date-field138891 -Node: date2 field138939 -Ref: #date2-field139080 -Node: status field139136 -Ref: #status-field139279 -Node: code field139328 -Ref: #code-field139473 -Node: description field139518 -Ref: #description-field139678 -Node: comment field139737 -Ref: #comment-field139892 -Node: account field140185 -Ref: #account-field140335 -Node: amount field140905 -Ref: #amount-field141054 -Node: currency field144430 -Ref: #currency-field144583 -Node: balance field144840 -Ref: #balance-field144972 -Node: if block145344 -Ref: #if-block145465 -Node: Matchers146873 -Ref: #matchers146987 -Node: if table148469 -Ref: #if-table148591 -Node: balance-type150013 -Ref: #balance-type150142 -Node: include150842 -Ref: #include150969 -Node: Working with CSV151413 -Ref: #working-with-csv151560 -Node: Rapid feedback151967 -Ref: #rapid-feedback152100 -Node: Valid CSV152552 -Ref: #valid-csv152698 -Node: File Extension153430 -Ref: #file-extension153603 -Node: Reading CSV from standard input154167 -Ref: #reading-csv-from-standard-input154391 -Node: Reading multiple CSV files154555 -Ref: #reading-multiple-csv-files154786 -Node: Reading files specified by rule155027 -Ref: #reading-files-specified-by-rule155255 -Node: Valid transactions156426 -Ref: #valid-transactions156625 -Node: Deduplicating importing157253 -Ref: #deduplicating-importing157448 -Node: Setting amounts158484 -Ref: #setting-amounts158655 -Node: Amount signs161120 -Ref: #amount-signs161290 -Node: Setting currency/commodity162187 -Ref: #setting-currencycommodity162391 -Node: Amount decimal places163565 -Ref: #amount-decimal-places163771 -Node: Referencing other fields164083 -Ref: #referencing-other-fields164296 -Node: How CSV rules are evaluated165193 -Ref: #how-csv-rules-are-evaluated165410 -Node: Well factored rules166863 -Ref: #well-factored-rules167031 -Node: CSV rules examples167355 -Ref: #csv-rules-examples167490 -Node: Bank of Ireland167555 -Ref: #bank-of-ireland167692 -Node: Coinbase169154 -Ref: #coinbase169292 -Node: Amazon170339 -Ref: #amazon170464 -Node: Paypal172183 -Ref: #paypal172291 -Node: Timeclock179935 -Ref: #timeclock180040 -Node: Timedot182218 -Ref: #timedot182341 -Node: PART 3 REPORTING CONCEPTS187210 -Ref: #part-3-reporting-concepts187374 -Node: Time periods187374 -Ref: #time-periods187508 -Node: Report start & end date187626 -Ref: #report-start-end-date187778 -Node: Smart dates189437 -Ref: #smart-dates189590 -Node: Report intervals191458 -Ref: #report-intervals191613 -Node: Date adjustment192031 -Ref: #date-adjustment192191 -Node: Period expressions193042 -Ref: #period-expressions193183 -Node: Period expressions with a report interval194947 -Ref: #period-expressions-with-a-report-interval195181 -Node: More complex report intervals195395 -Ref: #more-complex-report-intervals195640 -Node: Multiple weekday intervals197441 -Ref: #multiple-weekday-intervals197630 -Node: Depth198452 -Ref: #depth198554 -Node: Queries198850 -Ref: #queries198952 -Node: Query types199861 -Ref: #query-types199982 -Node: Combining query terms203156 -Ref: #combining-query-terms203333 -Node: Queries and command options204601 -Ref: #queries-and-command-options204800 -Node: Queries and valuation205049 -Ref: #queries-and-valuation205244 -Node: Querying with account aliases205473 -Ref: #querying-with-account-aliases205684 -Node: Querying with cost or value205814 -Ref: #querying-with-cost-or-value205991 -Node: Pivoting206292 -Ref: #pivoting206406 -Node: Generating data207864 -Ref: #generating-data207996 -Node: Forecasting209579 -Ref: #forecasting209704 -Node: --forecast210235 -Ref: #forecast210366 -Node: Inspecting forecast transactions211412 -Ref: #inspecting-forecast-transactions211614 -Node: Forecast reports212744 -Ref: #forecast-reports212917 -Node: Forecast tags213853 -Ref: #forecast-tags214013 -Node: Forecast period in detail214473 -Ref: #forecast-period-in-detail214667 -Node: Forecast troubleshooting215561 -Ref: #forecast-troubleshooting215729 -Node: Budgeting216632 -Ref: #budgeting216752 -Node: Cost reporting217189 -Ref: #cost-reporting217317 -Node: -B Convert to cost218424 -Ref: #b-convert-to-cost218580 -Node: Equity conversion postings219972 -Ref: #equity-conversion-postings220186 -Node: Inferring equity postings from cost221077 -Ref: #inferring-equity-postings-from-cost221326 -Node: Inferring cost from equity postings222137 -Ref: #inferring-cost-from-equity-postings222385 -Node: When to infer cost/equity224152 -Ref: #when-to-infer-costequity224370 -Node: How to record conversions224766 -Ref: #how-to-record-conversions224958 -Node: Conversion with implicit cost225249 -Ref: #conversion-with-implicit-cost225454 -Node: Conversion with explicit cost226331 -Ref: #conversion-with-explicit-cost226576 -Node: Conversion with equity postings226993 -Ref: #conversion-with-equity-postings227262 -Node: Conversion with equity postings and explicit cost228081 -Ref: #conversion-with-equity-postings-and-explicit-cost228348 -Node: Cost tips228810 -Ref: #cost-tips228936 -Node: Valuation229642 -Ref: #valuation229766 -Node: -V Value230540 -Ref: #v-value230666 -Node: -X Value in specified commodity230861 -Ref: #x-value-in-specified-commodity231056 -Node: Valuation date231205 -Ref: #valuation-date231376 -Node: Finding market price231813 -Ref: #finding-market-price232018 -Node: --infer-market-prices market prices from transactions233188 -Ref: #infer-market-prices-market-prices-from-transactions233464 -Node: Valuation commodity236220 -Ref: #valuation-commodity236433 -Node: Simple valuation examples237646 -Ref: #simple-valuation-examples237844 -Node: --value Flexible valuation238503 -Ref: #value-flexible-valuation238707 -Node: More valuation examples240351 -Ref: #more-valuation-examples240560 -Node: Interaction of valuation and queries242559 -Ref: #interaction-of-valuation-and-queries242800 -Node: Effect of valuation on reports243272 -Ref: #effect-of-valuation-on-reports243469 -Node: PART 4 COMMANDS251166 -Ref: #part-4-commands251309 -Node: Commands overview251688 -Ref: #commands-overview251822 -Node: DATA ENTRY252001 -Ref: #data-entry252125 -Node: DATA CREATION252324 -Ref: #data-creation252478 -Node: DATA MANAGEMENT252596 -Ref: #data-management252761 -Node: REPORTS FINANCIAL252882 -Ref: #reports-financial253057 -Node: REPORTS VERSATILE253362 -Ref: #reports-versatile253535 -Node: REPORTS BASIC253788 -Ref: #reports-basic253940 -Node: HELP254449 -Ref: #help254571 -Node: ADD-ONS254681 -Ref: #add-ons254787 -Node: accounts255366 -Ref: #accounts255499 -Node: activity257386 -Ref: #activity257505 -Node: add257879 -Ref: #add257989 -Node: aregister260800 -Ref: #aregister260921 -Node: aregister and custom posting dates263809 -Ref: #aregister-and-custom-posting-dates263975 -Node: balance264527 -Ref: #balance264653 -Node: balance features265628 -Ref: #balance-features265768 -Node: Simple balance report267727 -Ref: #simple-balance-report267912 -Node: Balance report line format269537 -Ref: #balance-report-line-format269739 -Node: Filtered balance report271897 -Ref: #filtered-balance-report272089 -Node: List or tree mode272416 -Ref: #list-or-tree-mode272584 -Node: Depth limiting273929 -Ref: #depth-limiting274095 -Node: Dropping top-level accounts274696 -Ref: #dropping-top-level-accounts274896 -Node: Showing declared accounts275206 -Ref: #showing-declared-accounts275405 -Node: Sorting by amount275936 -Ref: #sorting-by-amount276103 -Node: Percentages276773 -Ref: #percentages276932 -Node: Multi-period balance report277480 -Ref: #multi-period-balance-report277680 -Node: Balance change end balance279955 -Ref: #balance-change-end-balance280164 -Node: Balance report types281592 -Ref: #balance-report-types281773 -Node: Calculation type282271 -Ref: #calculation-type282426 -Node: Accumulation type282975 -Ref: #accumulation-type283155 -Node: Valuation type284057 -Ref: #valuation-type284245 -Node: Combining balance report types285240 -Ref: #combining-balance-report-types285434 -Node: Budget report287272 -Ref: #budget-report287424 -Node: Budget report start date293078 -Ref: #budget-report-start-date293256 -Node: Budgets and subaccounts294588 -Ref: #budgets-and-subaccounts294795 -Node: Selecting budget goals298235 -Ref: #selecting-budget-goals298434 -Node: Budget vs forecast299469 -Ref: #budget-vs-forecast299628 -Node: Data layout301258 -Ref: #data-layout301408 -Node: Useful balance reports309303 -Ref: #useful-balance-reports309453 -Node: balancesheet310538 -Ref: #balancesheet310683 -Node: balancesheetequity312003 -Ref: #balancesheetequity312161 -Node: cashflow313550 -Ref: #cashflow313681 -Node: check315109 -Ref: #check315223 -Node: Basic checks316025 -Ref: #basic-checks316145 -Node: Strict checks316665 -Ref: #strict-checks316808 -Node: Other checks317231 -Ref: #other-checks317373 -Node: Custom checks317936 -Ref: #custom-checks318093 -Node: More about specific checks318510 -Ref: #more-about-specific-checks318672 -Node: close319400 -Ref: #close319511 -Node: close and balance assertions322921 -Ref: #close-and-balance-assertions323099 -Node: Example retain earnings324250 -Ref: #example-retain-earnings324467 -Node: Example migrate balances to a new file324899 -Ref: #example-migrate-balances-to-a-new-file325164 -Node: Example excluding closing/opening transactions325740 -Ref: #example-excluding-closingopening-transactions325989 -Node: codes327207 -Ref: #codes327324 -Node: commodities328188 -Ref: #commodities328316 -Node: demo328386 -Ref: #demo328507 -Node: descriptions329351 -Ref: #descriptions329481 -Node: diff329772 -Ref: #diff329887 -Node: files330929 -Ref: #files331038 -Node: help331179 -Ref: #help-1331288 -Node: import332661 -Ref: #import332784 -Node: Deduplication333870 -Ref: #deduplication333995 -Node: Import testing335889 -Ref: #import-testing336054 -Node: Importing balance assignments336897 -Ref: #importing-balance-assignments337103 -Node: Commodity display styles337752 -Ref: #commodity-display-styles337925 -Node: incomestatement338054 -Ref: #incomestatement338196 -Node: notes339517 -Ref: #notes339639 -Node: payees340001 -Ref: #payees340116 -Node: prices340635 -Ref: #prices340750 -Node: print341048 -Ref: #print341163 -Node: register346501 -Ref: #register346623 -Node: Custom register output351654 -Ref: #custom-register-output351785 -Node: rewrite353122 -Ref: #rewrite353240 -Node: Re-write rules in a file355138 -Ref: #re-write-rules-in-a-file355301 -Node: Diff output format356450 -Ref: #diff-output-format356633 -Node: rewrite vs print --auto357725 -Ref: #rewrite-vs.-print---auto357885 -Node: roi358441 -Ref: #roi358548 -Node: Spaces and special characters in --inv and --pnl360269 -Ref: #spaces-and-special-characters-in---inv-and---pnl360509 -Node: Semantics of --inv and --pnl360997 -Ref: #semantics-of---inv-and---pnl361236 -Node: IRR and TWR explained363086 -Ref: #irr-and-twr-explained363246 -Node: stats366332 -Ref: #stats366440 -Node: tags367827 -Ref: #tags-1367934 -Node: test368943 -Ref: #test369036 -Node: PART 5 COMMON TASKS369778 -Ref: #part-5-common-tasks369924 -Node: Getting help370222 -Ref: #getting-help370363 -Node: Constructing command lines371123 -Ref: #constructing-command-lines371324 -Node: Starting a journal file371981 -Ref: #starting-a-journal-file372183 -Node: Setting LEDGER_FILE373385 -Ref: #setting-ledger_file373577 -Node: Setting opening balances374534 -Ref: #setting-opening-balances374735 -Node: Recording transactions377876 -Ref: #recording-transactions378065 -Node: Reconciling378621 -Ref: #reconciling378773 -Node: Reporting381030 -Ref: #reporting381179 -Node: Migrating to a new file385164 -Ref: #migrating-to-a-new-file385321 -Node: BUGS385620 -Ref: #bugs385710 -Node: Troubleshooting386589 -Ref: #troubleshooting386689 +Node: PART 1 USER INTERFACE3858 +Ref: #part-1-user-interface3997 +Node: Input3997 +Ref: #input4107 +Node: Data formats5056 +Ref: #data-formats5169 +Node: Standard input6602 +Ref: #standard-input6742 +Node: Multiple files6969 +Ref: #multiple-files7108 +Node: Strict mode7706 +Ref: #strict-mode7816 +Node: Commands8540 +Ref: #commands8642 +Node: Add-on commands9709 +Ref: #add-on-commands9811 +Node: Options10927 +Ref: #options11039 +Node: General help options11367 +Ref: #general-help-options11513 +Node: General input options11795 +Ref: #general-input-options11977 +Node: General reporting options12679 +Ref: #general-reporting-options12840 +Node: Command line tips16230 +Ref: #command-line-tips16360 +Node: Option repetition16619 +Ref: #option-repetition16763 +Node: Special characters17082 +Ref: #special-characters17255 +Node: Single escaping shell metacharacters17418 +Ref: #single-escaping-shell-metacharacters17659 +Node: Double escaping regular expression metacharacters18262 +Ref: #double-escaping-regular-expression-metacharacters18573 +Node: Triple escaping for add-on commands19099 +Ref: #triple-escaping-for-add-on-commands19359 +Node: Less escaping20003 +Ref: #less-escaping20157 +Node: Unicode characters20481 +Ref: #unicode-characters20656 +Node: Regular expressions22068 +Ref: #regular-expressions22241 +Node: Argument files23985 +Ref: #argument-files24121 +Node: Output24618 +Ref: #output24730 +Node: Output destination24857 +Ref: #output-destination24988 +Node: Output format25413 +Ref: #output-format25559 +Node: CSV output27097 +Ref: #csv-output27213 +Node: HTML output27316 +Ref: #html-output27454 +Node: JSON output27548 +Ref: #json-output27686 +Node: SQL output28608 +Ref: #sql-output28724 +Node: Commodity styles29459 +Ref: #commodity-styles29599 +Node: Colour30198 +Ref: #colour30316 +Node: Box-drawing30720 +Ref: #box-drawing30838 +Node: Paging31128 +Ref: #paging31242 +Node: Debug output32195 +Ref: #debug-output32301 +Node: Environment32964 +Ref: #environment33088 +Node: PART 2 DATA FORMATS33632 +Ref: #part-2-data-formats33775 +Node: Journal33775 +Ref: #journal33884 +Node: Journal cheatsheet34541 +Ref: #journal-cheatsheet34680 +Node: About journal format38665 +Ref: #about-journal-format38825 +Node: Comments40441 +Ref: #comments40571 +Node: Transactions41387 +Ref: #transactions41510 +Node: Dates42524 +Ref: #dates42631 +Node: Simple dates42676 +Ref: #simple-dates42792 +Node: Posting dates43292 +Ref: #posting-dates43410 +Node: Status44379 +Ref: #status44480 +Node: Code46188 +Ref: #code46291 +Node: Description46523 +Ref: #description46654 +Node: Payee and note46974 +Ref: #payee-and-note47080 +Node: Transaction comments47415 +Ref: #transaction-comments47568 +Node: Postings47931 +Ref: #postings48064 +Node: Account names49059 +Ref: #account-names49189 +Node: Amounts50863 +Ref: #amounts50978 +Node: Decimal marks digit group marks51963 +Ref: #decimal-marks-digit-group-marks52138 +Node: Commodity53152 +Ref: #commodity53339 +Node: Directives influencing number parsing and display54291 +Ref: #directives-influencing-number-parsing-and-display54550 +Node: Commodity display style55002 +Ref: #commodity-display-style55208 +Node: Rounding57377 +Ref: #rounding57495 +Node: Costs57794 +Ref: #costs57910 +Node: Other cost/lot notations60108 +Ref: #other-costlot-notations60240 +Node: Balance assertions62829 +Ref: #balance-assertions62980 +Node: Assertions and ordering64063 +Ref: #assertions-and-ordering64252 +Node: Assertions and multiple included files64952 +Ref: #assertions-and-multiple-included-files65212 +Node: Assertions and multiple -f files65712 +Ref: #assertions-and-multiple--f-files65963 +Node: Assertions and commodities66360 +Ref: #assertions-and-commodities66582 +Node: Assertions and prices67762 +Ref: #assertions-and-prices67968 +Node: Assertions and subaccounts68395 +Ref: #assertions-and-subaccounts68616 +Node: Assertions and virtual postings68940 +Ref: #assertions-and-virtual-postings69178 +Node: Assertions and auto postings69310 +Ref: #assertions-and-auto-postings69540 +Node: Assertions and precision70185 +Ref: #assertions-and-precision70367 +Node: Posting comments70634 +Ref: #posting-comments70780 +Node: Tags71157 +Ref: #tags71271 +Node: Tag values72464 +Ref: #tag-values72553 +Node: Directives73312 +Ref: #directives73439 +Node: Directives and multiple files74769 +Ref: #directives-and-multiple-files74947 +Node: Directive effects75714 +Ref: #directive-effects75868 +Node: account directive78881 +Ref: #account-directive79037 +Node: Account comments80435 +Ref: #account-comments80585 +Node: Account subdirectives81093 +Ref: #account-subdirectives81284 +Node: Account error checking81426 +Ref: #account-error-checking81624 +Node: Account display order82813 +Ref: #account-display-order83001 +Node: Account types84102 +Ref: #account-types84243 +Node: alias directive87870 +Ref: #alias-directive88031 +Node: Basic aliases89081 +Ref: #basic-aliases89212 +Node: Regex aliases89956 +Ref: #regex-aliases90113 +Node: Combining aliases91003 +Ref: #combining-aliases91181 +Node: Aliases and multiple files92457 +Ref: #aliases-and-multiple-files92661 +Node: end aliases directive93240 +Ref: #end-aliases-directive93459 +Node: Aliases can generate bad account names93608 +Ref: #aliases-can-generate-bad-account-names93856 +Node: Aliases and account types94441 +Ref: #aliases-and-account-types94633 +Node: commodity directive95329 +Ref: #commodity-directive95503 +Node: Commodity error checking98077 +Ref: #commodity-error-checking98223 +Node: decimal-mark directive98738 +Ref: #decimal-mark-directive98920 +Node: include directive99317 +Ref: #include-directive99481 +Node: P directive100405 +Ref: #p-directive100550 +Node: payee directive101433 +Ref: #payee-directive101582 +Node: tag directive101898 +Ref: #tag-directive102053 +Node: Periodic transactions102521 +Ref: #periodic-transactions102686 +Node: Periodic rule syntax104392 +Ref: #periodic-rule-syntax104570 +Node: Periodic rules and relative dates105215 +Ref: #periodic-rules-and-relative-dates105481 +Node: Two spaces between period expression and description!105992 +Ref: #two-spaces-between-period-expression-and-description106269 +Node: Auto postings106953 +Ref: #auto-postings107101 +Node: Auto postings and multiple files109538 +Ref: #auto-postings-and-multiple-files109702 +Node: Auto postings and dates110103 +Ref: #auto-postings-and-dates110351 +Node: Auto postings and transaction balancing / inferred amounts / balance assertions110526 +Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions110882 +Node: Auto posting tags111385 +Ref: #auto-posting-tags111667 +Node: Auto postings on forecast transactions only112303 +Ref: #auto-postings-on-forecast-transactions-only112549 +Node: Other syntax112796 +Ref: #other-syntax112912 +Node: Balance assignments113539 +Ref: #balance-assignments113695 +Node: Balance assignments and prices115025 +Ref: #balance-assignments-and-prices115193 +Node: Bracketed posting dates115404 +Ref: #bracketed-posting-dates115588 +Node: D directive116102 +Ref: #d-directive116270 +Node: apply account directive117870 +Ref: #apply-account-directive118050 +Node: Y directive118737 +Ref: #y-directive118897 +Node: Secondary dates119725 +Ref: #secondary-dates119879 +Node: Star comments120693 +Ref: #star-comments120853 +Node: Valuation expressions121385 +Ref: #valuation-expressions121562 +Node: Virtual postings121684 +Ref: #virtual-postings121861 +Node: Other Ledger directives123298 +Ref: #other-ledger-directives123461 +Node: CSV124027 +Ref: #csv124120 +Node: CSV rules cheatsheet126200 +Ref: #csv-rules-cheatsheet126329 +Node: source128127 +Ref: #source128250 +Node: separator129130 +Ref: #separator129243 +Node: skip129783 +Ref: #skip129891 +Node: date-format130435 +Ref: #date-format130556 +Node: timezone131280 +Ref: #timezone131403 +Node: newest-first132408 +Ref: #newest-first132546 +Node: intra-day-reversed133124 +Ref: #intra-day-reversed133278 +Node: decimal-mark133771 +Ref: #decimal-mark133912 +Node: fields list134251 +Ref: #fields-list134390 +Node: Field assignment136061 +Ref: #field-assignment136205 +Node: Field names137232 +Ref: #field-names137363 +Node: date field138566 +Ref: #date-field138684 +Node: date2 field138732 +Ref: #date2-field138873 +Node: status field138929 +Ref: #status-field139072 +Node: code field139121 +Ref: #code-field139266 +Node: description field139311 +Ref: #description-field139471 +Node: comment field139530 +Ref: #comment-field139685 +Node: account field139978 +Ref: #account-field140128 +Node: amount field140698 +Ref: #amount-field140847 +Node: currency field144223 +Ref: #currency-field144376 +Node: balance field144633 +Ref: #balance-field144765 +Node: if block145137 +Ref: #if-block145258 +Node: Matchers146666 +Ref: #matchers146780 +Node: if table148262 +Ref: #if-table148384 +Node: balance-type149806 +Ref: #balance-type149935 +Node: include150635 +Ref: #include150762 +Node: Working with CSV151206 +Ref: #working-with-csv151353 +Node: Rapid feedback151760 +Ref: #rapid-feedback151893 +Node: Valid CSV152345 +Ref: #valid-csv152491 +Node: File Extension153223 +Ref: #file-extension153396 +Node: Reading CSV from standard input153960 +Ref: #reading-csv-from-standard-input154184 +Node: Reading multiple CSV files154348 +Ref: #reading-multiple-csv-files154579 +Node: Reading files specified by rule154820 +Ref: #reading-files-specified-by-rule155048 +Node: Valid transactions156219 +Ref: #valid-transactions156418 +Node: Deduplicating importing157046 +Ref: #deduplicating-importing157241 +Node: Setting amounts158277 +Ref: #setting-amounts158448 +Node: Amount signs160913 +Ref: #amount-signs161083 +Node: Setting currency/commodity161980 +Ref: #setting-currencycommodity162184 +Node: Amount decimal places163358 +Ref: #amount-decimal-places163564 +Node: Referencing other fields163876 +Ref: #referencing-other-fields164089 +Node: How CSV rules are evaluated164986 +Ref: #how-csv-rules-are-evaluated165203 +Node: Well factored rules166656 +Ref: #well-factored-rules166824 +Node: CSV rules examples167148 +Ref: #csv-rules-examples167283 +Node: Bank of Ireland167348 +Ref: #bank-of-ireland167485 +Node: Coinbase168947 +Ref: #coinbase169085 +Node: Amazon170132 +Ref: #amazon170257 +Node: Paypal171976 +Ref: #paypal172084 +Node: Timeclock179728 +Ref: #timeclock179833 +Node: Timedot182011 +Ref: #timedot182134 +Node: PART 3 REPORTING CONCEPTS187003 +Ref: #part-3-reporting-concepts187167 +Node: Time periods187167 +Ref: #time-periods187301 +Node: Report start & end date187419 +Ref: #report-start-end-date187571 +Node: Smart dates189230 +Ref: #smart-dates189383 +Node: Report intervals191251 +Ref: #report-intervals191406 +Node: Date adjustment191824 +Ref: #date-adjustment191984 +Node: Period expressions192835 +Ref: #period-expressions192976 +Node: Period expressions with a report interval194740 +Ref: #period-expressions-with-a-report-interval194974 +Node: More complex report intervals195188 +Ref: #more-complex-report-intervals195433 +Node: Multiple weekday intervals197234 +Ref: #multiple-weekday-intervals197423 +Node: Depth198245 +Ref: #depth198347 +Node: Queries198643 +Ref: #queries198745 +Node: Query types199654 +Ref: #query-types199775 +Node: Combining query terms202949 +Ref: #combining-query-terms203126 +Node: Queries and command options204394 +Ref: #queries-and-command-options204593 +Node: Queries and valuation204842 +Ref: #queries-and-valuation205037 +Node: Querying with account aliases205266 +Ref: #querying-with-account-aliases205477 +Node: Querying with cost or value205607 +Ref: #querying-with-cost-or-value205784 +Node: Pivoting206085 +Ref: #pivoting206199 +Node: Generating data207657 +Ref: #generating-data207789 +Node: Forecasting209372 +Ref: #forecasting209497 +Node: --forecast210028 +Ref: #forecast210159 +Node: Inspecting forecast transactions211205 +Ref: #inspecting-forecast-transactions211407 +Node: Forecast reports212537 +Ref: #forecast-reports212710 +Node: Forecast tags213646 +Ref: #forecast-tags213806 +Node: Forecast period in detail214266 +Ref: #forecast-period-in-detail214460 +Node: Forecast troubleshooting215354 +Ref: #forecast-troubleshooting215522 +Node: Budgeting216425 +Ref: #budgeting216545 +Node: Cost reporting216982 +Ref: #cost-reporting217110 +Node: -B Convert to cost218217 +Ref: #b-convert-to-cost218373 +Node: Equity conversion postings219765 +Ref: #equity-conversion-postings219979 +Node: Inferring equity postings from cost220870 +Ref: #inferring-equity-postings-from-cost221119 +Node: Inferring cost from equity postings221930 +Ref: #inferring-cost-from-equity-postings222178 +Node: When to infer cost/equity223945 +Ref: #when-to-infer-costequity224163 +Node: How to record conversions224559 +Ref: #how-to-record-conversions224751 +Node: Conversion with implicit cost225042 +Ref: #conversion-with-implicit-cost225247 +Node: Conversion with explicit cost226124 +Ref: #conversion-with-explicit-cost226369 +Node: Conversion with equity postings226786 +Ref: #conversion-with-equity-postings227055 +Node: Conversion with equity postings and explicit cost227874 +Ref: #conversion-with-equity-postings-and-explicit-cost228141 +Node: Cost tips228603 +Ref: #cost-tips228729 +Node: Valuation229435 +Ref: #valuation229559 +Node: -V Value230333 +Ref: #v-value230459 +Node: -X Value in specified commodity230654 +Ref: #x-value-in-specified-commodity230849 +Node: Valuation date230998 +Ref: #valuation-date231169 +Node: Finding market price231606 +Ref: #finding-market-price231811 +Node: --infer-market-prices market prices from transactions232981 +Ref: #infer-market-prices-market-prices-from-transactions233257 +Node: Valuation commodity236013 +Ref: #valuation-commodity236226 +Node: Simple valuation examples237439 +Ref: #simple-valuation-examples237637 +Node: --value Flexible valuation238296 +Ref: #value-flexible-valuation238500 +Node: More valuation examples240144 +Ref: #more-valuation-examples240353 +Node: Interaction of valuation and queries242352 +Ref: #interaction-of-valuation-and-queries242593 +Node: Effect of valuation on reports243065 +Ref: #effect-of-valuation-on-reports243262 +Node: PART 4 COMMANDS250959 +Ref: #part-4-commands251102 +Node: Commands overview251481 +Ref: #commands-overview251615 +Node: DATA ENTRY251794 +Ref: #data-entry251918 +Node: DATA CREATION252117 +Ref: #data-creation252271 +Node: DATA MANAGEMENT252389 +Ref: #data-management252554 +Node: REPORTS FINANCIAL252675 +Ref: #reports-financial252850 +Node: REPORTS VERSATILE253155 +Ref: #reports-versatile253328 +Node: REPORTS BASIC253581 +Ref: #reports-basic253733 +Node: HELP254242 +Ref: #help254364 +Node: ADD-ONS254474 +Ref: #add-ons254580 +Node: accounts255159 +Ref: #accounts255292 +Node: activity257179 +Ref: #activity257298 +Node: add257672 +Ref: #add257782 +Node: aregister260593 +Ref: #aregister260714 +Node: aregister and custom posting dates263602 +Ref: #aregister-and-custom-posting-dates263768 +Node: balance264320 +Ref: #balance264446 +Node: balance features265421 +Ref: #balance-features265561 +Node: Simple balance report267520 +Ref: #simple-balance-report267705 +Node: Balance report line format269330 +Ref: #balance-report-line-format269532 +Node: Filtered balance report271690 +Ref: #filtered-balance-report271882 +Node: List or tree mode272209 +Ref: #list-or-tree-mode272377 +Node: Depth limiting273722 +Ref: #depth-limiting273888 +Node: Dropping top-level accounts274489 +Ref: #dropping-top-level-accounts274689 +Node: Showing declared accounts274999 +Ref: #showing-declared-accounts275198 +Node: Sorting by amount275729 +Ref: #sorting-by-amount275896 +Node: Percentages276566 +Ref: #percentages276725 +Node: Multi-period balance report277273 +Ref: #multi-period-balance-report277473 +Node: Balance change end balance279748 +Ref: #balance-change-end-balance279957 +Node: Balance report types281385 +Ref: #balance-report-types281566 +Node: Calculation type282064 +Ref: #calculation-type282219 +Node: Accumulation type282768 +Ref: #accumulation-type282948 +Node: Valuation type283850 +Ref: #valuation-type284038 +Node: Combining balance report types285033 +Ref: #combining-balance-report-types285227 +Node: Budget report287065 +Ref: #budget-report287217 +Node: Budget report start date292871 +Ref: #budget-report-start-date293049 +Node: Budgets and subaccounts294381 +Ref: #budgets-and-subaccounts294588 +Node: Selecting budget goals298028 +Ref: #selecting-budget-goals298227 +Node: Budget vs forecast299262 +Ref: #budget-vs-forecast299421 +Node: Data layout301051 +Ref: #data-layout301201 +Node: Useful balance reports309096 +Ref: #useful-balance-reports309246 +Node: balancesheet310331 +Ref: #balancesheet310476 +Node: balancesheetequity311796 +Ref: #balancesheetequity311954 +Node: cashflow313343 +Ref: #cashflow313474 +Node: check314902 +Ref: #check315016 +Node: Basic checks315818 +Ref: #basic-checks315938 +Node: Strict checks316458 +Ref: #strict-checks316601 +Node: Other checks317024 +Ref: #other-checks317166 +Node: Custom checks317729 +Ref: #custom-checks317886 +Node: More about specific checks318303 +Ref: #more-about-specific-checks318465 +Node: close319193 +Ref: #close319304 +Node: close and balance assertions322714 +Ref: #close-and-balance-assertions322892 +Node: Example retain earnings324043 +Ref: #example-retain-earnings324260 +Node: Example migrate balances to a new file324692 +Ref: #example-migrate-balances-to-a-new-file324957 +Node: Example excluding closing/opening transactions325533 +Ref: #example-excluding-closingopening-transactions325782 +Node: codes327000 +Ref: #codes327117 +Node: commodities327981 +Ref: #commodities328109 +Node: demo328179 +Ref: #demo328300 +Node: descriptions329144 +Ref: #descriptions329274 +Node: diff329565 +Ref: #diff329680 +Node: files330722 +Ref: #files330831 +Node: help330972 +Ref: #help-1331081 +Node: import332454 +Ref: #import332577 +Node: Deduplication333663 +Ref: #deduplication333788 +Node: Import testing335682 +Ref: #import-testing335847 +Node: Importing balance assignments336690 +Ref: #importing-balance-assignments336896 +Node: Commodity display styles337545 +Ref: #commodity-display-styles337718 +Node: incomestatement337847 +Ref: #incomestatement337989 +Node: notes339310 +Ref: #notes339432 +Node: payees339794 +Ref: #payees339909 +Node: prices340428 +Ref: #prices340543 +Node: print340841 +Ref: #print340956 +Node: register346294 +Ref: #register346416 +Node: Custom register output351447 +Ref: #custom-register-output351578 +Node: rewrite352915 +Ref: #rewrite353033 +Node: Re-write rules in a file354931 +Ref: #re-write-rules-in-a-file355094 +Node: Diff output format356243 +Ref: #diff-output-format356426 +Node: rewrite vs print --auto357518 +Ref: #rewrite-vs.-print---auto357678 +Node: roi358234 +Ref: #roi358341 +Node: Spaces and special characters in --inv and --pnl360062 +Ref: #spaces-and-special-characters-in---inv-and---pnl360302 +Node: Semantics of --inv and --pnl360790 +Ref: #semantics-of---inv-and---pnl361029 +Node: IRR and TWR explained362879 +Ref: #irr-and-twr-explained363039 +Node: stats366125 +Ref: #stats366233 +Node: tags367620 +Ref: #tags-1367727 +Node: test368736 +Ref: #test368829 +Node: PART 5 COMMON TASKS369571 +Ref: #part-5-common-tasks369717 +Node: Getting help370015 +Ref: #getting-help370156 +Node: Constructing command lines370916 +Ref: #constructing-command-lines371117 +Node: Starting a journal file371774 +Ref: #starting-a-journal-file371976 +Node: Setting LEDGER_FILE373178 +Ref: #setting-ledger_file373370 +Node: Setting opening balances374327 +Ref: #setting-opening-balances374528 +Node: Recording transactions377669 +Ref: #recording-transactions377858 +Node: Reconciling378414 +Ref: #reconciling378566 +Node: Reporting380823 +Ref: #reporting380972 +Node: Migrating to a new file384957 +Ref: #migrating-to-a-new-file385114 +Node: BUGS385413 +Ref: #bugs385503 +Node: Troubleshooting386382 +Ref: #troubleshooting386482  End Tag Table diff --git a/hledger/hledger.txt b/hledger/hledger.txt index 1c6c64bcb..c86e4ccce 100644 --- a/hledger/hledger.txt +++ b/hledger/hledger.txt @@ -7,11 +7,10 @@ NAME hledger - robust, friendly plain text accounting (CLI version) SYNOPSIS - hledger - hledger [-f FILE] COMMAND [OPTS] [ARGS] - hledger [-f FILE] ADDONCMD -- [OPTS] [ARGS] - -INTRODUCTION + hledger # show commmands list + hledger COMMAND [OPTS] [ARGS] # run built-in command + hledger ADDONCMD -- [OPTS] [ARGS] # run add-on command from PATH +DESCRIPTION hledger is a robust, user-friendly, cross-platform set of programs for tracking money, time, or any other commodity, using double-entry ac- counting and a simple, editable file format. hledger is inspired by @@ -550,27 +549,10 @@ Command line tips hledger bal @foo.args. Inside the argument file, each line should contain just one option or - argument. Also, don't use spaces except inside quotes (or you'll see a - confusing error). Ie, write = (or nothing) between a flag and its ar- - gument. Eg, bad: - - assets -X USD - - Good: - - assets - -X=USD - + argument. Don't use spaces except inside quotes (or you'll see a con- + fusing error); write = (or nothing) between a flag and its argument. For the special characters mentioned above, use one less level of quot- - ing than you would at the command prompt. Eg, bad: - - -X"$" - - Good: - - -X$ - - See also: Save frequently used options. + ing than you would at the command prompt. Output Output destination @@ -1627,11 +1609,12 @@ Journal READING DATA: Rewrite account names alias Comment out sections of the file comment + + Declare file's decimal mark, to help decimal-mark parse amounts accurately Include other data files include GENERATING DATA: - Generate recurring transactions or bud- ~ get goals Generate extra postings on existing = @@ -1699,12 +1682,13 @@ Journal --budget. Other syntax: + + apply Prepends a common parent account to all account names, in fol- Y account lowing entries until end of current file or end apply account. D Sets a default commodity to use for no-symbol amounts;and, if Y,Y,N,N there is no commodity directive for this commodity: its decimal mark, balancing precision, and display style, as above. - Y Sets a default year to use for any yearless dates, in following Y entries until end of current file. = Declares an auto posting rule that generates extra postings on partly @@ -2695,22 +2679,19 @@ Journal parentheses after an amount. hledger ignores these. Virtual postings - A posting with parentheses around the account name is called a virtual - posting or unbalanced posting, which means it is exempt from the usual - rule that a transaction's postings must balance add up to zero. + A posting with parentheses around the account name ((some:account)) is + called a unbalanced virtual posting. Such postings do not participate + in transaction balancing. (And if you write them without an amount, a + zero amount is always inferred.) These can occasionally be convenient + for special circumstances, but they violate double entry bookkeeping + and make your data less portable across applications, so many people + avoid using them at all. - This is not part of double entry bookkeeping, 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: - - 2022-01-01 opening balances - (assets:checking) $1000 - (assets:savings) $2000 - - A posting with brackets around the 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: + A posting with brackets around the account name ([some:account]) is + called a balanced virtual posting. The balanced virtual postings in a + transaction must add up to zero, just like ordinary postings, but sepa- + rately from them. These are not part of double entry bookkeeping ei- + ther, but they are at least balanced. An example: 2022-01-01 buy food with cash, update budget envelope subaccounts, & something else assets:cash $-10 ; <- these balance each other @@ -2720,17 +2701,13 @@ Journal [assets:checking:available] $10 ; <- (something:else) $5 ; <- this is not required to balance - Postings whose account names are neither parenthesised nor bracketed - are called real postings. You can exclude virtual postings from re- - ports with the -R/--real flag or a real:1 query. - - Downsides: violates double entry bookkeeping, can be used to avoid fig- - uring out correct entries, makes your financial data less portable and - less trustworthy in an audit. + Ordinary postings, whose account names are neither parenthesised nor + bracketed, are called real postings. You can exclude virtual postings + from reports with the -R/--real flag or a real:1 query. Other Ledger directives These other Ledger directives are currently accepted but ignored. This - allows hledger to read more Ledger files, but be aware that hledger's + allows hledger to read more Ledger files, but be aware that hledger's reports may differ from Ledger's if you use these. apply fixed COMM AMT @@ -2751,35 +2728,35 @@ Journal value EXPR --command-line-flags - See also https://hledger.org/ledger.html for a detailed hledger/Ledger + See also https://hledger.org/ledger.html for a detailed hledger/Ledger syntax comparison. CSV - hledger can read CSV files (Character Separated Value - usually comma, - semicolon, or tab) containing dated records, automatically converting + hledger can read CSV files (Character Separated Value - usually comma, + semicolon, or tab) containing dated records, automatically converting each record into a transaction. (To learn about writing CSV, see CSV output.) - For best error messages when reading CSV/TSV/SSV files, make sure they + For best error messages when reading CSV/TSV/SSV files, make sure they have a corresponding .csv, .tsv or .ssv file extension or use a hledger file prefix (see File Extension below). Each CSV file must be described by a corresponding rules file. - This contains rules describing the CSV data (header line, fields lay- - out, date format etc.), how to construct hledger transactions from it, - and how to categorise transactions based on description or other at- + This contains rules describing the CSV data (header line, fields lay- + out, date format etc.), how to construct hledger transactions from it, + and how to categorise transactions based on description or other at- tributes. - By default hledger looks for a rules file named like the CSV file with - an extra .rules extension, in the same directory. Eg when asked to + By default hledger looks for a rules file named like the CSV file with + an extra .rules extension, in the same directory. Eg when asked to read foo/FILE.csv, hledger looks for foo/FILE.csv.rules. You can spec- - ify a different rules file with the --rules-file option. If no rules - file is found, hledger will create a sample rules file, which you'll + ify a different rules file with the --rules-file option. If no rules + file is found, hledger will create a sample rules file, which you'll need to adjust. - At minimum, the rules file must identify the date and amount fields, - and often it also specifies the date format and how many header lines + At minimum, the rules file must identify the date and amount fields, + and often it also specifies the date format and how many header lines there are. Here's a simple CSV file and a rules file for it: Date, Description, Id, Amount @@ -2796,57 +2773,57 @@ CSV income:unknown -10.23 There's an introductory Importing CSV data tutorial on hledger.org, and - more CSV rules examples below, and a larger collection at + more CSV rules examples below, and a larger collection at https://github.com/simonmichael/hledger/tree/master/examples/csv. CSV rules cheatsheet The following kinds of rule can appear in the rules file, in any order. (Blank lines and lines beginning with # or ; or * are ignored.) - source optionally declare which file to read data + source optionally declare which file to read data from - separator declare the field separator, instead of rely- + + separator declare the field separator, instead of rely- ing on file extension skip skip one or more header lines at start of file date-format declare how to parse CSV dates/date-times - timezone declare the time zone of ambiguous CSV date- + timezone declare the time zone of ambiguous CSV date- times - newest-first improve txn order when: there are multiple + newest-first improve txn order when: there are multiple records, newest first, all with the same date - - intra-day-reversed improve txn order when: same-day txns are in + intra-day-reversed improve txn order when: same-day txns are in opposite order to the overall file - decimal-mark declare the decimal mark used in CSV amounts, + decimal-mark declare the decimal mark used in CSV amounts, when ambiguous - fields list name CSV fields for easy reference, and op- + fields list name CSV fields for easy reference, and op- tionally assign their values to hledger fields - Field assignment assign a CSV value or interpolated text value + Field assignment assign a CSV value or interpolated text value to a hledger field if block conditionally assign values to hledger fields, or skip a record or end (skip rest of file) if table conditionally assign values to hledger fields, using compact syntax - balance-type select which type of balance assertions/as- + balance-type select which type of balance assertions/as- signments to generate include inline another CSV rules file - Working with CSV tips can be found below, including How CSV rules are + Working with CSV tips can be found below, including How CSV rules are evaluated. source - If you tell hledger to read a csv file with -f foo.csv, it will look - for rules in foo.csv.rules. Or, you can tell it to read the rules - file, with -f foo.csv.rules, and it will look for data in foo.csv + If you tell hledger to read a csv file with -f foo.csv, it will look + for rules in foo.csv.rules. Or, you can tell it to read the rules + file, with -f foo.csv.rules, and it will look for data in foo.csv (since 1.30). - These are mostly equivalent, but the second method provides some extra - features. For one, the data file can be missing, without causing an - error; it is just considered empty. And, you can specify a different + These are mostly equivalent, but the second method provides some extra + features. For one, the data file can be missing, without causing an + error; it is just considered empty. And, you can specify a different data file by adding a "source" rule: source ./Checking1.csv - If you specify just a file name with no path, hledger will look for it + If you specify just a file name with no path, hledger will look for it in your system's downloads directory (~/Downloads, currently): source Checking1.csv @@ -2859,9 +2836,9 @@ CSV See also "Working with CSV > Reading files specified by rule". separator - You can use the separator rule to read other kinds of character-sepa- - rated data. The argument is any single separator character, or the - words tab or space (case insensitive). Eg, for comma-separated values + You can use the separator rule to read other kinds of character-sepa- + rated data. The argument is any single separator character, or the + words tab or space (case insensitive). Eg, for comma-separated values (CSV): separator , @@ -2874,32 +2851,32 @@ CSV separator TAB - If the input file has a .csv, .ssv or .tsv file extension (or a csv:, + If the input file has a .csv, .ssv or .tsv file extension (or a csv:, ssv:, tsv: prefix), the appropriate separator will be inferred automat- ically, and you won't need this rule. skip skip N - The word skip followed by a number (or no number, meaning 1) tells - hledger to ignore this many non-empty lines at the start of the input - data. You'll need this whenever your CSV data contains header lines. - Note, empty and blank lines are skipped automatically, so you don't + The word skip followed by a number (or no number, meaning 1) tells + hledger to ignore this many non-empty lines at the start of the input + data. You'll need this whenever your CSV data contains header lines. + Note, empty and blank lines are skipped automatically, so you don't need to count those. - skip has a second meaning: it can be used inside if blocks (described - below), to skip one or more records whenever the condition is true. + skip has a second meaning: it can be used inside if blocks (described + below), to skip one or more records whenever the condition is true. Records skipped in this way are ignored, except they are still required to be valid CSV. date-format date-format DATEFMT - This is a helper for the date (and date2) fields. If your CSV dates - are not formatted like YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll - need to add a date-format rule describing them with a strptime-style - date parsing pattern - see https://hackage.haskell.org/pack- - age/time/docs/Data-Time-Format.html#v:formatTime. The pattern must + This is a helper for the date (and date2) fields. If your CSV dates + are not formatted like YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll + need to add a date-format rule describing them with a strptime-style + date parsing pattern - see https://hackage.haskell.org/pack- + age/time/docs/Data-Time-Format.html#v:formatTime. The pattern must parse the CSV date value completely. Some examples: # MM/DD/YY @@ -2919,33 +2896,33 @@ CSV timezone timezone TIMEZONE - When CSV contains date-times that are implicitly in some time zone + When CSV contains date-times that are implicitly in some time zone other than yours, but containing no explicit time zone information, you - can use this rule to declare the CSV's native time zone, which helps + can use this rule to declare the CSV's native time zone, which helps prevent off-by-one dates. - When the CSV date-times do contain time zone information, you don't - need this rule; instead, use %Z in date-format (or %z, %EZ, %Ez; see + When the CSV date-times do contain time zone information, you don't + need this rule; instead, use %Z in date-format (or %z, %EZ, %Ez; see the formatTime link above). In either of these cases, hledger will do a time-zone-aware conversion, localising the CSV date-times to your current system time zone. If you prefer to localise to some other time zone, eg for reproducibility, you - can (on unix at least) set the output timezone with the TZ environment + can (on unix at least) set the output timezone with the TZ environment variable, eg: $ TZ=-1000 hledger print -f foo.csv # or TZ=-1000 hledger import foo.csv - timezone currently does not understand timezone names, except "UTC", - "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", or "PDT". For + timezone currently does not understand timezone names, except "UTC", + "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", or "PDT". For others, use numeric format: +HHMM or -HHMM. newest-first hledger tries to ensure that the generated transactions will be ordered - chronologically, including intra-day transactions. Usually it can - auto-detect how the CSV records are ordered. But if it encounters CSV + chronologically, including intra-day transactions. Usually it can + auto-detect how the CSV records are ordered. But if it encounters CSV where all records are on the same date, it assumes that the records are - oldest first. If in fact the CSV's records are normally newest first, + oldest first. If in fact the CSV's records are normally newest first, like: 2022-10-01, txn 3... @@ -2959,8 +2936,8 @@ CSV newest-first intra-day-reversed - CSV records for each day are sometimes ordered in reverse compared to - the overall date order. Eg, here dates are newest first, but the + CSV records for each day are sometimes ordered in reverse compared to + the overall date order. Eg, here dates are newest first, but the transactions on each date are oldest first: 2022-10-02, txn 3... @@ -2968,7 +2945,7 @@ CSV 2022-10-01, txn 1... 2022-10-01, txn 2... - In this situation, add the intra-day-reversed rule, and hledger will + In this situation, add the intra-day-reversed rule, and hledger will compensate, improving the order of transactions. # transactions within each day are reversed with respect to the overall date order @@ -2981,10 +2958,10 @@ CSV decimal-mark , - hledger automatically accepts either period or comma as a decimal mark - when parsing numbers (cf Amounts). However if any numbers in the CSV - contain digit group marks, such as thousand-separating commas, you - should declare the decimal mark explicitly with this rule, to avoid + hledger automatically accepts either period or comma as a decimal mark + when parsing numbers (cf Amounts). However if any numbers in the CSV + contain digit group marks, such as thousand-separating commas, you + should declare the decimal mark explicitly with this rule, to avoid misparsed numbers. fields list @@ -2993,17 +2970,17 @@ CSV A fields list (the word fields followed by comma-separated field names) is optional, but convenient. It does two things: - 1. It names the CSV field in each column. This can be convenient if - you are referencing them in other rules, so you can say %SomeField + 1. It names the CSV field in each column. This can be convenient if + you are referencing them in other rules, so you can say %SomeField instead of remembering %13. - 2. Whenever you use one of the special hledger field names (described - below), it assigns the CSV value in this position to that hledger - field. This is the quickest way to populate hledger's fields and + 2. Whenever you use one of the special hledger field names (described + below), it assigns the CSV value in this position to that hledger + field. This is the quickest way to populate hledger's fields and build a transaction. - Here's an example that says "use the 1st, 2nd and 4th fields as the - transaction's date, description and amount; name the last two fields + Here's an example that says "use the 1st, 2nd and 4th fields as the + transaction's date, description and amount; name the last two fields for later reference; and ignore the others": fields date, description, , amount, , , somefield, anotherfield @@ -3013,35 +2990,35 @@ CSV o There must be least two items in the list (at least one comma). - o Field names may not contain spaces. Spaces before/after field names + o Field names may not contain spaces. Spaces before/after field names are optional. o Field names may contain _ (underscore) or - (hyphen). - o Fields you don't care about can be given a dummy name or an empty + o Fields you don't care about can be given a dummy name or an empty name. - If the CSV contains column headings, it's convenient to use these for - your field names, suitably modified (eg lower-cased with spaces re- + If the CSV contains column headings, it's convenient to use these for + your field names, suitably modified (eg lower-cased with spaces re- placed by underscores). - Sometimes you may want to alter a CSV field name to avoid assigning to - a hledger field with the same name. Eg you could call the CSV's "bal- - ance" field balance_ to avoid directly setting hledger's balance field + Sometimes you may want to alter a CSV field name to avoid assigning to + a hledger field with the same name. Eg you could call the CSV's "bal- + ance" field balance_ to avoid directly setting hledger's balance field (and generating a balance assertion). Field assignment HLEDGERFIELD FIELDVALUE - Field assignments are the more flexible way to assign CSV values to + Field assignments are the more flexible way to assign CSV values to hledger fields. They can be used instead of or in addition to a fields list (see above). - To assign a value to a hledger field, write the field name (any of the - standard hledger field/pseudo-field names, defined below), a space, - followed by a text value on the same line. This text value may inter- - polate CSV fields, referenced by their 1-based position in the CSV - record (%N), or by the name they were given in the fields list (%CSV- + To assign a value to a hledger field, write the field name (any of the + standard hledger field/pseudo-field names, defined below), a space, + followed by a text value on the same line. This text value may inter- + polate CSV fields, referenced by their 1-based position in the CSV + record (%N), or by the name they were given in the fields list (%CSV- FIELD). Some examples: @@ -3054,26 +3031,26 @@ CSV Tips: - o Interpolation strips outer whitespace (so a CSV value like " 1 " be- + o Interpolation strips outer whitespace (so a CSV value like " 1 " be- comes 1 when interpolated) (#1051). - o Interpolations always refer to a CSV field - you can't interpolate a + o Interpolations always refer to a CSV field - you can't interpolate a hledger field. (See Referencing other fields below). Field names - Note the two kinds of field names mentioned here, and used only in + Note the two kinds of field names mentioned here, and used only in hledger CSV rules files: - 1. CSV field names (CSVFIELD in these docs): you can optionally name - the CSV columns for easy reference (since hledger doesn't yet auto- + 1. CSV field names (CSVFIELD in these docs): you can optionally name + the CSV columns for easy reference (since hledger doesn't yet auto- matically recognise column headings in a CSV file), by writing arbi- trary names in a fields list, eg: fields When, What, Some_Id, Net, Total, Foo, Bar - 2. Special hledger field names (HLEDGERFIELD in these docs): you must - set at least some of these to generate the hledger transaction from - a CSV record, by writing them as the left hand side of a field as- + 2. Special hledger field names (HLEDGERFIELD in these docs): you must + set at least some of these to generate the hledger transaction from + a CSV record, by writing them as the left hand side of a field as- signment, eg: date %When @@ -3088,7 +3065,7 @@ CSV currency $ comment %Foo %Bar - Here are all the special hledger field names available, and what hap- + Here are all the special hledger field names available, and what hap- pens when you assign values to them: date field @@ -3111,7 +3088,7 @@ CSV commentN, where N is a number, sets the Nth posting's comment. - You can assign multi-line comments by writing literal \n in the code. + You can assign multi-line comments by writing literal \n in the code. A comment starting with \n will begin on a new line. Comments can contain tags, as usual. @@ -3120,59 +3097,59 @@ CSV Assigning to accountN, where N is 1 to 99, sets the account name of the Nth posting, and causes that posting to be generated. - Most often there are two postings, so you'll want to set account1 and - account2. Typically account1 is associated with the CSV file, and is - set once with a top-level assignment, while account2 is set based on + Most often there are two postings, so you'll want to set account1 and + account2. Typically account1 is associated with the CSV file, and is + set once with a top-level assignment, while account2 is set based on each transaction's description, in conditional rules. - If a posting's account name is left unset but its amount is set (see - below), a default account name will be chosen (like "expenses:unknown" + If a posting's account name is left unset but its amount is set (see + below), a default account name will be chosen (like "expenses:unknown" or "income:unknown"). amount field - Amount setting can get a bit complex. Assigning to amount is suffi- - cient for simple transactions, but there are four field name variants + Amount setting can get a bit complex. Assigning to amount is suffi- + cient for simple transactions, but there are four field name variants you can use for different situations: - o amountN sets a specific posting's amount from one CSV field or arbi- + o amountN sets a specific posting's amount from one CSV field or arbi- trary value. - Assigning to amountN sets the amount of the Nth posting - and also + Assigning to amountN sets the amount of the Nth posting - and also causes that posting to be generated. N is most often 1 or 2 but can go - up to 99, potentially generating a 99-posting transaction. (Posting - numbers don't have to be consecutive; higher posting numbers can some- + up to 99, potentially generating a 99-posting transaction. (Posting + numbers don't have to be consecutive; higher posting numbers can some- times be useful with conditional rules, to ensure a certain ordering of postings.) o amountN-in/-out sets a specific posting's amount from two CSV fields. - When the amount is provided as two CSV fields - "Debit"/"Credit", "De- - posit"/"Withdrawal", "Money In"/"Money Out" or similar - assign those - fields to amountN-in and amountN-out respectively (or possibly the - other way round, depending on signs). This will set the Nth posting's - amount to whichever of the two CSV field values is non-zero. Some + When the amount is provided as two CSV fields - "Debit"/"Credit", "De- + posit"/"Withdrawal", "Money In"/"Money Out" or similar - assign those + fields to amountN-in and amountN-out respectively (or possibly the + other way round, depending on signs). This will set the Nth posting's + amount to whichever of the two CSV field values is non-zero. Some notes: - o Don't mix amountN and amountN-in/-out. When you have one CSV - amount field, use amountN. When you have two CSV amount fields, + o Don't mix amountN and amountN-in/-out. When you have one CSV + amount field, use amountN. When you have two CSV amount fields, use amountN-in/amountN-out. - o amountN-in and amountN-out are always used together, as a pair. + o amountN-in and amountN-out are always used together, as a pair. Assign to both of them. - o They do not generate two separate postings; rather, they generate - the Nth posting's single amount, from the value found in one or + o They do not generate two separate postings; rather, they generate + the Nth posting's single amount, from the value found in one or other of the two CSV fields. - o In each record, at least one of the two CSV fields must contain a + o In each record, at least one of the two CSV fields must contain a zero amount or be empty. o hledger assumes the two CSV fields contain unsigned numbers, and it will automatically negate the -out amount. - o This variant can be convenient, but it doesn't handle every two- - amount-field situation; if you need more flexibility, use an if + o This variant can be convenient, but it doesn't handle every two- + amount-field situation; if you need more flexibility, use an if rule (see "Setting amounts" below). - The other two variants are older and considered legacy syntax, but can + The other two variants are older and considered legacy syntax, but can still be convenient sometimes: o amount sets posting 1 and 2's amounts from one CSV field or value. @@ -3180,11 +3157,11 @@ CSV o sets posting 1's amount (like amount1) - o sets posting 2's amount to the same amount but with opposite sign; + o sets posting 2's amount to the same amount but with opposite sign; and also converts it to cost if it has a cost price - o can be overridden by amount1 and/or amount2 assignments. (This - helps with incremental migration of old rules files to the newer + o can be overridden by amount1 and/or amount2 assignments. (This + helps with incremental migration of old rules files to the newer syntax.) o amount-in/-out sets posting 1 and 2's amounts from two CSV fields. @@ -3192,43 +3169,43 @@ CSV fields reads whichever of the two values is non-zero as the amount, and then sets the first two posting amounts as above. - We recommend using only one of these variants within a rules file, - rather than mixing them. And remember that a fields list can also do - assignments, so eg naming a CSV field "amount" counts as an assignment - to amount; if you don't want that, call it something else, like + We recommend using only one of these variants within a rules file, + rather than mixing them. And remember that a fields list can also do + assignments, so eg naming a CSV field "amount" counts as an assignment + to amount; if you don't want that, call it something else, like "amount_". - In addition to this section, please see also the tips beginning at + In addition to this section, please see also the tips beginning at "Working with CSV > Setting amounts" below. currency field - currency sets a currency symbol, to be prepended to all postings' - amounts. You can use this if the CSV amounts do not have a currency + currency sets a currency symbol, to be prepended to all postings' + amounts. You can use this if the CSV amounts do not have a currency symbol, eg if it is in a separate column. currencyN prepends a currency symbol to just the Nth posting's amount. balance field - balanceN sets a balance assertion amount (or if the posting amount is + balanceN sets a balance assertion amount (or if the posting amount is left empty, a balance assignment) on posting N. balance is a compatibility spelling for hledger <1.17; it is equivalent to balance1. - You can adjust the type of assertion/assignment with the balance-type + You can adjust the type of assertion/assignment with the balance-type rule (see below). See Tips below for more about setting amounts and currency. if block - Rules can be applied conditionally, depending on patterns in the CSV - data. This allows flexibility; in particular, it is how you can cate- - gorise transactions, selecting an appropriate account name based on - their description (for example). There are two ways to write condi- - tional rules: "if blocks", described here, and "if tables", described + Rules can be applied conditionally, depending on patterns in the CSV + data. This allows flexibility; in particular, it is how you can cate- + gorise transactions, selecting an appropriate account name based on + their description (for example). There are two ways to write condi- + tional rules: "if blocks", described here, and "if tables", described below. - An if block is the word if and one or more "matcher" expressions (can + An if block is the word if and one or more "matcher" expressions (can be a word or phrase), one per line, starting either on the same or next line; followed by one or more indented rules. Eg, @@ -3244,11 +3221,11 @@ CSV RULE RULE - If any of the matchers succeeds, all of the indented rules will be ap- - plied. They are usually field assignments, but the following special + If any of the matchers succeeds, all of the indented rules will be ap- + plied. They are usually field assignments, but the following special rules may also be used within an if block: - o skip - skips the matched CSV record (generating no transaction from + o skip - skips the matched CSV record (generating no transaction from it) o end - skips the rest of the current CSV file. @@ -3274,26 +3251,26 @@ CSV Matchers There are two kinds: - 1. A record matcher is a word or single-line text fragment or regular - expression (REGEX), which hledger will try to match case-insensi- + 1. A record matcher is a word or single-line text fragment or regular + expression (REGEX), which hledger will try to match case-insensi- tively anywhere within the CSV record. Eg: whole foods - 2. A field matcher is preceded with a percent sign and CSV field name - (%CSVFIELD REGEX). hledger will try to match these just within the + 2. A field matcher is preceded with a percent sign and CSV field name + (%CSVFIELD REGEX). hledger will try to match these just within the named CSV field. Eg: %date 2023 - The regular expression is (as usual in hledger) a POSIX extended regu- - lar expression, that also supports GNU word boundaries (\b, \B, \<, - \>), and nothing else. If you have trouble, see "Regular expressions" + The regular expression is (as usual in hledger) a POSIX extended regu- + lar expression, that also supports GNU word boundaries (\b, \B, \<, + \>), and nothing else. If you have trouble, see "Regular expressions" in the hledger manual (https://hledger.org/hledger.html#regular-expres- sions). With record matchers, it's important to know that the record matched is - not the original CSV record, but a modified one: separators will be - converted to commas, and enclosing double quotes (but not enclosing - whitespace) are removed. So for example, when reading an SSV file, if + not the original CSV record, but a modified one: separators will be + converted to commas, and enclosing double quotes (but not enclosing + whitespace) are removed. So for example, when reading an SSV file, if the original record was: 2023-01-01; "Acme, Inc."; 1,000 @@ -3306,14 +3283,14 @@ CSV o By default they are OR'd (any one of them can match) - o When a matcher is preceded by ampersand (&) it will be AND'ed with + o When a matcher is preceded by ampersand (&) it will be AND'ed with the previous matcher (both of them must match). There's not yet an easy syntax to negate a matcher. if table - "if tables" are an alternative to if blocks; they can express many - matchers and field assignments in a more compact tabular format, like + "if tables" are an alternative to if blocks; they can express many + matchers and field assignments in a more compact tabular format, like this: if,HLEDGERFIELD1,HLEDGERFIELD2,... @@ -3322,17 +3299,17 @@ CSV MATCHERC,VALUE1,VALUE2,... - The first character after if is taken to be the separator for the rest - of the table. It should be a non-alphanumeric character like , or | - that does not appear anywhere else in the table. (Note: it is unre- - lated to the CSV file's separator.) Whitespace can be used in the - matcher lines for readability, but not in the if line currently. The - table must be terminated by an empty line (or end of file). Each line + The first character after if is taken to be the separator for the rest + of the table. It should be a non-alphanumeric character like , or | + that does not appear anywhere else in the table. (Note: it is unre- + lated to the CSV file's separator.) Whitespace can be used in the + matcher lines for readability, but not in the if line currently. The + table must be terminated by an empty line (or end of file). Each line must contain the same number of separators; empty values are allowed. - The above means: try all of the matchers; whenever a matcher succeeds, - assign all of the values on that line to the corresponding hledger - fields; later lines can overrider earlier ones. It is equivalent to + The above means: try all of the matchers; whenever a matcher succeeds, + assign all of the values on that line to the corresponding hledger + fields; later lines can overrider earlier ones. It is equivalent to this sequence of if blocks: if MATCHERA @@ -3359,10 +3336,10 @@ CSV balance-type Balance assertions generated by assigning to balanceN are of the simple - = type by default, which is a single-commodity, subaccount-excluding + = type by default, which is a single-commodity, subaccount-excluding assertion. You may find the subaccount-including variants more useful, - eg if you have created some virtual subaccounts of checking to help - with budgeting. You can select a different type of assertion with the + eg if you have created some virtual subaccounts of checking to help + with budgeting. You can select a different type of assertion with the balance-type rule: # balance assertions will consider all commodities and all subaccounts @@ -3378,9 +3355,9 @@ CSV include include RULESFILE - This includes the contents of another CSV rules file at this point. - RULESFILE is an absolute file path or a path relative to the current - file's directory. This can be useful for sharing common rules between + This includes the contents of another CSV rules file at this point. + RULESFILE is an absolute file path or a path relative to the current + file's directory. This can be useful for sharing common rules between several rules files, eg: # someaccount.csv.rules @@ -3397,42 +3374,42 @@ CSV Some tips: Rapid feedback - It's a good idea to get rapid feedback while creating/troubleshooting + It's a good idea to get rapid feedback while creating/troubleshooting CSV rules. Here's a good way, using entr from eradman.com/entrproject: $ ls foo.csv* | entr bash -c 'echo ----; hledger -f foo.csv print desc:SOMEDESC' - A desc: query (eg) is used to select just one, or a few, transactions - of interest. "bash -c" is used to run multiple commands, so we can - echo a separator each time the command re-runs, making it easier to + A desc: query (eg) is used to select just one, or a few, transactions + of interest. "bash -c" is used to run multiple commands, so we can + echo a separator each time the command re-runs, making it easier to read the output. Valid CSV - Note that hledger will only accept valid CSV conforming to RFC 4180, + Note that hledger will only accept valid CSV conforming to RFC 4180, and equivalent SSV and TSV formats (like RFC 4180 but with semicolon or tab as separators). This means, eg: o Values may be enclosed in double quotes, or not. Enclosing in single quotes is not allowed. (Eg 'A','B' is rejected.) - o When values are enclosed in double quotes, spaces outside the quotes + o When values are enclosed in double quotes, spaces outside the quotes are not allowed. (Eg "A", "B" is rejected.) - o When values are not enclosed in quotes, they may not contain double + o When values are not enclosed in quotes, they may not contain double quotes. (Eg A"A, B is rejected.) - If your CSV/SSV/TSV is not valid in this sense, you'll need to trans- - form it before reading with hledger. Try using sed, or a more permis- + If your CSV/SSV/TSV is not valid in this sense, you'll need to trans- + form it before reading with hledger. Try using sed, or a more permis- sive CSV parser like python's csv lib. File Extension - To help hledger choose the CSV file reader and show the right error - messages (and choose the right field separator character by default), - it's best if CSV/SSV/TSV files are named with a .csv, .ssv or .tsv + To help hledger choose the CSV file reader and show the right error + messages (and choose the right field separator character by default), + it's best if CSV/SSV/TSV files are named with a .csv, .ssv or .tsv filename extension. (More about this at Data formats.) - When reading files with the "wrong" extension, you can ensure the CSV - reader (and the default field separator) by prefixing the file path + When reading files with the "wrong" extension, you can ensure the CSV + reader (and the default field separator) by prefixing the file path with csv:, ssv: or tsv:: Eg: $ hledger -f ssv:foo.dat print @@ -3441,29 +3418,29 @@ CSV if needed. Reading CSV from standard input - You'll need the file format prefix when reading CSV from stdin also, + You'll need the file format prefix when reading CSV from stdin also, since hledger assumes journal format by default. Eg: $ cat foo.dat | hledger -f ssv:- print Reading multiple CSV files - If you use multiple -f options to read multiple CSV files at once, - hledger will look for a correspondingly-named rules file for each CSV - file. But if you use the --rules-file option, that rules file will be + If you use multiple -f options to read multiple CSV files at once, + hledger will look for a correspondingly-named rules file for each CSV + file. But if you use the --rules-file option, that rules file will be used for all the CSV files. Reading files specified by rule Instead of specifying a CSV file in the command line, you can specify a - rules file, as in hledger -f foo.csv.rules CMD. By default this will - read data from foo.csv in the same directory, but you can add a source - rule to specify a different data file, perhaps located in your web + rules file, as in hledger -f foo.csv.rules CMD. By default this will + read data from foo.csv in the same directory, but you can add a source + rule to specify a different data file, perhaps located in your web browser's download directory. This feature was added in hledger 1.30, so you won't see it in most CSV - rules examples. But it helps remove some of the busywork of managing + rules examples. But it helps remove some of the busywork of managing CSV downloads. Most of your financial institutions's default CSV file- - names are different and can be recognised by a glob pattern. So you - can put a rule like source Checking1*.csv in foo-checking.csv.rules, + names are different and can be recognised by a glob pattern. So you + can put a rule like source Checking1*.csv in foo-checking.csv.rules, and then periodically follow a workflow like: 1. Download CSV from Foo's website, using your browser's defaults @@ -3471,45 +3448,45 @@ CSV 2. Run hledger import foo-checking.csv.rules to import any new transac- tions - After import, you can: discard the CSV, or leave it where it is for a - while, or move it into your archives, as you prefer. If you do noth- - ing, next time your browser will save something like Checking1-2.csv, - and hledger will use that because of the * wild card and because it is + After import, you can: discard the CSV, or leave it where it is for a + while, or move it into your archives, as you prefer. If you do noth- + ing, next time your browser will save something like Checking1-2.csv, + and hledger will use that because of the * wild card and because it is the most recent. Valid transactions After reading a CSV file, hledger post-processes and validates the gen- erated journal entries as it would for a journal file - balancing them, - applying balance assignments, and canonicalising amount styles. Any - errors at this stage will be reported in the usual way, displaying the + applying balance assignments, and canonicalising amount styles. Any + errors at this stage will be reported in the usual way, displaying the problem entry. There is one exception: balance assertions, if you have generated them, - will not be checked, since normally these will work only when the CSV - data is part of the main journal. If you do need to check balance as- + will not be checked, since normally these will work only when the CSV + data is part of the main journal. If you do need to check balance as- sertions generated from CSV right away, pipe into another hledger: $ hledger -f file.csv print | hledger -f- print Deduplicating, importing - When you download a CSV file periodically, eg to get your latest bank - transactions, the new file may overlap with the old one, containing + When you download a CSV file periodically, eg to get your latest bank + transactions, the new file may overlap with the old one, containing some of the same records. The import command will (a) detect the new transactions, and (b) append just those transactions to your main journal. It is idempotent, so you - don't have to remember how many times you ran it or with which version - of the CSV. (It keeps state in a hidden .latest.FILE.csv file.) This + don't have to remember how many times you ran it or with which version + of the CSV. (It keeps state in a hidden .latest.FILE.csv file.) This is the easiest way to import CSV data. Eg: # download the latest CSV files, then run this command. # Note, no -f flags needed here. $ hledger import *.csv [--dry] - This method works for most CSV files. (Where records have a stable + This method works for most CSV files. (Where records have a stable chronological order, and new records appear only at the new end.) - A number of other tools and workflows, hledger-specific and otherwise, + A number of other tools and workflows, hledger-specific and otherwise, exist for converting, deduplicating, classifying and managing CSV data. See: @@ -3523,11 +3500,11 @@ CSV 1. If the amount is in a single CSV field: a. If its sign indicates direction of flow: - Assign it to amountN, to set the Nth posting's amount. N is usu- + Assign it to amountN, to set the Nth posting's amount. N is usu- ally 1 or 2 but can go up to 99. b. If another field indicates direction of flow: - Use one or more conditional rules to set the appropriate amount + Use one or more conditional rules to set the appropriate amount sign. Eg: # assume a withdrawal unless Type contains "deposit": @@ -3543,7 +3520,7 @@ CSV b. If either field is signed: Use a conditional rule to flip the sign when needed. Eg below, the - -out value already has a minus sign so we undo hledger's automatic + -out value already has a minus sign so we undo hledger's automatic negating by negating once more (but only if the field is non-empty, so that we don't leave a minus sign by itself): @@ -3551,12 +3528,12 @@ CSV if %amount1-out [1-9] amount1-out -%amount1-out - c. If both fields can contain a non-zero value (or both can be + c. If both fields can contain a non-zero value (or both can be empty): The -in/-out rules normally choose the value which is non-zero/non- empty. Some value pairs can be ambiguous, such as 1 and none. For - such cases, use conditional rules to help select the amount. Eg, - to handle the above you could select the value containing non-zero + such cases, use conditional rules to help select the amount. Eg, + to handle the above you could select the value containing non-zero digits: fields date, description, in, out @@ -3569,8 +3546,8 @@ CSV Use the unnumbered amount (or amount-in and amount-out) syntax. 4. If the CSV has only balance amounts, not transaction amounts: - Assign to balanceN, to set a balance assignment on the Nth posting, - causing the posting's amount to be calculated automatically. balance + Assign to balanceN, to set a balance assignment on the Nth posting, + causing the posting's amount to be calculated automatically. balance with no number is equivalent to balance1. In this situation hledger is more likely to guess the wrong default account name, so you may need to set that explicitly. @@ -3586,20 +3563,20 @@ CSV o If an amount value is parenthesised: it will be de-parenthesised and sign-flipped: (AMT) becomes -AMT - o If an amount value has two minus signs (or two sets of parentheses, + o If an amount value has two minus signs (or two sets of parentheses, or a minus sign and parentheses): they cancel out and will be removed: --AMT or -(AMT) becomes AMT - o If an amount value contains just a sign (or just a set of parenthe- + o If an amount value contains just a sign (or just a set of parenthe- ses): - that is removed, making it an empty value. "+" or "-" or "()" becomes + that is removed, making it an empty value. "+" or "-" or "()" becomes "". - It's not possible (without preprocessing the CSV) to set an amount to + It's not possible (without preprocessing the CSV) to set an amount to its absolute value, ie discard its sign. Setting currency/commodity - If the currency/commodity symbol is included in the CSV's amount + If the currency/commodity symbol is included in the CSV's amount field(s): 2023-01-01,foo,$123.00 @@ -3618,7 +3595,7 @@ CSV 2023-01-01,foo,USD,123.00 You can assign that to the currency pseudo-field, which has the special - effect of prepending itself to every amount in the transaction (on the + effect of prepending itself to every amount in the transaction (on the left, with no separating space): fields date,description,currency,amount @@ -3627,7 +3604,7 @@ CSV expenses:unknown USD123.00 income:unknown USD-123.00 - Or, you can use a field assignment to construct the amount yourself, + Or, you can use a field assignment to construct the amount yourself, with more control. Eg to put the symbol on the right, and separated by a space: @@ -3638,7 +3615,7 @@ CSV expenses:unknown 123.00 USD income:unknown -123.00 USD - Note we used a temporary field name (cur) that is not currency - that + Note we used a temporary field name (cur) that is not currency - that would trigger the prepending effect, which we don't want here. Amount decimal places @@ -3646,13 +3623,13 @@ CSV amount1 influence commodity display styles, such as the number of deci- mal places displayed in reports. - The original amounts as written in the CSV file do not affect display + The original amounts as written in the CSV file do not affect display style (because we don't yet reliably know their commodity). Referencing other fields - In field assignments, you can interpolate only CSV fields, not hledger - fields. In the example below, there's both a CSV field and a hledger - field named amount1, but %amount1 always means the CSV field, not the + In field assignments, you can interpolate only CSV fields, not hledger + fields. In the example below, there's both a CSV field and a hledger + field named amount1, but %amount1 always means the CSV field, not the hledger field: # Name the third CSV field "amount1" @@ -3664,7 +3641,7 @@ CSV # Set comment to the CSV amount1 (not the amount1 assigned above) comment %amount1 - Here, since there's no CSV amount1 field, %amount1 will produce a lit- + Here, since there's no CSV amount1 field, %amount1 will produce a lit- eral "amount1": fields date,description,csvamount @@ -3672,7 +3649,7 @@ CSV # Can't interpolate amount1 here comment %amount1 - When there are multiple field assignments to the same hledger field, + When there are multiple field assignments to the same hledger field, only the last one takes effect. Here, comment's value will be be B, or C if "something" is matched, but never A: @@ -3682,14 +3659,14 @@ CSV comment C How CSV rules are evaluated - Here's how to think of CSV rules being evaluated (if you really need + Here's how to think of CSV rules being evaluated (if you really need to). First, - o include - all includes are inlined, from top to bottom, depth first. - (At each include point the file is inlined and scanned for further + o include - all includes are inlined, from top to bottom, depth first. + (At each include point the file is inlined and scanned for further includes, recursively, before proceeding.) - Then "global" rules are evaluated, top to bottom. If a rule is re- + Then "global" rules are evaluated, top to bottom. If a rule is re- peated, the last one wins: o skip (at top level) @@ -3703,30 +3680,30 @@ CSV Then for each CSV record in turn: - o test all if blocks. If any of them contain a end rule, skip all re- - maining CSV records. Otherwise if any of them contain a skip rule, - skip that many CSV records. If there are multiple matched skip + o test all if blocks. If any of them contain a end rule, skip all re- + maining CSV records. Otherwise if any of them contain a skip rule, + skip that many CSV records. If there are multiple matched skip rules, the first one wins. - o collect all field assignments at top level and in matched if blocks. - When there are multiple assignments for a field, keep only the last + o collect all field assignments at top level and in matched if blocks. + When there are multiple assignments for a field, keep only the last one. - o compute a value for each hledger field - either the one that was as- + o compute a value for each hledger field - either the one that was as- signed to it (and interpolate the %CSVFIELD references), or a default o generate a hledger transaction (journal entry) from these values. - This is all part of the CSV reader, one of several readers hledger can - use to parse input files. When all files have been read successfully, - the transactions are passed as input to whichever hledger command the + This is all part of the CSV reader, one of several readers hledger can + use to parse input files. When all files have been read successfully, + the transactions are passed as input to whichever hledger command the user specified. Well factored rules - Some things than can help reduce duplication and complexity in rules + Some things than can help reduce duplication and complexity in rules files: - o Extracting common rules usable with multiple CSV files into a com- + o Extracting common rules usable with multiple CSV files into a com- mon.rules, and adding include common.rules to each CSV's rules file. o Splitting if blocks into smaller if blocks, extracting the frequently @@ -3734,8 +3711,8 @@ CSV CSV rules examples Bank of Ireland - Here's a CSV with two amount fields (Debit and Credit), and a balance - field, which we can use to add balance assertions, which is not neces- + Here's a CSV with two amount fields (Debit and Credit), and a balance + field, which we can use to add balance assertions, which is not neces- sary but provides extra error checking: Date,Details,Debit,Credit,Balance @@ -3777,13 +3754,13 @@ CSV assets:bank:boi:checking EUR-5.0 = EUR126.0 expenses:unknown EUR5.0 - The balance assertions don't raise an error above, because we're read- - ing directly from CSV, but they will be checked if these entries are + The balance assertions don't raise an error above, because we're read- + ing directly from CSV, but they will be checked if these entries are imported into a journal file. Coinbase - A simple example with some CSV from Coinbase. The spot price is - recorded using cost notation. The legacy amount field name conve- + A simple example with some CSV from Coinbase. The spot price is + recorded using cost notation. The legacy amount field name conve- niently sets amount 2 (posting 2's amount) to the total cost. # Timestamp,Transaction Type,Asset,Quantity Transacted,Spot Price Currency,Spot Price at Transaction,Subtotal,Total (inclusive of fees and/or spread),Fees and/or Spread,Notes @@ -3805,7 +3782,7 @@ CSV Amazon Here we convert amazon.com order history, and use an if block to gener- - ate a third posting if there's a fee. (In practice you'd probably get + ate a third posting if there's a fee. (In practice you'd probably get this data from your bank instead, but it's an example.) "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID" @@ -3857,7 +3834,7 @@ CSV expenses:fees $1.00 Paypal - Here's a real-world rules file for (customised) Paypal CSV, with some + Here's a real-world rules file for (customised) Paypal CSV, with some Paypal-specific rules, and a second rules file included: "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note" @@ -4008,12 +3985,12 @@ CSV Timeclock The time logging format of timeclock.el, as read by hledger. - hledger can read time logs in timeclock format. As with Ledger, these + hledger can read time logs in timeclock format. As with Ledger, these are (a subset of) timeclock.el's format, containing clock-in and clock- - out entries as in the example below. The date is a simple date. The - time format is HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. + out entries as in the example below. The date is a simple date. The + time format is HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. The timezone, if present, must be four digits and is ignored (currently - the time is always interpreted as a local time). Lines beginning with + the time is always interpreted as a local time). Lines beginning with # or ; or *, and blank lines, are ignored. i 2015/03/30 09:00:00 some account optional description after 2 spaces ; optional comment, tags: @@ -4021,9 +3998,9 @@ Timeclock i 2015/03/31 22:21:45 another:account o 2015/04/01 02:00:34 - hledger treats each clock-in/clock-out pair as a transaction posting - some number of hours to an account. Or if the session spans more than - one day, it is split into several transactions, one for each day. For + hledger treats each clock-in/clock-out pair as a transaction posting + some number of hours to an account. Or if the session spans more than + one day, it is split into several transactions, one for each day. For the above time log, hledger print generates these journal entries: $ hledger -f t.timeclock print @@ -4044,26 +4021,26 @@ Timeclock To generate time logs, ie to clock in and clock out, you could: - o use emacs and the built-in timeclock.el, or the extended timeclock- + o use emacs and the built-in timeclock.el, or the extended timeclock- x.el and perhaps the extras in ledgerutils.el o at the command line, use these bash aliases: shell alias ti="echo - i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG" alias to="echo o + i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG" alias to="echo o `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG" o or use the old ti and to scripts in the ledger 2.x repository. These - rely on a "timeclock" executable which I think is just the ledger 2 + rely on a "timeclock" executable which I think is just the ledger 2 executable renamed. Timedot - timedot format is hledger's human-friendly time logging format. Com- + timedot format is hledger's human-friendly time logging format. Com- pared to timeclock format, it is o convenient for quick, approximate, and retroactive time logging o readable: you can see at a glance where time was spent. - A timedot file contains a series of day entries, which might look like + A timedot file contains a series of day entries, which might look like this: 2023-05-01 @@ -4072,9 +4049,9 @@ Timedot per:admin:finance hledger reads this as a transaction on this day with three (unbalanced) - postings, where each dot represents "0.25". No commodity is assumed, - but normally we interpret it as hours, with each dot representing a - quarter-hour. It's convenient, though not required, to group the dots + postings, where each dot represents "0.25". No commodity is assumed, + but normally we interpret it as hours, with each dot representing a + quarter-hour. It's convenient, though not required, to group the dots in fours for easy reading. $ hledger -f a.timedot print # .timedot file extension (or timedot: prefix) is required @@ -4083,52 +4060,52 @@ Timedot (fos:hledger:timedot) 0.50 ; half an hour (per:admin:finance) 0 - A transaction begins with a non-indented simple date (Y-M-D, Y/M/D, or - Y.M.D). It can optionally be preceded by one or more stars and a + A transaction begins with a non-indented simple date (Y-M-D, Y/M/D, or + Y.M.D). It can optionally be preceded by one or more stars and a space, for Emacs org mode compatibility. It can optionally be followed - on the same line by a transaction description, and/or a transaction + on the same line by a transaction description, and/or a transaction comment following a semicolon. After the date line are zero or more time postings, consisting of: - o an account name - any hledger-style account name, optionally hierar- + o an account name - any hledger-style account name, optionally hierar- chical, optionally indented. - o two or more spaces - a field separator, required if there is an + o two or more spaces - a field separator, required if there is an amount (as in journal format). - o an optional timedot amount - dots representing quarter hours, or a + o an optional timedot amount - dots representing quarter hours, or a number representing hours, optionally with a unit suffix. o an optional posting comment following a semicolon. Timedot amounts can be: - o dots: zero or more period characters (.), each representing 0.25. + o dots: zero or more period characters (.), each representing 0.25. Spaces are ignored and can be used for grouping. Eg: .... .. o or a number. Eg: 1.5 - o or a number immediately followed by a unit symbol s, m, h, d, w, mo, - or y. These are interpreted as seconds, minutes, hours, days weeks, + o or a number immediately followed by a unit symbol s, m, h, d, w, mo, + or y. These are interpreted as seconds, minutes, hours, days weeks, months or years, and converted to hours, assuming: 60s = 1m, 60m = 1h, 24h = 1d, 7d = 1w, 30d = 1mo, 365d = 1y. Eg 90m is parsed as 1.5. - There is some added flexibility to help with keeping time log data in + There is some added flexibility to help with keeping time log data in the same file as your notes, todo lists, etc.: o Blank lines and lines beginning with # or ; are ignored. o Before the first date line, lines beginning with * are ignored. - o From the first date line onward, one or more *'s followed by a space - at beginning of lines (ie, the headline prefix used by Emacs Org - mode) is ignored. This means the time log can be kept under an Org - headline, and date lines or time transaction lines can be Org head- + o From the first date line onward, one or more *'s followed by a space + at beginning of lines (ie, the headline prefix used by Emacs Org + mode) is ignored. This means the time log can be kept under an Org + headline, and date lines or time transaction lines can be Org head- lines. - o Lines not ending with a double-space and amount are parsed as post- + o Lines not ending with a double-space and amount are parsed as post- ings with zero amount. Note hledger's register reports hide these by default (add -E to see them). @@ -4213,39 +4190,39 @@ PART 3: REPORTING CONCEPTS Time periods Report start & end date By default, most hledger reports will show the full span of time repre- - sented by the journal. The report start date will be the earliest + sented by the journal. The report start date will be the earliest transaction or posting date, and the report end date will be the latest transaction, posting, or market price date. - Often you will want to see a shorter time span, such as the current - month. You can specify a start and/or end date using -b/--begin, + Often you will want to see a shorter time span, such as the current + month. You can specify a start and/or end date using -b/--begin, -e/--end, -p/--period or a date: query (described below). All of these accept the smart date syntax (below). Some notes: - o End dates are exclusive, as in Ledger, so you should write the date + o End dates are exclusive, as in Ledger, so you should write the date after the last day you want to see in the report. - o As noted in reporting options: among start/end dates specified with + o As noted in reporting options: among start/end dates specified with options, the last (i.e. right-most) option takes precedence. - o The effective report start and end dates are the intersection of the - start/end dates from options and that from date: queries. That is, - date:2019-01 date:2019 -p'2000 to 2030' yields January 2019, the + o The effective report start and end dates are the intersection of the + start/end dates from options and that from date: queries. That is, + date:2019-01 date:2019 -p'2000 to 2030' yields January 2019, the smallest common time span. - o In some cases a report interval will adjust start/end dates to fall + o In some cases a report interval will adjust start/end dates to fall on interval boundaries (see below). Examples: -b 2016/3/17 begin on St. Patrick's day 2016 - -e 12/1 end at the start of december 1st of the current year + -e 12/1 end at the start of december 1st of the current year (11/30 will be the last date included) -b thismonth all transactions on or after the 1st of the current month -p thismonth all transactions in the current month - date:2016/3/17.. the above written as queries instead (.. can also be re- + date:2016/3/17.. the above written as queries instead (.. can also be re- placed with -) date:..12/1 date:thismonth.. @@ -4253,11 +4230,11 @@ Time periods Smart dates hledger's user interfaces accept a "smart date" syntax for added conve- - nience. Smart dates optionally can be relative to today's date, be - written with english words, and have less-significant parts omitted + nience. Smart dates optionally can be relative to today's date, be + written with english words, and have less-significant parts omitted (missing parts are inferred as 1). Some examples: - 2004/10/1, 2004-01-01, exact date, several separators allowed. Year + 2004/10/1, 2004-01-01, exact date, several separators allowed. Year 2004.9.1 is 4+ digits, month is 1-12, day is 1-31 2004 start of year 2004/10 start of month @@ -4283,26 +4260,26 @@ Time periods 20181201 8 digit YYYYMMDD with valid year month and day 201812 6 digit YYYYMM with valid year and month - Some counterexamples - malformed digit sequences might give surprising + Some counterexamples - malformed digit sequences might give surprising results: - 201813 6 digits with an invalid month is parsed as start of + 201813 6 digits with an invalid month is parsed as start of 6-digit year - 20181301 8 digits with an invalid month is parsed as start of + 20181301 8 digits with an invalid month is parsed as start of 8-digit year 20181232 8 digits with an invalid day gives an error 201801012 9+ digits beginning with a valid YYYYMMDD gives an error - "Today's date" can be overridden with the --today option, in case it's + "Today's date" can be overridden with the --today option, in case it's needed for testing or for recreating old reports. (Except for periodic transaction rules, which are not affected by --today.) Report intervals - A report interval can be specified so that reports like register, bal- + A report interval can be specified so that reports like register, bal- ance or activity become multi-period, showing each subperiod as a sepa- rate row or column. - The following standard intervals can be enabled with command-line + The following standard intervals can be enabled with command-line flags: o -D/--daily @@ -4315,38 +4292,38 @@ Time periods o -Y/--yearly - More complex intervals can be specified using -p/--period, described + More complex intervals can be specified using -p/--period, described below. Date adjustment - When there is a report interval (other than daily), report start/end - dates which have been inferred, eg from the journal, are automatically - adjusted to natural period boundaries. This is convenient for produc- + When there is a report interval (other than daily), report start/end + dates which have been inferred, eg from the journal, are automatically + adjusted to natural period boundaries. This is convenient for produc- ing simple periodic reports. More precisely: - o an inferred start date will be adjusted earlier if needed to fall on + o an inferred start date will be adjusted earlier if needed to fall on a natural period boundary - o an inferred end date will be adjusted later if needed to make the + o an inferred end date will be adjusted later if needed to make the last period the same length as the others. By contrast, start/end dates which have been specified explicitly, with - -b, -e, -p or date:, will not be adjusted (since hledger 1.29). This - makes it possible to specify non-standard report periods, but it also - means that if you are specifying a start date, you should pick one - that's on a period boundary if you want to see simple report period + -b, -e, -p or date:, will not be adjusted (since hledger 1.29). This + makes it possible to specify non-standard report periods, but it also + means that if you are specifying a start date, you should pick one + that's on a period boundary if you want to see simple report period headings. Period expressions - The -p/--period option specifies a period expression, which is a com- + The -p/--period option specifies a period expression, which is a com- pact way of expressing a start date, end date, and/or report interval. - Here's a period expression with a start and end date (specifying the + Here's a period expression with a start and end date (specifying the first quarter of 2009): -p "from 2009/1/1 to 2009/4/1" - Several keywords like "from" and "to" are supported for readability; + Several keywords like "from" and "to" are supported for readability; these are optional. "to" can also be written as ".." or "-". The spa- ces are also optional, as long as you don't run two dates together. So the following are equivalent to the above: @@ -4355,7 +4332,7 @@ Time periods -p2009/1/1to2009/4/1 -p2009/1/1..2009/4/1 - Dates are smart dates, so if the current year is 2009, these are also + Dates are smart dates, so if the current year is 2009, these are also equivalent to the above: -p "1/1 4/1" @@ -4367,28 +4344,28 @@ Time periods -p "from 2009/1/1" everything after january 1, 2009 - -p "since 2009/1" the same, since is a syn- + -p "since 2009/1" the same, since is a syn- onym -p "from 2009" the same - -p "to 2009" everything before january + -p "to 2009" everything before january 1, 2009 You can also specify a period by writing a single partial or full date: -p "2009" the year 2009; equivalent to "2009/1/1 to 2010/1/1" - -p "2009/1" the month of january 2009; equivalent to "2009/1/1 to + -p "2009/1" the month of january 2009; equivalent to "2009/1/1 to 2009/2/1" - -p "2009/1/1" the first day of 2009; equivalent to "2009/1/1 to + -p "2009/1/1" the first day of 2009; equivalent to "2009/1/1 to 2009/1/2" or by using the "Q" quarter-year syntax (case insensitive): - -p "2009Q1" first quarter of 2009, equivalent to "2009/1/1 to + -p "2009Q1" first quarter of 2009, equivalent to "2009/1/1 to 2009/4/1" -p "q4" fourth quarter of the current year Period expressions with a report interval - A period expression can also begin with a report interval, separated + A period expression can also begin with a report interval, separated from the start/end dates (if any) by a space or the word in: -p "weekly from 2009/1/1 to 2009/4/1" @@ -4411,10 +4388,10 @@ Time periods Weekly on a custom day: - o every Nth day of week (th, nd, rd, or st are all accepted after the + o every Nth day of week (th, nd, rd, or st are all accepted after the number) - o every WEEKDAYNAME (full or three-letter english weekday name, case + o every WEEKDAYNAME (full or three-letter english weekday name, case insensitive) Monthly on a custom day: @@ -4427,7 +4404,7 @@ Time periods o every MM/DD [of year] (month number and day of month number) - o every MONTHNAME DDth [of year] (full or three-letter english month + o every MONTHNAME DDth [of year] (full or three-letter english month name, case insensitive, and day of month number) o every DDth MONTHNAME [of year] (equivalent to the above) @@ -4440,21 +4417,21 @@ Time periods 2009/03" -p "every 2nd day of week" periods will go from Tue to Tue -p "every Tue" same - -p "every 15th day" period boundaries will be on 15th of each + -p "every 15th day" period boundaries will be on 15th of each month - -p "every 2nd Monday" period boundaries will be on second Monday + -p "every 2nd Monday" period boundaries will be on second Monday of each month - -p "every 11/05" yearly periods with boundaries on 5th of + -p "every 11/05" yearly periods with boundaries on 5th of November -p "every 5th November" same -p "every Nov 5th" same - Show historical balances at end of the 15th day of each month (N is an + Show historical balances at end of the 15th day of each month (N is an end date, exclusive as always): $ hledger balance -H -p "every 16th day" - Group postings from the start of wednesday to end of the following + Group postings from the start of wednesday to end of the following tuesday (N is both (inclusive) start date and (exclusive) end date): $ hledger register checking -p "every 3rd day of week" @@ -4465,27 +4442,27 @@ Time periods o every WEEKDAYNAME,WEEKDAYNAME,... (full or three-letter english week- day names, case insensitive) - Also, weekday and weekendday are shorthand for mon,tue,wed,thu,fri and + Also, weekday and weekendday are shorthand for mon,tue,wed,thu,fri and sat,sun. - This is mainly intended for use with --forecast, to generate periodic + This is mainly intended for use with --forecast, to generate periodic transactions on arbitrary days of the week. It may be less useful with -p, since it divides each week into subperiods of unequal length, which is unusual. (Related: #1632) Examples: - -p "every dates will be Mon, Wed, Fri; periods will be Mon- + -p "every dates will be Mon, Wed, Fri; periods will be Mon- mon,wed,fri" Tue, Wed-Thu, Fri-Sun - -p "every weekday" dates will be Mon, Tue, Wed, Thu, Fri; periods will + -p "every weekday" dates will be Mon, Tue, Wed, Thu, Fri; periods will be Mon, Tue, Wed, Thu, Fri-Sun -p "every weekend- dates will be Sat, Sun; periods will be Sat, Sun-Fri day" Depth - With the --depth NUM option (short form: -NUM), reports will show ac- - counts only to the specified depth, hiding deeper subaccounts. Use - this when you want a summary with less detail. This flag has the same + With the --depth NUM option (short form: -NUM), reports will show ac- + counts only to the specified depth, hiding deeper subaccounts. Use + this when you want a summary with less detail. This flag has the same effect as a depth: query argument: depth:2, --depth=2 or -2 are equiva- lent. @@ -4494,12 +4471,12 @@ Queries subset of your data. Most hledger commands accept optional query argu- ments to restrict their scope. The syntax is as follows: - o Zero or more space-separated query terms. These are most often ac- + o Zero or more space-separated query terms. These are most often ac- count name substrings: utilities food:groceries - o Terms with spaces or other special characters should be enclosed in + o Terms with spaces or other special characters should be enclosed in quotes: "personal care" @@ -4521,16 +4498,16 @@ Queries prefixed with not: to convert them into a negative match. acct:REGEX, REGEX - Match account names containing this (case insensitive) regular expres- + Match account names containing this (case insensitive) regular expres- sion. This is the default query type when there is no prefix, and reg- - ular expression syntax is typically not needed, so usually we just + ular expression syntax is typically not needed, so usually we just write an account name substring, like expenses or food. amt:N, amt:N, amt:>=N - Match postings with a single-commodity amount equal to, less than, or - greater than N. (Postings with multi-commodity amounts are not tested + Match postings with a single-commodity amount equal to, less than, or + greater than N. (Postings with multi-commodity amounts are not tested and will always match.) The comparison has two modes: if N is preceded - by a + or - sign (or is 0), the two signed numbers are compared. Oth- + by a + or - sign (or is 0), the two signed numbers are compared. Oth- erwise, the absolute magnitudes are compared, ignoring sign. code:REGEX @@ -4538,10 +4515,10 @@ Queries cur:REGEX Match postings or transactions including any amounts whose cur- - rency/commodity symbol is fully matched by REGEX. (For a partial - match, use .*REGEX.*). Note, to match special characters which are - regex-significant, you need to escape them with \. And for characters - which are significant to your shell you may need one more level of es- + rency/commodity symbol is fully matched by REGEX. (For a partial + match, use .*REGEX.*). Note, to match special characters which are + regex-significant, you need to escape them with \. And for characters + which are significant to your shell you may need one more level of es- caping. So eg to match the dollar sign: hledger print cur:\\$. @@ -4549,17 +4526,17 @@ Queries Match transaction descriptions. date:PERIODEXPR - Match dates (or with the --date2 flag, secondary dates) within the + Match dates (or with the --date2 flag, secondary dates) within the specified period. PERIODEXPR is a period expression with no report in- terval. Examples: date:2016, date:thismonth, date:2/1-2/15, date:2021-07-27..nextquarter. date2:PERIODEXPR - Match secondary dates within the specified period (independent of the + Match secondary dates within the specified period (independent of the --date2 flag). depth:N - Match (or display, depending on command) accounts at or above this + Match (or display, depending on command) accounts at or above this depth. note:REGEX @@ -4567,7 +4544,7 @@ Queries whole description if there's no |). payee:REGEX - Match transaction payee/payer names (the part of the description left + Match transaction payee/payer names (the part of the description left of |, or the whole description if there's no |). real:, real:0 @@ -4577,11 +4554,11 @@ Queries Match unmarked, pending, or cleared transactions respectively. type:TYPECODES - Match by account type (see Declaring accounts > Account types). TYPE- - CODES is one or more of the single-letter account type codes ALERXCV, + Match by account type (see Declaring accounts > Account types). TYPE- + CODES is one or more of the single-letter account type codes ALERXCV, case insensitive. Note type:A and type:E will also match their respec- - tive subtypes C (Cash) and V (Conversion). Certain kinds of account - alias can disrupt account types, see Rewriting accounts > Aliases and + tive subtypes C (Cash) and V (Conversion). Certain kinds of account + alias can disrupt account types, see Rewriting accounts > Aliases and account types. tag:REGEX[=REGEX] @@ -4597,11 +4574,11 @@ Queries o Transactions also acquire the tags of their postings. (inacct:ACCTNAME - A special query term used automatically in hledger-web only: tells + A special query term used automatically in hledger-web only: tells hledger-web to show the transaction register for an account.) Combining query terms - When given multiple space-separated query terms, most commands select + When given multiple space-separated query terms, most commands select things which match: o any of the description terms AND @@ -4622,13 +4599,13 @@ Queries o match all the other terms. - We also support more complex boolean queries with the 'expr:' prefix. - This allows one to combine queries using one of three operators: AND, + We also support more complex boolean queries with the 'expr:' prefix. + This allows one to combine queries using one of three operators: AND, OR, and NOT, where NOT is different syntax for 'not:'. Examples of such queries are: - o Match transactions with 'cool' in the description AND with the 'A' + o Match transactions with 'cool' in the description AND with the 'A' tag expr:"desc:cool AND tag:A" @@ -4638,22 +4615,22 @@ Queries expr:"NOT expenses:food OR tag:A" - o Match transactions NOT involving the 'expenses:food' account OR with - the 'A' tag AND involving the 'expenses:drink' account. (the AND is + o Match transactions NOT involving the 'expenses:food' account OR with + the 'A' tag AND involving the 'expenses:drink' account. (the AND is implicitly added by space-separation, following the rules above) expr:"expenses:food OR (tag:A expenses:drink)" Queries and command options - Some queries can also be expressed as command-line options: depth:2 is + Some queries can also be expressed as command-line options: depth:2 is equivalent to --depth 2, date:2023 is equivalent to -p 2023, etc. When - you mix command options and query arguments, generally the resulting + you mix command options and query arguments, generally the resulting query is their intersection. Queries and valuation - When amounts are converted to other commodities in cost or value re- - ports, cur: and amt: match the old commodity symbol and the old amount - quantity, not the new ones (except in hledger 1.22.0 where it's re- + When amounts are converted to other commodities in cost or value re- + ports, cur: and amt: match the old commodity symbol and the old amount + quantity, not the new ones (except in hledger 1.22.0 where it's re- versed, see #1625). Querying with account aliases @@ -4661,20 +4638,20 @@ Queries will match either the old or the new account name. Querying with cost or value - When amounts are converted to other commodities in cost or value re- + When amounts are converted to other commodities in cost or value re- ports, note that cur: matches the new commodity symbol, and not the old - one, and amt: matches the new quantity, and not the old one. Note: - this changed in hledger 1.22, previously it was the reverse, see the + one, and amt: 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. Pivoting - Normally, hledger groups and sums amounts within each account. The - --pivot FIELD option substitutes some other transaction field for ac- - count names, causing amounts to be grouped and summed by that field's - value instead. FIELD can be any of the transaction fields status, - code, description, payee, note, or a tag name. When pivoting on a tag - and a posting has multiple values of that tag, only the first value is - displayed. Values containing colon:separated:parts will be displayed + Normally, hledger groups and sums amounts within each account. The + --pivot FIELD option substitutes some other transaction field for ac- + count names, causing amounts to be grouped and summed by that field's + value instead. FIELD can be any of the transaction fields status, + code, description, payee, note, or a tag name. When pivoting on a tag + and a posting has multiple values of that tag, only the first value is + displayed. Values containing colon:separated:parts will be displayed hierarchically, like account names. Some examples: @@ -4706,7 +4683,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:. @@ -4717,67 +4694,67 @@ Pivoting Generating data hledger has several features for generating data, such as: - o Periodic transaction rules can generate single or repeating transac- - tions following a template. These are usually dated in the future, - eg to help with forecasting. They are activated by the --forecast + o Periodic transaction rules can generate single or repeating transac- + tions following a template. These are usually dated in the future, + eg to help with forecasting. They are activated by the --forecast option. - o The balance command's --budget option uses these same periodic rules + o The balance command's --budget option uses these same periodic rules to generate goals for the budget report. - o Auto posting rules can generate extra postings on certain matched + o Auto posting rules can generate extra postings on certain matched transactions. They are always applied to forecast transactions; with - the --auto flag they are applied to transactions recorded in the + the --auto flag they are applied to transactions recorded in the journal as well. - o The --infer-equity flag infers missing conversion equity postings - from @/@@ costs. And the inverse --infer-costs flag infers missing + o The --infer-equity flag infers missing conversion equity postings + from @/@@ costs. And the inverse --infer-costs flag infers missing @/@@ costs from conversion equity postings. Generated data of this kind is temporary, existing only at report time. - But you can see it in the output of hledger print, and you can save - that to your journal, in effect converting it from temporary generated - data to permanent recorded data. This could be useful as a data entry + But you can see it in the output of hledger print, and you can save + that to your journal, in effect converting it from temporary generated + data to permanent recorded data. This could be useful as a data entry aid. - If you are wondering what data is being generated and why, add the - --verbose-tags flag. In hledger print output you will see extra tags - like generated-transaction, generated-posting, and modified on gener- - ated/modified data. Also, even without --verbose-tags, generated data + If you are wondering what data is being generated and why, add the + --verbose-tags flag. In hledger print output you will see extra tags + like generated-transaction, generated-posting, and modified on gener- + ated/modified data. Also, even without --verbose-tags, generated data always has equivalen hidden tags (with an underscore prefix), so eg you could match generated transactions with tag:_generated-transaction. Forecasting - Forecasting, or speculative future reporting, can be useful for esti- + Forecasting, or speculative future reporting, can be useful for esti- mating future balances, or for exploring different future scenarios. The simplest and most flexible way to do it with hledger is to manually record a bunch of future-dated transactions. You could keep these in a - separate future.journal and include that with -f only when you want to + separate future.journal and include that with -f only when you want to see them. --forecast - There is another way: with the --forecast option, hledger can generate - temporary "forecast transactions" for reporting purposes, according to - periodic transaction rules defined in the journal. Each rule can gen- - erate multiple recurring transactions, so by changing one rule you can + There is another way: with the --forecast option, hledger can generate + temporary "forecast transactions" for reporting purposes, according to + periodic transaction rules defined in the journal. Each rule can gen- + erate multiple recurring transactions, so by changing one rule you can change many forecasted transactions. (These same rules can also gener- ate budget goals, described in Budgeting.) - Forecast transactions usually start after ordinary transactions end. + Forecast transactions usually start after ordinary transactions end. By default, they begin after your latest-dated ordinary transaction, or - today, whichever is later, and they end six months from today. (The + today, whichever is later, and they end six months from today. (The exact rules are a little more complicated, and are given below.) This is the "forecast period", which need not be the same as the report - period. You can override it - eg to forecast farther into the future, + period. You can override it - eg to forecast farther into the future, or to force forecast transactions to overlap your ordinary transactions - - by giving the --forecast option a period expression argument, like - --forecast=..2099 or --forecast=2023-02-15... Note that the = is re- + - by giving the --forecast option a period expression argument, like + --forecast=..2099 or --forecast=2023-02-15... Note that the = is re- quired. Inspecting forecast transactions - print is the best command for inspecting and troubleshooting forecast + print is the best command for inspecting and troubleshooting forecast transactions. Eg: ~ monthly from 2022-12-20 rent @@ -4811,7 +4788,7 @@ Forecasting expenses:rent $1000 Here there are no ordinary transactions, so the forecasted transactions - begin on the first occurence after today's date. (You won't normally + begin on the first occurence after today's date. (You won't normally use --today; it's just to make these examples reproducible.) Forecast reports @@ -4835,19 +4812,19 @@ Forecasting || $1000 $1000 $1000 $1000 $1000 Forecast tags - Forecast transactions generated by --forecast have a hidden tag, _gen- - erated-transaction. So if you ever need to match forecast transac- + Forecast transactions generated by --forecast have a hidden tag, _gen- + erated-transaction. So if you ever need to match forecast transac- tions, you could use tag:_generated-transaction (or just tag:generated) in a query. - For troubleshooting, you can add the --verbose-tags flag. Then, visi- + For troubleshooting, you can add the --verbose-tags flag. Then, visi- ble generated-transaction tags will be added also, so you can view them - with the print command. Their value indicates which periodic rule was + with the print command. Their value indicates which periodic rule was responsible. Forecast period, in detail Forecast start/end dates are chosen so as to do something useful by de- - fault in almost all situations, while also being flexible. Here are + fault in almost all situations, while also being flexible. Here are (with luck) the exact rules, to help with troubleshooting: The forecast period starts on: @@ -4879,7 +4856,7 @@ Forecasting o otherwise: 180 days (~6 months) from today. Forecast troubleshooting - When --forecast is not doing what you expect, one of these tips should + When --forecast is not doing what you expect, one of these tips should help: o Remember to use the --forecast option. @@ -4889,22 +4866,22 @@ Forecasting o Test with print --forecast. - o Check for typos or too-restrictive start/end dates in your periodic + o Check for typos or too-restrictive start/end dates in your periodic transaction rule. - o Leave at least 2 spaces between the rule's period expression and de- + o Leave at least 2 spaces between the rule's period expression and de- scription fields. - o Check for future-dated ordinary transactions suppressing forecasted + o Check for future-dated ordinary transactions suppressing forecasted transactions. o Try setting explicit report start and/or end dates with -b, -e, -p or date: - o Try adding the -E flag to encourage display of empty periods/zero + o Try adding the -E flag to encourage display of empty periods/zero transactions. - o Try setting explicit forecast start and/or end dates with --fore- + o Try setting explicit forecast start and/or end dates with --fore- cast=START..END o Consult Forecast period, in detail, above. @@ -4912,41 +4889,41 @@ Forecasting o Check inside the engine: add --debug=2 (eg). Budgeting - With the balance command's --budget report, each periodic transaction - rule generates recurring budget goals in specified accounts, and goals - and actual performance can be compared. See the balance command's doc + With the balance command's --budget report, each periodic transaction + rule generates recurring budget goals in specified accounts, and goals + and actual performance can be compared. See the balance command's doc below. - You can generate budget goals and forecast transactions at the same - time, from the same or different periodic transaction rules: hledger + You can generate budget goals and forecast transactions at the same + time, from the same or different periodic transaction rules: hledger bal -M --budget --forecast ... See also: Budgeting and Forecasting. Cost reporting - This section is about recording the cost of things, in transactions - where one commodity is exchanged for another. Eg an exchange of cur- + This section is about recording the cost of things, in transactions + where one commodity is exchanged for another. Eg an exchange of cur- rency, or a stock purchase or sale. First, a quick glossary: - o Conversion - an exchange of one currency or commodity for another. - Eg a foreign currency exchange, or a purchase or sale of stock or + o Conversion - an exchange of one currency or commodity for another. + Eg a foreign currency exchange, or a purchase or sale of stock or cryptocurrency. - o Conversion transaction - a transaction involving one or more conver- + o Conversion transaction - a transaction involving one or more conver- sions. o Conversion rate - the cost per unit of one commodity in the other, ie the exchange rate. - o Cost - how much of one commodity was paid to acquire the other. And - more generally, in hledger docs: the amount exchanged in the "sec- + o Cost - how much of one commodity was paid to acquire the other. And + more generally, in hledger docs: the amount exchanged in the "sec- ondary" commodity (usually your base currency), whether in a purchase - or a sale, and whether expressed per unit or in total. Also, the + or a sale, and whether expressed per unit or in total. Also, the "@/@@ PRICE" notation used to represent this. -B: Convert to cost - As discussed in JOURNAL > Costs, when recording a transaction you can - also record the amount's cost in another commodity, by adding @ UNIT- + As discussed in JOURNAL > Costs, when recording a transaction you can + also record the amount's cost in another commodity, by adding @ UNIT- PRICE or @@ TOTALPRICE. Then you can see a report with amounts converted to cost, by adding the @@ -4965,9 +4942,9 @@ Cost reporting Notes: - -B is sensitive to the order of postings when a cost is inferred: the - inferred price will be in the commodity of the last amount. So if ex- - ample 3's postings are reversed, while the transaction is equivalent, + -B is sensitive to the order of postings when a cost is inferred: the + inferred price will be in the commodity of the last amount. So if ex- + ample 3's postings are reversed, while the transaction is equivalent, -B shows something different: 2022-01-01 @@ -4978,13 +4955,13 @@ Cost reporting -100 assets:dollars # <- the dollars' selling price 100 assets:euros - The @/@@ cost notation is convenient, but has some drawbacks: it does - not truly balance the transaction, so it disrupts the accounting equa- + The @/@@ cost notation is convenient, but has some drawbacks: it does + not truly balance the transaction, so it disrupts the accounting equa- tion and tends to causes a non-zero total in balance reports. Equity conversion postings By contrast, conventional double entry bookkeeping (DEB) uses a differ- - ent notation: an extra pair of equity postings to balance conversion + ent notation: an extra pair of equity postings to balance conversion transactions. In this style, the above entry might be written: 2022-01-01 one hundred euros purchased at $1.35 each @@ -4993,15 +4970,15 @@ Cost reporting equity:conversion -100 assets:euros 100 - This style is more correct, but it's also more verbose and makes cost + This style is more correct, but it's also more verbose and makes cost reporting more difficult for PTA tools. - Happily, current hledger can read either notation, or convert one to + Happily, current hledger can read either notation, or convert one to the other when needed, so you can use the one you prefer. - You can even use cost notation and equivalent conversion postings at - the same time, for clarity. hledger will ignore the redundancy. But - be sure the cost and conversion posting amounts match, or you'll see a + You can even use cost notation and equivalent conversion postings at + the same time, for clarity. hledger will ignore the redundancy. But + be sure the cost and conversion posting amounts match, or you'll see a not-so-clear transaction balancing error message. Inferring equity postings from cost @@ -5022,14 +4999,14 @@ Cost reporting The conversion account names can be changed with the conversion account type declaration. - --infer-equity is useful when when transactions have been recorded us- + --infer-equity is useful when when transactions have been recorded us- ing cost notation, to help preserve the accounting equation and balance - reports' zero total, or to produce more conventional journal entries + reports' zero total, or to produce more conventional journal entries for sharing with non-PTA-users. Inferring cost from equity postings - The reverse operation is possible using --infer-costs, which detects - transactions written with equity conversion postings and adds cost no- + The reverse operation is possible using --infer-costs, which detects + transactions written with equity conversion postings and adds cost no- tation to them: 2022-01-01 @@ -5046,7 +5023,7 @@ Cost reporting assets:euros 100 --infer-costs is useful when combined with -B/--cost, allowing cost re- - porting even when transactions have been recorded using equity post- + porting even when transactions have been recorded using equity post- ings: $ hledger print --infer-costs -B @@ -5063,7 +5040,7 @@ Cost reporting 2. two equity postings, next to one another 3. the equity accounts must be declared, with account type V/Conversion - (or if they are not declared, they must be named equity:conversion, + (or if they are not declared, they must be named equity:conversion, equity:trade, equity:trading or subaccounts of these) 4. the equity postings' amounts must exactly match the non-equity post- @@ -5071,41 +5048,41 @@ Cost reporting Multiple such exchanges can coexist within a single transaction. - When inferring cost, the order of postings matters: the cost is added - to the first of the non-equity postings involved in the exchange, in - the commodity of the last non-equity posting involved in the exchange. + When inferring cost, the order of postings matters: the cost is added + to the first of the non-equity postings involved in the exchange, in + the commodity of the last non-equity posting involved in the exchange. If you don't want to write your postings in the required order, you can use explicit cost notation instead. - --infer-equity and --infer-costs can be used together, if you have a + --infer-equity and --infer-costs can be used together, if you have a mixture of both notations in your journal. When to infer cost/equity - Inferring equity postings or costs is still fairly new, so not enabled - by default. We're not sure yet if that should change. Here are two + Inferring equity postings or costs is still fairly new, so not enabled + by default. We're not sure yet if that should change. Here are two suggestions to try, experience reports welcome: - 1. When you use -B, always use --infer-costs as well. Eg: hledger bal + 1. When you use -B, always use --infer-costs as well. Eg: hledger bal -B --infer-costs - 2. Always run hledger with both flags enabled. Eg: alias hl="hledger + 2. Always run hledger with both flags enabled. Eg: alias hl="hledger --infer-equity --infer-costs" How to record conversions - Essentially there are four ways to record a conversion transaction in + Essentially there are four ways to record a conversion transaction in hledger. Here are all of them, with pros and cons. Conversion with implicit cost - Let's assume 100 EUR is converted to 120 USD. You can just record the - outflow (100 EUR) and inflow (120 USD) in the appropriate asset ac- + Let's assume 100 EUR is converted to 120 USD. You can just record the + outflow (100 EUR) and inflow (120 USD) in the appropriate asset ac- count: 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 + 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: @@ -5114,18 +5091,18 @@ Cost reporting Con: - o Less error checking - typos in amounts or commodity symbols may not + o Less error checking - typos in amounts or commodity symbols may not be detected o Conversion rate is not clear - o Disturbs the accounting equation, unless you add the --infer-equity + o Disturbs the accounting equation, unless you add the --infer-equity flag - You can prevent accidental implicit conversions due to a mistyped com- + 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 + You can prevent implicit conversions entirely, by using hledger check balancednoautoconversion, or -s/--strict. Conversion with explicit cost @@ -5148,16 +5125,16 @@ Cost reporting Con: - o Disturbs the accounting equation, unless you add the --infer-equity + o Disturbs the accounting equation, unless you add the --infer-equity flag Conversion with equity postings - In strict double entry bookkeeping, the above transaction is not bal- - anced in EUR or in USD, since some EUR disappears, and some USD ap- - pears. This violates the accounting equation (A+L+E=0), and prevents + In strict double entry bookkeeping, the above transaction is not bal- + anced in EUR or in USD, since some EUR disappears, and some USD ap- + pears. 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 + The proper way to make it balance is to add a balancing posting for each commodity, using an equity account: 2021-01-01 @@ -5208,98 +5185,98 @@ Cost reporting o Not compatible with ledger Cost tips - o Recording the cost/conversion rate explicitly is good because it + o Recording the cost/conversion rate explicitly is good because it makes that clear and helps detect errors. - o Recording equity postings is good because it is correct bookkeeping + o Recording equity postings is good because it is correct bookkeeping and preserves the accounting equation. o Combining these is possible. - o When you want to see the cost (or sale proceeds) of things, use -B + o When you want to see the cost (or sale proceeds) of things, use -B (short form of --cost). - o If you use conversion postings without cost notation, add --infer- + o If you use conversion postings without cost notation, add --infer- costs also. o If you use cost notation without conversion postings, and you want to - see a balanced balance sheet or print correct journal entries, use + see a balanced balance sheet or print correct journal entries, use --infer-equity. o Conversion to cost is performed before valuation (described next). 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] op- - tion, 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] op- + tion, 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. Finding market price - 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 costs. 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 - value, why not use the recorded costs as additional market prices (as - Ledger does) ? Adding the --infer-market-prices flag to -V, -X or + chore, and since transactions usually take place at close to market + value, why not use the recorded costs as additional market prices (as + Ledger does) ? 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. If both occur on + So for example, hledger bs -V --infer-market-prices will get market + prices both from P directives and from transactions. 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. @@ -5307,15 +5284,15 @@ 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 multicommodity transactions with equity postings, if cost is inferred with --infer-costs. - There is a limitation (bug) currently: when a valuation commodity is - not specified, prices inferred with --infer-market-prices do not help + There is a limitation (bug) currently: when a valuation commodity is + not specified, prices inferred with --infer-market-prices do not help select a default valuation commodity, as P prices would. So conversion might not happen because no valuation commodity was detected (--debug=2 will show this). To be safe, specify the valuation commmodity, eg: @@ -5325,8 +5302,8 @@ Valuation o --value=then,EUR --infer-market-prices, not --value=then --infer-mar- ket-prices - Signed costs and market prices can be confusing. For reference, here - is the current behaviour, since hledger 1.25. (If you think it should + Signed costs and market prices can be confusing. For reference, here + is the current behaviour, since hledger 1.25. (If you think it should work differently, see #1870.) 2022-01-01 Positive Unit prices @@ -5356,7 +5333,7 @@ Valuation b B -1 @@ A -1 All of the transactions above are considered balanced (and on each day, - the two transactions are considered equivalent). Here are the market + the two transactions are considered equivalent). Here are the market prices inferred for B: $ hledger -f- --infer-market-prices prices @@ -5369,34 +5346,34 @@ Valuation 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, costs 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 @@ -5423,7 +5400,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 @@ -5443,31 +5420,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 @@ -5505,7 +5482,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 @@ -5542,7 +5519,7 @@ Valuation 2000-03-01 (a) 1 B - You may need to explicitly set a commodity's display style, when re- + You may need to explicitly set a commodity's display style, when re- verse prices are used. Eg this output might be surprising: P 2000-01-01 A 2B @@ -5556,10 +5533,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 @@ -5575,7 +5552,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: @@ -5589,15 +5566,15 @@ 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 + 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. Re- lated: #329, #1083. @@ -5605,8 +5582,8 @@ Valuation type --value=now -------------------------------------------------------------------------------------------- print - posting cost value at re- value at posting value at re- value at - amounts port end or date port or DATE/today + posting cost value at re- value at posting value at re- value at + amounts port end or date port or DATE/today today journal end balance unchanged unchanged unchanged unchanged unchanged asser- @@ -5623,7 +5600,7 @@ Valuation report journal journal interval start start - posting cost value at re- value at posting value at re- value at + posting cost value at re- value at posting value at re- value at amounts port or date port or DATE/today journal end journal end summary summarised value at pe- sum of postings value at pe- value at @@ -5639,8 +5616,8 @@ Valuation balance (bs, bse, cf, is) - balance sums of value at re- value at posting value at re- value at - changes costs port end or date port or DATE/today of + balance sums of value at re- value at posting value at re- value at + changes costs port end or date port or DATE/today of today of journal end sums of post- sums of of sums of ings postings postings @@ -5648,7 +5625,7 @@ Valuation amounts changes changes changes ances changes (--bud- get) - grand to- sum of dis- sum of dis- sum of displayed sum of dis- sum of dis- + grand to- sum of dis- sum of dis- sum of displayed sum of dis- sum of dis- tal played val- played val- valued played val- played values ues ues ues @@ -5674,7 +5651,7 @@ Valuation end bal- sums of same as sums of values of period end value at ances costs of --value=end postings from be- balances, DATE/today of (bal -H, postings fore period start valued at sums of post- - is --H, from before to period end at period ends ings + is --H, from before to period end at period ends ings bs, cf) report start respective post- to period ing dates end @@ -5683,10 +5660,10 @@ Valuation (--bud- balances balances ances balances get) row to- sums, aver- sums, aver- sums, averages of sums, aver- sums, aver- - tals, row ages of dis- ages of dis- displayed values ages of dis- ages of dis- + tals, row ages of dis- ages of dis- displayed values ages of dis- ages of dis- averages played val- played val- played val- played values (-T, -A) ues ues ues - column sums of dis- sums of dis- sums of displayed sums of dis- sums of dis- + column sums of dis- sums of dis- sums of displayed sums of dis- sums of dis- totals played val- played val- values played val- played values ues ues ues grand to- sum, average sum, average sum, average of sum, average sum, average @@ -5702,29 +5679,29 @@ 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). @@ -5766,7 +5743,7 @@ PART 4: COMMANDS o print - show transactions or export journal data - o register (reg) - show postings in one or more accounts & running to- + o register (reg) - show postings in one or more accounts & running to- tal o roi - show return on investments @@ -5803,7 +5780,7 @@ PART 4: COMMANDS ADD-ONS And here are some typical add-on commands. Some of these are installed - by the hledger-install script. If installed, they will appear in + by the hledger-install script. If installed, they will appear in hledger's commands list: o ui - run hledger's terminal UI @@ -5816,7 +5793,7 @@ PART 4: COMMANDS o stockquotes - download market prices from AlphaVantage - o Scripts and add-ons - check-fancyassertions, edit, fifo, git, move, + o Scripts and add-ons - check-fancyassertions, edit, fifo, git, move, pijul, plot, and more.. Next, each command is described in detail, in alphabetical order. @@ -5824,38 +5801,38 @@ PART 4: COMMANDS accounts Show account names. - This command lists account names. By default it shows all known ac- - counts, either used in transactions or declared with account direc- + This command lists account names. By default it shows all known ac- + counts, either used in transactions or declared with account direc- tives. With query arguments, only matched account names and account names ref- erenced by matched postings are shown. - Or it can show just the used accounts (--used/-u), the declared ac- - counts (--declared/-d), the accounts declared but not used (--unused), + Or it can show just the used accounts (--used/-u), the declared ac- + counts (--declared/-d), the accounts declared but not used (--unused), the accounts used but not declared (--undeclared), or the first account matched by an account name pattern, if any (--find). - 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 components. Account names can be depth- + 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 components. Account names can be depth- clipped with depth:N or --depth N or -N. - With --types, it also shows each account's type, if it's known. (See + With --types, it also shows each account's type, if it's known. (See Declaring accounts > Account types.) - With --positions, it also shows the file and line number of each ac- - count's declaration, if any, and the account's overall declaration or- + With --positions, it also shows the file and line number of each ac- + count's declaration, if any, and the account's overall declaration or- der; these may be useful when troubleshooting account display order. - With --directives, it adds the account keyword, showing valid account + With --directives, it adds the account keyword, showing valid account directives which can be pasted into a journal file. This is useful to- - gether with --undeclared when updating your account declarations to + gether with --undeclared when updating your account declarations to satisfy hledger check accounts. - The --find flag can be used to look up a single account name, in the - same way that the aregister command does. It returns the alphanumeri- - cally-first matched account name, or if none can be found, it fails + The --find flag can be used to look up a single account name, in the + same way that the aregister command does. It returns the alphanumeri- + cally-first matched account name, or if none can be found, it fails with a non-zero exit code. Examples: @@ -5876,8 +5853,8 @@ PART 4: 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: @@ -5889,36 +5866,36 @@ PART 4: COMMANDS 2008-10-01 ** 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- - actions, and appends them to the main journal file (which should be in - journal format). Existing transactions are not changed. This is one - of the few hledger commands that writes to the journal file (see also + 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 main journal file (which should be in + journal format). Existing transactions are not changed. This is one + of the few hledger commands that writes to the journal file (see also import). 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 de- - scription) recent transaction (filtered by the query, if any) as a + o add tries to provide useful defaults, using the most similar (by de- + scription) recent transaction (filtered by the query, if any) as a template. o You can also set the initial defaults with command line arguments. o Readline-style edit keys can be used during data entry. - o The tab key will auto-complete whenever possible - accounts, pay- - ees/descriptions, dates (yesterday, today, tomorrow). If the input + o The tab key will auto-complete whenever possible - accounts, pay- + ees/descriptions, 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. @@ -5927,7 +5904,7 @@ PART 4: 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 https://hledger.org/add.html for a detailed tutorial): @@ -5957,82 +5934,82 @@ PART 4: 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 (areg) - Show the transactions and running historical balance of a single ac- + Show the transactions and running historical balance of a single ac- count, 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 + (and any subaccounts). Each report line represents one transaction in this account. Transactions before the report start date are always in- cluded 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 ex- + aregister requires one argument: the account to report on. You can + write either the full account name, or a case-insensitive regular ex- pression which will select the alphabetically first matched account. When there are multiple matches, the alphabetically-first choice can be - surprising; eg if you have assets:per:checking 1 and assets:biz:check- - ing 2 accounts, hledger areg checking would select assets:biz:checking - 2. It's just a convenience to save typing, so if in doubt, write the + surprising; eg if you have assets:per:checking 1 and assets:biz:check- + ing 2 accounts, hledger areg checking would select assets:biz:checking + 2. It's just a convenience to save typing, so if in doubt, write the full account name, or a distinctive substring that matches uniquely. - 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. - For performance reasons, column widths are chosen based on the first - 1000 lines; this means unusually wide values in later lines can cause - visual discontinuities as column widths are adjusted. If you want to - ensure perfect alignment, at the cost of more time and memory, use the + For performance reasons, column widths are chosen based on the first + 1000 lines; this means unusually wide values in later lines can cause + visual discontinuities as column widths are adjusted. If you want to + ensure perfect alignment, at the cost of more time and memory, use the --align-all flag. This command also supports the output destination and output format op- tions. 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 @@ -6040,19 +6017,19 @@ PART 4: COMMANDS 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.. @@ -6105,7 +6082,7 @@ PART 4: COMMANDS ..with.. - o totals (-T), averages (-A), percentages (-%), inverted sign (--in- + o totals (-T), averages (-A), percentages (-%), inverted sign (--in- vert) o rows and columns swapped (--transpose) @@ -6117,24 +6094,24 @@ PART 4: 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. ("Simple" here - means just one column of numbers, covering a single period. You can + 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. ("Simple" here + means just one column of numbers, covering a single period. You can also have multi-period reports, described later.) - For real-world accounts, these numbers will normally be their end bal- + For real-world accounts, these numbers will normally be their end bal- ance 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 @@ -6149,7 +6126,7 @@ PART 4: 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 (re- + - see below) are hidden by default. Use -E/--empty to show them (re- vealing assets:bank:checking here): $ hledger -f examples/sample.journal bal -E @@ -6164,12 +6141,12 @@ PART 4: 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. Balance report line format 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)" @@ -6186,7 +6163,7 @@ PART 4: COMMANDS --------------------------------- 0 - The FMT format string specifies the formatting applied to each ac- + The FMT format string specifies the formatting applied to each ac- count/balance pair. It may contain any suitable text, with data fields interpolated like so: @@ -6198,14 +6175,14 @@ PART 4: 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) @@ -6222,18 +6199,18 @@ PART 4: COMMANDS 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 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: @@ -6243,10 +6220,10 @@ PART 4: 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 @@ -6266,26 +6243,26 @@ PART 4: 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 @@ -6297,7 +6274,7 @@ PART 4: 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: @@ -6308,53 +6285,53 @@ PART 4: COMMANDS $2 Showing declared accounts - With --declared, accounts which have been declared with an account di- - rective will be included in the balance report, even if they have no + With --declared, accounts which have been declared with an account di- + rective 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 re- + The idea of this is to be able to see a useful "complete" balance re- port, even when you don't have transactions in all of your declared ac- counts yet. 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 --in- - vert to flip the signs. (Or, use one of the higher-level reports, + Revenues and liability balances are typically negative, however, so -S + shows these in reverse order. To work around this, you can add --in- + vert 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. 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: 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 @@ -6375,21 +6352,21 @@ PART 4: 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 @@ -6403,57 +6380,57 @@ PART 4: 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 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 ac- + A balance change is the net amount added to, or removed from, an ac- count 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 - The balance command is quite flexible; here is the full detail on how - to control what it reports. If the following seems complicated, don't - worry - this is for advanced reporting, and it does take time and ex- + The balance command is quite flexible; here is the full detail on how + to control what it reports. If the following seems complicated, don't + worry - this is for advanced reporting, and it does take time and ex- perimentation to get familiar with all the report modes. There are three important option groups: - hledger balance [CALCULATIONTYPE] [ACCUMULATIONTYPE] [VALUATIONTYPE] + hledger balance [CALCULATIONTYPE] [ACCUMULATIONTYPE] [VALUATIONTYPE] ... Calculation type @@ -6465,57 +6442,57 @@ PART 4: COMMANDS each account/period) 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) o --count : show the count of postings Accumulation type - How amounts should accumulate across report periods. Another way to - say it: which time period's postings should contribute to each cell's + How amounts should accumulate across report periods. Another way to + say it: which time period's postings should contribute to each cell's calculation. It is one of: - o --change : calculate with postings from column start to column end, - ie "just this column". Typically used to see revenues/expenses. + o --change : calculate with postings from column start to column end, + ie "just this column". Typically used to see revenues/expenses. (default for balance, incomestatement) - o --cumulative : calculate with postings from report start to column - end, ie "previous columns plus this column". Typically used to show + o --cumulative : calculate with postings from report start to column + end, ie "previous columns plus this column". Typically used to show changes accumulated since the report's start date. Not often used. - o --historical/-H : calculate with postings from journal start to col- - umn end, ie "all postings from before report start date until this - column's end". Typically used to see historical end balances of as- - sets/liabilities/equity. (default for balancesheet, balancesheete- + o --historical/-H : calculate with postings from journal start to col- + umn end, ie "all postings from before report start date until this + column's end". Typically used to see historical end balances of as- + sets/liabilities/equity. (default for balancesheet, balancesheete- quity, cashflow) Valuation type - Which kind of value or cost conversion should be applied, if any, be- + Which kind of value or cost conversion should be applied, if any, be- fore displaying the report. It is one of: o no valuation type : don't convert to cost or value (default) - o --value=cost[,COMM] : convert amounts to cost (then optionally to + o --value=cost[,COMM] : convert amounts to cost (then optionally to some other commodity) - o --value=then[,COMM] : convert amounts to market value on transaction + o --value=then[,COMM] : convert amounts to market value on transaction dates - o --value=end[,COMM] : convert amounts to market value on period end + o --value=end[,COMM] : convert amounts to market value on period end date(s) (default with --valuechange, --gain) o --value=now[,COMM] : convert amounts to market value on today's date - o --value=YYYY-MM-DD[,COMM] : convert amounts to market value on an- + o --value=YYYY-MM-DD[,COMM] : convert amounts to market value on an- other date or one of the equivalent simpler flags: - o -B/--cost : like --value=cost (though, note --cost and --value are + o -B/--cost : like --value=cost (though, note --cost and --value are independent options which can both be used at once) o -V/--market : like --value=end @@ -6525,13 +6502,13 @@ PART 4: COMMANDS See Cost reporting and Valuation for more about these. Combining balance report types - 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 @@ -6545,26 +6522,26 @@ PART 4: COMMANDS lation:v ----------------------------------------------------------------------------------- --change change in period sum of posting- period-end DATE-value of - date market val- value of change change in pe- + date market val- value of change change in pe- ues in period in period riod - --cumu- change from re- sum of posting- period-end DATE-value of - lative port start to date market val- value of change change from + --cumu- change from re- sum of posting- period-end DATE-value of + lative port 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 Budget report - The --budget report type activates extra columns showing any budget + The --budget report type activates extra columns showing any budget goals for each account and period. The budget goals are defined by pe- - riodic transactions. This is useful for comparing planned and actual + riodic transactions. This is useful for comparing planned and actual income, expenses, time usage, etc. - For example, you can take average monthly expenses in the common ex- + For example, you can take average monthly expenses in the common ex- pense categories to construct a minimal monthly budget: ;; Budget @@ -6609,30 +6586,30 @@ PART 4: COMMANDS ----------------------++---------------------------------------------------- || 0 [ 0] 0 [ 0] - This is different from a normal balance report in several ways. Cur- + This is different from a normal balance report in several ways. Cur- rently: - o Accounts with budget goals during the report period, and their par- + o Accounts with budget goals during the report period, and their par- ents, are shown. o Their subaccounts are not shown (regardless of the depth setting). - o Accounts without budget goals, if any, are aggregated and shown as + o Accounts without budget goals, if any, are aggregated and shown as "". - o Amounts are always inclusive (subaccount-including), even in list + o Amounts are always inclusive (subaccount-including), even in list mode. - o After each actual amount, the corresponding goal amount and percent- + o After each actual amount, the corresponding goal amount and percent- age of goal reached are also shown, in square brackets. - This means that the numbers displayed will not always add up! Eg - above, the expenses actual amount includes the gifts and supplies + This means that the numbers displayed will not always add up! Eg + above, the expenses actual amount includes the gifts and supplies transactions, 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 @@ -6679,19 +6656,19 @@ PART 4: COMMANDS hledger bal -M --budget type:rx - It's also common to limit or convert them to a single currency - (cur:COMM or -X COMM [--infer-market-prices]). If showing multiple + It's also common to limit or convert them to a single currency + (cur:COMM or -X COMM [--infer-market-prices]). If showing multiple currencies, --layout bare or --layout tall can help. 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 @@ -6710,9 +6687,9 @@ PART 4: 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 @@ -6725,12 +6702,12 @@ PART 4: 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: @@ -6740,13 +6717,13 @@ PART 4: 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 to- + Transactions in expenses:personal:electronics will be counted both to- wards its $100 budget and $1100 of expenses:personal , and transactions - in any other subaccount of expenses:personal would be counted towards + 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: @@ -6772,9 +6749,9 @@ PART 4: 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: @@ -6790,7 +6767,7 @@ PART 4: 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 @@ -6809,29 +6786,29 @@ PART 4: COMMANDS Selecting budget goals The budget report evaluates periodic transaction rules to generate spe- - cial "goal transactions", which generate the goal amounts for each ac- - count in each report subperiod. When troubleshooting, you can use + cial "goal transactions", which generate the goal amounts for each ac- + count in each report subperiod. When troubleshooting, you can use print --forecast 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 se- + regular expression or query). This means you can give your periodic + rules descriptions (remember that two spaces are needed), and then se- lect from multiple budgets defined in your journal. Budget vs forecast - hledger --forecast ... and hledger balance --budget ... are separate - features, though both of them use the periodic transaction rules de- - fined in the journal, and both of them generate temporary transactions + hledger --forecast ... and hledger balance --budget ... are separate + features, though both of them use the periodic transaction rules de- + fined in the journal, and both of them generate temporary transactions for reporting purposes ("forecast transactions" and "budget goal trans- actions", respectively). You can use both features at the same time if you want. Here are some differences between them, as of hledger 1.29: @@ -6847,26 +6824,26 @@ PART 4: COMMANDS o forecast transactions are visible in any report, like ordinary trans- actions - o budget goal transactions are invisible except for the goal amounts + o budget goal transactions are invisible except for the goal amounts they produce in --budget reports. Periodic transaction rules: o --forecast uses all available periodic transaction rules - o --budget uses all periodic rules (--budget) or a selected subset + o --budget uses all periodic rules (--budget) or a selected subset (--budget=DESCPAT) Period of generated transactions: o --forecast generates forecast transactions - o from after the last regular transaction to the end of the report + o from after the last regular transaction to the end of the report period (--forecast) o or, during a specified period (--forecast=PERIODEXPR) - o possibly further restricted by a period specified in the periodic + o possibly further restricted by a period specified in the periodic transaction rule o and always restricted within the bounds of the report period @@ -6875,16 +6852,16 @@ PART 4: COMMANDS o throughout the report period - o possibly restricted by a period specified in the periodic transac- + o possibly restricted by a period specified in the periodic transac- tion rule. Data layout - The --layout option affects how balance reports show multi-commodity - amounts and commodity symbols, which can improve readability. It can + The --layout option affects how balance reports show multi-commodity + amounts and commodity symbols, which can improve readability. It can also normalise the data for easy consumption by other programs. It has four possible values: - o --layout=wide[,WIDTH]: commodities are shown on a single line, op- + o --layout=wide[,WIDTH]: commodities are shown on a single line, op- tionally elided to WIDTH o --layout=tall: each commodity is shown on a separate line @@ -6892,10 +6869,10 @@ PART 4: COMMANDS o --layout=bare: commodity symbols are in their own column, amounts are bare numbers - o --layout=tidy: data is normalised to easily-consumed "tidy" form, + o --layout=tidy: data is normalised to easily-consumed "tidy" form, with one row per data value - Here are the --layout modes supported by each output format; note only + Here are the --layout modes supported by each output format; note only CSV output supports all of them: - txt csv html json sql @@ -6918,7 +6895,7 @@ PART 4: 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 @@ -6930,7 +6907,7 @@ PART 4: 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 @@ -6950,7 +6927,7 @@ PART 4: 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 @@ -6970,7 +6947,7 @@ PART 4: 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 for making charts: $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare @@ -6987,7 +6964,7 @@ PART 4: COMMANDS "total","VHT","294.00" o Tidy layout produces normalised "tidy data", where every variable has - its own column and each row represents a single data point. See + its own column and each row represents a single data point. See https://cran.r-project.org/web/packages/tidyr/vignettes/tidy- data.html for more. This is the easiest kind of data for other soft- ware to consume. Here's how it looks: @@ -7014,25 +6991,25 @@ PART 4: 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 @@ -7048,14 +7025,14 @@ PART 4: COMMANDS 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. - This report shows accounts declared with the Asset, Cash or Liability - type (see account types). Or if no such accounts are declared, it - shows top-level accounts named asset or liability (case insensitive, + This report shows accounts declared with the Asset, Cash or Liability + type (see account types). Or if no such accounts are declared, it + shows top-level accounts named asset or liability (case insensitive, plurals allowed) and their subaccounts. Example: @@ -7080,25 +7057,25 @@ PART 4: 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 op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. 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. - This report shows accounts declared with the Asset, Cash, Liability or - Equity type (see account types). Or if no such accounts are declared, - it shows top-level accounts named asset, liability or equity (case in- + This report shows accounts declared with the Asset, Cash, Liability or + Equity type (see account types). Or if no such accounts are declared, + it shows top-level accounts named asset, liability or equity (case in- sensitive, plurals allowed) and their subaccounts. Example: @@ -7128,27 +7105,27 @@ PART 4: 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 op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. cashflow (cf) - This command displays a cashflow statement, showing the inflows and - outflows affecting "cash" (ie, liquid, easily convertible) assets. - Amounts are shown with normal positive sign, as in conventional finan- + This command displays a cashflow statement, showing the inflows and + outflows affecting "cash" (ie, liquid, easily convertible) assets. + Amounts are shown with normal positive sign, as in conventional finan- cial statements. - This report shows accounts declared with the Cash type (see account + This report shows accounts declared with the Cash type (see account types). Or if no such accounts are declared, it shows accounts - o under a top-level account named asset (case insensitive, plural al- + o under a top-level account named asset (case insensitive, plural al- lowed) o whose name contains some variation of cash, bank, checking or saving. @@ -7177,21 +7154,21 @@ PART 4: 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 op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. 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: @@ -7200,7 +7177,7 @@ PART 4: COMMANDS hledger check -s # basic + strict checks hledger check ordereddates payees # basic + two other checks - If you are an Emacs user, you can also configure flycheck-hledger to + If you are an Emacs user, you can also configure flycheck-hledger to run these checks, providing instant feedback as you edit the journal. Here are the checks currently available: @@ -7212,34 +7189,34 @@ PART 4: 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 costs or automatically-inferred costs - 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 costs 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 o payees - all payees used by transactions have been declared - o recentassertions - all accounts with balance assertions have a bal- + o recentassertions - all accounts with balance assertions have a bal- ance assertion no more than 7 days before their latest posting o tags - all tags used by transactions have been declared @@ -7247,124 +7224,124 @@ PART 4: 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: Cookbook -> Scripting. More about specific checks - hledger check recentassertions will complain if any balance-asserted + hledger check recentassertions will complain if any balance-asserted account does not have a balance assertion within 7 days before its lat- - est posting. This aims to prevent the situation where you are regu- - larly updating your journal, but forgetting to check your balances - against the real world, then one day must dig back through months of - data to find an error. It assumes that adding a balance assertion re- - quires/reminds you to check the real-world balance. That may not be - true if you auto-generate balance assertions from bank data; in that - case, I recommend to import transactions uncleared, then use the man- + est posting. This aims to prevent the situation where you are regu- + larly updating your journal, but forgetting to check your balances + against the real world, then one day must dig back through months of + data to find an error. It assumes that adding a balance assertion re- + quires/reminds you to check the real-world balance. That may not be + true if you auto-generate balance assertions from bank data; in that + case, I recommend to import transactions uncleared, then use the man- ual-review-and-mark-cleared phase as a reminder to check the latest as- sertions against real-world balances. close (equity) - Generate transactions which transfer account balances to and/or from - another account (typically equity). This can be useful for migrating - balances to a new journal file, or for merging earnings into equity at + Generate transactions which transfer account balances to and/or from + another account (typically equity). This can be useful for migrating + balances to a new journal file, or for merging earnings into equity at end of accounting period. - By default, it prints a transaction that zeroes out ALE accounts (as- + By default, it prints a transaction that zeroes out ALE accounts (as- set, liability, equity accounts; this requires account types to be con- figured); or if ACCTQUERY is provided, the accounts matched by that. (experimental) - This command has four main modes, corresponding to the most common use + This command has four main modes, corresponding to the most common use cases: - 1. With --close (default), it prints a "closing balances" transaction - that zeroes out ALE (asset, liability, equity) accounts by default - (this requires account types to be inferred or declared); or, the + 1. With --close (default), it prints a "closing balances" transaction + that zeroes out ALE (asset, liability, equity) accounts by default + (this requires account types to be inferred or declared); or, the accounts matched by the provided ACCTQUERY arguments. - 2. With --open, it prints an opposite "opening balances" transaction + 2. With --open, it prints an opposite "opening balances" transaction that restores those balances from zero. This is similar to Ledger's equity command. 3. With --migrate, it prints both the closing and opening transactions. - This is the preferred way to migrate balances to a new file: run - hledger close --migrate, add the closing transaction at the end of - the old file, and add the opening transaction at the start of the - new file. The matching closing/opening transactions cancel each + This is the preferred way to migrate balances to a new file: run + hledger close --migrate, add the closing transaction at the end of + the old file, and add the opening transaction at the start of the + new file. The matching closing/opening transactions cancel each other out, preserving correct balances during multi-file reporting. 4. With --retain, it prints a "retain earnings" transaction that trans- - fers RX (revenue and expense) balances to equity:retained earnings. - Businesses traditionally do this at the end of each accounting pe- - riod; it is less necessary with computer-based accounting, but it - could still be useful if you want to see the accounting equation + fers RX (revenue and expense) balances to equity:retained earnings. + Businesses traditionally do this at the end of each accounting pe- + riod; it is less necessary with computer-based accounting, but it + could still be useful if you want to see the accounting equation (A=L+E) satisfied. In all modes, the defaults can be overridden: - o the transaction descriptions can be changed with --close-desc=DESC + o the transaction descriptions can be changed with --close-desc=DESC and --open-desc=DESC o the account to transfer to/from can be changed with --close-acct=ACCT and --open-acct=ACCT - o the accounts to be closed/opened can be changed with ACCTQUERY (ac- + o the accounts to be closed/opened can be changed with ACCTQUERY (ac- count query arguments). - By default just one destination/source posting will be used, with its - amount left implicit. With --x/--explicit, the amount will be shown + By default just one destination/source posting will be used, with its + amount left implicit. With --x/--explicit, the amount will be shown explicitly, and if it involves multiple commodities, a separate posting will be generated for each of them (similar to print -x). - With --show-costs, any amount costs are shown, with separate postings + With --show-costs, any amount costs are shown, with separate postings for each cost. This is currently the best way to view investment lots. If you have many currency conversion or investment transactions, it can generate very large journal entries. - With --interleaved, each individual transfer is shown with source and - destination postings next to each other. This could be useful for + With --interleaved, each individual transfer is shown with source and + destination postings next to each other. This could be useful for troubleshooting. - The default closing date is yesterday, or the journal's end date, - whichever is later. You can change this by specifying a report end + The default closing date is yesterday, or the journal's end date, + whichever is later. You can change this by specifying a report end date; (The report start date does not matter.) The last day of the re- - port period will be the closing date; eg -e 2022 means "close on - 2022-12-31". The opening date is always the day after the closing + port period will be the closing date; eg -e 2022 means "close on + 2022-12-31". The opening date is always the day after the closing date. close and balance assertions - Balance assertions will be generated, verifying that the accounts have - been reset to zero (and then restored to their previous balances, if + Balance assertions will be generated, verifying that the accounts have + been reset to zero (and then restored to their previous balances, if there is an opening transaction). - These provide useful error checking, but you can ignore them temporar- + These provide useful error checking, but you can ignore them temporar- ily with -I, or remove them if you prefer. - You probably should avoid filtering transactions by status or realness - (-C, -R, status:), or generating postings (--auto), with this command, + You probably should avoid filtering transactions by status or realness + (-C, -R, status:), or generating postings (--auto), with this command, since the balance assertions would depend on these. - Note custom posting dates spanning the file boundary will disrupt the + Note custom posting dates spanning the file boundary will disrupt the balance assertions: 2023-12-30 a purchase made in december, cleared in january expenses:food 5 assets:bank:checking -5 ; date: 2023-01-02 - To solve that you can transfer the money to and from a temporary ac- - count, in effect splitting the multi-day transaction into two single- + To solve that you can transfer the money to and from a temporary ac- + count, in effect splitting the multi-day transaction into two single- day transactions: ; in 2022.journal: @@ -7383,36 +7360,36 @@ PART 4: COMMANDS $ hledger close --retain -f 2022.journal -p 2022 >> 2022.journal - Note 2022's income statement will now show only zeroes, because rev- - enues and expenses have been moved entirely to equity. To see them + Note 2022's income statement will now show only zeroes, because rev- + enues and expenses have been moved entirely to equity. To see them again, you could exclude the retain transaction: $ hledger -f 2022.journal is not:desc:'retain earnings' Example: migrate balances to a new file - Close assets/liabilities/equity on 2022-12-31 and re-open them on + Close assets/liabilities/equity on 2022-12-31 and re-open them on 2023-01-01: $ hledger close --migrate -f 2022.journal -p 2022 # copy/paste the closing transaction to the end of 2022.journal # copy/paste the opening transaction to the start of 2023.journal - Now 2022's balance sheet will show only zeroes, indicating a balanced - accounting equation. (Unless you are using @/@@ notation - in that - case, try adding --infer-equity.) To see the end-of-year balances + Now 2022's balance sheet will show only zeroes, indicating a balanced + accounting equation. (Unless you are using @/@@ notation - in that + case, try adding --infer-equity.) To see the end-of-year balances again, you could exclude the closing transaction: $ hledger -f 2022.journal bs not:desc:'closing balances' Example: excluding closing/opening transactions - When combining many files for multi-year reports, the closing/opening - transactions cause some noise in transaction-oriented reports like + When combining many files for multi-year reports, the closing/opening + transactions cause some noise in transaction-oriented reports like print and register. You can exclude them as shown above, but - not:desc:... is not ideal as it depends on consistent descriptions; - also you will want to avoid excluding the very first opening transac- + not:desc:... is not ideal as it depends on consistent descriptions; + also you will want to avoid excluding the very first opening transac- tion, which could be awkward. Here is one alternative, using tags: - Add clopen: tags to all opening/closing balances transactions except + Add clopen: tags to all opening/closing balances transactions except the first, like this: ; 2021.journal @@ -7438,7 +7415,7 @@ PART 4: COMMANDS include 2022.journal include 2023.journal - The clopen: tag can exclude all but the first opening transaction. To + The clopen: tag can exclude all but the first opening transaction. To show a clean multi-year checking register: $ hledger -f all.journal areg checking not:tag:clopen @@ -7451,13 +7428,13 @@ PART 4: 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. @@ -7497,16 +7474,16 @@ PART 4: COMMANDS demo Play demos of hledger usage in the terminal, if asciinema is installed. - Run this command with no argument to list the demos. To play a demo, + Run this command with no argument to list the demos. To play a demo, write its number or a prefix or substring of its title. Tips: Make your terminal window large enough to see the demo clearly. - During playback, several keys are available: SPACE to pause/unpause, . + During playback, several keys are available: SPACE to pause/unpause, . to step forward (while paused), CTRL-c quit. asciinema options can be added following a double dash, such as -s N to - adjust speed and -i SECS to limit pauses. Run asciinema -h to list + adjust speed and -i SECS to limit pauses. Run asciinema -h to list these options. Examples: @@ -7520,7 +7497,7 @@ PART 4: 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: @@ -7531,18 +7508,18 @@ PART 4: COMMANDS Person A 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. @@ -7559,30 +7536,30 @@ PART 4: COMMANDS These transactions are in the second file only: files - List all files included in the journal. With a REGEX argument, only + List all files included in the journal. With a REGEX argument, only file names matching the regular expression (case sensitive) are shown. help - Show the hledger user manual in the terminal, with info, man, or a - pager. With a TOPIC argument, open it at that topic if possible. - TOPIC can be any heading in the manual, or a heading prefix, case in- + Show the hledger user manual in the terminal, with info, man, or a + pager. With a TOPIC argument, open it at that topic if possible. + TOPIC can be any heading in the manual, or a heading prefix, case in- sensitive. Eg: commands, print, forecast, journal, amount, "auto post- ings". This command shows the hledger manual built in to your hledger version. It can be useful when offline, or when you prefer the terminal to a web - browser, or when the appropriate hledger manual or viewing tools are + browser, or when the appropriate hledger manual or viewing tools are not installed on your system. - By default it chooses the best viewer found in $PATH, trying (in this - order): info, man, $PAGER, less, more. You can force the use of info, - man, or a pager with the -i, -m, or -p flags, If no viewer can be + By default it chooses the best viewer found in $PATH, trying (in this + order): info, man, $PAGER, less, more. You can force the use of info, + man, or a pager with the -i, -m, or -p flags, If no viewer can be found, or the command is run non-interactively, it just prints the man- ual to stdout. - If using info, note that version 6 or greater is needed for TOPIC - lookup. If you are on mac you will likely have info 4.8, and should - consider installing a newer version, eg with brew install texinfo + If using info, note that version 6 or greater is needed for TOPIC + lookup. If you are on mac you will likely have info 4.8, and should + consider installing a newer version, eg with brew install texinfo (#1770). Examples @@ -7593,71 +7570,71 @@ PART 4: COMMANDS $ hledger help -m journal # show it with man, even if info is installed import - Read new transactions added to each FILE since last run, and add them - to the journal. Or with --dry-run, just print the transactions that - would be added. Or with --catchup, just mark all of the FILEs' trans- + Read new transactions added to each FILE since last run, and add them + to the journal. Or with --dry-run, just print the transactions that + would be added. Or with --catchup, just mark all of the FILEs' trans- actions as imported, without actually importing any. - This command may append new transactions to the main journal file - (which should be in journal format). Existing transactions are not - changed. This is one of the few hledger commands that writes to the + This command may append new transactions to the main journal file + (which should be in journal format). Existing transactions are not + changed. This is one of the few hledger commands that writes to the journal file (see also add). - 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 al- + when you are periodically importing foreign data which may contain al- ready-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- + 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 @@ -7673,17 +7650,17 @@ PART 4: COMMANDS do a --dry-run first and fix any problems before the real import. 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 @@ -7693,13 +7670,13 @@ PART 4: COMMANDS incomestatement (is) - This command displays an income statement, showing revenues and ex- + This command displays an income statement, showing revenues and ex- penses during one or more periods. Amounts are shown with normal posi- tive sign, as in conventional financial statements. - This report shows accounts declared with the Revenue or Expense type - (see account types). Or if no such accounts are declared, it shows - top-level accounts named revenue or income or expense (case insensi- + This report shows accounts declared with the Revenue or Expense type + (see account types). Or if no such accounts are declared, it shows + top-level accounts named revenue or income or expense (case insensi- tive, plurals allowed) and their subaccounts. Example: @@ -7726,21 +7703,21 @@ PART 4: 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 op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. notes List the unique notes that appear in transactions. This command lists the unique notes that appear in transactions, in al- - phabetic order. You can add a query to select a subset of transac- - tions. The note is the part of the transaction description after a | + phabetic 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: @@ -7752,14 +7729,14 @@ PART 4: 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: @@ -7770,10 +7747,10 @@ PART 4: COMMANDS Person A prices - Print market price directives from the journal. With --infer-market- + Print market price directives from the journal. With --infer-market- prices, generate additional market prices from costs. With --infer-re- - verse-prices, also generate market prices by inverting known prices. - Prices can be filtered by a query. Price amounts are displayed with + verse-prices, also generate market prices by inverting known prices. + Prices can be filtered by a query. Price amounts are displayed with their full precision. print @@ -7782,15 +7759,15 @@ PART 4: 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 di- rectives and file-level comments. @@ -7819,7 +7796,7 @@ PART 4: 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: @@ -7829,7 +7806,7 @@ PART 4: 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. @@ -7838,33 +7815,33 @@ PART 4: COMMANDS 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 cost is implied but not - written, it will not appear in the output. You can use the -x/--ex- + not appear in the output. Similarly, when a cost is implied but not + written, it will not appear in the output. You can use the -x/--ex- plicit flag to make all amounts and costs 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 + 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 costs are converted to cost using that + With -B/--cost, amounts with costs are converted to cost using that price. This can be used for troubleshooting. - With -m DESC/--match=DESC, print does a fuzzy search for one recent - transaction whose description is most similar to DESC. DESC should - contain at least two characters. If there is no similar-enough match, - no transaction will be shown and the program exit code will be non- + With -m DESC/--match=DESC, print does a fuzzy search for one recent + transaction whose description is most similar to DESC. DESC should + contain at least two characters. If there is no similar-enough match, + no transaction will be shown and the program exit code will be non- zero. - 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 op- - tions The output formats supported are txt, csv, and (experimental) + tions The output formats supported are txt, csv, and (experimental) json and sql. Here's an example of print's CSV output: @@ -7883,20 +7860,20 @@ PART 4: 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.) register @@ -7905,14 +7882,14 @@ PART 4: 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 @@ -7923,14 +7900,14 @@ PART 4: COMMANDS With --date2, it shows and sorts by secondary date instead. - For performance reasons, column widths are chosen based on the first - 1000 lines; this means unusually wide values in later lines can cause - visual discontinuities as column widths are adjusted. If you want to - ensure perfect alignment, at the cost of more time and memory, use the + For performance reasons, column widths are chosen based on the first + 1000 lines; this means unusually wide values in later lines can cause + visual discontinuities as column widths are adjusted. If you want to + ensure perfect alignment, at the cost of more time and memory, use the --align-all flag. - 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 @@ -7940,18 +7917,18 @@ PART 4: 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 ac- + the whole report period). This flag implies --empty (see below). It + is affected by --historical. It works best when showing just one ac- count 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 to- + bers. It's also useful to show postings on the checking account to- gether with the related account: $ hledger register --related --invert assets:checking @@ -7963,7 +7940,7 @@ PART 4: COMMANDS 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 @@ -7980,7 +7957,7 @@ PART 4: COMMANDS 2008/11 0 $-2 2008/12 0 $-2 - Often, you'll want to see just one line per interval. The --depth op- + Often, you'll want to see just one line per interval. The --depth op- tion helps with this, causing subaccounts to be aggregated: $ hledger register --monthly assets --depth 1h @@ -7988,22 +7965,22 @@ PART 4: 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 in- - tervals. 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 in- + tervals. This ensures that the first and last intervals are full length and comparable to the others in the report. - With -m DESC/--match=DESC, register does a fuzzy search for one recent + With -m DESC/--match=DESC, register does a fuzzy search for one recent posting whose description is most similar to DESC. DESC should contain at least two characters. If there is no similar-enough match, no post- ing will be shown and the program exit code will be non-zero. 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 + The description and account columns normally share the space equally (about half of (width - 40) each). You can adjust this by adding a de- scription width as part of --width's argument, comma-separated: --width W,D . Here's a diagram (won't display correctly in --help): @@ -8022,18 +7999,18 @@ PART 4: COMMANDS $ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, and (experimental) + tions The output formats supported are txt, csv, and (experimental) json. 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: @@ -8049,7 +8026,7 @@ PART 4: 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: @@ -8059,16 +8036,16 @@ PART 4: 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 in- + factor for an amount of original matched posting. If the amount in- cludes a commodity name, the new posting amount will be in the new com- - modity; otherwise, it will be in the matched posting amount's commod- + modity; otherwise, it will be in the matched posting amount's commod- ity. 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. @@ -8083,7 +8060,7 @@ PART 4: 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. @@ -8096,12 +8073,12 @@ PART 4: 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' @@ -8125,10 +8102,10 @@ PART 4: 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: @@ -8136,53 +8113,53 @@ PART 4: 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 - 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 ac- - count name) to select your investment(s) with --inv, and another query + At a minimum, you need to supply a query (which could be just an ac- + count 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 be- + o Error (NotBracketed): No solution for Internal Rate of Return (IRR). + Possible causes: IRR is huge (>1000000%), balance of investment be- comes 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/invest- ing/roi-unrealised.ledger @@ -8192,28 +8169,28 @@ PART 4: 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 as- - sets, or otherwise converting between your investment commodity and + sets, or otherwise converting between your investment commodity and any other commodity. Example: 2019-01-01 Investing in Snake Oil @@ -8230,12 +8207,12 @@ PART 4: 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 re- + 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 re- turn. - 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 @@ -8252,57 +8229,57 @@ PART 4: 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 pe- - riod 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 + 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 pe- + riod 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 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: @@ -8313,21 +8290,21 @@ PART 4: COMMANDS o Explanation of TWR - o Examples of computing IRR and TWR and discussion of the limitations + o Examples of computing IRR and TWR and discussion of the limitations of both metrics 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: @@ -8357,35 +8334,35 @@ PART 4: COMMANDS This command lists the tag names used in the journal, whether on trans- actions, postings, or account declarations. - With a TAGREGEX argument, only tag names matching this regular expres- + With a TAGREGEX argument, only tag names matching this regular expres- sion (case insensitive, infix matched) are shown. - With QUERY arguments, only transactions and accounts matching this + With QUERY arguments, only transactions and accounts matching this query are considered. If the query involves transaction fields (date:, desc:, amt:, ...), the search is restricted to the matched transactions and their accounts. - With the --values flag, the tags' unique non-empty values are listed + With the --values flag, the tags' unique non-empty values are listed instead. With -E/--empty, blank/empty values are also shown. - With --parsed, tags or values are shown in the order they were parsed, - with duplicates included. (Except, tags from account declarations are + With --parsed, tags or values are shown in the order they were parsed, + with duplicates included. (Except, tags from account declarations are always shown first.) - Tip: remember, accounts also acquire tags from their parents, postings + Tip: remember, accounts also acquire tags from their parents, postings also acquire tags from their account and transaction, transactions also acquire tags from their postings. 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 -- @@ -8394,11 +8371,11 @@ PART 4: 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). PART 5: COMMON TASKS - Here are some quick examples of how to do some basic tasks with + Here are some quick examples of how to do some basic tasks with hledger. Getting help @@ -8408,37 +8385,37 @@ PART 5: COMMON TASKS $ hledger --help # show common options $ hledger CMD --help # show CMD's options, common options and CMD's documentation - You can also view your hledger version's manual in several formats by + You can also view your hledger version's manual in several formats by using the help command. Eg: $ hledger help # show the hledger manual with info, man or $PAGER (best available) $ hledger help journal # show the journal topic in the hledger manual $ hledger help --help # find out more about the help command - To view manuals and introductory docs on the web, visit - https://hledger.org. Chat and mail list support and discussion ar- + To view manuals and introductory docs on the web, visit + https://hledger.org. Chat and mail list support and discussion ar- chives can be found at https://hledger.org/support. Constructing command lines - hledger has a flexible command line interface. We strive to keep it - simple and ergonomic, but if you run into one of the sharp edges de- + hledger has a flexible command line interface. We strive to keep it + simple and ergonomic, but if you run into one of the sharp edges de- scribed in OPTIONS, here are some tips that might help: - o command-specific options must go after the command (it's fine to put + o command-specific options must go after the command (it's fine to put common options there too: hledger CMD OPTS ARGS) - o running add-on executables directly simplifies command line parsing + o running add-on executables directly simplifies command line parsing (hledger-ui OPTS ARGS) o enclose "problematic" args in single quotes - o if needed, also add a backslash to hide regular expression metachar- + o if needed, also add a backslash to hide regular expression metachar- acters from the shell o to see how a misbehaving command line is being parsed, add --debug=2. Starting a journal file - hledger looks for your accounting data in a journal file, + hledger looks for your accounting data in a journal file, $HOME/.hledger.journal by default: $ hledger stats @@ -8446,9 +8423,9 @@ PART 5: COMMON TASKS Please create it first, eg with "hledger add" or a text editor. Or, specify an existing journal file with -f or LEDGER_FILE. - You can override this by setting the LEDGER_FILE environment variable - (see below). It's a good practice to keep this important file under - version control, and to start a new file each year. So you could do + You can override this by setting the LEDGER_FILE environment variable + (see below). It's a good practice to keep this important file under + version control, and to start a new file each year. So you could do something like this: $ mkdir ~/finance @@ -8474,28 +8451,28 @@ PART 5: COMMON TASKS Setting LEDGER_FILE How to set LEDGER_FILE permanently depends on your setup: - On unix and mac, running these commands in the terminal will work for + On unix and mac, running these commands in the terminal will work for many people; adapt as needed: $ echo 'export LEDGER_FILE=~/finance/2023.journal` >> ~/.profile $ source ~/.profile - When correctly configured, in a new terminal window env | grep + When correctly configured, in a new terminal window env | grep LEDGER_FILE will show your file, and so will hledger files. - On mac, this additional step might be helpful for GUI applications - (like Emacs started from the dock): add an entry to ~/.MacOSX/environ- + On mac, this additional step might be helpful for GUI applications + (like Emacs started from the dock): add an entry to ~/.MacOSX/environ- ment.plist like { "LEDGER_FILE" : "~/finance/2023.journal" } - and then run killall Dock in a terminal window (or restart the ma- + and then run killall Dock in a terminal window (or restart the ma- chine). On Windows, see https://www.java.com/en/download/help/path.html, or try - running these commands in a powershell window (let us know if it per- + running these commands in a powershell window (let us know if it per- sists across a reboot, and if you need to be an Administrator): > CD @@ -8503,20 +8480,20 @@ PART 5: COMMON TASKS > SETX LEDGER_FILE "C:\Users\USERNAME\finance\2023.journal" Setting opening balances - Pick a starting date for which you can look up the balances of some - real-world assets (bank accounts, wallet..) and liabilities (credit + Pick a starting date for which you can look up the balances of some + real-world assets (bank accounts, wallet..) and liabilities (credit cards..). - To avoid a lot of data entry, you may want to start with just one or + To avoid a lot of data entry, you may want to start with just one or two accounts, like your checking account or cash wallet; and pick a re- - cent starting date, like today or the start of the week. You can al- - ways come back later and add more accounts and older transactions, eg + cent starting date, like today or the start of the week. You can al- + ways come back later and add more accounts and older transactions, eg going back to january 1st. - Add an opening balances transaction to the journal, declaring the bal- + Add an opening balances transaction to the journal, declaring the bal- ances on this date. Here are two ways to do it: - o The first way: open the journal in any text editor and save an entry + o The first way: open the journal in any text editor and save an entry like this: 2023-01-01 * opening balances @@ -8526,19 +8503,19 @@ PART 5: COMMON TASKS liabilities:creditcard $-50 = $-50 equity:opening/closing balances - These are start-of-day balances, ie whatever was in the account at + These are start-of-day balances, ie whatever was in the account at the end of the previous day. - The * after the date is an optional status flag. Here it means + The * after the date is an optional status flag. Here it means "cleared & confirmed". - The currency symbols are optional, but usually a good idea as you'll + The currency symbols are optional, but usually a good idea as you'll be dealing with multiple currencies sooner or later. - The = amounts are optional balance assertions, providing extra error + The = amounts are optional balance assertions, providing extra error checking. - o The second way: run hledger add and follow the prompts to record a + o The second way: run hledger add and follow the prompts to record a similar transaction: $ hledger add @@ -8575,18 +8552,18 @@ PART 5: COMMON TASKS Starting the next transaction (. or ctrl-D/ctrl-C to quit) Date [2023-01-01]: . - If you're using version control, this could be a good time to commit + If you're using version control, this could be a good time to commit the journal. Eg: $ git commit -m 'initial balances' 2023.journal Recording transactions - As you spend or receive money, you can record these transactions using - one of the methods above (text editor, hledger add) or by using the - hledger-iadd or hledger-web add-ons, or by using the import command to + As you spend or receive money, you can record these transactions using + one of the methods above (text editor, hledger add) or by using the + hledger-iadd or hledger-web add-ons, or by using the import command to convert CSV data downloaded from your bank. - Here are some simple transactions, see the hledger_journal(5) manual + Here are some simple transactions, see the hledger_journal(5) manual and hledger.org for more ideas: 2023/1/10 * gift received @@ -8602,22 +8579,22 @@ PART 5: COMMON TASKS assets:bank:checking $1000 Reconciling - Periodically you should reconcile - compare your hledger-reported bal- - ances against external sources of truth, like bank statements or your - bank's website - to be sure that your ledger accurately represents the - real-world balances (and, that the real-world institutions have not - made a mistake!). This gets easy and fast with (1) practice and (2) - frequency. If you do it daily, it can take 2-10 minutes. If you let - it pile up, expect it to take longer as you hunt down errors and dis- + Periodically you should reconcile - compare your hledger-reported bal- + ances against external sources of truth, like bank statements or your + bank's website - to be sure that your ledger accurately represents the + real-world balances (and, that the real-world institutions have not + made a mistake!). This gets easy and fast with (1) practice and (2) + frequency. If you do it daily, it can take 2-10 minutes. If you let + it pile up, expect it to take longer as you hunt down errors and dis- crepancies. A typical workflow: - 1. Reconcile cash. Count what's in your wallet. Compare with what - hledger reports (hledger bal cash). If they are different, try to - remember the missing transaction, or look for the error in the al- - ready-recorded transactions. A register report can be helpful - (hledger reg cash). If you can't find the error, add an adjustment + 1. Reconcile cash. Count what's in your wallet. Compare with what + hledger reports (hledger bal cash). If they are different, try to + remember the missing transaction, or look for the error in the al- + ready-recorded transactions. A register report can be helpful + (hledger reg cash). If you can't find the error, add an adjustment transaction. Eg if you have $105 after the above, and can't explain the missing $2, it could be: @@ -8627,26 +8604,26 @@ PART 5: COMMON TASKS 2. Reconcile checking. Log in to your bank's website. Compare today's (cleared) balance with hledger's cleared balance (hledger bal check- - ing -C). If they are different, track down the error or record the - missing transaction(s) or add an adjustment transaction, similar to + ing -C). If they are different, track down the error or record the + missing transaction(s) or add an adjustment transaction, similar to the above. Unlike the cash case, you can usually compare the trans- - action history and running balance from your bank with the one re- - ported by hledger reg checking -C. This will be easier if you gen- - erally record transaction dates quite similar to your bank's clear- + action history and running balance from your bank with the one re- + ported by hledger reg checking -C. This will be easier if you gen- + erally record transaction dates quite similar to your bank's clear- ing dates. 3. Repeat for other asset/liability accounts. - Tip: instead of the register command, use hledger-ui to see a live-up- + Tip: instead of the register command, use hledger-ui to see a live-up- dating register while you edit the journal: hledger-ui --watch --regis- ter checking -C - After reconciling, it could be a good time to mark the reconciled - transactions' status as "cleared and confirmed", if you want to track - that, by adding the * marker. Eg in the paycheck transaction above, + After reconciling, it could be a good time to mark the reconciled + transactions' status as "cleared and confirmed", if you want to track + that, by adding the * marker. Eg in the paycheck transaction above, insert * between 2023-01-15 and paycheck - If you're using version control, this can be another good time to com- + If you're using version control, this can be another good time to com- mit: $ git commit -m 'txns' 2023.journal @@ -8718,7 +8695,7 @@ PART 5: COMMON TASKS -------------------- 0 - Show only asset and liability balances, as a flat list, limited to + Show only asset and liability balances, as a flat list, limited to depth 2: $ hledger bal assets liabilities -2 @@ -8728,7 +8705,7 @@ PART 5: COMMON TASKS -------------------- $4055 - Show the same thing without negative numbers, formatted as a simple + Show the same thing without negative numbers, formatted as a simple balance sheet: $ hledger bs -2 @@ -8795,77 +8772,77 @@ PART 5: COMMON TASKS 2023-01-13 **** Migrating to a new file - At the end of the year, you may want to continue your journal in a new + At the end of the year, you may want to continue your journal in a new file, so that old transactions don't slow down or clutter your reports, - and to help ensure the integrity of your accounting history. See the + and to help ensure the integrity of your accounting history. See the close command. If using version control, don't forget to git add the new file. BUGS We welcome bug reports in the hledger issue tracker (shortcut: - http://bugs.hledger.org), or on the #hledger chat or hledger mail list + http://bugs.hledger.org), or on the #hledger chat or hledger mail list (https://hledger.org/support). Some known issues and limitations: - The need to precede add-on command options with -- when invoked from + The need to precede add-on command options with -- when invoked from hledger is awkward. (See Command options, Constructing command lines.) - A UTF-8-aware system locale must be configured to work with non-ascii + A UTF-8-aware system locale must be configured to work with non-ascii data. (See Unicode characters, Troubleshooting.) On Microsoft Windows, depending whether you are running in a CMD window or a Cygwin/MSYS/Mintty window and how you installed hledger, non-ascii characters and colours may not be supported, and the tab key may not be - supported by hledger add. (Running in a WSL window should resolve + supported by hledger add. (Running in a WSL window should resolve these.) When processing large data files, hledger uses more memory than Ledger. Troubleshooting - Here are some common issues you might encounter when you run hledger, - and how to resolve them (and remember also you can usually get quick + Here are some common issues you might encounter when you run hledger, + and how to resolve them (and remember also you can usually get quick Support): PATH issues: I get an error like "No command 'hledger' found" Depending how you installed hledger, the executables may not be in your - shell's PATH. Eg on unix systems, stack installs hledger in ~/.lo- + shell's PATH. Eg on unix systems, stack installs hledger in ~/.lo- cal/bin and cabal installs it in ~/.cabal/bin. You may need to add one - of these directories to your shell's PATH, and/or open a new terminal + of these directories to your shell's PATH, and/or open a new terminal window. - LEDGER_FILE issues: I configured LEDGER_FILE but hledger is not using + LEDGER_FILE issues: I configured LEDGER_FILE but hledger is not using it - o LEDGER_FILE should be a real environment variable, not just a shell + o LEDGER_FILE should be a real environment variable, not just a shell variable. Eg on unix, the command env | grep LEDGER_FILE should show - it. You may need to use export (see https://stackover- + it. You may need to use export (see https://stackover- flow.com/a/7411509). - o You may need to force your shell to see the new configuration. A + o You may need to force your shell to see the new configuration. A simple way is to close your terminal window and open a new one. - LANG issues: I get errors like "Illegal byte sequence" or "Invalid or + LANG issues: I get errors like "Illegal byte sequence" or "Invalid or incomplete multibyte or wide character" or "commitAndReleaseBuffer: in- valid argument (invalid character)" - Programs compiled with GHC (hledger, haskell build tools, etc.) need - the system locale to be UTF-8-aware, or they will fail when they en- - counter non-ascii characters. To fix it, set the LANG environment - variable to a locale which supports UTF-8 and which is installed on + Programs compiled with GHC (hledger, haskell build tools, etc.) need + the system locale to be UTF-8-aware, or they will fail when they en- + counter non-ascii characters. To fix it, set the LANG environment + variable to a locale which supports UTF-8 and which is installed on your system. - On unix, locale -a lists the installed locales. Look for one which - mentions utf8, UTF-8 or similar. Some examples: C.UTF-8, en_US.utf-8, - fr_FR.utf8. If necessary, use your system package manager to install - one. Then select it by setting the LANG environment variable. Note, - exact spelling and capitalisation of the locale name may be important: + On unix, locale -a lists the installed locales. Look for one which + mentions utf8, UTF-8 or similar. Some examples: C.UTF-8, en_US.utf-8, + fr_FR.utf8. If necessary, use your system package manager to install + one. Then select it by setting the LANG environment variable. Note, + exact spelling and capitalisation of the locale name may be important: Here's one common way to configure this permanently for your shell: $ echo "export LANG=en_US.utf8" >>~/.profile # close and re-open terminal window COMPATIBILITY ISSUES: hledger gives an error with my Ledger file - Not all of Ledger's journal file syntax or feature set is supported. + Not all of Ledger's journal file syntax or feature set is supported. See hledger and Ledger for full details.