ledger has the concept of fixated prices/costs which tells it not to
revalue it according to the current pricedb but to always use the
specified cost/price; see
https://www.ledger-cli.org/3.0/doc/ledger3.html#Fixated-prices-and-costs
I am trying to figure out how to handle these in ledger2beancount.
Obviously, beancount doesn't have a similar concept, so we need to strip
the fixated prices/costs and document how to interact with beancount to
get the expected behaviour.
If something is a fixated cost, it's easy. This:
2012-04-10 My Broker
Assets:Brokerage 10 AAPL {=$50.00}
Assets:Brokerage:Cash $750.00
becomes:
2012-04-10 txn "My Broker"
Assets:Brokerage 10 AAPL {50.00 USD}
Assets:Brokerage:Cash 750.00 USD
and you can run: SUM(COST(position)) to get the value. This will always
return the "fixated" value (i.e. the cost).
I thought that if you add:
plugin "beancount.plugins.implicit_prices"
you could alternatively do SUM(CONVERT(position, 'USD', date)), i.e. if
we convert everything on its original date and sum it up, we should get
the same value.
However, this doesn't work in practice, at least not in all cases.
I have an example where the two do not match:
beancount> SELECT SUM(CONVERT(position, 'USD', date)) WHERE date < 2018-03-01
AND account ~ '^Assets:Accounts-Receivable'
sum_convert_position
--------------------
508739.717262620 USD
beancount> SELECT SUM(COST(position)) WHERE date < 2018-03-01 AND account ~
'^Assets:Accounts-Receivable'
sum_cost_position
-------------------
507589.87445810 USD
beancount>
Martin, is this expected or a bug? Maybe this happens when you have
multiple price entries on the same day and beancount only has one price
per day instead of taking the price from the transaction?
And then my other question is what to do about fixated prices, e.g.:
2012-04-10 My Broker
Assets:Brokerage 10 AAPL @ =$50.00
Assets:Brokerage:Cash $750.00
ledger considers a fixated cost and a fixated price the same and this
transaction will actually lead to 10 APPL {=$50}. ledger2beancount has
some logic to figure out when a price should be converted to a cost
rather than a price. I'm wondering if in the case of a fixated price,
we should *always* convert to a cost so the "fixated" value is kept
around.
Any opinions on this?
--
Martin Michlmayr
https://www.cyrius.com/
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.