1771536720 english finance

Double entry bookkeeping explained

There are many explanations of double entry bookkeeping. I don't know why am I so fascinated by this topic, but thoughts about this kept looping in my brain so I have to dump it. Perhaps because soon I need to do tax return and need to report my capital gains, and looking for a good way to keep track of it. So here is my take.

When money moves it comes from somewhere and goes to somewhere. The point of double entry bookkeeping is to record where does the money come from and where does it go. The amount of money that comes from certain accounts must be equal to the money that goes to certain other accounts.

In the book, the accounts where money comes from is credited (the right column), accounts where the money goes to are debited (the left column). The sum of all credits and debits in the book must be equal.

This analogy works for transactions where there is actual movement of value, but we'll see examples where this analogy kind of breaks down. And the main reason for it breaking down is the capital gains income. At that point we'll introduce a more generic rule.

The debit/credit system was invented way before the negative numbers were accepted in Europe, nowadays positive and negative numbers are used for this purpose, but for historical reasons this system is still in use like it was back then, and negative numbers in balance usually means something extraordinary that needs attention.

Examples

Spending money

Let's assume you spend $100 on the electric bill using a bank transfer. The money comes from your bank account, therefore you credit $100 from there. The money goes to your "electric utility bill" account, therefore you debit $100 to here. (I assume the opening balance on your bank account is $10000). Therefore you book these changes on the account pages:

Assets: Bank account
DateNoteDebitCreditBalance
$10000
2000-03-01Electric bill$100$9900

Expenses: Utilities: Electric
DateNoteDebitCreditBalance
$0
2000-03-01Electric bill$100$100

You bank account is an asset, when money goes there (debited), it increases, when money comes from there (credited) it decreases. Your "electricity bills" accounts is an expense account that tracks your expense, the more money that is debited there, the more your expenses are. So debiting the expense account increases the balance there, crediting it decreases it.

Selling an item

You earn $200 in cash from selling an item. The money comes from the sales, so you credit $200 to the sales account. The money goes into your cash box, so you debit $200 to the cash account.

Income: Sales
DateNoteDebitCreditBalance
$0
2000-03-02Sale of item$200$200

Assets: Cash
DateNoteDebitCreditBalance
$0
2000-03-02Sale of item$200$200

The sales account is an income account, that's where money comes from. The more money it comes from them, the more your income becomes. Therefore an income account's balance increases when you credit them.

Earning a salary

Your gross salary is $5000 per month. From this $4000 goes to your account, $1000 is withheld as tax. So the money comes from your salary. So you credit $5000 to the salary account. $4000 of the money goes to the bank account, so you debit it there. $1000 goes to the state, so you debit it there:

Income: Salary
DateNoteDebitCredit
2000-03-03Salary$5000

Assets: Bank account
DateNoteDebitCredit
2000-03-03Salary$4000

Expenses: income tax
DateNoteDebitCredit
2000-03-03Income tax$1000

As you can see a transaction can have more than 2 legs. As long as the credits and debits are equal, you can have arbitrary many legs in a transaction.

I've omitted the Balance column here, because they are not interesting this time.

And if we are not interested in balances in a transaction, there is a different format for that: the journal entry. Money movements are initially entered into a journal then later entered into the books. The above transaction would look like this in a journal entry:

DateParticularsDebitCredit
2000-03-03Assets: Bank account$4000
Expenses: income tax$1000
Income: Salary$5000
(Salary)

In this table the particulars column contain all the accounts that change. The debited accounts come first. Followed by the credited ones. The names of the credited ones are indented, and at the bottom there is the description of the transaction in parentheses (optional). This is a shorter format, but it doesn't contain the balance.

Crediting expense and debiting income

Expense accounts are where money you spend goes, so expense accounts are almost always debited. Income accounts are where your money come from, so income accounts are almost always credited.

But it's important to point out that your income is the tax base of your income taxes. So it's important to categorize your incomes by tax categories. E.g. some kind of income is not taxable, other kind of income is taxable at different rates. For this reason you want to have separate income accounts for capital gains, salary, dividends, for example.

There may be expenses that can be written off from your income. You may choose to debit these expenses on your income account to reduce the income, or create a special expense accounts where they are tracked, so you can put them into your tax return.

Similarly some of your expenses can be paid by your employer, if that does not increase your income tax base, then those payments can be credited into an expense account, and essentially reduces your expenses.

Always check your local laws to find out what is best for you.

Taking an loan

You need money for a house so you take $100000 in mortgage. The money comes from your loan, so you credit $100000 to the loan account. The money goes to your bank account, so you debit $100000 to the bank account:

DateParticularsDebitCredit
2000-03-03Assets: Bank account$100000
Liabilities: Mortgage$100000
(Took loan)

The mortgage is a liability, it's your debt that needs to be paid back. If you take money from a liability account (credit), you get more indebted, your debt and its account balance increases. If you send money to a liability account (debit), you pay off the debt, your debt and its account balance decreases. Therefore, just like income, the liability account's balance increases when it's credited. So after this transaction the balance of both "Assets: Bank account" and "Liabilities: Mortgage" grow by $100000.

Paying back an installment to the loan

You pay back $1500 of the debt, form which $1000 pays back the principal, and $500 is the interest payment. The money comes from your bank account, so you credit $1500 on it. The principal payment goes to your loan account to pay it off, so you debit $1000 on it. The interest payment is going to be an expense, so you debit $500 to an expense account:

DateParticularsDebitCredit
2000-04-03Liabilities: Mortgage$1000
Expenses: Interest payments$500
Assets: Bank account$1500
(Paid off loan installment)

Debit and credit is reversed when the bank talks about bank accounts

When your bank says your bank account is debited, that means they took money from it. When it's credited, they added money to it.

This happens because for the bank, you bank account is a liability account. It's their debt to you.

Taking money from an ATM using debit card

You can go to an ATM and take the money they owe to you. When you use your debit card and take cash from the account, the sum is debited to your account in their books. Here is an example what happens in their books when you take $500 from an ATM. Essentially bank is taking their cash pay back their debt with it.

DateAccountDebitCredit
2000-04-03Liabilities: Customer checking accounts: John Doe$500
Assets: Cash in ATM$500

Interestingly in your books the opposite happens:

DateParticularsDebitCredit
2000-04-03Assets: Cash$500
Assets: Bank account$500

Your "Assets: Bank account" in your book is the "Liabilities: Customer checking accounts: John Doe" in their books. Your "Assets: Cash" in your book is "Assets: Cash in ATM" in their book.

What is a liability to them, is an asset to you. What is credited for you is debited for them, and vice versa.

Earning interest on your checking account

As another example here what booked when your account earns $10 interest. So the money comes from your liability account at the bank (so they owe more to you!). And is sent straight into an expense account:

DateParticularsDebitCredit
2000-05-01Expenses: checking account interest$10
Liabilities: customer checking accounts: John Doe$10

On your side you see $10 coming from the interest income and lands on your bank account:

DateParticularsDebitCredit
2000-05-01Assets: bank account$10
Income: interest income$10

Their expense is your income. Their liability is your asset.

Using a credit card

Let's say you pay $300 expense using your credit card. It's called credit, because it uses your bank's money and credit their bank account and your credit card liability account. At the bank's side this transaction is basically invests the bank's money into debt, it simply moves from one kind of asset to the other:

DateParticularsDebitCredit
2000-05-02Assets: Customer credit line: John Doe$300
Assets: Bank's money$300

While on your book it would look like this:

DateParticularsDebitCredit
2000-05-02Expenses: Purchases$300
Liabilities: Credit card$300

Your liability is the bank's asset. If you don't pay, they can sell it to a debt collector, who will use force to get the money back from you!

Opening and closing the book

Opening the book

Sometimes the transactions in the book represent only technical movements. An example of this is when you start the bookkeeping, you want to enter all your existing assets into the book. The transactions still need to balance. So for this reason we introduce the 5th kind of account which is simply labelled as Equity.

At the beginning the book is empty and all the balances are 0. In the previous examples we assumed that some accounts have a preexisting balance, in these accounts, the balances first need to be established by recording the appropriate transactions. Let's assume you have $1000 on the bank account $500 in cash. And you have $90000 debt in mortgage and $300 in credit card debt. These need to be added to the book, but you still need to do it such that the credits and debits balance:

DateParticularsDebitCredit
2001-01-01Assets: Bank account$1000
Assets: Cash$500
Equity: Opening balance$88800
Liabilities: Mortgage$90000
Liabilities: Credit card$300

The equity accounts are also accounts that grow when credited (similar to liability and income accounts). It's value essentially represents your net worth, it's the difference between assets and liabilities, in this example it's negative (-$88800) due to the high weight of debt.

When equity accounts are involved, then the money moves from accounts and to accounts completely breaks down..

Closing the book

Once the accounting period is over the book needs to be closed so no more entries are added to it. In this final step cancel out all the incomes and expenses and transfer their balances into the equity accounts, only the assets and a liabilities are left:

DateParticularsDebitCredit
2001-12-31Income: Salary$60000
Income: Capital Gains$3000
Income: Dividends$3000
Income: Sales$200
Income: Fringe benefits$1000
Equity: Expenses 2025$4200
Equity: Taxable income 2025$66200
Equity: Nontaxable income 2025$1000
Expenses: Utilities: Electric $1200
Expenses: Groceries $3000

After this transaction the balance of your income and expense accounts should be reset to zero for the new accounting period. You don't strictly need to do this, because accounting programs can generate the appropriate reports e.g. annual expenses.

Then you open the new book for the next year, and then you take the closing balances of all asset and liability accounts and balance it with Equity:Opening balance.

The accounting equation

The simple accounting equation looks like this:

Assets = Equity + Liabilities

These are the kind of accounts that remain once the book is closed. But the equity itself can be split apart to include expenses, income and other things. So it looks like this:

Assets + Expense = Liabilities + Income + Other equity

On the left side there are the things that increase when debited. On the right side there are the things that increase when credited. So basically your Assets can increase only because you've got income, took a loan, have an expense rebated, or opened the book, there shouldn't be any other reason.

In the sections below there will be more complicated transactions that involve a lot of movement and balances need to be included as well. But journal entries do not contain balances, while the book's pages do not contain all details of the transactions in one place. So from now I'll use a new format. In those tables the the left and right side of the accounting equation is separated by a thick table border. Changes on the left side are the accounts that increase with debit (negative means credit there). Changes on the right side are the accounts that increase with credit (negative means debit there). The sum of the changes within a transaction on both sides of the border must be equal to satisfy the accounting equation. The transactions are between thick horizontal lines. After each transaction the balances of each accounts are mentioned to see the effect of the change, here is an example of the paying the loan in that format:

DateExpenses: Interest paymentsAssets: Bank accountLiabilities: Mortgage
2000-04-02Balance$0$100000$100000
2000-04-03Paying off loan installment$500-$1500-$1000
Balance$500$98500$99000

While this isn't a standard format it helps to see the balances and changes of those accounts. The left and right sides of the thick border represent the two sides of the accounting equation, and must have the same amount of changes.

On mobile devices these tables can be very wide and might not fit the screen, so you need to scroll them so see all or reduce the zoom level of your device.

Keeping track of the value of financial assets

Here is where things get interesting. Previously money always just moved from one place to the other. When you buy a financial asset, such as a stock or foreign currency, you not only spend money but receive a valuable in return. You need to keep track of those as well, because you need to calculate capital gains when you sell it.

Buying stocks

So as a first example let's assume you have $10000 in an investment account and buy 13 units of stock, the total price of stocks is $3900, with a $100 as commission. So the transaction will look like this:

DateNoteAssets: Brokerage accountEquity: Open positions: Stock: 1
2000-04-04Balance$100000
2000-04-05Stock purchase-$3900, 13 stocks -$4000, 13 stocks
Commission-$100
Balance $6000, 13 stocks-$4000, 13 stocks

The accounting equation must balance in both dollars and stocks, therefore an equity account is introduced to record this. The equity account basically contains the information about your open position. In some countries the cost of purchase (such as commissions) are included in the cost basis as in the above table. In other countries it's an expense that isn't included (so they can tax the hell out of you):

DateNoteAssets: Brokerage accountExpenses: Brokerage feesEquity: Open positions: Stock: 1
2000-04-04Balance$1000000
2000-04-05Stock purchase-$3900, 13 stocks-$3900, 13 stocks
Commission-$100$100
Balance$6000, 13 stocks$100-$3900, 13 stocks

Or it can be written off as a loss right away:

DateNoteAssets: Brokerage accountIncome: Capital gainsEquity: Open positions: Stock: 1
2000-04-04Balance$1000000
2000-04-05Stock purchase-$3900, 13 stocks-$3900, 13 stocks
Commission-$100-$100
Balance$6000, 13 stocks-$100-$3900, 13 stocks

In the examples from now, I assume that the commissions and other costs are parts of the cost basis.

The account is named "Equity: Open positions: Stock: 1" because you need to keep track of the price of every single purchase. This can only be possible, if you record each purchase separately into different accounts, so let's assume you make another purchase of 5 stocks at $250/stock each with $100 commission:

DateNoteAssets: Brokerage accountEquity: Open positions: Stock: 1Equity: Open positions: Stock: 2
2000-04-05Balance $6000, 13 stocks-$4000, 13 stocks0
2000-04-06Stock purchase-$1250, 5 stocks -$1350, 5 stocks
Commission-$100
Balance $4650, 18 stocks-$4000, 13 stocks-$1350, 5 stocks

Therefore this change is added into a different equity account to keep track of cost basis.

Selling stocks

Using the first-in-first-out method

When you sell a stock you need to know which stock do you sell. The one you bought for $300 or the one you bought for $250? The tax rules specify which one you need to sell first. A common rule is FIFO: that is you always sell the stock you bought first. In this case we have to sell from the "Equity: Open positions: Stock: 1" first, and calculate capital gains.

So let's sell 7 stocks at $350 each, again we pay $100 commission. First using the the FIFO method:

DateNoteAssets: Brokerage accountEquity: Open positions: Stock: 1Equity: Open positions: Stock: 2Income: Capital gains
2000-05-01Balance $4650, 18 stocks-$4000, 13 stocks-$1350, 5 stocks0
2000-05-02Sale of stock$2450,-7 stocks$2153.85, -7stocks
Commission-$100
Capital gains$196.15
Balance $7000, 11 stocks-$1846.15, 6 stocks-$1350, 5 stocks$196.15

The most important cell of the above table is where we remove the stocks from "Equity: Open positions: Stock: 1". We always need to remove stocks and value proportionally. The whole value is $4000 and there are 13 stocks in that account, we sell 7/13 of the value from that. In order to minimize the rounding errors we must ensure and reorder the expression to ensure that we divide last. So first calculate 4000*7 = 28000. Then 28000 / 13 = 2153.846153846... And round that to 2153.85. We do this instead of calculating 4000 / 13 (the unit price), then rounding that and multiplying with 7, because in that case we would get 2153.83 which is already 2 cents off. I've intentionally chosen an example where the calculation is not nice and round, because you will run into this situation a lot.

And of course to balance this, we need to add some capital gains.

So let's sell 7 stocks again at $360 each and $100 commission:

DateNoteAssets: Brokerage accountEquity: Open positions: Stock: 1Equity: Open positions: Stock: 2Income: Capital gains
2000-05-03Balance $7000, 11 stocks-$1846.15, 6 stocks-$1350, 5 stocks$196.15
2000-05-04Sale of stock$2520,-7 stocks$1846.15, -6 stocks$270, -1 stock
Commission-$100
Capital gains$303.85
Balance $9420, 4 stocks0-$1080, 4 stocks$500

Following the FIFO rules, the "Equity: Open positions: Stock: 1" position needs to be sold first. In this case all the remaining stocks are sold form there and the account can be closed with 0 balance. Then we sell 1 additional stock from "Equity: Open positions: Stock: 2", again taking the cost basis proportionally from the account. This time it's nice and round.

And finally let's sell the remaining 4 stocks too, at $400 each:

DateNoteAssets: Brokerage accountEquity: Open positions: Stock: 1Equity: Open positions: Stock: 2Income: Capital gains
2000-05-04Balance $9420, 4 stocks0-$1080, 4 stocks$500
2000-06-01Sale of stock$1600,-4 stocks$1080, -4 stocks
Commission-$100
Capital gains$420
Balance $1092000$920

So we gained $920 in the whole business which is accurately reflected in the calculated capital gains.

Using the average value method

In some countries the cost basis is the average cost of the stocks. In that case we don't need to create separate accounts for each purchase to track the purchase cost. We can lump together the value into a single account. But we still need to take the cost basis proportionally. Here is the complete transaction history of the stock purchase and sale when using average cost basis:

DateNoteAssets: Brokerage accountEquity: Open positions: StockIncome: Capital gains
2000-04-04Balance$1000000
2000-04-05Stock purchase-$3900, 13 stocks -$4000, 13 stocks
Commission-$100
Balance $6000, 13 stocks-$4000, 13 stocks0
2000-04-06Stock purchase-$1250, 5 stocks-$1350, 5 stocks
Commission-$100
Balance $4650, 18 stocks-$5350, 18 stocks0
2000-05-02Sale of stock$2450,-7 stocks2080.56, -7 stocks
Commission-$100
Capital gains$269.44
Balance $7000, 11 stocks-$3269.44, 11 stocks$269.44
2000-05-04Sale of stock$2520,-7 stocks2080.55, -7 stocks
Commission-$100
Capital gains$339.45
Balance$9420, 4 stocks-$1188.89, 4 stocks$608.89
2000-06-01Sale of stock$1600,-4 stocks$1188.89, -4 stocks
Commission-$100
Capital gains$311.11
Balance$109200$920
In both FIFO and average cost the changes of value on your brokerage account is the same. And the end result after selling all the stock is the same: you have $920 capital gains. The only difference is the amount of capital gains calculated during the progress. This is important if the tax year ends before selling all the stocks. If you sell everything within a tax year, the for taxation purposes you can add up the money you get for each sale: $2450+$2520+$1600 = $6570. then subtract the cost which was $5350 and you again, get that $920 capital gains you need.

Other methods

Other countries allow other methods. A few countries allow LIFO (last-in-first-out) method, and some also allows picking which stock to sell. Working the capital gains out in those cases is left as an exercise to the reader.

Deferring capital gains calculation

The above calculations can be super awkward, if you buy and sell a lot of stocks, and do this manually. This calculation is best left for an accounting program. But if you do you accounting manually, maybe on paper, is there a better way? While I was writing this post, I've realized that it's possible to do this easier. If you use FIFO, you can simply balance the transaction directly to the first stock purchase, without calculating capital gains. When you fully sell it, you zero it out, and balance the transaction with the second stock and so on. It's the end of the year when you fix the stock account to the correct value an calculate the capital gains. Here is it for the FIFO method for the first 4 transactions:

DateNoteAssets: Brokerage accountEquity: Open positions: Stock: 1Equity: Open positions: Stock: 2Income: Capital gains
2000-05-01Balance $4650, 18 stocks-$4000, 13 stocks-$1350, 5 stocks0
2000-05-02Sale of stock$2450,-7 stocks$2350, -7stocks
Commission-$100
Balance $7000, 11 stocks-$1650, 6 stocks-$1350, 5 stocks$0
2000-05-04Sale of stock$2520,-7 stocks$1650, -6 stocks$770, -1 stock
Commission-$100
Balance $9420, 4 stocks0-$580, 4 stocks$0
2000-12-31Correction-$500
Capital gains$500
Balance $9420, 4 stocks0-$1080, 4 stocks$500

You can see at the end that we have 4 stocks left from the 5 we originally purchased. So we calculate 1350*4/5 = 1080 and reset that account that that correct value. We again end up having the correct amount of capital gains.

Here is the same method when using the average costs valuation:

Date Note Assets: Brokerage account Equity: Open positions: Stock Income: Capital gains
2000-04-06 Balance $4650, 18 stocks -$5350, 18 stocks 0
2000-05-02 Sale of stock $2450,-7 stocks $2350, -7 stocks
Commission -$100
Balance $7000, 11 stocks -$3000, 11 stocks 0
2000-05-04 Sale of stock $2520,-7 stocks $2420, -7 stocks
Commission -$100
Balance $9420, 4 stocks -$580, 4 stocks 0
2000-12-31 Correction -$608.89
Capital gains $608.89
Balance $9420, 4 stocks -$1188.89, 4 stocks $608.89

We started with 18 stocks at $5350 value, 4 remained so the remaining value is: 5350*4/18 = 1188.89 after rounding, so we need to do this adjustment at the end to get the same amount of capital gains as before.

Investment in foreign currency

Here in Hungary people frequently invest in foreign currency. That is you first spend your Hungarian forints to buy euros, then invest the euros into stocks, then later sell the stocks and finally sell the euros to get forints back. There aren't many good writings how to calculate capital gains in these cases. Here is my attempt. The notation for Hungarian forints is adding an "Ft" after the quantity. That's what I will use.

Calculation using immediate capital gains

First let's do the calculation in a way where we immediately calculate all gains. Start with 1000000Ft on the brokerage account. And buy €550 for 300Ft/€.

Date Note Assets: Brokerage account Equity: Open positions: €: 1
1 Balance 1 000 000Ft 0
2 Purchase of euro -165000Ft, €550 -165000Ft, €550
Balance 835 000Ft, €550 -165000Ft, €550

In a later date, buy another batch of €450 euros for 310Ft/€, this goes into another tax lot (separate account) as usual with stocks:

Date Note Assets: Brokerage account Equity: Open positions: €: 1 Equity: Open positions: €: 2
2 Balance 835 000Ft, €550 -165000Ft, €550
3 Buy more euros -139500Ft, €450 -139500Ft, €450
Balance 695500Ft, €1000 -165000Ft, €550 -139500Ft, €450

Now buy 3 stocks, 100€ each, commission is €50. The €/Ft exchange rate is 320 that day.

Date Note Assets: Brokerage account Income: Capital gains Equity: Open positions: €: 1 Equity: Open positions: €: 2 Equity: Open positions: Stock: 1
3 Balance 695500Ft, €1000 0 -165000Ft, €550 -139500Ft, €450 0
4 Purchase of stock (€/Ft=320) -€300, 3stocks
Commission -50€ 105000Ft, -€350 -112000Ft, 3 stocks
Capital gains 7000Ft
Balance 695500Ft, €650, 3 stocks 7000Ft -60000Ft, €200 -139500Ft, €450 -112000Ft, 3 stocks

Now here is the first interesting thing. In this transaction we have spent foreign currency to buy stocks. However we need to keep track of the stocks in the native currency for tax purposes. So we have to convert these euros to forints at the exchange rate of that day and use that for the value, so €350 * 320Ft/€ = 112000Ft. And for the payment we use FIFO and dispose the oldest euros. Those euros were bought for 300Ft each, which we essentially now sold it for 320Ft, and gained 7000Ft capital gain on it to balance the transaction.

Okay let's buy another batch of stocks 5 stocks, €110 each, with €50 commission, on a day when the €/Ft is 330:

Date Note Assets: Brokerage account Income: Capital gains Equity: Open positions: €: 1 Equity: Open positions: €: 2 Equity: Open positions: Stock: 1 Equity: Open positions: Stock: 2
4 Balance 695500Ft, €650, 3 stocks 7000Ft -60000Ft, €200 -139500Ft, €450 -112000Ft, 3 stocks 0
5 Stock purchase (€/Ft = 330) -€550, 5 stocks
Commission -€50 60000Ft, -€200 124000Ft, -€400 -198000Ft, 5 stocks
Capital gains 14000Ft
Balance 695500Ft, €50, 8 stocks 21000Ft 0 -15500Ft, €50 -112000Ft, 3 stocks -198000Ft, 5 stocks

Just like before we disposed the euros proportionally, and because they were cheap euros, we have capital gains on them.

In the next step sell all the stocks. Let's assume the stock price is €120, but the forint got stronger and is €/Ft = 300 again. And we pay €50 as commission again.

Date Note Assets: Brokerage account Income: Capital gains Equity: Open positions: €: 2 Equity: Open positions: €: 3 Equity: Open positions: Stock: 1 Equity: Open positions: Stock: 2
5 Balance 695500Ft, €50, 8 stocks 21000Ft -15500Ft, €50 0 -112000Ft, 3 stocks -198000Ft, 5 stocks
6 Selling the stocks (€/Ft = 300) €960, -8 stocks
Commission -€50 -273000Ft, €910 112000Ft, -3 stocks 198000Ft, -5 stocks
Capital gains -37000Ft
Balance 695500Ft, €960 -16000Ft -15500Ft, €50 -273000Ft, €910 0 0

With this transaction we ended up losing both national currency and euros. But we've got euros for cheap.

As a final step, we wait for national currency to become weak, let's say €/Ft = 400 and then we sell all the euros:

Date Note Assets: Brokerage account Income: Capital gains Equity: Open positions: €: 2 Equity: Open positions: €: 3
6 Balance 695500Ft, €960 -16000Ft -15500Ft, €50 -273000Ft, €910
7 Sell euro 384000Ft, -€960 15500Ft, -€50 273000Ft, -€910
Capital gains 95500Ft
Balance 1 079 500Ft 79500Ft 0 0

And we end up gaining some national money in the end.

Calculation with deferred capital gains

We can do the same capital gains calculation deferral trick we did before. In this example I'll do the whole thing in one table. The capital gains is deferred until the 5th transaction first, then at the 7th.

Date Note Assets: Brokerage account Income: Capital gains Equity: Open positions: €: 1 Equity: Open positions: €: 2 Equity: Open positions: €: 3 Equity: Open positions: Stock: 1 Equity: Open positions: Stock: 2
1 Opening balance 1 000 000 Ft 0 0 0 0 0 0
2 Purchase of euro -165000Ft, €550 -165000Ft, €550
Balance 835 000Ft, €550 0 -165000Ft, €550 0 0 0 0
3 Buy more euros -139500Ft, €450 -139500Ft, €450
Balance 695500Ft, €1000 0 -165000Ft, €550 -139500Ft, €450 0 0 0
4 Purchase of stock (€/Ft=320) -€300, 3stocks
Commission -50€ 112000Ft, -€350 -112000Ft, 3 stocks
Balance 695500Ft, €650, 3 stocks 0 -53000Ft, €200 -139500Ft, €450 0 -112000Ft, 3 stocks 0
5 Stock purchase (€/Ft = 330) -€550, 5 stocks
Commission -€50 53000Ft, -€200 145000Ft, -€400 -198000Ft, 5 stocks
Balance 695500Ft, €50, 8 stocks 0 0 5500Ft, €50 0 -112000Ft, 3 stocks -198000Ft, 5 stocks
5 Adjustment -21000Ft
Capital gains 21000Ft
Balance 695500Ft, €50, 8 stocks 21000Ft 0 -15500Ft, €50 0 -112000Ft, 3 stocks -198000Ft, 5 stocks
6 Selling the stocks (€/Ft = 300) €960, -8 stocks
Commission -€50 -273000Ft, €910 112000Ft, -3 stocks 161000Ft, -5 stocks
Balance 695500Ft, €960 21000Ft 0 -15500Ft, €50 -273000Ft, €910 0 -37000Ft
7 Sell euro 384000Ft, -€960 15500Ft, -€50 368500Ft, -€910
Balance 1 079 500Ft 21000Ft 0 0 95500Ft 0 -37000Ft
7 Adjustment 58500 Ft -95500Ft 37000Ft
Balance 1 079 500Ft 79500Ft 0 0 0 0 0

So that's how you can do trading in foreign currency. The key takeaways is: whenever an asset enter in your possession you need to give a value to it in your native currency, and create an account where you track it. Whenever an asset leaves your possession it brings away value with it. You can be accurate and proportionally reduce the stored value each time you sell and calculate capital gains for each transaction. Alternatively you can simply reduce it's value by the amount you received for it, then you later calculate the capital gains when you want to make your taxes, but restoring the stored value to be in proportion with the original purchase.

Feedback

Posts

See the latest posts below, click the "..." to see them all. Click the tags to filter by tag. You can also subscribe to RSS in those lists.

Double entry bookkeeping explained - 1771536720 english finance

Chat2026 part 10: continuing application design - 1770850620 english chat2026-devblog

If you want privacy, please use a desktop PC - 1770575340 english privacy

YouTube is now practically unsearchable - 1770565140 english rants

Chat2026 part 9: using CRL in the server and client examples - 1770031740 english chat2026-devblog

...