perp-funding-basis
できること
このスキルは、暗号資産の無期限先物のファンディングレートとベーシスの差を説明します。市場の混雑度を測ったり、キャリートレードをテストしたりしたいトレーダー向けです。
使う場面
- ✓暗号資産市場のトレーダーが、ロングかショートに大きく偏っているかを知りたいとき。
- ✓無期限先物のファンディングレートが異常に高くなったり、マイナスになったりしたとき。
- ✓キャリートレードの機会を探すため、現物価格と先物価格を比べているとき。
スキルのリンク
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/perp-funding-basis/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“ビットコインの無期限先物のファンディングレートは、今異常に高いですか?それは何を意味しますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、ファンディングレートを年率に換算し、先物価格と現物価格を比べます。プラスのファンディングが高いと、ロングのポジションが混み合っていることを示し、マイナスのファンディングはショートが混み合っていることを示します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Perpetual Funding Rate & Basis Trading
Overview
Analyze perpetual futures funding rates and spot-futures basis to identify carry trade opportunities, market positioning extremes, and directional sentiment signals. Funding rates are the single most important microstructure indicator in crypto derivatives — they reveal real-time leverage positioning and crowd sentiment.
Core Concepts
1. Funding Rate Mechanics
Perpetual futures have no expiry date. Instead, a funding rate is exchanged between longs and shorts every 8 hours (on most exchanges) to keep the perpetual price anchored to the spot price.
If perp price > spot price → funding rate positive → longs pay shorts
If perp price < spot price → funding rate negative → shorts pay longs
OKX funding rate schedule: payments at 00:00, 08:00, 16:00 UTC
Annualized funding rate:
# Funding rate is a per-8h DECIMAL, exactly as OKX/Binance return it
# (the API sends "0.0001" for 0.01%). 3 funding windows/day → × 3 × 365.
funding_rate_8h = 0.0001 # 0.01% per 8h, as a decimal
annualized = funding_rate_8h * 3 * 365 # 0.1095 → 10.95% annualized
Units convention (whole skill): all code treats the funding rate as a per-8h decimal (
0.0001= 0.01%), matching the raw OKX/Binance API value. The tables below show the equivalent percentages for readability — divide a table's%by 100 to get the decimal a comparison expects (+0.05%→0.0005).
2. Funding Rate Signal Framework
| Funding Rate (8h) | Annualized | Market State | Signal |
|---|---|---|---|
| > +0.05% | > +54.75% | Extreme long crowding | Contrarian short / reduce longs |
| +0.02% to +0.05% | +21.9% to +54.75% | Elevated long bias | Cautious, carry trade viable |
| +0.005% to +0.02% | +5.5% to +21.9% | Mild long bias | Neutral to mild bullish |
| -0.005% to +0.005% | -5.5% to +5.5% | Balanced | Neutral |
| -0.02% to -0.005% | -21.9% to -5.5% | Mild short bias | Neutral to mild bearish |
| < -0.02% | < -21.9% | Short squeeze territory | Contrarian long / reduce shorts |
Funding rate regime detection:
def funding_regime(rates_7d):
"""Classify funding rate regime from 7-day history."""
avg = sum(rates_7d) / len(rates_7d)
consecutive_positive = all(r > 0 for r in rates_7d[-3:])
consecutive_negative = all(r < 0 for r in rates_7d[-3:])
if avg > 0.0003 and consecutive_positive: # > +0.03% per 8h
return "overheated_long" # High risk of long squeeze
elif avg > 0.0001 and consecutive_positive: # > +0.01% per 8h
return "bullish_carry" # Good carry trade environment
elif avg < -0.0002 and consecutive_negative: # < -0.02% per 8h
return "overheated_short" # High risk of short squeeze
elif avg < -0.00005 and consecutive_negative: # < -0.005% per 8h
return "bearish_carry" # Inverse carry trade
else:
return "neutral"
3. Spot-Futures Basis Analysis
Basis = Futures price - Spot price
For dated futures (quarterly), basis reflects cost-of-carry expectations:
# Annualized basis
def annualized_basis(futures_price, spot_price, days_to_expiry):
basis_pct = (futures_price - spot_price) / spot_price
annualized = basis_pct * (365 / days_to_expiry)
return annualized
# Example: BTC spot $65,000, quarterly future $66,500, 45 days to expiry
# Basis: 2.31%, Annualized: 18.7%
Basis signal interpretation:
| Annualized Basis | Market State | Signal |
|---|---|---|
| > 30% | Extreme contango, euphoric leverage | Sell basis (cash-carry), top warning |
| 15-30% | Elevated contango, bullish leverage | Carry trade attractive |
| 5-15% | Normal contango | Neutral, mild bullish |
| 0-5% | Flat basis | Low conviction, wait for direction |
| < 0% (backwardation) | Bearish, forced selling | Contrarian long, extreme pessimism |
4. Cash-Carry Arbitrage (Delta-Neutral)
Strategy: buy spot + sell perpetual futures → collect funding rate
# Cash-carry trade P&L
def carry_trade_pnl(spot_entry, funding_rates, position_size):
"""
Delta-neutral carry: long spot + short perp
P&L comes purely from funding rate collection.
"""
total_funding_collected = 0
for rate in funding_rates:
if rate > 0: # Longs pay shorts → we collect as short
total_funding_collected += rate
よくある質問
誰がファンディングレートを払いますか?
ファンディングがプラスのときはロングがショートに払い、マイナスのときはショートがロングに払います。
ファンディングはどれくらいの頻度で支払われますか?
OKXを含む多くの取引所では、8時間ごとに支払われます。
キャリートレードとは何ですか?
現物の資産を買い、先物を売ってベーシスの差を得る取引で、それでも一部のリスクはあります。
詳細
作者による元の説明
Perpetual futures funding rate analysis and cash-carry basis trading — funding rate regimes, annualized basis signals, carry trade construction, and funding rate arbitrage between exchanges.
repo: HKUDS/Vibe-Trading
人気
- GitHubのスター
- 37k
- ランキング
- #7542
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
vibe-trading
37kバックテスト、ファクター分析、オプション価格、多くの市場にまたがる市場データを含む、金融リサーチの完全なツールキットをエージェントに与えます。
adr-hshare
37k中国企業が複数の市場に上場している価格差、例えば米国のADRと香港株の差を比べる方法をエージェントに示します。
akshare
37kエージェントが、APIキーなしで、中国と世界の株式、先物、外国為替、経済指標の無料の市場データを取得できるよう支援します。
alpha-zoo
37k既製のストックファクターのライブラリを閲覧し、選んだ市場で一群のファクターがリターンをどれだけ予測するかを検証できるよう支援します。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。