;doc: fix conversion & cost depth

This commit is contained in:
Simon Michael 2021-12-21 10:54:47 -10:00
parent 4bf0d76a1f
commit d10f3df27b

View File

@ -915,7 +915,7 @@ 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](https://github.com/simonmichael/hledger/issues/1625).
## CONVERSION & COST
# CONVERSION & COST
This section is about converting between commodities. Some definitions:
@ -927,11 +927,11 @@ This section is about converting between commodities. Some definitions:
- "Cost" is how much of one commodity was paid to acquire the other (when buying), or how much was received in exchange for the other (when selling). We call both of these "cost" for convenience (after all, it is cost for one party or the other).
### Recording conversions
## Recording conversions
As a concrete example, let's assume 100 EUR was converted to 120 USD. There are several ways to record this in the journal, each with pros and cons which will be explained in more detail below. (Also, these examples use [journal format](#journal-format) which is properly explained much further below; sorry about that, you may want to read some of that first.)
#### Implicit conversion
### Implicit conversion
You can just record the outflow (100 EUR) and inflow (120 USD) in the appropriate asset account:
@ -955,7 +955,7 @@ Con:
You can prevent accidental implicit conversions due to a mistyped commodity symbol, by using `hledger check commodities`.
You can prevent implicit conversions entirely, by using `hledger check balancednoautoconversion`, or `-s/--strict`.
#### Priced conversion
### Priced conversion
You can add the conversion rate using @ notation:
@ -976,7 +976,7 @@ Pro:
Con:
- Disturbs the accounting equation
#### Equity conversion
### Equity conversion
In strict double entry bookkeeping, the above transaction is not balanced in EUR or in USD, since some EUR disappears, and some USD appears. This violates the accounting equation (A+L+E=0), and prevents reports like `balancesheetequity` from showing a zero total.
@ -1000,7 +1000,7 @@ Con:
- conversion rate is not clear
- hledger can not do cost reporting
#### Priced equity conversion
### Priced equity conversion
Another possible notation would be to record both the conversion rate and the equity postings:
@ -1014,22 +1014,22 @@ Another possible notation would be to record both the conversion rate and the eq
hledger currently does not allow this; instead, you can record the conversion rate as a comment.
### Inferring missing conversion rates
## Inferring missing conversion rates
hledger will do this automatically for implicit conversions. Currently it can not do this for equity conversions.
### Inferring missing equity postings
## Inferring missing equity postings
With the `--infer-equity` flag, hledger will add equity postings to priced and implicit conversions (and move the conversion rate into a comment).
### Cost reporting
## Cost reporting
With the `-B/--cost` flag, hledger will convert the amounts in priced and implicit conversions to their cost in the other commodity. This is useful to see a report of what you paid for things (or how much you sold things for). Currently `-B/--cost` does not work on equity conversions, and it disables `--infer-equity`.
These operations are transient, only affecting reports. If you want to change the journal file permanently, you could pipe each entry through
`hledger -f- -I print [-x] [--infer-equity] [-B]`
### Conversion summary
## Conversion summary
- Recording the conversion rate is good because it makes that clear and allows cost reporting.
- Recording equity postings is good because it balances the accounting equation and is correct bookkeeping.