Skip to main content

kalshi-csv

Parse Kalshi transaction CSV files and generate IRS Form 8949 tax summaries for event contract trading.

Installation

pip install kalshi-csv

Getting Your Transactions CSV

Download your transaction history from Kalshi:

  1. Go to https://kalshi.com/account/taxes
  2. Download the transaction CSV for the tax year you want to analyze
  3. Pass it to kalshi-csv as shown below

Each tax year produces a separate CSV file.

CSV Format

The tool expects the standard Kalshi transaction export with these columns:

type, quantity_fp, market_ticker, side, entry_price_dollars, exit_price_dollars,
open_fees_dollars, close_fees_dollars, realized_pnl_without_fees_dollars,
realized_pnl_with_fees_dollars, close_timestamp, open_timestamp

Rows without realized_pnl_without_fees_dollars are automatically skipped.

CLI Usage

Parse a Kalshi transactions CSV and display the trade matrix with IRS summary:

kalshi-csv Kalshi-Transactions-2026.csv

Export the IRS summary to a file:

kalshi-csv Kalshi-Transactions-2026.csv --irs-file irs-summary.txt

Disable colored output (useful for piping or redirecting):

kalshi-csv Kalshi-Transactions-2026.csv --no-color

Use ASCII characters instead of Unicode box-drawing (for terminals without UTF-8 support):

kalshi-csv Kalshi-Transactions-2026.csv --ascii

Sample Output

Default mode (Unicode box-drawing):

┌──────────────────────────────────┬──────┬────────┬────────┬────────┬────────────────┬────────┐
│ Ticker                           │ Side │ Qty    │ Entry  │ Exit   │ P&L (No Fees)  │ Fees   │
├──────────────────────────────────┼──────┼────────┼────────┼────────┼────────────────┼────────┤
│ KXWCADVANCE-26JUL07ARGEGY-ARG    │ YES  │ 0.17   │ $0.86  │ $0.69  │ $-0.03         │ $0.00  │
│ KXWC1H-26JUL07ARGEGY-TIE         │ YES  │ 0.34   │ $0.28  │ $0.00  │ $-0.10         │ $0.00  │
│ KXMLBGAME-26JUL081940BOSCWS-BOS  │ YES  │ 0.96   │ $0.50  │ $0.91  │ $+0.39         │ $0.02  │
└──────────────────────────────────┴──────┴────────┴────────┴────────┴────────────────┴────────┘
Total Transactions Parsed: 3
Total Exchange Fees Paid:  $0.02
Internal Tracked Net P&L:  $+0.26
-----------------------------------------------------------------------------------
=== IRS FORM 8949 / SCHEDULE D AGGREGATE SUMMARY ===
Use these exact aggregates for a single-line summary entry:
  * Box to Check:            Box C (Short-term, not reported on Form 1099-B)
  * (a) Description:         Kalshi Event Contracts (Aggregate Summary)
  * (d) Gross Proceeds:      $+2.50
  * (e) Cost or Other Basis: $2.24
  * (h) Gain or (Loss):      $+0.26
====================================================

ASCII mode (--ascii):

+----------------------------------+------+--------+--------+--------+----------------+--------+
| Ticker                           | Side | Qty    | Entry  | Exit   | P&L (No Fees)  | Fees   |
+----------------------------------+------+--------+--------+--------+----------------+--------+
| KXWCADVANCE-26JUL07ARGEGY-ARG    | YES  | 0.17   | $0.86  | $0.69  | $-0.03         | $0.00  |
| KXWC1H-26JUL07ARGEGY-TIE         | YES  | 0.34   | $0.28  | $0.00  | $-0.10         | $0.00  |
| KXMLBGAME-26JUL081940BOSCWS-BOS  | YES  | 0.96   | $0.50  | $0.91  | $+0.39         | $0.02  |
+----------------------------------+------+--------+--------+--------+----------------+--------+
Total Transactions Parsed: 3
Total Exchange Fees Paid:  $0.02
Internal Tracked Net P&L:  $+0.26
-----------------------------------------------------------------------------------
=== IRS FORM 8949 / SCHEDULE D AGGREGATE SUMMARY ===
Use these exact aggregates for a single-line summary entry:
  * Box to Check:            Box C (Short-term, not reported on Form 1099-B)
  * (a) Description:         Kalshi Event Contracts (Aggregate Summary)
  * (d) Gross Proceeds:      $+2.50
  * (e) Cost or Other Basis: $2.24
  * (h) Gain or (Loss):      $+0.26
====================================================

Library API

Use kalshi-csv as a Python library in your own scripts:

from kalshi_csv import KalshiCSV

kalshi = KalshiCSV("Kalshi-Transactions-2026.csv")
kalshi.parse()

# Access individual trades
for trade in kalshi.trades:
    print(f"{trade['ticker']}: {trade['side']} {trade['qty']} @ ${trade['entry']}")
    print(f"  P&L: ${trade['pnl_with_fees']:.2f}")

# Access aggregate summary
print(f"Total trades: {kalshi.summary['trade_count']}")
print(f"Total fees: ${kalshi.summary['total_fees']:.2f}")
print(f"Total P&L: ${kalshi.summary['total_pnl_with_fees']:.2f}")

# Get IRS Form 8949 data
irs = kalshi.irs_summary()
print(f"Gross Proceeds: ${irs['gross_proceeds']:.2f}")
print(f"Cost Basis: ${irs['cost_basis']:.2f}")
print(f"Gain/Loss: ${irs['gain_or_loss']:.2f}")

Data Structures

Trade dict (kalshi.trades):

  • ticker: Market ticker symbol
  • side: "YES" or "NO"
  • qty: Quantity of contracts
  • entry: Entry price in dollars
  • exit: Exit price in dollars
  • pnl_no_fees: P&L without fees
  • pnl_with_fees: P&L including fees
  • open_fees: Opening fees
  • close_fees: Closing fees

Summary dict (kalshi.summary):

  • trade_count: Number of trades parsed
  • total_fees: Sum of all fees
  • total_pnl_without_fees: Total P&L excluding fees
  • total_pnl_with_fees: Total P&L including fees
  • total_tax_basis: Total cost basis for IRS reporting
  • total_tax_proceeds: Total proceeds for IRS reporting

IRS summary dict (kalshi.irs_summary()):

  • box: "C" (for Form 8949 Box C)
  • description: "Kalshi Event Contracts (Aggregate Summary)"
  • gross_proceeds: Total proceeds
  • cost_basis: Total cost basis
  • gain_or_loss: Net gain or loss

IRS Form 8949

Kalshi event contracts are typically reported on IRS Form 8949, Box C (short-term transactions not reported on Form 1099-B). The tool calculates:

  • Gross Proceeds: Total exit value minus close fees
  • Cost Basis: Total entry value plus open fees
  • Gain/Loss: Realized P&L including all fees

Use the aggregate summary for a single-line entry on Form 8949, or export to a file for your records.

Disclaimer: This tool provides calculations based on Kalshi transaction data. Consult a tax professional for specific tax advice.

Source Code

This project is hosted in two locations:

License

MIT

Metadata

Release files for kalshi-csv 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kalshi-csv 0.1.1
File Size Uploaded Provenance Actions
kalshi_csv-0.1.1.tar.gz 7.8 kB Without provenance Details for kalshi_csv-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kalshi-csv 0.1.1
File Interpreter ABI Platform Actions
kalshi_csv-0.1.1-py3-none-any.whl Python 3 none any Details for kalshi_csv-0.1.1-py3-none-any.whl

Total release size: 15.9 kB

Release files / kalshi_csv-0.1.1.tar.gz

Download URL kalshi_csv-0.1.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3129657481ebbd3fc8751244b695dff4d4bf2499ccf956eb713edad796452d25
BLAKE2b-256 checksum
How to use checksums
d38e5f6a0558efbd29e2f2c5e1ff4f98314033dea3cf52576afc340a8d5b54ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / kalshi_csv-0.1.1-py3-none-any.whl

Download URL kalshi_csv-0.1.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f44eee0940d62b28d650f36628901c2b2f19bd35eeee1a594adda1e3a8974f0
BLAKE2b-256 checksum
How to use checksums
c01e0638b9fe5ef38db633da848853104f1919fa8a66847bc99e533f1f5ab6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for kalshi-csv 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page