Last active
March 3, 2021 00:31
-
-
Save simonmichael/6aff5d4867e59d67199eb979e4da26b9 to your computer and use it in GitHub Desktop.
hledger entries for adjusting cost basis of investments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comment | |
Journal entries describing a stock or cryptocurrency purchase and | |
sale, with cost basis adjustments to account for fees. In this | |
example, even though selling at a higher price, the high fees | |
turn the gain into a loss. | |
This is just one way to record these; I have tried to split | |
out the parts for clarity. Opening and closing transactions | |
and some reports have been added to show the results and | |
verify that the accounts are balanced. | |
Issues: | |
Factoring fees into the cost basis reduces the capital gains reported, | |
to the proper number for tax reporting; but it disturbs personal reports, | |
as can be seen in the last income statement, where you'd probably prefer | |
to see capital gain revenue of $80, and a net loss of $20. | |
end comment | |
2021-01-01 open assets/liabilities | |
assets:broker:usd $2000 | |
equity:opening balances | |
2021-02-01 buy 0.02 btc at 50000 | |
; cc-btc-acquire: | |
; trade | |
assets:broker:usd $-1000 | |
assets:cc:btc:20210215 BTC 0.02 @@ $1000 = BTC 0.02 @ $1000 | |
; pay fee | |
assets:broker:usd $-50 | |
expenses:fees:brokerage $50 | |
; adjust cost basis to include fee | |
assets:cc:btc:20210215 -BTC 0.02 @@ $1000 | |
assets:cc:btc:20210215 BTC 0.02 @@ $1050 = BTC 0.02 @ $1050 | |
equity:basis adjustment $-50 | |
2021-03-15 sell all of btc 2/1 lot at 54000 | |
; cc-btc-dispose: | |
; pay fee | |
assets:broker:usd $-50 | |
expenses:fees:brokerage $50 | |
; adjust cost basis to include fee | |
equity:basis adjustment $-50 | |
assets:cc:btc:20210215 BTC -0.02 @@ $1050 | |
assets:cc:btc:20210215 BTC 0.02 @@ $1100 = BTC 0.02 @@ $1100 | |
; trade | |
assets:cc:btc:20210215 BTC -0.02 @@ $1100 = BTC 0 | |
assets:broker:usd $1080 ; 0.02 * 54000 | |
revenues:cc:gain/loss $20 ; 20 loss (would show as 80 gain without the basis adjustments) | |
2021-03-31 close revenues/expenses | |
; clopen: | |
revenues:cc:gain/loss = $0 | |
expenses:fees:brokerage = $0 | |
equity:retained earnings | |
comment | |
$ hledger bal -E | |
$1980 assets:broker:usd | |
0 assets:cc:btc:20210215 | |
$-100 equity:basis adjustment | |
$-2000 equity:opening balances | |
$120 equity:retained earnings | |
0 expenses:fees:brokerage | |
0 revenues:cc:gain/loss | |
-------------------- | |
0 | |
$ hledger bse -E | |
Balance Sheet With Equity 2021-03-31 | |
|| 2021-03-31 | |
==========================++============ | |
Assets || | |
--------------------------++------------ | |
assets:broker:usd || $1980 | |
assets:cc:btc:20210215 || 0 | |
--------------------------++------------ | |
|| $1980 | |
==========================++============ | |
Liabilities || | |
--------------------------++------------ | |
--------------------------++------------ | |
|| | |
==========================++============ | |
Equity || | |
--------------------------++------------ | |
equity:basis adjustment || $100 | |
equity:opening balances || $2000 | |
equity:retained earnings || $-120 | |
--------------------------++------------ | |
|| $1980 | |
==========================++============ | |
Net: || 0 | |
$ hledger is -E | |
Income Statement 2021Q1 | |
|| 2021Q1 | |
=========================++======== | |
Revenues || | |
-------------------------++-------- | |
revenues:cc:gain/loss || 0 | |
-------------------------++-------- | |
|| 0 | |
=========================++======== | |
Expenses || | |
-------------------------++-------- | |
expenses:fees:brokerage || 0 | |
-------------------------++-------- | |
|| 0 | |
=========================++======== | |
Net: || 0 | |
$ hledger is -E not:tag:clopen | |
Income Statement 2021Q1 | |
|| 2021Q1 | |
=========================++======== | |
Revenues || | |
-------------------------++-------- | |
revenues:cc:gain/loss || $-20 | |
-------------------------++-------- | |
|| $-20 | |
=========================++======== | |
Expenses || | |
-------------------------++-------- | |
expenses:fees:brokerage || $100 | |
-------------------------++-------- | |
|| $100 | |
=========================++======== | |
Net: || $-120 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment