Re: Marking stock options with beancount

2021-04-06 Thread Tuomas Salmi
Thanks for reply. Looks like my terminology is a bit off since I this is 
first time I have had to think about this in English.
What I meant was that my employer gave me 10 options which let me to 
purchase stocks with the fixed price which was set when options were given 
to me. In this case I can buy COMPANY for 6.19 euros regardless of the real 
rate of the COMPANY in stock market. So I think you are right about 
"exercise" being the correct term.

> Your transactions seems incomplete to me.
> You will want to represent the options themselves using a unique 
instrument name with the strike, side (put/call) and expiration 
data embedded in the symbol.
> You will want to carefully adjust the sales price vs. cost basis and 
recognize the P/L to the right account if this is a company incentive (I 
believe the initial P/L may be treated as income tax, not gains).

Do you have any example of representing options like this? I think in 
Finland the initial P/L is treated as income tax. However, for my personal 
ledger in general I'm not too concerned about taxing details since almost 
all personal taxing process is done by taxing organization in Finland. So I 
don't usually track those details in my personal ledger and I'm happy with 
having the correct balances on each of my accounts. However, I suppose I 
might have to be a bit more careful in this case.

To be honest I think for my purposes it would be enough to just add 10 
COMPANY stocks to my Assets:OtherBank:Company  with correct sales price and 
deduce the 61.90e from my cash bank account.

maanantai 5. huhtikuuta 2021 klo 8.23.48 UTC+3 bl...@furius.ca kirjoitti:

>  Hi Tuomas,
> I don't understand your terminology.
> "Marking" is the process of valuing active positions for the purpose of 
> calculation unrealized P/L.
> I think you mean "exercise."
>
> On Sun, Apr 4, 2021 at 6:49 AM Tuomas Salmi  wrote:
>
>>
>> Recently my employer let me to mark some stock options I had and I'm 
>> having trouble to add them properly to the Beancount ledger.
>>
>> Lets say I had 10 options letting me to buy 10 stocks of COMPANY. Looks 
>> like the transaction will be made first to my incentive bank account and 
>> then I'll transfer the bought stocks to my actual bank which holds my 
>> stocks. 
>>
>> I tried the following:
>>
>> 2021-03-31 * "Mark options"
>>   Assets:OP:BankAccount -61.90 EUR 
>>   Assets:IncentiveBankAccount:Company   10 COMPANY {6.19 EUR} 
>>
>> 2021-04-01 * "Transfer stocks to other bank account"
>>   Assets:IncentiveBankAccount:Company   -10 
>> COMPANY
>>   Assets:OtherBank:Company 10 COMPANY
>>
>> The beancheck accepts this syntax. However when I check the account 
>> balances in the Fava, I see that the end balance for "IncentiveBankAccount" 
>> is:
>> 61.90 EUR
>> -10 COMPANY
>>
>> So it seems like the Beancount will use two separate units for the 
>> "IncentiveBankAccount".
>>
>
> You need to use the cost basis on your transfer.
>
> Your transactions seems incomplete to me.
> You will want to represent the options themselves using a unique 
> instrument name with the strike, side (put/call) and expiration 
> data embedded in the symbol.
> You will want to carefully adjust the sales price vs. cost basis and 
> recognize the P/L to the right account if this is a company incentive (I 
> believe the initial P/L may be treated as income tax, not gains).
> There is much to say.
>
>
>  
>
>>
>> So how should I mark the following transactions to get all this sorted 
>> out:
>> 1. Pay 61.90 EUR from my cash bank account to buy 10 COMPANY stocks to 
>> IncentiveBankAccount account (balance -> 10 COMPANY)
>> 2. Move 10 COMPANY from IncentiveBankAccount to OtherBank:Company 
>> (balance 10 -> 0 COMPANY in incentive)
>>
>> -- 
>> 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+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/beancount/b0b0602c-807b-479c-8d5e-1cf147cada7en%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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/bde20d72-3ab4-4cc8-b77c-31a46856f207n%40googlegroups.com.


transaction costs:

2021-04-06 Thread david e
I am wondering about how to book transaction costs correctly. as I am doing 
ethereum tx, I have to track cost basis of the fees. compared to paying 
fees to a broker, this is a bit more work.  

my entry would look like this: 

2018-01-01 * "Send 1.5 ETH & 0.05 ETH gas"
Assets:Crypto:ETH -1.55 ETH {}
Expenses:Crypto 100 USD
Expenses:Crypto:Fees 1 USD
Income:Crypto:PnL 

but in this case, the PnL is the total of both ETH entries (Assets and 
Fees). to have the entries separated, it could look like this, split into 
two entries:

2018-01-01 * "Send 1.5 ETH example"
Assets:Crypto:ETH -1.5 ETH {}
Expenses:Crypto 100 USD
Income:Crypto:PnL 

2018-01-01 * "Send 0.05 ETH for gas example"
Assets:Crypto:ETH -0.05 ETH {}
Expenses:Crypto:Fees 1 USD
Income:Crypto:PnL 

my question: is it possible to calculate / report the PnL of the fees 
separately even though I list it in one entry as shown above? or do I have 
to split it for correct calculation?

my assumption is that for tax reporting I have to be able to list PnL for 
each position and therefore it would be a problem to mix it with the fees. 

thanks

-- 
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/929614fd-dbff-4a6f-a43e-07dfd3ab7879n%40googlegroups.com.


Re: decimal

2021-04-06 Thread francois PEGORY
unfortunatly it don't work. because if do this. some operations does not
balance.
example with option "inferred_tolerance_default" "EUR:0.01", it balance
well. with option "inferred_tolerance_default" "EUR:0.0005" , it does not
balance anymore ...

2019-09-30 * "Achat" ""
  Assets:Titre:PEE0.7996 PEEB {125.055 EUR, 2019-09-30}
  Assets:Titre:PEE2.4955 PEEE {40.0720 EUR, 2019-09-30}
  Assets:Titre:PEE:Cash  -200.00 EUR

Le lun. 5 avr. 2021 à 23:42, Martin Blais  a écrit :

> Precision selected for BQL is a bit of a mess.
> Just another reason why it needs a rewrite.
> This is really gnawing at me, but I just don't have the cycles to
> rewrite it
> Try this in the meantime:
>
> option "inferred_tolerance_default" "EUR:0.0005"
>
>
>
> On Mon, Apr 5, 2021 at 4:08 PM francois PEGORY 
> wrote:
>
>> i have a problem with decimal of commodities.
>> my stocks have 5 decimal for units but euro have only two decimals.
>>
>> so basically here i have a buy operation.:
>> 2021-02-09 * "Achat" "100"
>>   Assets:Titre: Assurance-vie   0.081869 SMG-ASIE {232.69
>> EUR, 2021-02-09}
>>   Assets:Titre: Assurance-vie   1.498820 ODDO-PATRIMOINE
>> {25.42 EUR, 2021-02-09}
>>   Assets:Titre: Assurance-vie   0.273118 ODDO-CONV
>> {139.50 EUR, 2021-02-09}
>>   Assets:Titre: Assurance-vie   0.021467 ODDO-AVENIR
>> {4436.98 EUR, 2021-02-09}
>>   Expenses:Frais-bancaires  9.50 EUR
>>   Assets:Titre:Assurance-vie:Cash  -200 EUR
>>
>> and the problem is if i do a BQL :
>> SELECT
>> account, units(sum(position)) AS quantity
>> WHERE
>> account ~ "Generation"
>> GROUP BY account
>> ORDER BY account
>>
>> the quantity is with only two decimals not five :(
>> how i can do it ?
>>
>> regards
>>
>> --
>> 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/CALUWbLf2eBhyOA8G59B8p-gxXof6k_Sn9Nv3RjEe088ia_N27A%40mail.gmail.com
>> 
>> .
>>
> --
> 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%2BhOUXTz8urpS2L5OiOPsadQryDxXFhtE%3DiMrE%3D%2B35XTVhQ%40mail.gmail.com
> 
> .
>

-- 
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/CALUWbLdpACRTkKV8fU-Gu-0EcS_fddNTSeFHWL3f_8qNJx_BNQ%40mail.gmail.com.


Re: decimal

2021-04-06 Thread Martin Blais
Try setting the tolerance for the instruments

  option "inferred_tolerance_default" "SMG-ASIE:0.05"

The rendering code is buried in here somewhere:
https://github.com/beancount/beancount/blob/master/beancount/query/query_render.py

All that code will be thrown away and get rewritten eventually.
Patches are welcome in the meantime.


On Tue, Apr 6, 2021 at 6:07 PM francois PEGORY 
wrote:

> unfortunatly it don't work. because if do this. some operations does not
> balance.
> example with option "inferred_tolerance_default" "EUR:0.01", it balance
> well. with option "inferred_tolerance_default" "EUR:0.0005" , it does not
> balance anymore ...
>
> 2019-09-30 * "Achat" ""
>   Assets:Titre:PEE0.7996 PEEB {125.055 EUR, 2019-09-30}
>   Assets:Titre:PEE2.4955 PEEE {40.0720 EUR, 2019-09-30}
>   Assets:Titre:PEE:Cash  -200.00 EUR
>
> Le lun. 5 avr. 2021 à 23:42, Martin Blais  a écrit :
>
>> Precision selected for BQL is a bit of a mess.
>> Just another reason why it needs a rewrite.
>> This is really gnawing at me, but I just don't have the cycles to
>> rewrite it
>> Try this in the meantime:
>>
>> option "inferred_tolerance_default" "EUR:0.0005"
>>
>>
>>
>> On Mon, Apr 5, 2021 at 4:08 PM francois PEGORY 
>> wrote:
>>
>>> i have a problem with decimal of commodities.
>>> my stocks have 5 decimal for units but euro have only two decimals.
>>>
>>> so basically here i have a buy operation.:
>>> 2021-02-09 * "Achat" "100"
>>>   Assets:Titre: Assurance-vie   0.081869 SMG-ASIE
>>> {232.69 EUR, 2021-02-09}
>>>   Assets:Titre: Assurance-vie   1.498820 ODDO-PATRIMOINE
>>> {25.42 EUR, 2021-02-09}
>>>   Assets:Titre: Assurance-vie   0.273118 ODDO-CONV
>>> {139.50 EUR, 2021-02-09}
>>>   Assets:Titre: Assurance-vie   0.021467 ODDO-AVENIR
>>> {4436.98 EUR, 2021-02-09}
>>>   Expenses:Frais-bancaires  9.50 EUR
>>>   Assets:Titre:Assurance-vie:Cash  -200 EUR
>>>
>>> and the problem is if i do a BQL :
>>> SELECT
>>> account, units(sum(position)) AS quantity
>>> WHERE
>>> account ~ "Generation"
>>> GROUP BY account
>>> ORDER BY account
>>>
>>> the quantity is with only two decimals not five :(
>>> how i can do it ?
>>>
>>> regards
>>>
>>> --
>>> 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/CALUWbLf2eBhyOA8G59B8p-gxXof6k_Sn9Nv3RjEe088ia_N27A%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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%2BhOUXTz8urpS2L5OiOPsadQryDxXFhtE%3DiMrE%3D%2B35XTVhQ%40mail.gmail.com
>> 
>> .
>>
> --
> 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/CALUWbLdpACRTkKV8fU-Gu-0EcS_fddNTSeFHWL3f_8qNJx_BNQ%40mail.gmail.com
> 
> .
>

-- 
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%2BhPG7rgcB0%2BYL9vr44vi8GVrPTWDEapgXu1ocjG_izi1Cw%40mail.gmail.com.


Re: transaction costs:

2021-04-06 Thread Martin Blais
There's no facility to do this.
You can write a script to handle the separation by processing the stream of
transactions yourself.


On Tue, Apr 6, 2021 at 3:16 PM david e  wrote:

> I am wondering about how to book transaction costs correctly. as I am
> doing ethereum tx, I have to track cost basis of the fees. compared to
> paying fees to a broker, this is a bit more work.
>
> my entry would look like this:
>
> 2018-01-01 * "Send 1.5 ETH & 0.05 ETH gas"
> Assets:Crypto:ETH -1.55 ETH {}
> Expenses:Crypto 100 USD
> Expenses:Crypto:Fees 1 USD
> Income:Crypto:PnL
>
> but in this case, the PnL is the total of both ETH entries (Assets and
> Fees). to have the entries separated, it could look like this, split into
> two entries:
>
> 2018-01-01 * "Send 1.5 ETH example"
> Assets:Crypto:ETH -1.5 ETH {}
> Expenses:Crypto 100 USD
> Income:Crypto:PnL
>
> 2018-01-01 * "Send 0.05 ETH for gas example"
> Assets:Crypto:ETH -0.05 ETH {}
> Expenses:Crypto:Fees 1 USD
> Income:Crypto:PnL
>
> my question: is it possible to calculate / report the PnL of the fees
> separately even though I list it in one entry as shown above? or do I have
> to split it for correct calculation?
>
> my assumption is that for tax reporting I have to be able to list PnL for
> each position and therefore it would be a problem to mix it with the fees.
>
> thanks
>
> --
> 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/929614fd-dbff-4a6f-a43e-07dfd3ab7879n%40googlegroups.com
> 
> .
>

-- 
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%2BhMJ7b8qpS9nhOruN0WODJk5B76gpS8u2HbtVVd_cnJFWA%40mail.gmail.com.


Re: Marking stock options with beancount

2021-04-06 Thread Martin Blais
Search on the mailing-list I'm pretty sure this came up before.
I'd have recognized call options using a unique symbol at zero cost and
6.19 is the strike.
Then on exercise reducing them while simultaneously opening a position in
the company at the current value, reducing the cash account by the strike
times the number of units and adding a posting for the profit to be
recognized as income.


On Tue, Apr 6, 2021 at 6:27 AM Tuomas Salmi  wrote:

> Thanks for reply. Looks like my terminology is a bit off since I this is
> first time I have had to think about this in English.
> What I meant was that my employer gave me 10 options which let me to
> purchase stocks with the fixed price which was set when options were given
> to me. In this case I can buy COMPANY for 6.19 euros regardless of the real
> rate of the COMPANY in stock market. So I think you are right about
> "exercise" being the correct term.
>
> > Your transactions seems incomplete to me.
> > You will want to represent the options themselves using a unique
> instrument name with the strike, side (put/call) and expiration
> data embedded in the symbol.
> > You will want to carefully adjust the sales price vs. cost basis and
> recognize the P/L to the right account if this is a company incentive (I
> believe the initial P/L may be treated as income tax, not gains).
>
> Do you have any example of representing options like this? I think in
> Finland the initial P/L is treated as income tax. However, for my personal
> ledger in general I'm not too concerned about taxing details since almost
> all personal taxing process is done by taxing organization in Finland. So I
> don't usually track those details in my personal ledger and I'm happy with
> having the correct balances on each of my accounts. However, I suppose I
> might have to be a bit more careful in this case.
>
> To be honest I think for my purposes it would be enough to just add 10
> COMPANY stocks to my Assets:OtherBank:Company  with correct sales price and
> deduce the 61.90e from my cash bank account.
>
> maanantai 5. huhtikuuta 2021 klo 8.23.48 UTC+3 bl...@furius.ca kirjoitti:
>
>>  Hi Tuomas,
>> I don't understand your terminology.
>> "Marking" is the process of valuing active positions for the purpose of
>> calculation unrealized P/L.
>> I think you mean "exercise."
>>
>> On Sun, Apr 4, 2021 at 6:49 AM Tuomas Salmi  wrote:
>>
>>>
>>> Recently my employer let me to mark some stock options I had and I'm
>>> having trouble to add them properly to the Beancount ledger.
>>>
>>> Lets say I had 10 options letting me to buy 10 stocks of COMPANY. Looks
>>> like the transaction will be made first to my incentive bank account and
>>> then I'll transfer the bought stocks to my actual bank which holds my
>>> stocks.
>>>
>>> I tried the following:
>>>
>>> 2021-03-31 * "Mark options"
>>>   Assets:OP:BankAccount -61.90 EUR
>>>   Assets:IncentiveBankAccount:Company   10 COMPANY {6.19 EUR}
>>>
>>> 2021-04-01 * "Transfer stocks to other bank account"
>>>   Assets:IncentiveBankAccount:Company   -10
>>> COMPANY
>>>   Assets:OtherBank:Company 10 COMPANY
>>>
>>> The beancheck accepts this syntax. However when I check the account
>>> balances in the Fava, I see that the end balance for "IncentiveBankAccount"
>>> is:
>>> 61.90 EUR
>>> -10 COMPANY
>>>
>>> So it seems like the Beancount will use two separate units for the
>>> "IncentiveBankAccount".
>>>
>>
>> You need to use the cost basis on your transfer.
>>
>> Your transactions seems incomplete to me.
>> You will want to represent the options themselves using a unique
>> instrument name with the strike, side (put/call) and expiration
>> data embedded in the symbol.
>> You will want to carefully adjust the sales price vs. cost basis and
>> recognize the P/L to the right account if this is a company incentive (I
>> believe the initial P/L may be treated as income tax, not gains).
>> There is much to say.
>>
>>
>>
>>
>>>
>>> So how should I mark the following transactions to get all this sorted
>>> out:
>>> 1. Pay 61.90 EUR from my cash bank account to buy 10 COMPANY stocks to
>>> IncentiveBankAccount account (balance -> 10 COMPANY)
>>> 2. Move 10 COMPANY from IncentiveBankAccount to OtherBank:Company
>>> (balance 10 -> 0 COMPANY in incentive)
>>>
>>> --
>>> 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+...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/b0b0602c-807b-479c-8d5e-1cf147cada7en%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and st