Skip to main content

yabc on PyPI MIT License badge yabc on TravisCI Supported Python versions

yabc - a bitcoin tax calculator

yabc translates cryptocurrency trades, mining, and spending data into a list of reports that can be sent to tax authorities. It is most useful for cryptocurrency traders in the US.

yabc is the tax calculator behind https://velvetax.com/.

$ python -m yabc testdata/gemini/sample_gemini.csv ./testdata/coinbase/sample_coinbase.csv
13 transactions to be reported

<Sold 0.76 BTC on 2008-04-21 01:12:00 for $236. Exchange: coinbase. Profit:$-155.
	<TX 2008-04-21 01:12:00 SELL 1993.93 USD for 6.26 BTC, from exchange coinbase. Fee 48.44 USD>>
<Sold 1 BTC on 2008-04-21 01:12:00 for $311. Exchange: coinbase. Profit:$29.
	<TX 2008-04-21 01:12:00 SELL 1993.93 USD for 6.26 BTC, from exchange coinbase. Fee 48.44 USD>>
<Sold 2 BTC on 2008-04-21 01:12:00 for $622. Exchange: coinbase. Profit:$546.
	<TX 2008-04-21 01:12:00 SELL 1993.93 USD for 6.26 BTC, from exchange coinbase. Fee 48.44 USD>>
<Sold 2.5 BTC on 2008-04-21 01:12:00 for $777. Exchange: coinbase. Profit:$666.
	<TX 2008-04-21 01:12:00 SELL 1993.93 USD for 6.26 BTC, from exchange coinbase. Fee 48.44 USD>>
<Sold 0.04290503 BTC on 2008-08-13 06:27:56.145000 for $594. Exchange: gemini. Profit:$572.
	<TX 2008-08-13 06:27:56.145000 SELL 595.36 USD for 0.04290503 BTC, from exchange gemini. Fee 1.49 USD>>
<Sold 0.35608537 BTC on 2008-08-14 06:27:56.146000 for $4929. Exchange: gemini. Profit:$4746.
	<TX 2008-08-14 06:27:56.146000 SELL 4941.11 USD for 0.35608537 BTC, from exchange gemini. Fee 12.35 USD>>
<Sold 0.0010096 BTC on 2008-08-15 06:27:56.147000 for $14. Exchange: gemini. Profit:$13.
	<TX 2008-08-15 06:27:56.147000 SELL 14.01 USD for 0.0010096 BTC, from exchange gemini. Fee 0.04 USD>>
<Sold 0.5 BTC on 2008-08-18 06:27:56.150000 for $7032. Exchange: gemini. Profit:$6775. Long term.
	<TX 2008-08-18 06:27:56.150000 SELL 7050.00 USD for 0.5 BTC, from exchange gemini. Fee 17.63 USD>>
<Sold 0.035 BTC on 2008-08-20 06:27:56.152000 for $496. Exchange: gemini. Profit:$478. Long term.
	<TX 2008-08-20 06:27:56.152000 SELL 497.44 USD for 0.035 BTC, from exchange gemini. Fee 1.24 USD>>
<Sold 0.03518002 BTC on 2008-08-21 06:27:56.153000 for $498. Exchange: gemini. Profit:$480. Long term.
	<TX 2008-08-21 06:27:56.153000 SELL 499.51 USD for 0.03518002 BTC, from exchange gemini. Fee 1.25 USD>>
<Sold 0.03447186 BTC on 2008-08-22 06:27:56.154000 for $488. Exchange: gemini. Profit:$470. Long term.
	<TX 2008-08-22 06:27:56.154000 SELL 489.45 USD for 0.03447186 BTC, from exchange gemini. Fee 1.22 USD>>
<Sold 0.01057786 BTC on 2008-08-23 06:27:56.155000 for $150. Exchange: gemini. Profit:$145. Long term.
	<TX 2008-08-23 06:27:56.155000 SELL 150.19 USD for 0.01057786 BTC, from exchange gemini. Fee 0.38 USD>>
<Sold 0.035 BTC on 2009-08-24 06:27:56.156000 for $496. Exchange: gemini. Profit:$478. Long term.
	<TX 2009-08-24 06:27:56.156000 SELL 496.95 USD for 0.035 BTC, from exchange gemini. Fee 1.24 USD>>

total gain or loss for above transactions: 15243

total basis for above transactions: 1400
total proceeds for above transactions: 16643
Remaining coins after sales:
<TX 2007-08-18 01:12:00 BUY 4 BTC for 2048 USD, from exchange coinbase. Fee 11.11 USD>
<TX 2007-08-31 01:12:00 BUY 4 BTC for 97 USD, from exchange coinbase. Fee 11.12 USD>
<TX 2007-09-13 01:12:00 BUY 7 BTC for 102.34 USD, from exchange coinbase. Fee 14.98 USD>
<TX 2007-10-22 01:12:00 BUY 4 BTC for 45.6 USD, from exchange coinbase. Fee 31.9 USD>
<TX 2007-12-13 01:12:00 BUY 8 BTC for 13.2 USD, from exchange coinbase. Fee 32.25 USD>
<TX 2007-12-26 01:12:00 BUY 3 BTC for 98.04 USD, from exchange coinbase. Fee 9.54 USD>
<TX 2008-02-03 01:12:00 BUY 10.23 BTC for 203 USD, from exchange coinbase. Fee 92.2 USD>
<TX 2008-03-13 01:12:00 BUY 5.234 BTC for 302 USD, from exchange coinbase. Fee 30.4 USD>
<TX 2008-04-08 01:12:00 BUY 2.532 BTC for 1776.76 USD, from exchange coinbase. Fee 17.56 USD>
<TX 2008-09-08 06:27:56.141000 BUY 20.2092 BTC for 53.62 USD, from exchange gemini. Fee 0.13 USD>
<TX 2008-10-08 06:27:56.142000 BUY 0.339 BTC for 86.90 USD, from exchange gemini. Fee 0.22 USD>
<TX 2008-11-08 06:27:56.143000 BUY 0.323 BTC for 82.79 USD, from exchange gemini. Fee 0.21 USD>

An adhoc CSV format is supported for non-exchange transactions like mining, gifts, and purchases.

yabc also includes a set of HTTP endpoints that allow for storing data more permanently in a database, sqlite by default. Postgres as a backend is also supported.

TODO

  • TODO: Support coin/coin trades like BTC/ETH.
  • TODO: Enable importing from more exchanges (binance)
  • TODO: Add better historical price lookup support; it is now a stub.

Installation from source, with virtualenv

git clone git@github.com:robertkarl/yabc.git
cd yabc
virtualenv -p python3 venv
. venv/bin/activate
python setup.py install

Notes

File structure, setup.py usage, and shields inspired by source of python modules sshuttle, flask, and black.

Caveats

Please note that yabc is not a tax service or tax accounting software and is provided with no warranty. Please see the LICENSE file for more details.

yabc is not associated with any of the mentioned exchanges or companies including but not limited to binance, coinbase, or gemini. Any trademarks are property of their respective owners.

Metadata

Release files for yabc 0.1.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yabc 0.1.22
File Size Uploaded
yabc-0.1.22.tar.gz 30.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yabc 0.1.22
File Interpreter ABI Platform
yabc-0.1.22-py3-none-any.whl Python 3 none any Details

Total release size: 76.2 kB

Release files / yabc-0.1.22.tar.gz

Download URL yabc-0.1.22.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
97f8fd83a98079aeea9369162097e691091cc6f3869bf1d29d5fea2a6842cb68
BLAKE2b-256 checksum
How to use checksums
e49cc088787e0f751c01a1268ecae623249a887c0b64f4ed064ae9f84528559c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / yabc-0.1.22-py3-none-any.whl

Download URL yabc-0.1.22-py3-none-any.whl
Size 45.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
659a4630f09b0deb36662b8725a965492bf64e2c8521e47eba4d91d1def74ff8
BLAKE2b-256 checksum
How to use checksums
79b25dd5758c02e02c4e2804fec8a64bed9955fb6fbf7f0d748d3783f043c0ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.1.22 This release

2 release files

0.1.18

2 release files

0.1.16

2 release files

0.1.12

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

4 release files

0.0.2

3 release files

0.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page