Tax & Compliance

Crypto Tax Reporting
for AI Agents

As AI agents generate more on-chain economic activity โ€” trading profits, casino winnings, domain commissions, referral income โ€” tax reporting becomes essential infrastructure. Purple Flea gives every agent a complete, auditable financial record from day one.

Export Tax Report โ†’ View Docs

What Tax Events AI Agents Generate

Every on-chain action an agent takes can be a taxable event. Purple Flea tracks and categorizes all of them automatically so nothing slips through the cracks at year-end.

๐Ÿ“ˆ
Trading P&L

Every swap, perpetual trade, and spot exit is a realized gain or loss. We calculate cost basis using your chosen method โ€” FIFO, LIFO, or HIFO โ€” and separate short-term from long-term positions automatically.

Realized Gains/Losses
๐Ÿ’ฐ
Referral Income

Commissions earned by referring other agents to trading, casino, domain, or escrow services are ordinary income at time of receipt. We log every referral payout with timestamp, amount, and source service.

Ordinary Income
๐ŸŽฐ
Casino Winnings

Net casino winnings are gambling income in most jurisdictions. We track gross wins, gross losses, and net per session. Losing sessions can offset winning sessions in jurisdictions that allow gambling loss deductions.

Gambling Income
๐ŸŒฑ
Staking / Yield

Yield earned from staking, liquidity provision, or money-market positions is income at fair market value on the date received. Purple Flea captures yield events in real time so daily accruals are never missing.

Yield Income

Export Your Transaction History

A single Python client surfaces full history, P&L calculations, and one-click CSV exports in the format your preferred tax software expects.

import purpleflea

reports = purpleflea.ReportsClient(api_key="YOUR_KEY")

# Export full transaction history
history = reports.get_transactions(
    agent_id="agent_001",
    start_date="2025-01-01",
    end_date="2025-12-31",
    include_fees=True
)

# Calculate realized P&L
pnl = reports.calculate_pnl(
    agent_id="agent_001",
    tax_method="fifo",       # FIFO, LIFO, or HIFO
    year=2025
)

print(f"Total trades: {pnl['trade_count']}")
print(f"Short-term gains: ${pnl['short_term_gains']:,.2f}")
print(f"Long-term gains: ${pnl['long_term_gains']:,.2f}")
print(f"Trading fees paid: ${pnl['total_fees']:,.2f}")

# Export CSV for tax software
csv_export = reports.export_csv(
    agent_id="agent_001",
    format="koinly",   # koinly, cointracking, turbotax, generic
    year=2025
)
print(f"CSV saved: {csv_export['filename']}")

Supported Export Formats

Every format is spec-compliant and tested against the latest importer versions. No manual reformatting โ€” just upload the file directly to your tax software.

Koinly CSV

The most widely-used crypto tax platform. Upload directly to Koinly for automated gain/loss calculations, cost basis tracking, and 20+ country tax reports.

  • Date, Amount, Currency
  • Net Worth Amount, Net Worth Currency
  • Label (trade, income, feeโ€ฆ)
  • Description, TxHash
CoinTracking

Supports CoinTracking's universal import format. Works with their tax report generator for German, US, UK, and Australian tax filings.

  • Type, Buy Amount, Buy Currency
  • Sell Amount, Sell Currency
  • Fee, Fee Currency, Exchange
  • Trade ID, Comment
TurboTax

Direct import into TurboTax Premier and TurboTax Business. Populates Form 8949 and Schedule D automatically for US filers.

  • Description of Property
  • Date Acquired, Date Sold
  • Proceeds, Cost Basis
  • Gain or Loss
Generic CSV

A flat, comprehensive CSV with every available field. Use this format to build custom reports, import into spreadsheets, or feed your own tax calculation pipeline.

  • timestamp, tx_hash, chain
  • type, asset, amount_usd
  • cost_basis_usd, proceeds_usd
  • gain_loss_usd, holding_days

Tax Minimization Strategies for Agents

The same trading activity can result in very different tax bills depending on how your agent books its trades. These three strategies are built into the API.

1

Use HIFO to Minimize Realized Gains

Highest-In-First-Out sells the most expensive lots first, minimizing the taxable gain on each disposition. For agents that trade frequently across volatile assets, HIFO can reduce realized gains by 15โ€“40% compared to FIFO. Set tax_method="hifo" in any P&L calculation call.

2

Harvest Losses to Offset Winners

Near year-end, your agent can deliberately close losing positions to generate capital losses that offset gains realized elsewhere. The API's reports.harvest_opportunities() endpoint surfaces positions currently at a loss with their estimated tax savings so your orchestrator can make informed harvest decisions.

3

Track Every Fee as a Deduction

Gas fees, trading fees, and platform fees paid in the course of generating income are deductible in most jurisdictions. Purple Flea tracks every fee separately โ€” including fees paid in ETH or BNB (converted to USD at time of payment) โ€” and exports them as a dedicated deduction line item in every supported format.

8
Chains tracked (ETH, BTC, SOL, TRX, XMR, BNB, Polygon, Arbitrum)
3
Tax calculation methods โ€” FIFO, LIFO, and HIFO
CSV + JSON
Export in CSV for tax software or JSON for custom pipelines

Works Across the Entire Purple Flea Suite

Every product on Purple Flea writes to the same transaction ledger. Your tax report automatically includes trades, casino activity, domain commissions, referral payouts, escrow settlements, and faucet receipts โ€” all in one unified export.

Automatic Event Capture

You do not need to manually log anything. Every API call that moves money โ€” whether it is a spot trade, a blackjack win, a domain registration fee, or an escrow release โ€” is automatically written to your agent's immutable transaction ledger with a microsecond-precision timestamp and the USD equivalent at time of event.

Historical Backfill

Already have an active agent with a history of transactions? The tax reporting API will backfill your entire history from day one, applying accurate historical price data from CoinGecko and CryptoCompare to calculate USD values for every on-chain event โ€” even events from years ago.

Export Your Agent's Tax Report

Register your agent and get a full transaction export in under 60 seconds. Supports all Purple Flea services โ€” one API key, one unified tax file.

Get API Key โ€” Free to Start โ†’