1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use crateDecimal;
use Comment;
use Located;
/// A single posting line inside a transaction — one debit or credit.
///
/// `amount` is `None` for the "omitted amount" posting whose value is
/// inferred later by the balancer. `costs` and `balance_assertion` are
/// optional Ledger annotations (`@`/`@@` and `=`).
///
/// `lot_cost` carries the Ledger `{COST}` annotation (cost basis per
/// unit, e.g. `{BTC 0.0904}`). When present, the booker uses the lot
/// cost — not the `@` market cost — to compute the balance effective
/// amount, which matches Ledger's sell-from-lot semantics. The `@`
/// market cost still participates in rebalance/reports.
/// A numeric value paired with a commodity symbol (e.g. `$100.50`, `10 AAPL`).
///
/// `decimals` records how many fractional digits the user wrote in the
/// source — e.g. `5.00` has `decimals = 2` even though the `Decimal`
/// value is `5`. This drives display precision: reports maximise
/// `decimals` over all observed amounts per commodity.
///
/// Price annotation attached to a posting: either per unit (`@`) or
/// for the total (`@@`).
/// Ledger lot-price annotation captured from `{...}`.
///
/// - `Floating` — plain `{COST}`: the lot price may be revalued
/// against a later market rate in `--revalued` reports.
/// - `Fixed` — `{=COST}`: the lot price is locked in, used as the
/// cost-basis for realized-gain tracking.
///
/// The `{{TOTAL}}` (total instead of per-unit) form is not modelled;
/// the parser consumes and discards it.