backtrader
Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers,…
Real-time tax liability analysis for active crypto traders with proportional cost basis, gain classification, and tax-aware trading signals
$ npx -y skills add agiprolabs/claude-trading-skills --skill tax-liability-tracking --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/tax-liability-trackingContext preview
The summary Claude sees to decide when to auto-load this skill.
Real-time tax liability analysis for active crypto traders with proportional cost basis, gain classification, and tax-aware trading signals
name: tax-liability-tracking description: Real-time tax liability analysis for active crypto traders with proportional cost basis, gain classification, and tax-aware trading signals license: MIT metadata: author: agipro version: "0.1.0" category: trading
Real-time tax liability analysis purpose-built for active Solana traders. Track proportional cost basis across partial sells, classify realized vs unrealized gains, project quarterly tax obligations, and surface tax-aware signals that feed back into trading decisions.
Active crypto traders generate hundreds of taxable events per year. Without real-time tracking:
This skill keeps a running tax ledger alongside your trading activity so every decision incorporates its tax consequence.
This is the most critical concept. When you sell a portion of a position, the cost basis splits proportionally — it does not shift to zero for the remaining tokens.
**Example — The Accumulate / House-Money Play:**
1. **Buy**: 1,000 tokens at $1.00 each. Total cost basis = $1,000. 2. **Partial sell**: Sell 800 tokens at $1.25 each. Proceeds = $1,000. 3. **What happened**:
**Common mistake**: Recording the partial sell as "capital recovered, remaining basis = $0." This understates the realized gain on the partial sell and overstates the gain when the remaining tokens are eventually sold. The total tax owed is the same either way, but the timing and classification (short-term vs long-term) can differ significantly.
| Classification | Holding Period | US Federal Rate (2024) | |---|---|---| | Short-term capital gain | < 1 year | Ordinary income rate (10-37%) | | Long-term capital gain | >= 1 year | 0%, 15%, or 20% |
Each tax lot tracks its own acquisition date. Partial sells consume lots in the order specified by your accounting method (FIFO, LIFO, or specific identification).
Solana traders typically think in SOL but US tax obligations are denominated in USD. Every taxable event requires:
1. **SOL price at acquisition** — establishes USD cost basis 2. **SOL price at disposition** — establishes USD proceeds 3. **Token price in SOL at both events** — converted to USD via SOL/USD rate
The skill tracks SOL/USD rates at each event timestamp to compute USD-denominated gains.
The after-tax P&L view shows both, with unrealized gains marked at current estimated tax rates.
from tax_tracker import TaxTracker, Trade
tracker = TaxTracker(
accounting_method="fifo",
federal_bracket=0.32, # Your marginal federal rate
state_rate=0.05, # Your state income tax rate
long_term_rate=0.15, # Your long-term capital gains rate
)
# Record the accumulate/house-money play
tracker.add_trade(Trade(
timestamp="2025-06-15T10:00:00Z",
side="buy",
token="BONK",
amount=1_000_000,
price_usd=0.00002, # Per-token price in USD
total_usd=20.00,
))
tracker.add_trade(Trade(
timestamp="2025-07-20T14:30:00Z",
side="sell",
token="BONK",
amount=800_000, # Sell 80% to recover capital
price_usd=0.000025,
total_usd=20.00,
))
# Check what happened
summary = tracker.position_summary("BONK")
print(f"Realized gain: ${summary.realized_gain:.2f}")
# Realized gain: $4.00 (sold 800k at $0.000025 = $20, basis = $16, gain = $4)
print(f"Remaining basis: ${summary.remaining_cost_basis:.2f}")
# Remaining basis: $4.00 (200k tokens x $A comprehensive collection of 68 ready-to-use trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools.
Repo: agiprolabs/claude-trading-skills
Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers,…
Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security…
Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market stats,…
Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability…
Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading
Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail…