docs: update amount haddock
This commit is contained in:
parent
8b47aeb146
commit
17da24710a
@ -17,25 +17,31 @@ A simple amount is a 'Commodity', quantity pair:
|
|||||||
A 'MixedAmount' is zero or more simple amounts:
|
A 'MixedAmount' is zero or more simple amounts:
|
||||||
|
|
||||||
@
|
@
|
||||||
$50, EUR 3, AAPL 500
|
$50 + EUR 3
|
||||||
16h, $13.55, oranges 6
|
16h + $13.55 + AAPL 500 + 6 oranges
|
||||||
@
|
@
|
||||||
|
|
||||||
Not implemented:
|
A normalised mixed amount has at most one amount of each commodity, and no
|
||||||
Commodities may be convertible or not. A mixed amount containing only
|
zero amounts (or it has just a single zero amount and no others.)
|
||||||
convertible commodities can be converted to a simple amount. Arithmetic
|
|
||||||
examples:
|
Amounts often have a price per unit, or conversion rate, in terms of
|
||||||
|
another commodity. also. If present, this is displayed after \@:
|
||||||
|
|
||||||
@
|
@
|
||||||
$1 - $5 = $-4
|
EUR 3 \@ $1.35
|
||||||
$1 + EUR 0.76 = $2
|
@
|
||||||
EUR0.76 + $1 = EUR 1.52
|
|
||||||
EUR0.76 - $1 = 0
|
A normalised mixed amount has at most one amount in each
|
||||||
($5, 2h) + $1 = ($6, 2h)
|
commodity/pricing, and no zero amounts (or, it has only a zero amount).
|
||||||
($50, EUR 3, AAPL 500) + ($13.55, oranges 6) = $67.51, AAPL 500, oranges 6
|
|
||||||
($50, EUR 3) * $-1 = $-53.96
|
In principle we can convert an amount to any other commodity to which we
|
||||||
($50, AAPL 500) * $-1 = error
|
have a known sequence of conversion rates; in practice we only do one
|
||||||
@
|
conversion step (eg to show cost basis with -B).
|
||||||
|
|
||||||
|
We can do limited arithmetic with simple or mixed amounts: either
|
||||||
|
price-preserving arithmetic with similarly-priced amounts, or
|
||||||
|
price-discarding arithmetic which ignores and discards prices.
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
module Ledger.Amount
|
module Ledger.Amount
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user