Skip to main content

Capital gains calculator

Project description

capital-gains

Capital gains calculator.

This transforms transaction histories into a format suitable for IRS form 8949, taking care of wash sale adjustments.

Note: The logic is ignorant of share type, and cannot account for e.g. bargain elements for ESPP, ISO, and NSO. You must enter the appropriate cost basis depending on your situation, e.g. the fair market value on exercise date for ESPP disqualifying dispositions.

See also nkouevda/estimated-taxes.

Installation

pip install capital-gains

Or:

brew install nkouevda/nkouevda/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
  -w, --wash-sales, --no-wash-sales
                        identify wash sales and adjust cost basis (default: True)

Input Format

See input/example.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.

Examples

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

TODO

  • STCG vs. LTCG

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.7.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

capital_gains-1.0.7-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file capital-gains-1.0.7.tar.gz.

File metadata

  • Download URL: capital-gains-1.0.7.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for capital-gains-1.0.7.tar.gz
Algorithm Hash digest
SHA256 a47c1cdb00dee602a89fe3476a71e48cbf1260bee947fc9eef7756d8998be1be
MD5 8e61fb1de0837e9c4886574fd05266fe
BLAKE2b-256 f3111b3b093002c8f38ab6c05a0b247725d28b0896cbd9e4c93214a623378ae0

See more details on using hashes here.

File details

Details for the file capital_gains-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: capital_gains-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for capital_gains-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f1409d58abf920b53eadc4e9525898f580897e6d4359f423f337a4185a05abf5
MD5 b13e2210828f44fbcb71e52651f80de9
BLAKE2b-256 96e3ae19a22870c00e6d19eb1a2116ec589838a4975f8ad4fc4f0bb0208a8dff

See more details on using hashes here.

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