Input Format

Trades DataFrame

Coin2086 functions take as input a pandas DataFrame of all your crypto-currency trades (purchase and sales). You should be able to download the history of your trades from your user porfile on the exchange you use (Bistamp, Coinbase, Kraken etc.), however, you will need to adapt it so that it follows the format expected by coin2086.


The trades must be sorted by increasing datetime, this can be achieved as follows trades.sort_values('datetime').reset_index(drop=True).

The columns must follow the following specification:


The date and time of your trades in the UTC timezone. If the time is not in the UTC timezone, the computed valuation of your portfolio will be wrong.


The side of your trade, either BUY or SELL (uppercase)


The crypto-currency you bought or sold


The quantity of crypto-currency you bought or sold


The price at which you bought or sold the crypto-currency


The base currency you bought or sold the crypto-currency for. For now, it must be EUR (uppercase)


The amount of base_currency you received or spent, respectively for selling or buying a crypto-currency.


The exchange fee for the trade. Must be expressed in base_currency.


It is critically important that the trades DataFrame contains all of your crypto-currency trades since your bought your very crypto-currency, not just the trades for the last tax year.

In other words, before the first trade in the trades DataFrame, you should have been holding no crypto-currency. This is important to determine your portfolio purchase price, which is used in the computation of your profit and losses. If this is not possible, you will have to use the initial_porfolio argument.

Trades Normalization

Coin2086 provides helpers to help your normalize transaction histories downloaded from exchanges into the Trades DataFrame format expected by coin2086. Currently a trade normalisation function is provided for Bitstamp only, see coin2086.bitstamp.normalize_bitstamp_transactions().

If you write your own trade normalization function for another exchange, please submit a pull request.

Initial Portfolio

Your initial portfolio is simply the composition of your crypto-currency portfolio before the first trade in the trades DataFrame. Coin2086 will also need the purchase price for this portfolio.

For instance, suppose you have bought one Bitcoin and one Ethereum in 2017 (but you have lost the trades) for 2400 euros and 290 euros respectively. Your intial portfolio is as follows:

import coin2086
# trades is the DataFrame above
initial_porfolio = {'BTC': 1.0, 'ETH': 1.0}
initial_purchase_price = 2400 + 290
sales, total_pnl = coin2086.compute_taxable_pnls(
    trades, 2020, initial_porfolio=initial_porfolio,

Notice that, in this case, coin2086.compute_taxable_pnls() produces very different results if you forget your intial portfolio

import coin2086
sales, total_pnl = coin2086.compute_taxable_pnls(trades, 2020)