On Fri, Jun 13, 2014 at 9:01 AM, Rick F <[email protected]> wrote: > The method used in the cookbook, is not correct. >
That's not exactly true: it's correct if your definition of capital gain does not take into account commissions. I used the definition that excludes capital gains in order to keep things simple (the level of discussion I chose in that doc is that congruent with trying to explain P/L clearly, intro level). Whether you should be able to exclude commissions or not from your gains is a matter tax law, and it depends on your own situation. Thanks for bringing up the topic, though, I admit I did forget to explain it. I'll add a separate section about commissions. I'm well aware of this. At the moment, I simply subtract the commissions from the gains for reporting. The gains and commissions get counted in separate accounts (which is mostly fine, except for the prorating detail you bring up below). You can subtract the total commissions from total gain for a good approximation of gains-without-commissions. Most of my trading accounts already provide a suitable 1099 so I use my own accounting on these accounts for tax planning and cross-checking against their calculations, and I use the 1099 forms for tax reporting. The cookbook uses the example of buying 10 shares of IBM at $160 and then > selling those shares at $170. Without commissions, that would amount to a > realized gain of $100, $1700 (the sales price) - $1600 (the cost basis). > With commissions, however, the reportable gain is really $1700 (the sales > price) - $9.95 (commission on the sale) - $1600 (basis) - $9.95 > (commission on purchase) = $80.10. The method in the cookbook only > accounts for the sale commission when figuring the capital gain. > Actually, that's incorrect, the method I described does exclude the commission from the gain on BOTH sides and will thus calculate a gain of 100$ (no commissions at all). So what's the right way to do this, accounting for commission on purchase. > Note that if only part of the purchased shares are sold the commission is > prorated, so the actual basis is $1609.95 or $160.995 per share. > That's a great question. Again, how it should be done is a matter of tax law, it's a choice, but this is indeed a sensible one in many cases. Simply subtracting the sum of the commissions - you could easily track them per account, e.g. using Expenses:US:ETrade:Commissions instead of Expenses:Financial:Commissions - from the capital gains provides a good approximation of the gains as you describe it, but as you point out, not a perfectly accurate one, especially if you hold positions across reporting periods (taxation years). It is appropriate to note that folding in the purchase commission on the cost basis is but one method to automatically pro-rate that commission into the gain - we could track it separately, per-lot - but it is one that is elegant and leads to an unambiguous implementation. I would like to be able to support it. I don't have a good solution for doing this at the moment, but I want to think of one. In particular, we should design a method that leads to easy entry by a user, with a correspondingly nice syntax. I'll be thinking about this; any ideas welcome. On Wednesday, June 11, 2014 11:05:54 PM UTC-7, Martin Blais wrote: > >> Christophe, >> I was going to reply with the detail to this email, but I decided to >> write it up in my cookbook instead: >> http://furius.ca/beancount/doc/cookbook >> >> I've been fantasizing for a while about writing up detailed examples for >> all the things I've discovered for myself about bookkeeping over the years, >> and waiting to finish the whole document just hasn't served me well, might >> as well deliver it piecemeal. So here I wrote up much of the "Stock >> Trading" section for you, and I hope you will find it explains well how >> this is meant to be booked in our systems, Ledger or Beancount the same (I >> think). >> >> >> Michael: I don't understand how it works in your example. You're entering >> the positions with price conversion, using the @ sign: >> >> 2014-01-01 Details for shares >> Assets:Investments:Stocks:Share A 15 ShareA @ 20€ >> Assets:Investments:Stocks:Share B 5 ShareB @ 100€ >> Equity:Opening Balance >> >> But his sale is using the "cost" syntax (with {}): >> >> 2014-04-01 Selling 2 ShareB >> Assets:Bank:Check Account 240,00 € >> Assets:Investments:Stocks:Share B -2 ShareB {100€} @ 120€ >> Income:Investments Gains >> >> How does this work under the covers? >> I'm not sure how Ledger works in this regard actually, I'd love to know, >> I should probably dig in the source code. In my system, these are two >> completely different kinds of events. The first one is a "price >> conversion", such that no memory is maintained regarding the cost of the >> units converted. The price/rate is used to balance the transaction but the >> units are deposited in the account without associated cost. This is what >> you would do, for instance, if you were making a withdrawal in a foreign >> country, e.g. in JPY and then spend it locally: you never think of these >> yen in your wallet as "being held at such and such" exchange rate, once >> converted, they have no "cost" to them anymore, all the bills are just >> "yen". (In fact, if you're homed in multiple countries and hold assets in >> many places, holding currencies at cost creates incredible unnecessary >> complexities, I'm quite certain this is not what's happening). These >> conversion events are relatively rare in practice. >> >> The semantics I attach to the second one is explained in a good amount of >> detail in the link to my document above. But it requires that when I enter >> a position, I say "this is held at cost" by virtue of using the {} syntax. >> It then attaches the cost to the lot as it accumulates balances for each >> posting of an account. >> >> If someone could provide some insight, that would be interesting. >> >> >> Finally, without the fix you provided in the github ticket, I don't >> understand how you've been using the system to track capital gains until >> now. With virtual transactions? How did this use to work? >> >> Thank you, >> >> >> >> >> >> >> >> >> >> On Wed, Jun 11, 2014 at 6:56 PM, Martin Michlmayr <[email protected]> >> wrote: >> >>> * Christophe Schockaert <[email protected]> [2014-06-11 22:10]: >>> >>> > ; Details of shares at 2014/01/01 >>> > 2014-01-01 Details for shares >>> > Assets:Investments:Stocks:Total Value >>> >>> This is incorrect (see below). >>> >>> > Assets:Investments:Stocks:Share A 15 ShareA @ 20€ >>> > Assets:Investments:Stocks:Share B 5 ShareB @ 100€ >>> > >>> > Then, I run "ledger --real -B -V balance", which returns: >>> > : 5000,00 € Assets >>> > : 5000,00 € Bank:Check Account >>> > : 0 Investments:Stocks >>> > : 300,00 € Share A >>> > : 500,00 € Share B >>> > : -800,00 € Total Value >>> > : -5000,00 € Equity:Opening Balance >>> > : -------------------- >>> > : 0 >>> > >>> > That's fine. I understand that doing this, only the gains and loss >>> will end in >>> > the assets. I put the "Total Value" entry in order to see at a glance >>> the value >>> > of all shares. >>> >>> This "Total Value" entry is incorrect. It's not the total value, but >>> the cost. You have share A worth 300 and share B worth 500. How did >>> you pay for those shares? You either have to reduce cash, or your >>> case, use Equity:Opening Balance. >>> >>> What you want is something like this: >>> >>> 2014-01-01 Details for shares >>> Assets:Investments:Stocks:Share A 15 ShareA @ 20€ >>> Assets:Investments:Stocks:Share B 5 ShareB @ 100€ >>> Equity:Opening Balance >>> >>> Also, -B -V doesn't make much sense together. -B is the cost (what >>> you paid), -V is the current value (what it's worth now). Look here: >>> >>> 2014-01-01 Details for shares >>> Assets:Investments:Stocks:Share A 15 ShareA @ 20€ >>> Assets:Investments:Stocks:Share B 5 ShareB @ 100€ >>> Equity:Opening Balance >>> >>> P 2014-02-01 ShareA 30€ >>> >>> bal 'Assets:Investments:Stocks:Share A' -B >>> €300 Assets:Investments:Stocks:Share A >>> bal 'Assets:Investments:Stocks:Share A' -V >>> €450 Assets:Investments:Stocks:Share A >>> >>> > In my second try (case B), I wish to see the contribution of my stocks >>> within >>> > the assets (I don't know if that's a valid practice but it gives me an >>> overview >>> > of the whole money available a time "t"). >>> >>> I don't know what you're trying to say exactly, but in any case, this >>> is the correct accounting practice to use. >>> >>> > The, I sell some shares of stock B at a higher price, in both cases. >>> > This is were problems rises for me. >>> ... >>> > There are a few things that bother me: >>> > 1) The presence of the "Equity:Capital Gains", which I understand >>> balances the >>> > entry, but it is automatically added and I can't choose its name. >>> I thought >>> > the balance would go to the "Income:Investments Gains" in fact. >>> >>> These Equity entries ledger generates are wrong. This is bug >>> http://bugs.ledger-cli.org/show_bug.cgi?id=712 >>> The good news is that John and I agreed on a fix recently. You can >>> try the 713-costs branch and see if it does what you expect. >>> >>> > So, what's the status for this question ? >>> >>> There's a fix. We're just waiting for more people to test it. >>> >>> > 2) The left-over for "Share B" shows 260€, which does not render the >>> fact that >>> > I still have 3 plain stocks, which would at least value 300€ (from >>> their >>> > initial value), or 360€ for the current value. >>> >>> This is http://bugs.ledger-cli.org/show_bug.cgi?id=713 >>> which should be fixed on the 713-costs branch. >>> >>> > 3) I would like to have a view of the left-over value of the stocks, >>> at time >>> > "t". In "case A", the total still show "800€" which is the initial >>> value, >>> > and in "case B", I see 560€, which reflects the "800€-240€", but >>> not the >>> > sum of the 10 ShareA and the 3 remaining ShareB. >>> >>> I'm not entirely sure I understand, but with the 713-costs branch, >>> you should get the correct result: >>> >>> bal 'Assets:Investments:Stocks' -B >>> 600,00 € Assets:Investments:Stocks >>> 300,00 € Share A >>> 300,00 € Share B >>> -------------------- >>> 600,00 € >>> >>> bal 'Assets:Investments:Stocks' -V >>> 660,00 € Assets:Investments:Stocks >>> 300,00 € Share A >>> 360,00 € Share B >>> -------------------- >>> 660,00 € >>> >>> -B is the cost: you originally paid 20 for A and 100 for B: 3 * 100 + >>> 15*20 = 600 >>> >>> -V is the current value. A is worth 20, B is worth 120: 3 * 120 + 15*20 >>> = 660 >>> >>> > However, I run into other issues, mainly that it only uses the last >>> value, even >>> > for the initial value, and if I mix the notation in "plain shares" (-2 >>> ShareB) >>> > and the notation with attributed values (-2 ShareB {100€} @ 120€), >>> they don't >>> > get along very well. >>> >>> I'm not sure I understand. >>> >>> BTW, you use Assets:Investments:Stocks:Share A and >>> Assets:Investments:Stocks:Share B >>> as account names. General practice on this list appears to be not to >>> use too many subaccounts. I'd just use Assets:Investments:Stocks for >>> both. If you want to see what Share A is worth only, you can do >>> -l "commodity == 'ShareA'" >>> >>> -- >>> Martin Michlmayr >>> http://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. >>> >> >> -- > > --- > 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. > -- --- 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.
