Coder Social home page Coder Social logo

uk_cgt_calculator's Introduction

UK CGT calculator

To run

If you want to make a report for tax year Apr 2020 - Apr 2021 use:

  • For stocks: python3 main_ibkr.py 2020
  • For crypto: python3 main_crypto.py 2020

Dependencies

  • You need to install cryptocompare library to fetch crypto prices on a given date. python3 -m pip install cryptocompare
  • The free version of their API should generally suffice, although there are rate limits. However this program stores all fetched prices in a file so that they don't need to be fetched again. If you run into rate limits, simply re-run the program after few seconds and new data will be appended

About

  • This is a CGT calculator for UK tax. You need to download trade reports from your brokers and store it in Data folder. You'll need your statements since you opened your accounts (and not just the tax year in focus) since your cost basis is dependent on your past trades
  • This calculator handles
    • Uses UK cost averaging, with daily GBP rates used
    • Matches Disposals in this order: Same Day -> 30-day bed and breakfast rule -> Sec 104 Matching -> Buys after 30 days
    • Handles option expiry, assignment
    • Handles crypto trades and staking / earn interest
    • Does not include FX transactions. Unclear if currency held in accounts should be liable to CGT upon exchange back to GBP

Support

  • IBKR: You need to download monthly tradelog exports from IBKR. Store them as Data/IBKR/ibkr_monthly.csv
  • Coinbase: Download all transactions in csv format. Store them as Data/Coinbase/coinbase.csv
    • There are 2 tricky transactions: sends and receives from external wallets, make sure you handle them correctly.
    • Either you ignore them if you sent them to yourself or consider them as a disposal if you used them up on the blockchain.
    • By default these are ignored
  • Coinbase Pro: Download all transactions in csv format.Store them as Data/CoinbasePro/coinbasepro.csv
    • By default deposits and withdrawals are ignored (usually they are through coinbase itself)
  • Binance: Download trade reports per quarter:
    • Combined account statements (Needed for Spot and Earn accounts). Store them as Data/Binance/binance_all_monthly.csv
    • Cross margin. Store them as Data/Binance/binance_cross_margin_monthly.csv
    • Isolated margin. Store them as Data/Binance/binance_isolated_margin_monthly.csv

uk_cgt_calculator's People

Contributors

anubhav94n avatar infiloop2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.