I just found another approach: 
https://groups.google.com/g/beancount/c/OIjyBo-Ehu0/m/b3ujN_oMAQAJ

If I understand correctly, he simply has a phantom account that offsets the 
initial notional value and track only PnL afterwards. This phantom account 
offers a nice hack to deal with futures. However, for some reason he calls 
this "margin" (not sure why, maybe this is special Ameritrade terminology).

On Friday, December 8, 2023 at 6:06:57 PM UTC Dan Andersson wrote:

> I think I can get a fully customizable experience by using "NONE" and zero 
> cost basis. Please critique this:
>
> ;----------
> 2014-05-20 open Assets:Futures:GOLD-DEC-24 GOLD-DEC-24 "NONE"
> 2014-05-20 open Assets:Citibank:Cash USD
> 2014-05-20 open Income:CapitalGains USD
> 2014-05-20 open Expenses:CapitalLosses USD
>
> 2014-05-20 * "Buy GOLD-DEC-24 @1000.0"
>   Assets:Futures:GOLD-DEC-24  2 GOLD-DEC-24  { 0 USD }
>
> 2014-05-21 * "Sell GOLD-DEC-24 @1010.0"
>   Assets:Futures:GOLD-DEC-24  -1 GOLD-DEC-24  { 0 USD }
>   Assets:Citibank:Cash 10 USD
>   Income:CapitalGains -10 USD
>
> 2014-05-22 * "Sell GOLD-DEC-24 @990.0"
>   Assets:Futures:GOLD-DEC-24  -1 GOLD-DEC-24  { 0 USD }
>   Assets:Citibank:Cash -10 USD
>   Expenses:CapitalLosses 10 USD
> ;----------
>
> Advantage: Full control.
>
> Drawbacks:
>
>    1. The cost basis is just a dummy value (only to "enable a custom 
>    experience").
>    2. I lose Beancount's automatic mismatch checks on futures quantity 
>    vs. cash.
>    3. I also lose Beancount's automatic matching; have to do matching and 
>    PnL calculations myself.
>    4. Beancount reporting doesn't automatically reflect unrealized gains.
>    
> Is this on the right track? (Point 4 is very unfortunate but I could 
> alleviate that by e.g. annual (December 31) entry to record unrealized 
> gains.)
>
> Thanks,
> Dan
>
> On Tuesday, December 5, 2023 at 10:10:03 PM UTC Dan Andersson wrote:
>
>> Hi,
>>
>> For stocks (and even options), you pay for a thing (or short sell a 
>> thing) and cash leaves (or comes into) your cash account. Very clear. The 
>> cash is price * quantity * multiplier.
>>
>> Futures are different. No cash leaves/arrives in the beginning. Basically 
>> the value starts at zero. Only price differences over time matter and only 
>> when closing position does realized PnL bring cash in/out of cash account.
>>
>> How to deal with this in Beancount? Should I set the Beancount price to 
>> zero at first (and e.g. for informational purposes put the actual market 
>> price into the comment)?
>>
>> (I realize there is margin but that's just a virtual allocation of sorts 
>> (cash is still in the cash account), cannot really be determined from the 
>> price, plus it varies from time to time depending on volatility etc.)
>>
>> Thanks,
>> Dan
>>
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/2aabf18c-ce90-4475-9b07-0c4023e0f657n%40googlegroups.com.

Reply via email to