Skip to main content

Capital gains calculator

Project description

capital-gains

Capital gains calculator.

Installation

pip install capital-gains

Usage

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

Capital gains calculator

optional arguments:
  -h, --help            show this help message and exit
  -d <n>, --decimal-places <n>
                        round $ to <n> decimal places; default: 0
  -s <n>, --shares-decimal-places <n>
                        round shares to <n> decimal places; default: 0
  -t, --totals          output totals
  -v, --verbose         verbose output
  -V, --version         show program's version number and exit

Input Format

See example/input.csv.

Each entry has the following format:

date,symbol,name,shares,price,fee

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 IRS form 8949, rounded to the nearest dollar (use -d 2 to round to the nearest cent).

Open lots, and optionally totals for both closed and open lots (use -t), are also summarized.

Examples

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

License

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.3.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

capital_gains-1.0.3-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

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