cad-capgains


Namecad-capgains JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://github.com/EmilMaric/cad-capital-gains
SummaryA CLI tool to calculate your capital gains
upload_time2024-07-24 07:41:57
maintainerEddy Maric
docs_urlNone
authorEddy Maric
requires_python<4.0,>=3.8
licenseMIT
keywords capital gains canadian tax
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Canadian Capital Gains CLI Tool
=
[![Build Status](https://travis-ci.org/EmilMaric/cad-capital-gains.svg?branch=master)](https://travis-ci.org/EmilMaric/cad-capital-gains)
[![codecov](https://codecov.io/gh/EmilMaric/cad-capital-gains/branch/master/graph/badge.svg)](https://codecov.io/gh/EmilMaric/cad-capital-gains)

Calculating your capital gains and tracking your adjusted cost base (ACB) manually, or using an Excel document, often proves to be a laborious process. This CLI tool calculates your capital gains and ACB for you, and just requires a CSV file with basic information about your transactions. The idea with this tool is that you are able to more or less cut-and-copy the output that it genarates and copy it into whatever tax filing software you end up using.

## Features:
- Supports transactions with multiple different stock tickers in the same CSV file, and outputs them in separate tables.
- Currently supports transactions done in both USD and CAD. For USD transactions, the daily exchange rate will be automatically fetched from the Bank of Canada.
- Will automatically apply [superficial capital loss](https://www.canada.ca/en/revenue-agency/services/tax/individuals/topics/about-your-tax-return/tax-return/completing-a-tax-return/personal-income/line-127-capital-gains/capital-losses-deductions/what-a-superficial-loss.html) rules when calculating your capital gains and ACB. This tool only supports full superficial capital losses, and does not support partial superficial losses. In sales with a superficial capital loss, the capital loss will be carried forward as perscribed by the CRA. A sale with a capital loss will be treated as superficial if it satisifies the following:
    - Shares with the same ticker were bought in the 61 day window (30 days before or 30 days after the sale)
    - There is a non-zero balance of shares sharing the same ticker at the end of the 61 day window (30 days after the sale)
- Outputs the running adjusted cost base (ACB) for every transaction with a non-superficial capital gain/loss
- Supports fractional quantities of shares

# Installation
```bash
# To get the latest release
pip install cad-capgains
```

# CSV File Requirements
To start, create a CSV file that will contain all of your transactions. In the CSV file, each line will represent a `BUY` or `SELL` transaction.  Your transactions **must be in order**, with the oldest transactions coming first, followed by newer transactions coming later. The format is as follows:
```csv
<yyyy-mm-dd>,<description>,<stock_ticker>,<action(BUY/SELL)>,<quantity>,<price>,<commission>,<currency>
```
Here is a sample CSV file:
```csv
# sample.csv
2017-2-15,ESPP PURCHASE,GOOG,BUY,100,50.00,10.00,USD
2017-5-20,RSU VEST,GOOG,SELL,50,45.00,0.00,CAD
```

**NOTE: This tool only supports calculating ACB and capital gains with transactions
dating from May 1, 2007 and onwards.**

# Usage
To show the CSV file in a nice tabular format you can run:
```bash
$ capgains show sample.csv
+------------+---------------+----------+----------+-------+---------+--------------+------------+
| date       | description   | ticker   | action   |   qty |   price |   commission |   currency |
|------------+---------------+----------+----------+-------+---------+--------------+------------|
| 2017-02-15 | ESPP PURCHASE | GOOG     | BUY      |   100 |   50.00 |        10.00 |        USD |
| 2017-05-20 | RSU VEST      | GOOG     | SELL     |    50 |   45.00 |         0.00 |        CAD |
+------------+---------------+----------+----------+-------+---------+--------------+------------+
```
To calculate the capital gains you can run:
```bash
$ capgains calc sample.csv 2017
GOOG-2017
[Total Gains = -1,028.54]
+------------+---------------+----------+-------+------------+----------+-----------+---------------------+
| date       | description   | ticker   | qty   |   proceeds |      ACB |   outlays |   capital gain/loss |
|------------+---------------+----------+-------+------------+----------+-----------+---------------------|
| 2017-05-20 | RSU VEST      | GOOG     | 50    |   2,250.00 | 3,278.54 |      0.00 |           -1,028.54 |
+------------+---------------+----------+-------+------------+----------+-----------+---------------------+
```
Your CSV file can contain transactions spanning across multiple different tickers. You can filter the above commands by running the following:
```bash
$ capgains calc sample.csv 2017 -t GOOG
...

$ capgains show sample.csv -t GOOG
...
```
For additional commands and options, run one of the following:
```bash
$ capgains --help

$ capgains <command> --help
```
You can take this output and plug it into your favourite tax software (Simpletax, StudioTax, etc) and verify that the capital gains/losses that the tax software reports lines up with what the output of this command says.

# Finding issues
If you find issues using this tool, please create an Issue using the [Github issue tracker](https://github.com/EmilMaric/cad-capital-gains/issues) and one of us will try to fix it.

# Contributing
If you would like to contribute, please read the [CONTRIBUTING.md](https://github.com/EmilMaric/cad-capital-gains/blob/master/CONTRIBUTING.md) page


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/EmilMaric/cad-capital-gains",
    "name": "cad-capgains",
    "maintainer": "Eddy Maric",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "capital, gains, canadian, tax",
    "author": "Eddy Maric",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ac/88/539704b01d0bd4a3817277763c23d8c4635ba2cfc5a00637e7c0cfb9fdf9/cad_capgains-2.0.2.tar.gz",
    "platform": null,
    "description": "Canadian Capital Gains CLI Tool\n=\n[![Build Status](https://travis-ci.org/EmilMaric/cad-capital-gains.svg?branch=master)](https://travis-ci.org/EmilMaric/cad-capital-gains)\n[![codecov](https://codecov.io/gh/EmilMaric/cad-capital-gains/branch/master/graph/badge.svg)](https://codecov.io/gh/EmilMaric/cad-capital-gains)\n\nCalculating your capital gains and tracking your adjusted cost base (ACB) manually, or using an Excel document, often proves to be a laborious process. This CLI tool calculates your capital gains and ACB for you, and just requires a CSV file with basic information about your transactions. The idea with this tool is that you are able to more or less cut-and-copy the output that it genarates and copy it into whatever tax filing software you end up using.\n\n## Features:\n- Supports transactions with multiple different stock tickers in the same CSV file, and outputs them in separate tables.\n- Currently supports transactions done in both USD and CAD. For USD transactions, the daily exchange rate will be automatically fetched from the Bank of Canada.\n- Will automatically apply [superficial capital loss](https://www.canada.ca/en/revenue-agency/services/tax/individuals/topics/about-your-tax-return/tax-return/completing-a-tax-return/personal-income/line-127-capital-gains/capital-losses-deductions/what-a-superficial-loss.html) rules when calculating your capital gains and ACB. This tool only supports full superficial capital losses, and does not support partial superficial losses. In sales with a superficial capital loss, the capital loss will be carried forward as perscribed by the CRA. A sale with a capital loss will be treated as superficial if it satisifies the following:\n    - Shares with the same ticker were bought in the 61 day window (30 days before or 30 days after the sale)\n    - There is a non-zero balance of shares sharing the same ticker at the end of the 61 day window (30 days after the sale)\n- Outputs the running adjusted cost base (ACB) for every transaction with a non-superficial capital gain/loss\n- Supports fractional quantities of shares\n\n# Installation\n```bash\n# To get the latest release\npip install cad-capgains\n```\n\n# CSV File Requirements\nTo start, create a CSV file that will contain all of your transactions. In the CSV file, each line will represent a `BUY` or `SELL` transaction.  Your transactions **must be in order**, with the oldest transactions coming first, followed by newer transactions coming later. The format is as follows:\n```csv\n<yyyy-mm-dd>,<description>,<stock_ticker>,<action(BUY/SELL)>,<quantity>,<price>,<commission>,<currency>\n```\nHere is a sample CSV file:\n```csv\n# sample.csv\n2017-2-15,ESPP PURCHASE,GOOG,BUY,100,50.00,10.00,USD\n2017-5-20,RSU VEST,GOOG,SELL,50,45.00,0.00,CAD\n```\n\n**NOTE: This tool only supports calculating ACB and capital gains with transactions\ndating from May 1, 2007 and onwards.**\n\n# Usage\nTo show the CSV file in a nice tabular format you can run:\n```bash\n$ capgains show sample.csv\n+------------+---------------+----------+----------+-------+---------+--------------+------------+\n| date       | description   | ticker   | action   |   qty |   price |   commission |   currency |\n|------------+---------------+----------+----------+-------+---------+--------------+------------|\n| 2017-02-15 | ESPP PURCHASE | GOOG     | BUY      |   100 |   50.00 |        10.00 |        USD |\n| 2017-05-20 | RSU VEST      | GOOG     | SELL     |    50 |   45.00 |         0.00 |        CAD |\n+------------+---------------+----------+----------+-------+---------+--------------+------------+\n```\nTo calculate the capital gains you can run:\n```bash\n$ capgains calc sample.csv 2017\nGOOG-2017\n[Total Gains = -1,028.54]\n+------------+---------------+----------+-------+------------+----------+-----------+---------------------+\n| date       | description   | ticker   | qty   |   proceeds |      ACB |   outlays |   capital gain/loss |\n|------------+---------------+----------+-------+------------+----------+-----------+---------------------|\n| 2017-05-20 | RSU VEST      | GOOG     | 50    |   2,250.00 | 3,278.54 |      0.00 |           -1,028.54 |\n+------------+---------------+----------+-------+------------+----------+-----------+---------------------+\n```\nYour CSV file can contain transactions spanning across multiple different tickers. You can filter the above commands by running the following:\n```bash\n$ capgains calc sample.csv 2017 -t GOOG\n...\n\n$ capgains show sample.csv -t GOOG\n...\n```\nFor additional commands and options, run one of the following:\n```bash\n$ capgains --help\n\n$ capgains <command> --help\n```\nYou can take this output and plug it into your favourite tax software (Simpletax, StudioTax, etc) and verify that the capital gains/losses that the tax software reports lines up with what the output of this command says.\n\n# Finding issues\nIf you find issues using this tool, please create an Issue using the [Github issue tracker](https://github.com/EmilMaric/cad-capital-gains/issues) and one of us will try to fix it.\n\n# Contributing\nIf you would like to contribute, please read the [CONTRIBUTING.md](https://github.com/EmilMaric/cad-capital-gains/blob/master/CONTRIBUTING.md) page\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A CLI tool to calculate your capital gains",
    "version": "2.0.2",
    "project_urls": {
        "Homepage": "https://github.com/EmilMaric/cad-capital-gains",
        "Repository": "https://github.com/EmilMaric/cad-capital-gains"
    },
    "split_keywords": [
        "capital",
        " gains",
        " canadian",
        " tax"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2107365db576d602947953e2640c876c9bac43adcfad8e9927b341c2dea7494e",
                "md5": "d2f9ac262a0193357312cafa15f7d133",
                "sha256": "1597997d0f9608aea974662f000f2de2dd6165d40301290457cd3602e575a53a"
            },
            "downloads": -1,
            "filename": "cad_capgains-2.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d2f9ac262a0193357312cafa15f7d133",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 12500,
            "upload_time": "2024-07-24T07:41:56",
            "upload_time_iso_8601": "2024-07-24T07:41:56.549227Z",
            "url": "https://files.pythonhosted.org/packages/21/07/365db576d602947953e2640c876c9bac43adcfad8e9927b341c2dea7494e/cad_capgains-2.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac88539704b01d0bd4a3817277763c23d8c4635ba2cfc5a00637e7c0cfb9fdf9",
                "md5": "677b1120b6c8bc0ff4adb0ed547834cb",
                "sha256": "1505e915725f6d38f8e2f70a6af9198a22424dde2d880645f8afc332831228d5"
            },
            "downloads": -1,
            "filename": "cad_capgains-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "677b1120b6c8bc0ff4adb0ed547834cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 11493,
            "upload_time": "2024-07-24T07:41:57",
            "upload_time_iso_8601": "2024-07-24T07:41:57.595829Z",
            "url": "https://files.pythonhosted.org/packages/ac/88/539704b01d0bd4a3817277763c23d8c4635ba2cfc5a00637e7c0cfb9fdf9/cad_capgains-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-24 07:41:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EmilMaric",
    "github_project": "cad-capital-gains",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "cad-capgains"
}
        
Elapsed time: 0.88427s