Sorry for the late reply, I've been busy.

Yeah, maybe I shouldn't have called it "margin," it's inaccurate.
In particular, this method doesn't actually track the margin usage (which
seems unnecessary).
Maybe it should be some Equity account.

There's some other discussion about futures contracts here:
https://docs.google.com/document/d/1H0UDD1cKenraIMe40PbdMgnqJdeqI6yKv0og51mXk-0/edit

The other problem is inferring the multiplier. That's not done.
https://docs.google.com/document/d/1qPdNXaz5zuDQ8M9uoZFyyFis7hA0G55BEfhWhrVBsfc/edit#heading=h.b30u633jlv5x
I'm thinking the instrument names maybe should have a multiplier in them,
or we should have some global option to register a prefix-to-multiplier
mapping.




On Fri, Dec 8, 2023 at 3:24 PM Dan Andersson <danandersso...@gmail.com>
wrote:

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

Reply via email to