MCPcopy Index your code
hub / github.com/BittyTax/BittyTax

github.com/BittyTax/BittyTax @v0.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.0 ↗ · + Follow
846 symbols 5,055 edges 153 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

BittyTax logo [![Version badge][version-badge]][version] [![License badge][license-badge]][license] [![Python badge][python-badge]][python] [![Downloads badge][downloads-badge]][downloads] [![Stars badge][github-stars-badge]][github-stars] [![Sponsor badge][sponsor-badge]][sponsor] [![X badge][x-badge]][x] [![Discord badge][discord-badge]][discord] [![PayPal badge][paypal-badge]][PayPal] [![Bitcoin badge][bitcoin-badge]][bitcoin]

BittyTax

Overview

BittyTax is a collection of command-line tools to help you calculate your cryptoasset taxes in the UK.

This tool is designed to be used by someone who is already familiar with cryptoasset taxation rules in the UK. HMRC has published guidance on this. We've collected some useful links in the Resources section at the end.

BittyTax comprises of the following tools.

  1. bittytax - process your transaction records and generate a PDF tax report (see Accounting Tool)

  2. bittytax_conv - convert your wallet and exchange files into transaction records (see Conversion Tool)

  3. bittytax_price - (optional) lookup historic price data for cryptoassets and foreign currencies (see Price Tool)

Although UK focused, many of the tools can be used for other countries and currencies, see International support.

There is also a US version of BittyTax which has its own branch, see USA.

Why use BittyTax?

  • Open-source: growing community of users
  • Free to use: no subscriptions, no transaction limits
  • Protects your privacy: no need to share your data with a 3rd party
  • Fully transparent: all calculations and data sources are provided
  • Accuracy: built in integrity check, passes all the HMRC example test cases
  • Auditability: compliant with HMRC auditing requirements

License/Disclaimer

This software is copyright (c) Nano Nano Ltd, and licensed for use under the AGPLv3 License, see LICENSE file for details. The BittyTaxAPI server is licensed for personal use only. If you would like a license to use this software commercially, please get in touch.

Nano Nano Ltd does not provide tax, legal, accounting or financial advice. This software and its content are provided for information only, and as such should not be relied upon for tax, legal, accounting or financial advice.

You should obtain specific professional advice from a professional accountant, tax or legal/financial advisor before you take any action.

This software is provided 'as is', Nano Nano Ltd does not give any warranties of any kind, express or implied, as to the suitability or usability of this software, or any of its content.

Getting Started

You will need Python installed on your machine before you can install BittyTax, see the installation guide which covers Windows, macOS and Linux for full details.

If you are upgrading from a previous version of BittyTax, please follow the upgrade instructions.

Transaction Records

BittyTax is only as accurate as the data you provide it. This means it's essential that you keep records of ALL cryptoasset transactions, which includes not just trades but also records of spending, income, gifts sent or received, etc.

The bittytax_conv tool is provided to assist with this transaction record keeping, it allows data exported from various different wallets and exchanges to be processed into the format required by the bittytax accounting tool. Manual entry or editing of this data may also be required. It is vital that converted data files are reviewed against the raw data and audited before use.

Transaction records can be stored in an Excel or CSV file. Excel is preferred as it makes editing and managing your data easier. Data can be split across multiple worksheets, for example, you might want to split up transactions by wallet or exchange, or by transaction type. With Excel you can also annotate your records, append additional data columns, or even include the original raw data for reference.

A transaction record is represented as a row of data which contains the following fields in the order given.

Field Type Description
Type Deposit Tokens deposited to a wallet you own
Mining Tokens received as income from mining
Staking Tokens received as income from staking
Interest Tokens received as interest
Dividend Tokens received as a dividend
Income Tokens received as other income
Gift-Received Tokens received as a gift
Fork Tokens received as the result of a blockchain fork
Airdrop Tokens received from an airdrop
Referral Tokens received as a reward through a referral program
Cashback Tokens received as cashback
Fee-Rebate Tokens received as a rebate of fees
Loan Tokens received as a loan
Margin-Gain Tokens received as a result of a margin gain
Margin-Fee-Rebate Tokens received as a rebate of margin fees
Withdrawal Tokens withdrawn from a wallet you own
Spend Tokens spent on goods or services
Gift-Sent Tokens sent as a gift
Gift-Spouse Tokens gifted to your spouse or civil partner
Charity-Sent Tokens sent to a charity as a gift
Lost Tokens that have been lost or stolen
Loan-Repayment Tokens returned to the lender of a loan
Loan-Interest Tokens paid as a fee to the lender of a loan
Margin-Loss Tokens deducted as a result of a margin loss
Margin-Fee Tokens paid as fees for a margin position
Trade Tokens exchanged for another token or fiat currency
Buy Quantity Quantity of the asset acquired
Buy Asset Symbol name of the asset acquired
Buy Value in GBP Value in UK pounds of the asset acquired
Sell Quantity Quantity of the asset disposed
Sell Asset Symbol name of the asset disposed
Sell Value in GBP Value in UK pounds of the asset disposed
Fee Quantity Quantity of the fee
Fee Asset Symbol name of the asset used for fees
Fee Value in GBP Value in UK pounds of the fee
Wallet Name of wallet
Timestamp Date/time of transaction
Note Description of transaction

The transaction Type dictates which fields in the row are required, either (M)andatory or (O)ptional.

Type Buy Quantity Buy Asset Buy Value in GBP Sell Quantity Sell Asset Sell Value in GBP Fee Quantity Fee Asset Fee Value in GBP Wallet Timestamp Note
Deposit M M O O O O M O
Mining M M O O O O O M O
Staking M M O O O O O M O
Interest M M O O O O O M O
Dividend M M O O O O O M O
Income M M O O O O O M O
Gift-Received M M O O O O O M O
Fork M M O O O O O M O
Airdrop M M O O O O O M O
Referral M M O O O O O M O
Cashback M M O O O O O M O
Fee-Rebate M M O O O O O M O
Loan M M O O O O O M O
Margin-Gain M M O O O O O M O
Margin-Free-Rebate M M O O O O O M O
Withdrawal M M O O O O M O
Spend M M O O O O O M O
Gift-Sent M M O O O O O M O
Gift-Spouse M M O O O O M O
Charity-Sent M M O O O O O M O
Lost M M O O O O O M O
Loan-Repayment M M O O O O O M O
Loan-Interest M M O O O O O M O
Margin-Loss M M O O O O O M O
Margin-Fee M M O O O O O M O
Trade M M O M M O O O O O M O
  • If the Fee Asset is the same as Sell Asset, then the Sell Quantity must be the net amount (after fee deduction), not gross amount.

  • If the Fee Asset is the same as Buy Asset, then the Buy Quantity must be the gross amount (before fee deduction), not net amount.

  • The Buy Value in GBP, Sell Value in GBP and Fee Value in GBP fields are always optional, if you don't provide a fixed value, bittytax will calculate the value for you via one of its price data sources.

  • Wallet name is optional, but recommended if you want to audit your cryptoasset balances across multiple wallets.

  • Timestamps should be in Excel Date & Time format (as UTC), or if text, in the format YYYY-MM-DDTHH:MM:SS.000000 ZZZ where ZZZ represents the timezone, or if omitted UTC is assumed. Milliseconds or microseconds are optional.

  • Cryptoasset symbol names need to be consistent throughout your transaction records. The symbol name you choose should match the symbol name used by the price data source, otherwise valuations will fail. See Price Tool for more information. NFT assets should be identified with a unique symbol name in the format "\<Name> #\<Id>", i.e. CryptoPunk #369.

  • Transaction records can be listed in any order. Bittytax will sort them by Timestamp before processing.

Example files are provided in both Excel and CSV format.

Deposit

A Deposit is a transfer transaction record, indicating the receipt of cryptoasset tokens to a wallet you control. For example, you might have deposited tokens to a wallet on a cryptocurrency exchange.

Deposit should NOT be used to record transfers to someone else's wallet, this would be categorised as either a Gift-Sent or a Spend.

There should always be an equivalent Withdrawal transaction record for every deposit, since tokens are always moving out of one wallet into another.

It is important that any deposit fee paid is specified, the deposit quantity should be the gross amount (before fee deduction).

Deposits and Withdrawals are not taxable events, but paying the transfer fee is (unless otherwise configured), see transfer_fee_disposal.

The Deposit type can also be used to record fiat deposits into an exchange. Although this is not used for tax calculations, it will be used for auditing purposes.

Withdrawal

A Withdrawal is a transfer transaction record, indicating tokens being sent from a wallet you control. It is always used in combination with a Deposit transaction.

It is important that any withdrawal fee paid is specified, the withdrawal quantity should be the net amount (after fee deduction).

Its corresponding Deposit quantity should match the Withdrawal quantity, this is important, as the transfers will be removed from the tax calculations.

The Withdrawal type can also be used to record fiat withdrawals from an exchange.

Mining

The Mining transaction type is used to identify tokens received as income from mining. The Income transaction type could also be used to record this - its use is purely descriptive.

These transaction records will appear within your income tax report. See HMRC guidance on mining transactions.

Staking

The Staking transaction type is used to identify tokens received as income from staking.

These transaction records will appear within your income tax report. See HMRC guidance on staking.

If staking income is received as return for the lending of tokens (or providing liquidity), and beneficial ownership of those tokens transfers to the borrower/lending platform, then additional transaction records will need to be added to record disposals for both the lending and the repayment, see HMRC guidance on making a DeFi loan.

It's also possible that staking tokens received are considered capital instead of income, see HMRC guidance on nature of the return.

Our HMRC DeFi examples show you how you can structure your transaction records accordingly.

Interest

The Interest transaction type is used to identify tokens received as interest.

These transaction records will appear within your income tax report.

The same HMRC guidance on lending and staking as described above will also apply here.

Dividend

The Dividend transaction type is used to identify tokens received as a dividend.

These transaction records will appear within your income tax report.

Income

The Income transaction type is used to identify tokens received as other income, i.e. income which cannot be categorised as Mining, Staking, Interest or Dividend.

These transaction records will appear within your income tax report.

Gift-Received

The Gift-Received transaction type is used to record cryptoasset tokens received as a gift.

A gift re

Core symbols most depended-on inside this repo

Shape

Function 383
Method 351
Class 112

Languages

Python100%

Modules by API surface

src/bittytax/tax.py49 symbols
src/bittytax/price/datasource.py45 symbols
src/bittytax/report.py42 symbols
src/bittytax/transactions.py35 symbols
src/bittytax/conv/exceptions.py29 symbols
src/bittytax/conv/dataparser.py24 symbols
src/bittytax/conv/output_excel.py23 symbols
src/bittytax/audit_excel.py21 symbols
src/bittytax/conv/parsers/binance.py20 symbols
src/bittytax/conv/parsers/kucoin.py19 symbols
src/bittytax/conv/datafile.py18 symbols
src/bittytax/t_record.py15 symbols

For agents

$ claude mcp add BittyTax \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page