How do ledger price files/entries affect multi-currency lot inventories?

150 views
Skip to first unread message

Joel Swanson

unread,
Sep 1, 2017, 4:06:16 PM9/1/17
to Ledger
Hello ledger community,

I'm trying to find the best way to use ledger to track my transactions, and to calculate capital gains/losses. Is it possible to book commodities in one currency, sell them in another on a later date, and providing have ledger correctly calculate the capital gains/losses? For example, in this made-up transaction, last June I sold 0.75 BTC I'd bought with USD in the US for euros. You can see below that the bitcoin was actually from two different purchase lots:

P 2014-11-28 EUR 1.245128 USD
P 2016-06-01 EUR 1.12 USD
P
2016-06-03 EUR 1.14 USD

2016-06-03 * Sell BTC via bitsquare
   
Assets:Checking:FrenchBank         363.75 EUR
   
Assets:Crypto:Bitcoin    -0.53443347 BTC {482.79 USD} [2014-11-28] @ 485.00 EUR
   
Assets:Crypto:Bitcoin    -0.21556653 BTC {531.93 USD} [2016-06-01] @ 485.00 EUR
   
Income:CapitalGains

Where I run ledger bal on that entry, the output ignores the Income account entirely, as follows:

     -0.75000000 BTC
         
363.75 EUR  Assets
         
363.75 EUR    Checking:FrenchBank
     
-0.75000000 BTC    Crypto:Bitcoin
--------------------
     
-0.75000000 BTC
         
363.75 EUR

Its as if it doesn't see the lot price information, and therefore doesn't calculate the capital losses of 53.61 USD.

If I manually convert the euros to dollars as shown below, the bal report correctly calculates my capital gains (losses).
P 2014-11-28 EUR 1.245128 USD
P 2016-06-01 EUR 1.12 USD
P
2016-06-03 EUR 1.14 USD


2016-06-03 * Sell BTC via bitsquare
   
Assets:Checking:FrenchBank           319.08 USD
   
Assets:Crypto:Bitcoin    -0.53443347 BTC {482.79 USD} [2014-11-28] @ 425.44 USD
   
Assets:Crypto:Bitcoin    -0.21556653 BTC {531.93 USD} [2016-06-01] @ 425.44 USD
    Income:CapitalGains

     -0.75000000 BTC
          319.08 USD  Assets
          319.08 USD    Checking:FrenchBank
     -0.75000000 BTC    Crypto:Bitcoin
           53.61 USD  Income:CapitalGains
--------------------
     -0.75000000 BTC
          372.69 USD

So, how does ledger deal with commodity lot currencies? Is there a way I can use my price file of conversion rates to tell ledger to convert the lots with the rate of their lot purchase date, so that capital gains and losses get calculated by ledger? Or are inventory bookings limited to records kept within the same currency (which is my understanding of how beancount deals with reducing lots)?

o1bigtenor

unread,
Sep 1, 2017, 7:38:46 PM9/1/17
to ledge...@googlegroups.com
On Fri, Sep 1, 2017 at 3:06 PM, Joel Swanson <jke...@gmail.com> wrote:
Hello ledger community,

I'm trying to find the best way to use ledger to track my transactions, and to calculate capital gains/losses. Is it possible to book commodities in one currency, sell them in another on a later date, and providing have ledger correctly calculate the capital gains/losses? For example, in this made-up transaction, last June I sold 0.75 BTC I'd bought with USD in the US for euros. You can see below that the bitcoin was actually from two different purchase lots:

Ledger can deal with this in a number of ways. What sort of gets in the road is that according to governments they want your books to be in 1 currency. My guess is that means in your case in $USD. Change from something into $USD and then from something back into $USD. 

I use the comments area to track all of this - - - but that is only one way of doing things. 
I use something like this (I work in a different currency)
   ;  booked as 32.59 USD
   ;  any other notes
Expense: blah blah: 8754.99.87.14                                $   42.96
Asset: credit card 2947: 1045.45.15.18                         $   -42.96

This tells me the currency of the transaction AND also gives the results in my home currency. (This would keep the auditors happy (I hope - - - - grin!!).)

(The 10 digit codes is my way of using GIFI codes  AND having some granularity.)

There are other ways of doing this. The main idea in ledgers is orderliness and accuracy IMO. AIUI auditors look for anything that 'looks' goofy - - - - then they start digging - - -  you want to make a guess at how often they don't find something to get stupid about? (Its their job after all!)

Dee
Reply all
Reply to author
Forward
0 new messages