Leveraged Trading: Gains and Losses in IRPF
Leveraged trading —futures, margin trading, and CFDs— is increasingly common in the crypto ecosystem. Its tax treatment has important nuances that are worth understanding well.
Crypto Futures
Futures contracts are agreements to buy or sell an asset at a set price on a future date. When closing the position (or upon settlement), a gain or loss is realized.
Tax Classification:
Crypto futures are taxed as capital gains or losses (ganancias o pérdidas patrimoniales) in the savings base when the position is closed.
Taxable Event Timing: At the closing of the position, not when opening the contract.
Calculation Base:
- Closing price − Opening price (adjusted for fees and financing).
Perpetual Swaps and Funding Rates
Perpetual contracts have no expiry date but periodically charge or pay a "funding rate" between long and short positions.
- Funding rate received: Investment income (rendimiento del capital mobiliario).
- Funding rate paid: Deductible expense of the operation (reduces the gain).
Margin Trading (Collateral and Liquidations)
In margin trading, you use your crypto as collateral to trade with more capital than you have.
Tax Aspects:
- Using collateral to open a margin position does not trigger a taxable event.
- Gains and losses from positions are capital gains/losses upon closing.
- If the exchange liquidates your position (margin call), the liquidation is the closing date → gain or loss at that moment.
- Interest paid for the borrowed margin is not deductible for individuals.
CFDs on Cryptocurrencies
CFDs are contracts for difference where you never own the underlying asset. The gain is the difference between the opening and closing price.
Classification: Capital gain or loss, same as futures.
Important: Many CFD providers are based abroad. Gains must still be reported, even if there is no withholding tax.
Offsetting Leverage Losses
Losses from futures, margin, and CFDs are capital losses in the savings base and are offset against other capital gains (including spot crypto gains) following the same rules we already know.
Taxation of Operations on Derivative Exchanges
Most major crypto derivative exchanges (Binance Futures, Bybit, OKX…) are not established in Spain and do not apply withholding tax. The responsibility to report gains lies entirely with the taxpayer.
Summary
| Instrument | Classification | Taxable Event Timing |
|---|---|---|
| Futures | Capital gain/loss | Upon closing position |
| Perpetuals | Capital gain/loss | Upon closing position |
| Funding rate received | Investment income | Periodically |
| CFDs | Capital gain/loss | Upon closing position |
| Margin call (liquidation) | Capital gain/loss | Upon being liquidated |
Conclusion
Leveraged trading can generate both large gains and large losses, and both must be reported. Keeping a detailed record of every operation —opening price, closing price, fees, and funding— is essential to correctly calculate the tax result.


