crypto-derivatives
This Claude Code skill provides strategies for three major cryptocurrency derivatives approaches: perpetual funding-rate arbitrage that exploits regular settlement payments between longs and shorts, futures term-structure trading that trades price differences across contract expiries, and options volatility strategies that analyze price-smile patterns and Greeks. Use this skill when developing quantitative trading systems on OKX and Deribit exchanges that require understanding funding mechanisms, basis relationships, or derivative pricing dynamics.
git clone --depth 1 https://github.com/HKUDS/Vibe-Trading /tmp/crypto-derivatives && cp -r /tmp/crypto-derivatives/agent/src/skills/crypto-derivatives ~/.claude/skills/crypto-derivativesSKILL.md
# Crypto-Derivatives Strategies
## Overview
Covers three major crypto-derivatives strategy directions: perpetual funding-rate arbitrage, futures term-structure trading, and options strategies (volatility trading). The main exchanges are OKX and Deribit.
## Perpetual Funding-Rate Arbitrage
### Funding-Rate Mechanism
```
Perpetual contracts have no expiry and rely on the funding rate to anchor prices to spot:
Funding rate > 0: longs pay shorts (strong bullish sentiment)
Funding rate < 0: shorts pay longs (strong bearish sentiment)
Settlement frequency: OKX settles every 8 hours (00:00 / 08:00 / 16:00 UTC)
Annualized return = funding rate × 3 × 365
```
### Arbitrage Strategies
```
Positive carry arbitrage (funding rate > 0):
Long spot + short perpetual = net delta close to zero
Return source: collect funding every 8 hours
Reverse carry arbitrage (funding rate < 0, less common):
Short spot (borrow coin and sell) + long perpetual
Return source: collect funding every 8 hours
```
### Funding-Rate Signals
| Funding Rate (8h) | Annualized | Market Sentiment | Strategy Signal |
|-------------|------|---------|---------|
| > 0.1% | > 109% | Extreme greed | Short signal (rate is unsustainable) |
| 0.03-0.1% | 33-109% | Bullish bias | Positive carry arbitrage is attractive |
| 0.01-0.03% | 11-33% | Normal bullish | Positive carry arbitrage is tradable |
| -0.01~0.01% | -11~11% | Neutral | No arbitrage opportunity |
| < -0.01% | < -11% | Bearish bias | Reverse carry arbitrage or stop-loss |
| < -0.1% | < -109% | Extreme panic | Long signal (rate is unsustainable) |
### Arbitrage Risk Control
```
Risk points:
1. Insufficient margin: the derivatives leg requires margin, and extreme moves can liquidate the account
2. Funding reversal: a positive rate can suddenly turn negative, making the arbitrage unprofitable
3. Basis volatility: changes in the spot-futures basis can cause floating losses
4. Exchange risk: withdrawal limits, downtime, liquidation-mechanism differences
Risk parameters:
- Leverage: no more than 3x (arbitrage does not need high leverage)
- Margin ratio: keep >50% (far from liquidation)
- Single-coin allocation: <30% (diversification)
- Stop-loss: close when floating loss exceeds expected return over 3 months
```
## Term-Structure Trading
### Basic Concepts
```
Term structure = futures price curve across different expiries
Contango: far month > near month > spot
- Meaning: market expects higher future prices
- Common in bull markets or normal market conditions
Backwardation: far month < near month < spot
- Meaning: market expects lower future prices or spot shortage
- Common in bear markets or after extreme events
```
### Term-Structure Metrics
```python
def term_structure_spread(spot_price, futures_prices: dict) -> dict:
"""
Args:
spot_price: Spot price
futures_prices: {expiry: price}, for example {'2026-06': 105000, '2026-09': 107000}
Returns:
Basis, annualized basis, and structure type
"""
results = {}
for expiry, price in futures_prices.items():
days_to_expiry = (pd.Timestamp(expiry) - pd.Timestamp.now()).days
basis = (price - spot_price) / spot_price
annualized = basis / days_to_expiry * 365
results[expiry] = {
'basis': basis,
'annualized_basis': annualized,
'days': days_to_expiry,
}
return results
```
### Trading Strategies
| Strategy | Action | Applicable Environment | Risk |
|------|------|---------|------|
| Cash-and-Carry | Long spot + short futures | Significant contango (annualized >15%) | Exchange risk |
| Calendar Spread | Long near month + short far month | Expect contango convergence | Basis widening |
| Reverse Calendar | Short near month + long far month | Expect backwardation convergence | Basis reversal |
### Historical Regularities of BTC Term Structure
```
- Bull market: contango annualized 15-40%, quarterly futures premium 5-10%
- Bear market: backwardation or contango annualized <5%
- Around halving: contango usually widens
- Extreme crashes: brief backwardation (such as March 12 and May 19)
```
## Options Strategies
### Overview of the Crypto Options Market
| Exchange | Underlyings | Characteristics |
|--------|------|------|
| Deribit | BTC / ETH | Largest options exchange, >80% market share |
| OKX | BTC / ETH | Second largest, liquidity still growing |
| Binance | BTC / ETH | Weaker liquidity |
### Basic Greeks
| Greek | Meaning | Crypto-Specific Characteristic |
|-------|------|-----------|
| Delta | Change in option price for a 1% move in the underlying | BTC is highly volatile, so Delta changes quickly |
| Gamma | Rate of change of Delta | ATM options have the highest Gamma |
| Theta | Time decay (per day) | Crypto trades 7x24, so there are no weekends off |
| Vega | Impact of a 1% move in implied volatility | BTC IV is often 50-120%, far above traditional assets |
| Rho | Rate sensitivity | In crypto markets, the rate proxy is DeFi yield |
### Volatility Smile / Skew
```
Characteristics of the BTC option volatility surface:
1. Smile: IV of OTM puts and OTM calls is both higher than ATM IV
2. Skew: usually OTM put IV > OTM call IV (downside-protection demand)
3. Reverse skew: in bull markets, OTM call IV may exceed OTM put IV
25Δ Risk Reversal = IV(25Δ Call) - IV(25Δ Put)
> 0: bullish skew
< 0: bearish skew (normal state)
The larger the absolute value, the steeper the skew
```
### Common Options Strategies
#### 1. Short Straddle
```
Action: sell ATM call + ATM put simultaneously
Return source: time decay (Theta income)
Risk: large move in the underlying
Applicable when: IV is considered too high and the market is expected to stay range-bound
BTC parameter suggestions:
- Consider selling when IV > 80%
- Expiry: 7-14 days (faster decay)
- Margin: at least 30% of underlying notional
```
#### 2. Protective Put
```
Action: hold spot + buy OTM put
Purpose: hedge downside risk
CProfessional finance research toolkit — backtesting (7 engines + benchmark comparison panel), factor analysis, Alpha Zoo (452 pre-built alphas across qlib158/alpha101/gtja191/academic), options pricing, 77 finance skills, 29 multi-agent swarm teams, Trade Journal analyzer, and Shadow Account (extract → backtest → render) across 7 data sources (tushare, yfinance, okx, akshare, mootdx, ccxt, futu).
ADR/H-share/A-share cross-listing premium analysis — track pricing gaps between US-listed ADRs, HK-listed H-shares, and A-shares for arbitrage signals, dual-listing valuation, and delisting risk assessment.
AKShare financial data aggregator (18k+ stars). Free, no API key. Covers A-shares, US, HK, futures, macro, forex. Primary fallback for tushare and yfinance.
Browse and bench the bundled alpha zoos — prebuilt cross-sectional factor libraries (Kakushadze 101, GTJA 191, Qlib 158, Fama-French / Carhart). Use when the user asks "which alphas exist", wants metadata on a named alpha, or wants to run IC/IR on a whole zoo over a universe.
A 股 ST/*ST 风险预测框架 — 基于最新中报/三季报或业绩预告/快报,预测下一财年是否会因营收、利润、净资产、分红不达标而被风险警示,并将新浪监管处罚记录作为独立证据面纳入风险等级。仅适用于 A 股,不预测财务造假。
Asset allocation theory and optimizer usage — MPT / Black-Litterman / risk budgeting / all-weather strategy, including guides for 4 optimizers and rebalancing rules.
Diagnose failed or underperforming backtests, locate the root cause, and fix the issue
Behavioral finance applications: theories of overreaction and underreaction, behavioral explanations for momentum and reversal, investor sentiment cycles, cognitive-bias checklists, and debiasing quantitative strategies.