Ah right, you also need to book your profit/loss in a separate account.
Thanks Jason for catching that.

A full example of the sell transaction with P/L:

2017-03-27 * "sell 20 shares of VGHCX"
  Assets:Investments:Fidelity:Roth:VGHCX                  -20 VGHCX{205 USD}
  Assets:Investments:Fidelity:Roth                        205 USD
  Assets:Investments:Fidelity:Roth:PL                      -5 USD


Do note that the {200 USD} notation is to specify your lot, If for some
reason you have two lot both with same acquire price, you'll need to add
date to disambiguate (something like {200 USD, 2017-01-01}). I believe this
is explained in the doc.

On Tue, Mar 28, 2017 at 1:08 PM, Andrew Sail <[email protected]> wrote:

> Thanks! That's really helpful. Could you modify yegle's example to include
> a PnL/CapitalGains account? Are you suggesting I return principal to cash
> but growth to a gains account on sale? If you could also clarify what you
> mean by {} ambiguous matching syntax, I would really appreciate it.
>
> On Tuesday, March 28, 2017 at 4:03:28 PM UTC-4, Jason Chu wrote:
>>
>> To better understand how inventories work, I highly recommend reading
>> http://furius.ca/beancount/doc/booking.  It explains why you have to
>> select lots at all and the various booking methods you probably want to use.
>>
>> In addition, yegle's example is missing the PnL/CapitalGains account, so
>> you'll actually return the wrong amount to your Roth account.  The doc
>> explains why.
>>
>> I have converted nearly every one of my sales to using the {} ambiguous
>> matching syntax and I feel so much better for it.
>>
>> On Tue, Mar 28, 2017 at 12:08 PM yegle <[email protected]> wrote:
>>
>>> When you sell your holdings, you should specify which lot you want to
>>> sell in the curly bracket. In your case, you should write the following.
>>>
>>>
>>>
>>> 2017-03-27 * "sell 20 shares of VGHCX"
>>>   Assets:Investments:Fidelity:Roth:VGHCX                  -20 VGHCX{200
>>> USD} @205 USD
>>>   Assets:Investments:Fidelity:Roth
>>>
>>>
>>> On Tue, Mar 28, 2017 at 12:04 PM, Andrew Sail <[email protected]>
>>> wrote:
>>>
>>>> I'm receiving a strange error when trying to sell shares of an
>>>> investment fund that I have previously purchased. Below is an example from
>>>> my ledger, replaced with dummy data. In this example, I'm trying to buy 20
>>>> shares of the fund at $200/each, funded from my main account, and then sell
>>>> them at $205/each (the sale is obviously just for the sake of my
>>>> understanding of how to use the tool).
>>>>
>>>> 2017-01-01 * "buy 20 shares of VGHCX"
>>>>   Assets:Investments:Fidelity:Roth:VGHCX                  20 VGHCX{200
>>>> USD}
>>>>   Assets:Investments:Fidelity:Roth                       -4000 USD
>>>>
>>>> 2017-03-27 * "sell 20 shares of VGHCX"
>>>>   Assets:Investments:Fidelity:Roth:VGHCX                  -20
>>>> VGHCX{205 USD}
>>>>   Assets:Investments:Fidelity:Roth
>>>>
>>>> 2017-01-01 price VGHCX                              200.00 USD
>>>> 2017-03-27 price VGHCX                              205.00 USD
>>>>
>>>> The error I receive is below.
>>>>
>>>> $ bean-check ledger.beancount
>>>> /path/to/ledger.beancount:74:      No position matches
>>>> "Posting(account='Assets:Investments:Fidelity:Roth:VGHCX', units=-20
>>>> VGHCX, cost=CostSpec(number_per=Decimal('205.00'), number_total=None,
>>>> currency='USD', date=None, label=None, merge=False), price=None, flag=None,
>>>> meta={'filename': '/path/to/ledger.beancount', 'lineno': 75})" against
>>>> balance (20 VGHCX {200 USD, 2017-01-01})
>>>>
>>>> This leads me to asking a few questions:
>>>> 1) The obvious; what am I doing wrong? I simply want to sell the 20
>>>> shares of VGHCX at $205/share that I own and return the funds as USD to my
>>>> main account (cash).
>>>> 2) If I remove the sale, only my principal shows on my ledger, my
>>>> investment's growth is not shown as a part of my net worth; is this
>>>> correct, or is there a deeper rooted issue?
>>>> 3) Should reporting price in my ledger impact my net worth and if not,
>>>> where in bean-web or fava should I be able to refer to my growth for
>>>> further analysis?
>>>>
>>>> Thank you in advance for your help!
>>>>
>>>> --
>>>> 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 post to this group, send email to [email protected].
>>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>>> gid/beancount/2e046181-afad-4010-8df3-63b97d399a2a%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/beancount/2e046181-afad-4010-8df3-63b97d399a2a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Yuchen Ying
>>> https://about.me/yegle
>>>
>>> --
>>> 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 post to this group, send email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/beancount/CAFL5w3Xvrw96YYHYDOfFXyLK7daun9Enc7kYZjc9GVVvN
>>> 7uwsg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/beancount/CAFL5w3Xvrw96YYHYDOfFXyLK7daun9Enc7kYZjc9GVVvN7uwsg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/beancount/12a6c1c2-3a29-42df-b039-2a0131811ae7%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/12a6c1c2-3a29-42df-b039-2a0131811ae7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Yuchen Ying
https://about.me/yegle

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAFL5w3VjyyR5to2aAAAywpV8qkbDEhPYTG7S48mpB%3DNquGddsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to