On Saturday, October 31, 2020 at 4:38:28 PM UTC-4 [email protected] wrote:

> On Sat, Oct 31, 2020 at 4:09 PM Aaron Lindsay <[email protected]> wrote:
>
>> Hello!
>>
>> I have a scary accounting question for Halloween...
>>
>
> oooOOOoOOoOoOoOOoO
>  
>
>>
>> I have 8 years of GnuCash data I'd like to convert to beancount. The 
>> problem is that, as far as I can tell, GnuCash doesn't track cost basis for 
>> trades. Because of that, I'm having difficulty replicating the suggested 
>> approach from 
>> https://beancount.github.io/docs/trading_with_beancount.html. I am using 
>> https://github.com/falsifian/gnucash-to-beancount and can 'successfully' 
>> convert my data to beancount, but instead of specifying the cost basis, 
>> purchases of investments end up looking like:
>>
>> 2014-10-31 * "BUY 1 SPY @ 200"
>>   Assets:Current-Assets:Brokerage:SPY 1 SPY @ 200 USD 
>>   Assets:Trading:CURRENCY:USD 200 USD
>>   Assets:Current-Assets:Brokerage -200 USD
>>   Assets:Trading:NYSE:SPY -1 SPY @ 200 USD
>>
>
> Urg...
> This should be an improvement (despite the absence of cost basis):
>
> 2014-10-31 * "BUY 1 SPY @ 200"
>>   Assets:Current-Assets:Brokerage:SPY 1 SPY @ 200 USD 
>>
>   Assets:Current-Assets:Brokerage -200 USD
>>
>
> Also, I'd create a cash sub-account for the cash portin.
>
> Sales are in essentially the same form, just in reverse. In this way, my 
> Assets:Trading:CURRENCY:USD 
>> account ends up being a weird combination 
>>
>
> It's the aggregate P/L (without discounting commissions).
>

Isn't it only the aggregate P/L *after* I sell all positions? Otherwise it 
also includes the cash used to buy my currently-held investments. Or maybe 
I'm confused about the definition of "aggregate P/L"?
 

> of the total cost basis of all my current investments and the gains or 
>> losses from previous investments. Obviously I have enough data here to 
>> calculate the cost basis for *purchases* of investments,
>>
>
> Yes, something like this: 
>
> 2014-10-31 * "BUY 1 SPY @ 200"
>>
>   Assets:Current-Assets:Brokerage:SPY 1 SPY {200 USD}
>>   Assets:Current-Assets:Brokerage:Cash               -200 USD
>>
>  
Yup, that's exactly what I was thinking of doing. And I think I've got 
gnucash-to-beancount doing that for me now.

so that ought to be do-able with some modification of the 
>> gnucash-to-beancount scripts, but I'm not sure how best to handle the 
>> sales. I've been reading the beancount documentation and have found the 
>> "FIFO" booking method - is that pretty much my only option at this point? 
>> Are there any gotchas to using it in my case?
>>
>
> You could use that, but it's not necessarily going to match the P/L you 
> declared in the past for each period (though the total P/L should be 
> right). Personally I would gather my history and then try to manually match 
> each of the sales, but I'm a maniac. bean-doctor context can help, by 
> printing the available lots just before a transaction.
>
> How many sales do you have?
>

To be honest, I haven't been tracking my P/L much, if at all. Though I'm 
even a little unclear on how GnuCash would derive P/L given the 'Trading' 
account setup it uses - how are you assuming GnuCash calculates P/L when 
you say it's not going to match beancount's?

Assuming they're all recorded in a consistent form (which I'm not sure I 
believe), I have around 200 sales. I think I will probably end up letting 
bean-count do its best using "FIFO" and go back behind it and check up on 
the ones that I can find data for.
 

> As a bonus - if I end up using the "FIFO" booking method, is it possible 
>> to get beancount re-write my .beancount file with the cost basis it 
>> calculated internally for the sales? 
>>
> My goal there would be to make the implicit cost basis on sales explicit - 
>> and allow me to use STRICT moving forward without having to manually fix up 
>> 8 years of transactions.
>>
>
> Yes. Just "bean-query print" your ledger and it will print out everything 
> explicitly.
>
> I hope this helps, 
>

It does, thanks!

-Aaron

Thanks for any pointers!
>>
>> -Aaron
>>
>> -- 
>> 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/01dd4feb-9b9a-423b-bbee-d7a9d2613035n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/beancount/01dd4feb-9b9a-423b-bbee-d7a9d2613035n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/f3419875-8c5a-482b-b74e-5c2b157216a6n%40googlegroups.com.

Reply via email to