Hi,
I am a very happy user of Beancount for the past six or so months. I
currently use it for tracking vacation hours, shares, and crypto. Since tax
reporting is almost due, I need to properly calculate PnL for my shares and
crypto. This becomes extremely difficult when purchasing many lots, when
transferring lots from one broker to another and when exchanging between
multiple currencies.
Some further elaboration:
1. I recently had to transfer some shares from one broker account to
another in order to perform a sale. Since I have purchased shares at
BrokerOne many times through my employer's share savings plan, I'd prefer
to not manually enter each lot to be transferred (in my example I had
almost 60 lots to be transferred which would create 120 painstakingly
manually entered lines of transaction). Instead I'd like to do something
like the following and have the transfer use FIFO to identify the lots
transferred from BrokerOne to BrokerTwo and maintaing the cost basis *and*
date stamp:
2000-01-01 * "Transfer shares from BrokerOne to BrokerTwo to sell at
BrokerTwo"
Assets:BrokerOne -10 HOOL {}
Assets:BrokerTwo 10 HOOL
2000-01-02 * "Sell shares from BrokerTwo"
Assets:BrokerTwo -10 HOOL {} @ 12.00 USD
Assets:Bank 120.00 USD
Income:PnL
The reason the date stamp would need to be maintained is so that if I had
some shares at BrokerTwo already that were purchased after I purchased the
shares at BrokerOne, the older shares transferred from BrokerOne would be
the ones that were sold.
2. During crypto trading this becomes even more difficult to handle
manually since each coin can be exchanged back and forth with a number of
base coins such as BTC, ETH and LTC. Here we have to assign a cost basis
and price in the local FIAT currency to each and every transaction in order
to correctly calculate PnL. This is ok and can probably be automated from
input scripts (I'm currently looking into that). However, there are two
more issues for crypto trading:
a) It is very common to transfer coins between crypto exchanges (as for my
share example above), but due to the nature of crypto trading where trades
happen much more frequently for different base coins, it becomes impossible
to stay on top of which lot to transfer. One way of solving this is by
using FIAT cost basis and price to calculate a PnL for the transfer itself
and establish a new cost basis for the lot after the transfer. But this is
both odd and formally wrong.
b) If on day one I buy ETH for BTC at Binance, on day two I buy ETH for BTC
at Poloniex, and on day three I sell ETH at Poloniex, the cost basis to be
used for PnL calculations should really be the cost basis for the first ETH
lot I bought, i.e. the one at Binance, and /not/ the cost basis for the lot
at Poloniex.
These two issues can be solved by lumping the accounts together as one.
I.e. instead of having both Assets:Crypto:Binance and
Assets:Crypto:Poloniex, I have just Assets:Crypto. Any transfer can be
ignored (except for transfer fees), and FIFO is properly maintained. The
problem with this is that I lose track of how much I have at each exchange.
My current approach to solving these problems is to have two separate
Beancount files. One contains each exchange account and includes transfers
between them in order to give me an overview of where my coins are located.
I can choose whether to use FIAT cost basis or not, depending on how I want
to represent the values. The other file lumps all the brokers together into
one so that I can calculate PnL correctly. This two-file solution is less
than ideal, and I am looking for alternatives. Does anyone have any
suggestions?
If I may pose a suggestion myself for a modification (perhaps a plugin?)
that may solve all these problems: What if it were possible to link/group
exchange accounts in such a way that their holdings/values are reported per
account, but their lots are considered lumped together? When transferring
from one account to another in the same group, the lots don't change at all
(except for the transfer fee), but when selling lots (i.e. any transaction
that transfer from the group to outside the group), the default or
account-specific booking method is used. This would probably require a new
keyword to link accounts together, something like:
2017-01-01 open Assets:Crypto:Binance:BTC BTC
2017-01-01 open Assets:Crypto:Binance:ETH ETH
2017-01-01 open Assets:Crypto:Poloniex:BTC BTC
2017-01-01 open Assets:Crypto:Poloniex:ETH ETH
; List all accounts to be linked on one line:
2017-01-01 link Assets:Crypto:Binance:BTC Assets:Crypto:Poloniex:BTC
2017-01-01 link Assets:Crypto:Binance:ETH Assets:Crypto:Poloniex:ETH
Alternatively link on higher account levels:
2017-01-01 open Assets:Crypto:BTC:Binance BTC
2017-01-01 open Assets:Crypto:ETH:Binance ETH
2017-01-01 open Assets:Crypto:BTC:Poloniex BTC
2017-01-01 open Assets:Crypto:ETH:Poloniex ETH
2017-01-01 link Assets:Crypto:BTC ; implies "link
Assets:Crypto:BTC:Binance Assets:Crypto:BTC:Poloniex
Assets:Crypto:BTC:whatever"
2017-01-01 link Assets:Crypto:ETH
It may actually be better to just link a commodity across Assets (and
Assets only):
2017-01-01 commodity BTC
linked: "true"
; or simply 2017-01-01 commodity BTC "linked"
2017-01-01 open Assets:Crypto:Binance BTC,ETH
2017-01-01 open Assets:Crypto:Poloniex:BTC BTC
2017-01-01 open Assets:Crypto:Poloniex:ETH ETH
Any thoughts? If these issues can already be handled in Beancount, please
let me know how.
Cheers,
Einar
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/2ca8ea71-90c0-4d41-925d-4753258b6125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.