From 5beeb56a875131dd3b6ac3eca5543cf49e13f284 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 8 Apr 2020 19:02:24 -0700 Subject: [PATCH] ;journal: document improved lot price parsing; changelog --- hledger-lib/hledger_journal.m4.md | 16 +++++++++++++--- hledger/CHANGES.md | 7 +++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hledger-lib/hledger_journal.m4.md b/hledger-lib/hledger_journal.m4.md index 7ffaefe6a..1ae895a5d 100644 --- a/hledger-lib/hledger_journal.m4.md +++ b/hledger-lib/hledger_journal.m4.md @@ -549,9 +549,6 @@ There are several ways to record a transaction price: assets:dollars $-135 ; for $135 ``` -(Ledger users: Ledger uses a different [syntax](http://ledger-cli.org/3.0/doc/ledger3.html#Fixing-Lot-Prices) -for fixed prices, `{=UNITPRICE}`, which hledger currently ignores). - Use the [`-B/--cost`](hledger.html#reporting-options) flag to convert amounts to their transaction price's commodity, if any. (mnemonic: "B" is from "cost Basis", as in Ledger). @@ -582,6 +579,19 @@ $ hledger bal -N --flat -B €100 assets:euros ``` +## Lot Prices + +Ledger allows another kind of price, +[lot price](http://ledger-cli.org/3.0/doc/ledger3.html#Fixing-Lot-Prices), +to be specified in curly braces +(three variants: `{UNITPRICE}`, `{{TOTALPRICE}}`, `{=FIXEDUNITPRICE}`). +This is normally used to select a lot when selling investments. +hledger will parse these, for compatibility with Ledger journals, but +currently ignores them. +They may appear after the posting amount, before or after the +[transaction price](#transaction-prices) if any, and before the +balance assertion if any. + ## Balance Assertions hledger supports diff --git a/hledger/CHANGES.md b/hledger/CHANGES.md index 82083382a..c1205178a 100644 --- a/hledger/CHANGES.md +++ b/hledger/CHANGES.md @@ -3,6 +3,13 @@ User-visible changes in the hledger command line tool and library. # e7e9f1ee +- Improved parse compatibility for Ledger lot prices: + hledger up to 1.17.1 did not accept Ledger's lot price syntax except + in vary limited circumstances (`{= }` at the end of the posting line). + hledger now accepts all three lot price syntaxes (`{ }`, `{{ }}`, `{= }`), + anywhere after the posting amount but before any balance assertion. + All of these lot prices are ignored. + - csv: don't discard explicit assignments of a 0 amount Eg: an `amount1 $0.00` assignment was generating a posting1 with missing amount.