5

TL;DR: I'm wondering how should I balance out values when dealing with multiple currencies being traded over time along with normal expenses that might occur along the way, as well as transactions exclusive to separate currencies.

I have been timidly tinkering with double entry accounting recently and while I'm comfortable with the nature of balancing all transactions, I'm scratching my head to understand how to correctly process this across different currencies (or even if I should balance them against anything at all).

While I'm using ledger-cli, this is more of a conceptual question rather than one related to how this specific software works.

Suppose I begin with $ 5000 at the 1st, which being the single transaction will be balanced out by default:

2021/10/01
    Assets:Cash             $     5000.00   ; D
    Equity:Opening          $    -5000.00   ; C

1. Trading at the simplest level

Let's work with a fictional staking cryptocurrency as an example, as this will enable me to showcase both the trading aspects and dividends, and to start let's say I'll buy an amount for $ 2 each:

2021/10/02
    Assets:Crypto           XPTO   864.00   ; D
    Assets:Cash             $    -1728.00   ; C

Buying an amount at a price of $ 2, I'll still have a balanced ledger, albeit with different currencies:

           $ 3272.00
         XPTO 864.00  Assets
           $ 3272.00    Cash
         XPTO 864.00    Crypto
          $ -5000.00  Equity:Opening
--------------------
          $ -1728.00
         XPTO 864.00

Now let's say all that happens is that I sell XPTO at a later date at a higher price ($ 2.27). This will make my ledger unbalanced due to the capital gain obtained:

2021/10/07
    Assets:Cash             $     1961.28   ; D
    Assets:Crypto           XPTO  -864.00   ; C

This is how the ledger would be at this point:

           $ 5233.28  Assets:Cash
          $ -5000.00  Equity:Opening
--------------------
            $ 233.28

Should I be looking to balance out the capital gain observing all accounts? Or should I only pay attention to the balance sheet?

As far as I understand, the next move should be accruing the capital gain as an income against my equity:

2021/10/07
    Income:Gains            $      233.28   ; D
    Equity:Profits          $     -233.28   ; C

However, since this is double-entry, looking at all five accounts together (assets, liabilities, equity, income, expenses) will keep the ledger "unbalanced":

           $ 5233.28  Assets:Cash
          $ -5233.28  Equity
          $ -5000.00    Opening
           $ -233.28    Profits
            $ 233.28  Income:Gains
--------------------
            $ 233.28

On the other hand, if I just look at the balance sheet (assets, liabilities, equity), things will level out:

           $ 5233.28  Assets:Cash
          $ -5233.28  Equity
          $ -5000.00    Opening
           $ -233.28    Profits
--------------------
                   0

What I'm not sure right now is which of these two should I be looking for: the balance sheet is only "zeroed" because absolutely nothing happened between buying and selling the cryptocurrency. Now, if anything happens inbetween, this does not hold true anymore:

2021/10/04
    Expenses:Sandwich       $        3.00   ; D
    Assets:Cash             $       -3.00   ; C

While the sandwich was yummy, I'm left in a pickle: the five accounts together will balance out its value, but keep the "inbalance" of the crypto. On the other hand, the balance sheet balances out the trade while keeping the "inbalance" of my sandwich:

; All five accounts together
           $ 5230.28  Assets:Cash
          $ -5233.28  Equity
          $ -5000.00    Opening
           $ -233.28    Profits
              $ 3.00  Expenses:Sandwich
            $ 233.28  Income:Gains
--------------------
            $ 233.28

; Balance sheet only
           $ 5230.28  Assets:Cash
          $ -5233.28  Equity
          $ -5000.00    Opening
           $ -233.28    Profits
--------------------
             $ -3.00

Which one of the two should I be aiming to balance out completely and which transaction would be needed for such?


2. Enter the fee

Now, to me things get even more complicated. Had I been trading stock, brokerage fees would be made in dollars, but since this is a crypto, let's work on the usual approach where fees are covered in crypto accordingly:

2021/10/01
    Assets:Cash             $     5000.00   ; D
    Equity:Opening          $    -5000.00   ; C

2021/10/02
    Assets:Crypto           XPTO   864.00   ; D
    Assets:Cash             $    -1728.00   ; C

2021/10/02
    Expenses:Brokerage      XPTO     0.83   ; D
    Assets:Crypto           XPTO    -0.83   ; C

Now let's say I'll still sell everything on the 7th like I did in the first example. Obviously, the amount won't be the same due to this fee:

2021/10/07
    Assets:Cash             $     1959.40   ; D
    Assets:Crypto           XPTO  -863.17   ; C

Now looking at the five accounts together, I'll have to deal with the capital gain as last time, but since the fees have both been debited and credited in XPTO, it'll always be there unless I do something, but since I've already sold everything of it, I'm not sure [what/if anything] should be done here:

           $ 5231.40  Assets:Cash
          $ -5000.00  Equity:Opening
           XPTO 0.83  Expenses:Brokerage
--------------------
            $ 231.40
           XPTO 0.83

3. Receiving staking rewards

I'm pretty sure this will be the same or very similar to the previous case, but anyways, let's consider that this cryptocurrency rewards staking users. In a discussion with an accountant friend, he was of the opinion that should we be talking about personal ledgers, dividends would be accounted for as equity:

2021/10/01
    Assets:Cash             $     5000.00   ; D
    Equity:Opening          $    -5000.00   ; C

2021/10/02
    Assets:Crypto           XPTO   864.00   ; D
    Assets:Cash             $    -1728.00   ; C

2021/10/02
    Expenses:Brokerage      XPTO     0.83   ; D
    Assets:Crypto           XPTO    -0.83   ; C

2021/10/05
    Assets:Crypto           XPTO    51.79   ; D
    Equity:Dividends        XPTO   -51.79   ; C

2021/10/07
    Assets:Cash             $     2076.96   ; D
    Assets:Crypto           XPTO  -914.96   ; C

Now both by looking at the five accounts together or just the balance sheet, I'll have inbalances in both currencies:

; All five accounts together
           $ 5348.96  Assets:Cash
          $ -5000.00
         XPTO -51.79  Equity
         XPTO -51.79    Dividends
          $ -5000.00    Opening
           XPTO 0.83  Expenses:Brokerage
--------------------
            $ 348.96
         XPTO -50.96

; Balance sheet only
           $ 5348.96  Assets:Cash
          $ -5000.00
         XPTO -51.79  Equity
         XPTO -51.79    Dividends
          $ -5000.00    Opening
--------------------
            $ 348.96
         XPTO -51.79

Which in this case I'm not even sure if I should write the capital gains as it would be done in the first example, since I can't simply take the difference between buy and sell due to these staking rewards.


I'm probably missing a basic accounting operation in all of these cases, but I've struggled with this for months now and I always come back to square one. I hope the examples suffice to reach an answer, but please pinpoint to any unclear passages I've left here.


EDIT: making a case for the rationale based on Jérémie's answer

We were thinking if whenever a transaction involving a trading account would need to update exchange rates accodingly to the date the transaction was made. I'm pretty sure this is irrelevant and the only rates needed are the first and the last.

Let's rework the third example using a trading account:

2021/10/01
    Assets:Cash             $     5000.00   ; D
    Equity:Opening                          ; C

; Buying XPTO at $ 2
2021/10/02
    Assets:Crypto           XPTO   864.00   ; D
    Trading:XPTO            XPTO  -864.00
    Assets:Cash             $    -1728.00   ; C
    Trading:USD             $     1728.00

; I'll treat fees as if the rate never moved
2021/10/02
    Expenses:Fees           $        1.66   ; D
    Trading:USD             $       -1.66   ; C
    Assets:Crypto           XPTO    -0.83   ; D
    Trading:XPTO            XPTO     0.83   ; C

; The same for dividends (staking), even though we're in a different date
2021/10/05
    Assets:Crypto           XPTO    51.79   ; D
    Trading:XPTO            XPTO   -51.79   ; C
    Trading:USD             $      103.58   ; D
    Equity:Dividends        $     -103.58   ; C

Now, the balance at the 4th will look like:

           $ 3272.00
         XPTO 914.96  Assets
           $ 3272.00    Cash
         XPTO 914.96    Crypto
          $ -5103.58  Equity
           $ -103.58    Dividends
          $ -5000.00    Opening
              $ 1.66  Expenses:Fees
           $ 1829.92
        XPTO -914.96  Trading
           $ 1829.92    USD
        XPTO -914.96    XPTO
--------------------
                   0

Again, let's sell XPTO for $ 2.27:

2021/10/07
    Assets:Cash             $     2076.96   ; D
    Trading:USD             $    -2076.96   ; C
    Assets:Crypto           XPTO  -914.96   ; D
    Trading:XPTO            XPTO   914.96   ; C

The balance looks like this now:

           $ 5348.96  Assets:Cash
          $ -5103.58  Equity
           $ -103.58    Dividends
          $ -5000.00    Opening
              $ 1.66  Expenses:Fees
           $ -247.04  Trading:USD
--------------------
                   0

Now, if we take by logic, the profit should be 2076.96 - 1728.00 = 348.96 (all the dollars I got for selling XPTO vs. all the dollars I've spent for buying XPTO), so at first glance, it seems something is wrong.

However, if we take into account that we have already "pocketed" both the fee and the staking reward, the value to balance out is right: 103.58 + 247.04 - 1.66 = 348.96

Sure, this allows for some "creative accounting" depending on the situation and intent of the bookkeeper, but now I'm convinced the best way to handle this is through the use of the trading account.

0

1 Answer 1

6

To do proper double-entry bookkeeping when multiple currencies or securities are involved, you can use what GnuCash calls trading accounts. They are described in detail in a tutorial by Peter Selinger.

The basic idea is that you must balance transactions independently in each currency, so for example your first transaction in §1 wouldn't be valid. Instead, you would use trading accounts to handle the currency conversion:

2021/10/02
    Assets:Crypto           XPTO   864.00   ; D
    Trading:XPTO            XPTO  -864.00   ; C
    Trading:USD             $     1728.00   ; D
    Assets:Cash             $    -1728.00   ; C

Then the ledger balances in each currency:

           $ 3272.00
         XPTO 864.00  Assets
           $ 3272.00    Cash
         XPTO 864.00    Crypto
          $ -5000.00  Equity:Opening
           $ 1728.00
        XPTO -864.00  Trading
           $ 1728.00    USD
        XPTO -864.00    XPTO
--------------------
                   0

The trading accounts are a type of equity account, like income and expense accounts, so you can read the balances above as saying that you spent $1728 and earned 864 XPTO.

When you sell your XPTO at $2.27, you will enter the following transaction:

2021/10/07
    Assets:Cash             $     1961.28   ; D
    Trading:USD             $    -1961.28   ; C
    Trading:XPTO            XPTO   864.00   ; D
    Assets:Crypto           XPTO  -864.00   ; C

Your ledger will still be balanced:

           $ 5233.28  Assets:Cash
          $ -5000.00  Equity:Opening
           $ -233.28  Trading:USD
--------------------
                   0

You can then record your realized capital gains as follows:

2021/10/07
    Trading:USD             $      233.28   ; D
    Income:Gains            $     -233.28   ; C

Then your ledger will look like:

           $ 5233.28  Assets:Cash
          $ -5000.00  Equity:Opening
           $ -233.28  Income:Gains
--------------------
                   0

Note that if you calculate the overall USD value of your trading accounts for a given price of XPTO, you will get your unrealized gains/losses at that point in time. You can even use different (sets of) trading accounts to separate different lots.

If something is unclear feel free to drop a comment, and if you want to dig deeper I encourage you to check out Peter Selinger's excellent tutorial.

5
  • 1
    Thanks for the tutorial, it was really helpful after all! I'm curious on the case with fees and dividends: Peter's tutorial presents a similar situation with buying food on a foreign currency and then trading back, but he always uses the exchange rate of the day to update values on the trading account accordingly. Is that necessary to maintain this kind of account? I'm mainly asking this because it'd be much simpler if levelling out could be done in a single entry at the end (trading back). Oct 31, 2021 at 15:32
  • You could have an expense account denominated in XPTO and record the fee in that currency directly. The downside I can see is that if you have expense accounts denominated in different currencies, the price fluctuations will affect their relative values forever (so your "expenses in USD" will keep changing even if you don't do anything). Also this will be balanced by -0.87 XPTO which will have to stay in the trading account forever. Oct 31, 2021 at 16:22
  • You could also pay the fee back to the trading account (which in a sense represents the broker). In effect that would make it part of the basis, as if you had purchased 863.17 XPTO for $1728.00. I'll try to think it through and update the answer when I have a moment. Oct 31, 2021 at 16:36
  • 1
    I think I've sorted it out and updated my question with a new section to illustrate it. Anyway, thanks a lot for help! Oct 31, 2021 at 21:35
  • 1
    As you note, the trading account mechanism gives you a lot of flexibility. You can record things in different ways which will compute different numbers. It matters for tax purposes whether you consider the fee as part of the basis or not, and whether the staking counts as dividends or capital gains. But I imagine your broker will send you tax forms with the right numbers to report when the time comes. If you don't need to track the tax stuff in your personal accounting, you're of course free to set things up in whatever way makes sense to you and produces the numbers that you want. Nov 1, 2021 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.