Wash sale detection under 2025 US crypto rules with 61-day window monitoring, disallowed loss tracking, and safe re-entry countdown
npx skills add https://github.com/agiprolabs/claude-trading-skills --skill wash-sale-detection
Detect wash sales under current US crypto tax rules (effective 2025), monitor the 61-day window around realized losses, track disallowed losses with basis adjustments, and compute safe re-entry countdowns.
> Disclaimer: This skill provides informational analysis only. It is NOT tax advice. Consult a qualified tax professional or CPA for guidance on your specific situation. Tax law is complex, and the application of wash sale rules to cryptocurrency may vary based on individual circumstances, IRS guidance updates, and court rulings.
Before 2025, cryptocurrency was not subject to the wash sale rule because digital assets were classified as property rather than securities. The Infrastructure Investment and Jobs Act and subsequent IRS rulemaking extended wash sale treatment to digital assets beginning January 1, 2025.
Under IRC Section 1091 (as amended for digital assets), if you sell or dispose of a cryptocurrency at a loss and acquire a substantially identical asset within a 61-day window (30 days before the sale through 30 days after), the loss is disallowed for tax purposes. The disallowed loss is added to the cost basis of the replacement position.
Day -30 ................. Day 0 ................. Day +30
|--- 30 days before ---|--- sale day ---|--- 30 days after ---|
^ ^ ^
Window opens Loss realized Window closes
For crypto, "substantially identical" generally means the same token. Selling SOL at a loss and buying SOL within 30 days is a wash sale. Selling SOL and buying ETH is not (they are different assets).
Edge cases that may be scrutinized:
When a wash sale occurs:
Example:
from datetime import date
# Define your trade history
trades = [
{"date": date(2025, 3, 1), "action": "buy", "token": "SOL", "qty": 10, "price": 100.0},
{"date": date(2025, 3, 15), "action": "sell", "token": "SOL", "qty": 10, "price": 80.0},
{"date": date(2025, 3, 25), "action": "buy", "token": "SOL", "qty": 10, "price": 85.0},
]
# Check for wash sales
from scripts.wash_sale_scanner import WashSaleScanner
scanner = WashSaleScanner(trades)
results = scanner.scan()
for ws in results.wash_sales:
print(f"WASH SALE: {ws.token} — Loss ${ws.disallowed_loss:.2f} disallowed")
print(f" Sale: {ws.sale_date} | Re-entry: {ws.replacement_date}")
print(f" Adjusted basis: ${ws.adjusted_basis:.2f}")
# Check safe re-entry countdowns
for countdown in results.countdowns:
print(f"{countdown.token}: {countdown.days_remaining} days until safe re-entry")
Scan your full year of trading activity to identify all wash sales before filing taxes. Generate a report showing total disallowed losses and adjusted cost bases.
Before placing a buy order, check whether the token has an open wash sale window from a recent loss. Avoid inadvertent wash sales by waiting for the countdown to expire.
Automated trading systems (copy-trading bots, DCA bots, grid bots) frequently trigger wash sales because they buy and sell the same tokens repeatedly. Run this scanner on bot trade exports to quantify the tax impact.
When executing a tax-loss harvesting strategy, use the safe re-entry countdown to plan when you can re-enter positions. Swap into a non-identical asset during the 30-day window if you want to maintain market exposure.
The wash sale rule applies across all accounts controlled by the same taxpayer. If you trade SOL on multiple exchanges or wallets, aggregate the trade history before scanning.
Dollar-cost averaging bots that buy a token weekly will almost certainly trigger wash sales if the token is also sold at a loss during the same period. The scanner flags overlapping buy/sell patterns within the 61-day window.
If a copy-trade system sells a token at a loss and the leader re-enters within 30 days, your copied trades inherit the wash sale. There is no "I didn't place the trade" exception.
When a sale at a loss is followed by multiple smaller purchases, the wash sale applies to each purchase up to the quantity of the loss-generating sale. The scanner handles partial matching.
Transferring tokens to another wallet you control and selling there does not avoid the wash sale rule. The rule follows the taxpayer, not the account.
After selling a token at a loss:
Token: SOL
Sale Date: 2025-03-15
Loss: $200.00
Window Closes: 2025-04-14
Days Remaining: 12
Status: DO NOT BUY — wash sale window active
Detailed step-by-step basis adjustment example:
TRADE 1: Buy 100 SOL @ $150.00 → Basis: $15,000.00
TRADE 2: Sell 100 SOL @ $120.00 → Proceeds: $12,000.00, Loss: $3,000.00
TRADE 3: Buy 100 SOL @ $125.00 → Basis before adjustment: $12,500.00
(within 30 days of Trade 2)
WASH SALE TRIGGERED:
Disallowed loss: $3,000.00
Adjusted basis: $12,500.00 + $3,000.00 = $15,500.00
Effective price: $155.00 per SOL (not $125.00)
Later sale at $160.00:
Proceeds: $16,000.00
Adj. basis: $15,500.00
Gain: $500.00 (not $3,500.00)
The $3,000 loss is recovered through the higher basis.
references/planned_features.md — Wash sale rules in depth, 61-day window mechanics, basis adjustment examples, automation edge cases, IRS guidance referencesscripts/wash_sale_scanner.py — Complete wash sale scanner: loads trade history, identifies wash sales, computes disallowed losses and basis adjustments, shows safe re-entry countdowns. Run with --demo for example scenarios.Automatically organizes invoices and receipts for tax preparation by reading messy files, extracting key information, renaming them consistently, and sorting them into logical folders. Turns hours of manual bookkeeping into minutes of automated organization.
Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.
This skill calculates key financial ratios and metrics from financial statement data for investment analysis
This skill provides an advanced financial modeling suite with DCF analysis, sensitivity testing, Monte Carlo simulations, and scenario planning for investment decisions
This skill retrieves upcoming earnings announcements for US stocks using the Financial Modeling Prep (FMP) API. Use this when the user requests earnings calendar data, wants to know which companies are reporting earnings in the upcoming week, or needs a weekly earnings review. The skill focuses on mid-cap and above companies (over $2B market cap) that have significant market impact, organizing the data by date and timing in a clean markdown table format. Supports multiple environments (CLI, Desktop, Web) with flexible API key management.
Crypto wallet operations via the awal CLI — sign in, check balances, send USDC/ETH/POL/SOL, trade tokens, fund the wallet, and use the x402 payment protocol to discover paid services, pay for API calls, monetize an API, or query onchain data. Use whenever the user mentions signing in, login, authentication, wallet status, balance, address, sending money, paying someone, transferring tokens, ENS names, swapping/trading/converting tokens, funding/topping up/onramp, USDC, ETH, POL, SOL, the x402 bazaar, paid APIs, monetizing an endpoint, or querying onchain data on Base.
Access real-time and historical stock market data, forex rates, cryptocurrency prices, commodities, economic indicators, and 50+ technical indicators via the Alpha Vantage API. Use when fetching stock prices (OHLCV), company fundamentals (income statement, balance sheet, cash flow), earnings, options data, market news/sentiment, insider transactions, GDP, CPI, treasury yields, gold/silver/oil prices, Bitcoin/crypto prices, forex exchange rates, or calculating technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands). Requires a free API key from alphavantage.co.
Braintree Automation: manage payment processing via Stripe-compatible tools for customers, subscriptions, payment methods, and transactions
Take agiprolabs/wash-sale-detection from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.