@@ -7064,56 +7064,48 @@ $ hledger print --lots desc:sell
70647064
70657065When a disposal or transfer doesn't specify a particular lot (eg the amount is like ` -5 AAPL {} ` , or just ` -5 AAPL ` ),
70667066hledger selects lot(s) automatically using a reduction method.
7067- This is configured by giving the commodity's (or account's) ` lots: ` tag a value.
7067+ You can configure the method via the ` lots: ` tag on a commodity or account declaration (account tags override commodity tags):
7068+
7069+ ``` journal
7070+ commodity AAPL ; lots: FIFOALL
7071+ account assets:mutualfund ; lots: AVERAGE
7072+ ```
7073+
7074+ The default method is ` FIFO ` (first in first out within one account).
70687075The available methods are:
70697076
70707077| Method | Lots selected | Disposal cost basis | Error checking
7071- |--------------------|--------------------|---------------------------|---------------------------------------
7072- | ** FIFO** (default) | oldest first | each lot's cost | Sufficient lot(s) exist in the specified account.
7078+ |--------------------|--------------------|---------------------------|---------------------------------------------------------------------------------------
7079+ | ** SPECID** | one specific lot | specified lot's cost | A matching lot, with sufficient balance, exists in the account.
7080+ | ** FIFO** (default) | oldest first | each lot's cost | Sufficient lot(s) exist in the account.
70737081| ** LIFO** | newest first | each lot's cost | "
70747082| ** HIFO** | highest cost first | each lot's cost | "
70757083| ** AVERAGE** | oldest first | weighted average cost | "
70767084| ** FIFOALL** | oldest first | each lot's cost | Sufficient lot(s) exist in the account, and are highest priority across all accounts.
70777085| ** LIFOALL** | newest first | each lot's cost | "
70787086| ** HIFOALL** | highest cost first | each lot's cost | "
70797087| ** AVERAGEALL** | oldest first | global weighted avg cost | "
7080- | ** SPECID** | one specified lot | specified lot's cost | This lot exists in the account, and has sufficient balance.
7081-
7082- ** HIFO** (highest-in-first-out) selects the lot with the highest per-unit cost first,
7083- which can be useful for tax optimization.
7084-
7085- ** AVERAGE** uses the weighted average per-unit cost of the account's pool as the
7086- disposal cost basis, rather than each lot's individual cost.
7087- This is required in some jurisdictions (eg Canada's Adjusted Cost Base, France's PMPA, UK's S104 pools).
7088- Lots are still consumed in FIFO order for bookkeeping purposes.
70897088
70907089** SPECID** (specific identification) is what you're using if the journal entry contains
70917090explicit lot selectors like ` {2026-01-15, $50} ` or ` {$50} ` ,
70927091or an explicit lot subaccount like ` assets:broker:{2026-01-15, $50} ` .
70937092
7094- ### All-accounts reduction
7095-
7096- All of these methods select lots from the account mentioned in the posting.
7097-
7098- The ** \* ALL** variants (FIFOALL, LIFOALL, HIFOALL, AVERAGEALL)
7099- also validate that these lots are the ones that would be chosen
7100- if all accounts' lots were considered together.
7101- If there is a more appropriate lot in another account (eg an older lot when using FIFOALL),
7102- an error is raised showing which account holds it.
7103- This is useful to check and enforce a consistent global disposal order
7104- across multiple brokerage/exchange/wallet accounts.
7105-
7106- ** AVERAGEALL** additionally computes the weighted average cost across the global pool
7107- (all accounts holding that commodity), not just the posting's account.
7093+ ** HIFO** (highest-in-first-out) selects the lot with the highest per-unit cost first,
7094+ which can be useful for tax optimization.
71087095
7109- Configure the method via the ` lots: ` tag on a commodity or account declaration:
7096+ ** AVERAGE** consumes lots in FIFO order,
7097+ but uses the weighted average per-unit cost, within the specified account,
7098+ as the disposal cost basis, rather than each lot's individual cost.
7099+ This is required in some jurisdictions (eg Canada's Adjusted Cost Base, France's PMPA, UK's S104 pools).
71107100
7111- ``` journal
7112- commodity AAPL ; lots: FIFO
7113- account assets:stocks ; lots: AVERAGEALL
7114- ```
7101+ All of these methods select lots from the account mentioned in the posting.
7102+ But the ** \* ALL** variants (FIFOALL, LIFOALL, HIFOALL, AVERAGEALL) additionally validate
7103+ that these lots are the ones that would be chosen if considering the global pool (all accounts holding that commodity).
7104+ So if there is a more appropriate lot in another account (eg an older lot when using FIFOALL),
7105+ they will raise an error showing which account holds it.
7106+ This is useful if you need to enforce a global disposal order across all accounts (brokers, exchanges, wallets etc).
71157107
7116- Account tags override commodity tags .
7108+ ** AVERAGEALL ** computes the weighted average cost across the global pool .
71177109
71187110## Lot postings with balance assertions
71197111
0 commit comments