There's a total cost syntax, it's double curlys {{ }}. The main downside of
it: we have limited control over the precision for non-round numbers, so
the costs can be long (and an exact match is required if you ever want to
match by cost).Also there's a # syntax for specifying an expense like a commission. I'm not sure if Martin intends either to be 'general availability' yet. Here's an example from the tests of cost basis syntax (#) <https://github.com/beancount/beancount/blob/v2/beancount/parser/booking_full_test.py#L745> . Note you can't currently combine double curly total cost with the # function. The # operator absorbs the commission into the basis: 2013-05-18 * "" Assets:Investments:MSFT 10 MSFT { 200 # 9.95 USD } Assets:Investments:Cash -2009.95 USD resolves to: 2013-05-18 * Assets:Investments:MSFT 10 MSFT {200.995 USD, 2013-05-18} Assets:Investments:Cash -2009.95 USD On Tue, May 4, 2021 at 6:42 AM James Cook <[email protected]> wrote: > Hi beancount list, > > I have three questions about capital gains and trading commissions: > > 1. I understand Beancount 2 doesn't have good support for factoring > trading commissions into capital gains calculations. Is my example > below a reasonable workaround, or is there a better way? (See bottom > of email. I think this more or less implements the suggestion at > > https://beancount.github.io/docs/trading_with_beancount.html#commissions) > > 2. Is there a syntax for specifying the total cost of a lot, instead of the > per-unit cost? E.g. instead of > > Assets:Brokerage:ACME 10 ACME {10.50 USD} > > I would like to write something like > > Assets:Brokerage:ACME 10 ACME {@@ 105.00 USD} > > or even > > Assets:Brokerage:ACME 10 ACME {@@ 100.00 + 5.00 USD} > > The latter two would be more pleasant to use when the cost per unit > is not a nice round number. > > 3. Is there a plan for dealing with this in a clever way? I found a > reference to a "proposal" at > > > https://beancount.github.io/docs/trading_with_beancount.html#commissions > > but when I click the link I get a 404 at > > > https://beancount.github.io/docs/a_proposal_for_an_improvement_on_inventory_booking.md > > Thanks for your time. > > > For question #1: here is how I am thinking of dealing with it. First, > here's a ledger before the workaround. Capital gains will be computed > incorrectly. (My ledger is like this right now.) > > > option "operating_currency" "USD" > > plugin "beancount.plugins.auto_accounts" > > 2000-01-01 * "Buy ACME" > Assets:Brokerage:ACME 10 ACME {10.00 USD} > Expenses:Trading-commissions 5.00 USD > Assets:Brokerage:Cash -105.00 USD > > 2000-01-02 * "Sell 1 ACME" > Assets:Brokerage:ACME -1 ACME {10.00 USD} @ 12.00 USD > Expenses:Trading-commissions 2.00 USD > Assets:Brokerage:Cash 10.00 USD > Income:Capital-gains > > 2000-01-02 * "Sell 9 ACME" > Assets:Brokerage:ACME -9 ACME {10.00 USD} @ 20.00 USD > Expenses:Trading-commissions 2.00 USD > Assets:Brokerage:Cash 178.00 USD > Income:Capital-gains > > > And here is what I'm thinking of changing that to. The > Expenses:Trading-commissions account disappears, but now commissions > are subtracted from capital gains, which my tax jurisdictions allow. > > > option "operating_currency" "USD" > > plugin "beancount.plugins.auto_accounts" > > 2000-01-01 * "Buy ACME" > Assets:Brokerage:ACME 10 ACME {10.50 USD} > Assets:Brokerage:Cash -105.00 USD > > 2000-01-02 * "Sell 1 ACME" > Assets:Brokerage:ACME -1 ACME {10.50 USD} @ 12.00 USD > Assets:Brokerage:Cash 10.00 USD > Income:Capital-gains > > 2000-01-02 * "Sell 9 ACME" > Assets:Brokerage:ACME -9 ACME {10.50 USD} @ 20.00 USD > Assets:Brokerage:Cash 178.00 USD > Income:Capital-gains > > > -- > James > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/20210504134212.pczxfpx54isjchif%40moth.falsifian.org > . > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACGEkZv2Vnm9WV%3DpaatsSZNsuhFaAx4YZQWn%2B49qoJRW83s72g%40mail.gmail.com.
