Open Account with several transactions for correct cost basis

86 views
Skip to first unread message

david e

unread,
Mar 23, 2021, 12:12:14 PM3/23/21
to Beancount
I am trying to open an account and immediately add existing lots that go back in time to my journal file.

for small positions with only one entry I simply did the following:

2021-03-23 * "Open XYZ"
  Assets:Crypto:WalletB:XYZ 3000.00 XYZ {0.03 USD, 2018-11-11}
  Income:Crypto:Airdrop

but what about having several buy and sell transactions?

ideally, I would like to have an entry like this

2000-01-01 * "Open ETH"
  Assets:Crypto:WalletB:ETH 0.5 ETH {1200.00 USD, 2018-01-01}
  Assets:Crypto:WalletB:ETH -0.1 ETH
  Assets:Crypto:WalletB:ETH 0.5 ETH {1300.00 USD, 2018-01-20}
  Equity:Opening-Balances

to automatically subtract from the first lot, but this doesn't work as in bean-report holdings simply all listed positions show up, positive and negative. the subtraction only works when I specify from which lot I want to sell, like this:

2000-03-23 * "Open ETH"
  Assets:Crypto:WalletB:ETH 0.5 ETH {1212.59 USD, 2018-01-01}
  Assets:Crypto:WalletB:ETH -0.1 ETH {1212.59 USD}
  Assets:Crypto:WalletB:ETH 0.5 ETH {1300 USD, 2018-01-20}
  Equity:Opening-Balances

here the problem is that a lot of other entries are following and I can't keep track of the lots so the manual approach doesn't work here. 

is there any way I can open this account and calculate the correct Lots by putting several ins and out into the same entry? otherwise I could also book an average price for all transactions but I would very much prefer to have it as accurate as possible.

thanks

Ben Blount

unread,
Mar 23, 2021, 12:24:40 PM3/23/21
to Beancount
Beancount doesn't currently support transactions that self-reduce. So you need to at least split the buys and sells. Should be no problem with having those be grouped together though.

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/a5186533-f5c1-4ad6-93d8-4404bed0a927n%40googlegroups.com.

david e

unread,
Mar 23, 2021, 12:31:27 PM3/23/21
to Beancount
thanks good idea – so the second entry with negative amounts is also balanced against Equity:Opening-Balances?

Ben Blount

unread,
Mar 23, 2021, 1:12:45 PM3/23/21
to Beancount
If you really want but I'm somewhat unclear what you are trying to do. Normally you'd book sales to PnL + a cash account for the proceeds. If you group the transactions together under a single txn your income statement will all be grouped under that date. Maybe that's fine if you don't care about the history, just the lot details.

If you're trying to avoid a lot of tedious typing, you can probably get a history CSV from Etherscan and then use a CSV importer (or make your own) to import these automatically. 

You could always start like this and import more history as you have the need / desire for.

david e

unread,
Mar 24, 2021, 3:42:14 AM3/24/21
to Beancount
thanks. yes my intention was simply to have the cost basis available to basically start calculating profits from today on instead of trying to re-build history entries and might be failing, leading to frustration. like doing one step after the other.

but you are right, this way I might have the right cost basis but the actual entries aren't booked as it should be. as a non-dev the importer doesn't appear easy to start with, but I found some community contribution and might be able to get things going.

david e

unread,
Mar 25, 2021, 5:33:10 AM3/25/21
to Beancount
so I am running into another issue here as I am trying to add some old history entries manually. 

I have this simple booking for selling some ETH as a fee (accounts opened correctly):

2018-05-08 * "Send ETH"
  Assets:Crypto:0x9:ETH -0.00212724 ETH {} ;; cost basis of 1.54 USD
  Expenses:Crypto:Fees   1.64 USD
  Income:Crypto:PnL

but instead of returning the correct USD amount for PNL, I get this entry when checking running bean-report myfile.bean journal

2018-05-08 *     Send ETH                     -0.00 ETH 
                                              -0.00 ETH
                                               1.54 USD 

assuming that the USD value for ETH is correct (cost basis), what else would I have to do to get an entry with 0.10 USD profit? the shared entry from above is correct, isn't it? and what would be the best way to double check entries like that, running journal or another way?

thanks

david e

unread,
Mar 25, 2021, 8:27:01 AM3/25/21
to Beancount
I just got an error message and really like the way the entry is displayed, it looks like this

Invalid currency USD for account 'Expenses:Crypto:ERC20:Fees'


   2018-05-08 * "Send NAS"

     Assets:Crypto:0x9:NAS             -35 NAS {10.32 USD, 2018-01-21}  

     Assets:Crypto:0x9:ETH     -0.00025037 ETH {1146.00 USD, 2018-01-09}

     Assets:Crypto:0x9:ETH     -0.00187687 ETH {666.26 USD, 2018-04-24} 

     Expenses:Crypto:ERC20:Fees       1.59 USD                          

     Assets:Crypto:Exchange         361.15 USD 


is there a way to see my listings like this (the cost basis is added automatically) instead of the empty journal from the post above?

thanks

Ben Blount

unread,
Mar 25, 2021, 12:40:24 PM3/25/21
to Beancount
You can use bean-doctor print to show your journal with fully resolved lots.

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.

david e

unread,
Mar 25, 2021, 1:14:42 PM3/25/21
to Beancount
thank you, bean-report print worked for me instead of bean-doctor
Reply all
Reply to author
Forward
0 new messages