Skip to main content

Capital gains calculator

Project description


Capital gains calculator.


pip install capital-gains


usage: capital-gains [<options>] [--] <input file>

Capital gains calculator

optional arguments:
  -h, --help     show this help message and exit
  --cents        round to nearest cent, not dollar
  -v, --version  show program's version number and exit

Input format

See example/input.csv.

Each entry has the following format:


Buys have positive shares; sells have negative shares. price and fee are always positive. fee and name are optional. A sell without a name will sell all open lots FIFO; a sell with a name will only sell lots with the same name. Thus name can be used to specify sell orders other than FIFO.

Output format

Closed lots are tabulated in a format suitable for form 8949, rounded to the nearest dollar (use --cents to round to the nearest cent).

Open lots are also summarized.


capital-gains example/input.csv > example/output.txt


MIT License

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

capital-gains-1.0.1.tar.gz (4.2 kB view hashes)

Uploaded source

Built Distribution

capital_gains-1.0.1-py2.py3-none-any.whl (5.7 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page