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
options:
-h, --help show this help message and exit
-d, --decimal-places <n>
round $ to <n> decimal places (default: 0)
-s, --shares-decimal-places <n>
round shares to <n> decimal places (default: 0)
-t, --totals output totals (default: False)
-v, --verbose verbose output (default: False)
-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
date:YYYY-MM-DDformatname: optional (can be blank)shares: purchases have positiveshares; sales have negativesharesprice: non-negativefee: non-negative; optional (can be blank)
Entries must be in ascending date order, i.e. oldest first.
A sale without a name will sell all open lots FIFO; a sale with a name will
only sell lots with the same name. Thus name can be used to specify orders
other than FIFO.
Examples
capital-gains -t input/example.csv > output/example.txt
TODO
- STCG vs. LTCG
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file capital_gains-1.0.8.tar.gz.
File metadata
- Download URL: capital_gains-1.0.8.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75e787370a8a51338d31bd79f900dc92e7e15d0b10affa3abd3dad75d56b5f7a
|
|
| MD5 |
1f36c738f20a92007757f978d6570222
|
|
| BLAKE2b-256 |
b2398ef1a79d8521022360587f38c059b723e87176bebf58e1f5df28a20a17da
|
File details
Details for the file capital_gains-1.0.8-py3-none-any.whl.
File metadata
- Download URL: capital_gains-1.0.8-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f4bb860017e37ed9ce760f0a0122fbf5aaace4fa8fbe269de56484a6fd02538
|
|
| MD5 |
cde9c335f654435f1e562285d6be19ca
|
|
| BLAKE2b-256 |
9dc9e58fc2258198dabdf2a698f52f1d03e36a591d647ca1438575b820fbf796
|