@@ -7066,54 +7066,50 @@ $ hledger print --lots desc:sell
70667066
70677067## Reduction methods
70687068
7069- When a disposal or transfer doesn't specify a particular lot (eg the amount is ` -5 AAPL ` or ` -5 AAPL {} ` ),
7070- hledger selects lot(s) automatically using a reduction method. The available methods are:
7069+ When a disposal or transfer doesn't specify a particular lot (eg the amount is like ` -5 AAPL {} ` , or just ` -5 AAPL ` ),
7070+ hledger selects lot(s) automatically using a reduction method.
7071+ You can configure the method via the ` lots: ` tag on a commodity or account declaration (account tags override commodity tags):
70717072
7072- | Method | Lots selected | Disposal cost basis |
7073- | --------------------| --------------------| ---------------------------|
7074- | ** FIFO** (default) | oldest first | each lot's cost |
7075- | ** LIFO** | newest first | each lot's cost |
7076- | ** HIFO** | highest cost first | each lot's cost |
7077- | ** AVERAGE** | oldest first | weighted average cost |
7078- | ** SPECID** | one specified lot | specified lot's cost |
7079- | ** FIFOALL** | oldest first | each lot's cost |
7080- | ** LIFOALL** | newest first | each lot's cost |
7081- | ** HIFOALL** | highest cost first | each lot's cost |
7082- | ** AVERAGEALL** | oldest first | global weighted avg cost |
7073+ ``` journal
7074+ commodity AAPL ; lots: FIFOALL
7075+ account assets:mutualfund ; lots: AVERAGE
7076+ ```
7077+
7078+ The default method is ` FIFO ` (first in first out within one account).
7079+ The available methods are:
70837080
7084- All methods select lots from the posting's account only.
7081+ | Method | Lots selected | Disposal cost basis | Error checking
7082+ |--------------------|--------------------|---------------------------|---------------------------------------------------------------------------------------
7083+ | ** SPECID** | one specific lot | specified lot's cost | A matching lot, with sufficient balance, exists in the account.
7084+ | ** FIFO** (default) | oldest first | each lot's cost | Sufficient lot(s) exist in the account.
7085+ | ** LIFO** | newest first | each lot's cost | "
7086+ | ** HIFO** | highest cost first | each lot's cost | "
7087+ | ** AVERAGE** | oldest first | weighted average cost | "
7088+ | ** FIFOALL** | oldest first | each lot's cost | Sufficient lot(s) exist in the account, and are highest priority across all accounts.
7089+ | ** LIFOALL** | newest first | each lot's cost | "
7090+ | ** HIFOALL** | highest cost first | each lot's cost | "
7091+ | ** AVERAGEALL** | oldest first | global weighted avg cost | "
70857092
7086- An explicit lot selector (eg ` {2026-01-15, $50} ` or ` {$50} ` ) uses specific-identification (SPECID).
7093+ ** SPECID** (specific identification) is what you're using if the journal entry contains
7094+ explicit lot selectors like ` {2026-01-15, $50} ` or ` {$50} ` ,
7095+ or an explicit lot subaccount like ` assets:broker:{2026-01-15, $50} ` .
70877096
70887097** HIFO** (highest-in-first-out) selects the lot with the highest per-unit cost first,
70897098which can be useful for tax optimization.
70907099
7091- ** AVERAGE** uses the weighted average per-unit cost of the account's pool as the
7092- disposal cost basis, rather than each lot's individual cost.
7100+ ** AVERAGE** consumes lots in FIFO order,
7101+ but uses the weighted average per-unit cost, within the specified account,
7102+ as the disposal cost basis, rather than each lot's individual cost.
70937103This is required in some jurisdictions (eg Canada's Adjusted Cost Base, France's PMPA, UK's S104 pools).
7094- Lots are still consumed in FIFO order for bookkeeping purposes.
7095-
7096- ### All-accounts reduction
7097-
7098- The ** \* ALL** variants (FIFOALL, LIFOALL, HIFOALL, AVERAGEALL) work like their base methods
7099- but additionally validate that the selected lots would also be chosen first
7100- if all accounts' lots were considered together.
7101- If a lot on another account has higher priority (eg is older under FIFOALL),
7102- an error is raised showing which account holds it.
7103- This is useful when you want to enforce a consistent global disposal order
7104- across multiple brokerage accounts.
71057104
7106- ** AVERAGEALL** additionally computes the weighted average cost across the global pool
7107- (all accounts holding that commodity), not just the posting's account.
7108-
7109- Configure the method via the ` lots: ` tag on a commodity or account declaration:
7110-
7111- ``` journal
7112- commodity AAPL ; lots: FIFO
7113- account assets:stocks ; lots: AVERAGEALL
7114- ```
7105+ All of these methods select lots from the account mentioned in the posting.
7106+ But the ** \* ALL** variants (FIFOALL, LIFOALL, HIFOALL, AVERAGEALL) additionally validate
7107+ that these lots are the ones that would be chosen if considering the global pool (all accounts holding that commodity).
7108+ So if there is a more appropriate lot in another account (eg an older lot when using FIFOALL),
7109+ they will raise an error showing which account holds it.
7110+ This is useful if you need to enforce a global disposal order across all accounts (brokers, exchanges, wallets etc).
71157111
7116- Account tags override commodity tags .
7112+ ** AVERAGEALL ** computes the weighted average cost across the global pool .
71177113
71187114## Lot postings with balance assertions
71197115
0 commit comments