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.
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 | ||||
|---|---|---|---|---|
| Date | Note | Debit | Credit | Balance |
| $10000 | ||||
| 2000-03-01 | Electric bill | $100 | $9900 | |
| Expenses: Utilities: Electric | ||||
|---|---|---|---|---|
| Date | Note | Debit | Credit | Balance |
| $0 | ||||
| 2000-03-01 | Electric 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.
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 | ||||
|---|---|---|---|---|
| Date | Note | Debit | Credit | Balance |
| $0 | ||||
| 2000-03-02 | Sale of item | $200 | $200 | |
| Assets: Cash | ||||
|---|---|---|---|---|
| Date | Note | Debit | Credit | Balance |
| $0 | ||||
| 2000-03-02 | Sale 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.
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 | |||
|---|---|---|---|
| Date | Note | Debit | Credit |
| 2000-03-03 | Salary | $5000 | |
| Assets: Bank account | |||
|---|---|---|---|
| Date | Note | Debit | Credit |
| 2000-03-03 | Salary | $4000 | |
| Expenses: income tax | |||
|---|---|---|---|
| Date | Note | Debit | Credit |
| 2000-03-03 | Income 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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-03-03 | Assets: 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.
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.
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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-03-03 | Assets: 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.
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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-04-03 | Liabilities: Mortgage | $1000 | |
| Expenses: Interest payments | $500 | ||
| Assets: Bank account | $1500 | ||
| (Paid off loan installment) |
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.
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.
| Date | Account | Debit | Credit |
|---|---|---|---|
| 2000-04-03 | Liabilities: Customer checking accounts: John Doe | $500 | |
| Assets: Cash in ATM | $500 |
Interestingly in your books the opposite happens:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-04-03 | Assets: 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.
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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-05-01 | Expenses: 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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-05-01 | Assets: bank account | $10 | |
| Income: interest income | $10 |
Their expense is your income. Their liability is your asset.
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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-05-02 | Assets: Customer credit line: John Doe | $300 | |
| Assets: Bank's money | $300 |
While on your book it would look like this:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2000-05-02 | Expenses: 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!
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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2001-01-01 | Assets: 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..
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:
| Date | Particulars | Debit | Credit |
|---|---|---|---|
| 2001-12-31 | Income: 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 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:
| Date | Expenses: Interest payments | Assets: Bank account | Liabilities: Mortgage | |
|---|---|---|---|---|
| 2000-04-02 | Balance | $0 | $100000 | $100000 |
| 2000-04-03 | Paying 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.
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.
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:
| Date | Note | Assets: Brokerage account | Equity: Open positions: Stock: 1 |
|---|---|---|---|
| 2000-04-04 | Balance | $10000 | 0 |
| 2000-04-05 | Stock 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):
| Date | Note | Assets: Brokerage account | Expenses: Brokerage fees | Equity: Open positions: Stock: 1 |
|---|---|---|---|---|
| 2000-04-04 | Balance | $10000 | 0 | 0 |
| 2000-04-05 | Stock 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:
| Date | Note | Assets: Brokerage account | Income: Capital gains | Equity: Open positions: Stock: 1 |
|---|---|---|---|---|
| 2000-04-04 | Balance | $10000 | 0 | 0 |
| 2000-04-05 | Stock 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:
| Date | Note | Assets: Brokerage account | Equity: Open positions: Stock: 1 | Equity: Open positions: Stock: 2 |
|---|---|---|---|---|
| 2000-04-05 | Balance | $6000, 13 stocks | -$4000, 13 stocks | 0 |
| 2000-04-06 | Stock 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.
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:
| Date | Note | Assets: Brokerage account | Equity: Open positions: Stock: 1 | Equity: Open positions: Stock: 2 | Income: Capital gains |
|---|---|---|---|---|---|
| 2000-05-01 | Balance | $4650, 18 stocks | -$4000, 13 stocks | -$1350, 5 stocks | 0 |
| 2000-05-02 | Sale 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:
| Date | Note | Assets: Brokerage account | Equity: Open positions: Stock: 1 | Equity: Open positions: Stock: 2 | Income: Capital gains |
|---|---|---|---|---|---|
| 2000-05-03 | Balance | $7000, 11 stocks | -$1846.15, 6 stocks | -$1350, 5 stocks | $196.15 |
| 2000-05-04 | Sale of stock | $2520,-7 stocks | $1846.15, -6 stocks | $270, -1 stock | |
| Commission | -$100 | ||||
| Capital gains | $303.85 | ||||
| Balance | $9420, 4 stocks | 0 | -$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:
| Date | Note | Assets: Brokerage account | Equity: Open positions: Stock: 1 | Equity: Open positions: Stock: 2 | Income: Capital gains |
|---|---|---|---|---|---|
| 2000-05-04 | Balance | $9420, 4 stocks | 0 | -$1080, 4 stocks | $500 |
| 2000-06-01 | Sale of stock | $1600,-4 stocks | $1080, -4 stocks | ||
| Commission | -$100 | ||||
| Capital gains | $420 | ||||
| Balance | $10920 | 0 | 0 | $920 |
So we gained $920 in the whole business which is accurately reflected in the calculated capital gains.
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:
| Date | Note | Assets: Brokerage account | Equity: Open positions: Stock | Income: Capital gains |
|---|---|---|---|---|
| 2000-04-04 | Balance | $10000 | 0 | 0 |
| 2000-04-05 | Stock purchase | -$3900, 13 stocks | -$4000, 13 stocks | |
| Commission | -$100 | |||
| Balance | $6000, 13 stocks | -$4000, 13 stocks | 0 | |
| 2000-04-06 | Stock purchase | -$1250, 5 stocks | -$1350, 5 stocks | |
| Commission | -$100 | |||
| Balance | $4650, 18 stocks | -$5350, 18 stocks | 0 | |
| 2000-05-02 | Sale of stock | $2450,-7 stocks | 2080.56, -7 stocks | |
| Commission | -$100 | |||
| Capital gains | $269.44 | |||
| Balance | $7000, 11 stocks | -$3269.44, 11 stocks | $269.44 | |
| 2000-05-04 | Sale of stock | $2520,-7 stocks | 2080.55, -7 stocks | |
| Commission | -$100 | |||
| Capital gains | $339.45 | |||
| Balance | $9420, 4 stocks | -$1188.89, 4 stocks | $608.89 | |
| 2000-06-01 | Sale of stock | $1600,-4 stocks | $1188.89, -4 stocks | |
| Commission | -$100 | |||
| Capital gains | $311.11 | |||
| Balance | $10920 | 0 | $920 |
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.
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:
| Date | Note | Assets: Brokerage account | Equity: Open positions: Stock: 1 | Equity: Open positions: Stock: 2 | Income: Capital gains |
|---|---|---|---|---|---|
| 2000-05-01 | Balance | $4650, 18 stocks | -$4000, 13 stocks | -$1350, 5 stocks | 0 |
| 2000-05-02 | Sale of stock | $2450,-7 stocks | $2350, -7stocks | ||
| Commission | -$100 | ||||
| Balance | $7000, 11 stocks | -$1650, 6 stocks | -$1350, 5 stocks | $0 | |
| 2000-05-04 | Sale of stock | $2520,-7 stocks | $1650, -6 stocks | $770, -1 stock | |
| Commission | -$100 | ||||
| Balance | $9420, 4 stocks | 0 | -$580, 4 stocks | $0 | |
| 2000-12-31 | Correction | -$500 | |||
| Capital gains | $500 | ||||
| Balance | $9420, 4 stocks | 0 | -$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.
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.
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.
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.
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 - english finance
Chat2026 part 10: continuing application design - english chat2026-devblog
If you want privacy, please use a desktop PC - english privacy
YouTube is now practically unsearchable - english rants
Chat2026 part 9: using CRL in the server and client examples - english chat2026-devblog