Skip to main content

UK capital gains tax calculator for Charles Schwab and Trading 212 accounts

Project description

UK capital gains calculator

CI PyPI version

Calculate capital gains tax by transaction history exported from Charles Schwab, Trading 212 and Morgan Stanley. Generate PDF report with calculations.

Automatically convert all prices to GBP and apply HMRC rules to calculate capital gains tax: "same day" rule, "bed and breakfast" rule, section 104 holding.

Report example

calculations_example.pdf

Installation

Install it with pipx (or regular pip):

pipx install cgt-calc

Prerequisites

  • Python 3.8 or above.
  • pdflatex is required to generate the report.

Install LaTeX

MacOS

brew install --cask mactex-no-gui

Debian based

apt install texlive-latex-base

Windows

Install MiKTeX.

Usage

You will need several input files:

  • Exported transaction history from Schwab in CSV format since the beginning. Or at least since you first acquired the shares, which you were holding during the tax year. See example.
  • Exported transaction history from Trading 212. You can use several files here since Trading 212 limit the statements to 1 year periods. See example.
  • Exported transaction history from Morgan Stanley. Since Morgan Stanley generates multiple files in a single report, please specify a directory produced from the report download page.
  • CSV file with initial stock prices in USD at the moment of vesting, split, etc. initial_prices.csv comes pre-packaged, you need to use the same format.
  • (Optional) Monthly GBP/USD prices from gov.uk. GBP_USD_monthly_history.csv comes pre-packaged, you need to use the same format if you want to override it.

Then run (you can omit the brokers you don't use):

cgt-calc --year 2020 --schwab schwab_transactions.csv --trading212 trading212/ --mssb mmsb_report/

See cgt-calc --help for the full list of settings.

Disclaimer

Please be aware that I'm not a tax adviser so use this data at your own risk.

Contribute

All contributions are highly welcomed. If you notice any bugs please open an issue or send a PR to fix it.

Feel free to add new parsers to support transaction history from more brokers.

Testing

This project uses Poetry for managing dependencies.

  • For local testing you need to install it.
  • After that run poetry install to install all dependencies.
  • Then activate pre-commit hook: poetry run pre-commit install

You can also run all linters and tests manually with this command:

poetry run pre-commit run --all-files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgt-calc-1.1.0.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cgt_calc-1.1.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file cgt-calc-1.1.0.tar.gz.

File metadata

  • Download URL: cgt-calc-1.1.0.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.8.10 Linux/5.4.0-1047-azure

File hashes

Hashes for cgt-calc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4f753c8b23c25c5473ce5aed6a43e4f5f56f1caa75d78319a9c9ace8720e063c
MD5 b6ff83063afe9b5830dab11d8621179b
BLAKE2b-256 87b243a09d97bc73d327f37bbf8406e0c5345bc37a9f7475c0dabdfcb93c7839

See more details on using hashes here.

File details

Details for the file cgt_calc-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: cgt_calc-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.8.10 Linux/5.4.0-1047-azure

File hashes

Hashes for cgt_calc-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5cee1e24f073f113eaa729a46fcabaaa18075b294167b5dacac48ce1b417249
MD5 4dbfde8d9b848cb42b5313189d403ed0
BLAKE2b-256 5d7a04d9f5aceb06b202ca01de6998ce8af0e314f112c56bc77144532a4be931

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page