Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Testing ledger cost/price syntax, lots, revaluation, capital gains
; Test ledger cost/price syntax, lots, revaluation, capital gains
P 2019-01-01 ETC 11 EUR
P 2019-02-01 ETC 12 EUR
; Fluctuating cost/price
; @, @@ https://www.ledger-cli.org/3.0/doc/ledger3.html#Posting-cost
; { }, {{ }} https://www.ledger-cli.org/3.0/doc/ledger3.html#Commodity-prices
; "functionally.. no difference" https://www.ledger-cli.org/3.0/doc/ledger3.html#Prices-versus-costs
2019-01-11
(A) 2 ETF @ 10 EUR ; "fluctuating unit posting cost"
2019-01-12
(B) 2 ETF @@ 20 EUR ; "fluctuating total posting cost"
2019-01-13
(C) 2 ETF {10 EUR} ; "fluctuating unit commodity price" (no lot date shown)
2019-01-14
(D) 2 ETF {{20 EUR}} ; "fluctuating total commodity price" (no lot date shown)
; Fixated cost/price
; @=, @@=, {= }, {{= }} https://www.ledger-cli.org/3.0/doc/ledger3.html#Fixated-prices-and-costs
2019-01-15
(F) 2 ETF @= 10 EUR ; "fixated unit posting cost"
2019-01-16
(G) 2 ETF @@= 20 EUR ; "fixated total posting cost"
2019-01-17
(H) 2 ETF {=10 EUR} ; "fixated unit commodity price" (no lot date shown)
2019-01-18
(I) 2 ETF {{=20 EUR}} ; "fixated total commodity price" (no lot date shown)
; Late transaction just in case it helps ensure full-period behaviour
2019-02-15
(J) 2 ETF
comment
Observations:
bal --flat --no-total --lots shows {LOTPRICE} for A-I, and [LOTDATE] for A, B, F, G.
Ie @/@@ shows a lot date, {}/{{}} doesn't.
--revalued does nothing. --revalued-only with -V suppresses all postings.
reg -E --gain shows a -2 ETF, EUR 20 gain in C, D, H, I, J. With -V it shows no gains.
Related help:
--lot-dates
Report the date on which each commodity in a balance report was pur-
chased.
--lot-notes
Report the tag attached to each commodity in a balance report.
--lot-prices
Report the price at which each commodity in a balance report was pur-
chased.
--lots Report the date and price at which each commodity was purchased in a bal-
ance report.
--lots-actual
Preserve the uniqueness of commodities so they aren't merged during
reporting without printing the lot annotations.
--revalued
Report discrepancy in values for manual reports by inserting <Revalued>
postings. This is implied when using the --exchange (-X) or --market
(-V) option.
--revalued-only
Show only <Revalued> postings.
--revalued-total
Display the sum of the revalued postings as the running total, which
serves to show unrealized capital in a gain/losses report.
--gain (-G)
Report net gain or loss for commodities that have a price history.
end comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.