@intentsolutionsio/crypto-derivatives-tracker 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,25 @@
1
1
  ---
2
2
  name: tracking-crypto-derivatives
3
- description: |
4
- Track cryptocurrency futures, options, and perpetual swaps with funding rates, open interest, liquidations, and comprehensive derivatives market analysis.
5
- Use when monitoring derivatives markets, analyzing funding rates, tracking open interest, finding liquidation levels, or researching options flow.
6
- Trigger with phrases like "funding rate", "open interest", "perpetual swap", "futures basis", "liquidation levels", "options flow", "put call ratio", "derivatives analysis", or "BTC perps".
3
+ description: 'Track cryptocurrency futures, options, and perpetual swaps with funding
4
+ rates, open interest, liquidations, and comprehensive derivatives market analysis.
5
+
6
+ Use when monitoring derivatives markets, analyzing funding rates, tracking open
7
+ interest, finding liquidation levels, or researching options flow.
8
+
9
+ Trigger with phrases like "funding rate", "open interest", "perpetual swap", "futures
10
+ basis", "liquidation levels", "options flow", "put call ratio", "derivatives analysis",
11
+ or "BTC perps".
12
+
13
+ '
7
14
  allowed-tools: Read, Write, Edit, Grep, Glob, Bash(crypto:derivatives-*)
8
15
  version: 1.0.0
9
16
  author: Jeremy Longshore <jeremy@intentsolutions.io>
10
17
  license: MIT
11
- compatible-with: claude-code, codex, openclaw
12
- tags: [crypto, monitoring, tracking-crypto]
18
+ tags:
19
+ - crypto
20
+ - monitoring
21
+ - tracking-crypto
22
+ compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
13
23
  ---
14
24
  # Tracking Crypto Derivatives
15
25
 
@@ -29,27 +39,32 @@ Aggregate funding rates, open interest, liquidations, and options data across CE
29
39
  ## Instructions
30
40
 
31
41
  1. **Check funding rates** across exchanges to identify sentiment and arbitrage opportunities:
42
+
32
43
  ```bash
33
44
  python derivatives_tracker.py funding BTC
34
45
  python derivatives_tracker.py funding BTC ETH SOL
35
46
  python derivatives_tracker.py funding BTC --history 7d
36
47
  ```
48
+
37
49
  - Positive funding (>0.01%): Longs pay shorts, bullish sentiment
38
50
  - Negative funding (<-0.01%): Shorts pay longs, bearish sentiment
39
51
  - Extreme funding (>0.1%): Potential contrarian opportunity
40
52
 
41
53
  2. **Analyze open interest** to gauge market positioning and trend strength:
54
+
42
55
  ```bash
43
56
  python derivatives_tracker.py oi BTC
44
57
  python derivatives_tracker.py oi BTC --changes
45
58
  python derivatives_tracker.py oi BTC --divergence
46
59
  ```
60
+
47
61
  - Rising OI + Rising Price = strong bullish trend
48
62
  - Rising OI + Falling Price = strong bearish trend
49
63
  - Falling OI + Rising Price = short covering rally
50
64
  - Falling OI + Falling Price = long liquidations
51
65
 
52
66
  3. **Monitor liquidations** to find support/resistance clusters:
67
+
53
68
  ```bash
54
69
  python derivatives_tracker.py liquidations BTC
55
70
  python derivatives_tracker.py liquidations BTC --recent
@@ -57,6 +72,7 @@ Aggregate funding rates, open interest, liquidations, and options data across CE
57
72
  ```
58
73
 
59
74
  4. **Analyze options market** for IV, put/call ratio, and max pain:
75
+
60
76
  ```bash
61
77
  python derivatives_tracker.py options BTC
62
78
  python derivatives_tracker.py options BTC --pcr
@@ -64,6 +80,7 @@ Aggregate funding rates, open interest, liquidations, and options data across CE
64
80
  ```
65
81
 
66
82
  5. **Calculate basis** for spot-futures arbitrage opportunities:
83
+
67
84
  ```bash
68
85
  python derivatives_tracker.py basis BTC
69
86
  python derivatives_tracker.py basis BTC --quarterly
@@ -71,6 +88,7 @@ Aggregate funding rates, open interest, liquidations, and options data across CE
71
88
  ```
72
89
 
73
90
  6. **Run full dashboard** for comprehensive derivatives overview:
91
+
74
92
  ```bash
75
93
  python derivatives_tracker.py dashboard BTC
76
94
  python derivatives_tracker.py dashboard BTC ETH SOL
@@ -100,21 +118,25 @@ See `${CLAUDE_SKILL_DIR}/references/implementation.md` for detailed output forma
100
118
  ## Examples
101
119
 
102
120
  **Morning derivatives check** - Scan funding, OI, and liquidations for top assets:
121
+
103
122
  ```bash
104
123
  python derivatives_tracker.py dashboard BTC ETH SOL
105
124
  ```
106
125
 
107
126
  **Funding rate arbitrage** - Alert when funding exceeds threshold for cash-and-carry:
127
+
108
128
  ```bash
109
129
  python derivatives_tracker.py funding BTC --alert-threshold 0.08
110
130
  ```
111
131
 
112
132
  **Pre-expiry options analysis** - Check max pain and IV before Friday expiry:
133
+
113
134
  ```bash
114
135
  python derivatives_tracker.py options BTC --expiry friday
115
136
  ```
116
137
 
117
138
  **Basis trading scan** - Find all pairs with annualized yield above 5%:
139
+
118
140
  ```bash
119
141
  python derivatives_tracker.py basis --all --min-yield 5 # 5 = minimum annualized yield %
120
142
  ```
@@ -5,6 +5,7 @@
5
5
  ### Authentication Failures
6
6
 
7
7
  **API Key Invalid**
8
+
8
9
  - Error: `Invalid API key` or `Signature mismatch`
9
10
  - Causes: Expired key, wrong permissions, clock drift
10
11
  - Solution:
@@ -14,12 +15,14 @@
14
15
  4. Check key has futures/derivatives permissions
15
16
 
16
17
  **IP Whitelist Rejected**
18
+
17
19
  - Error: `IP not in whitelist`
18
20
  - Solution: Add current IP to exchange API settings or remove whitelist restriction
19
21
 
20
22
  ### Rate Limiting
21
23
 
22
24
  **Too Many Requests**
25
+
23
26
  - Error: `429 Too Many Requests` or `Rate limit exceeded`
24
27
  - Threshold varies by exchange:
25
28
  - Binance: 1200 requests/minute (weighted)
@@ -33,6 +36,7 @@
33
36
  4. Batch requests where possible
34
37
 
35
38
  **Weight Exceeded**
39
+
36
40
  - Error: `Request weight exceeded`
37
41
  - Solution: Some endpoints cost more weight; use lightweight endpoints or wait
38
42
 
@@ -41,6 +45,7 @@
41
45
  ### Missing or Stale Data
42
46
 
43
47
  **No Data Available**
48
+
44
49
  - Error: `No funding data available for {symbol}`
45
50
  - Causes: Symbol not listed, exchange down, maintenance
46
51
  - Solution:
@@ -50,6 +55,7 @@
50
55
  4. Use mock data for testing
51
56
 
52
57
  **Stale Timestamp**
58
+
53
59
  - Error: Data timestamp older than expected
54
60
  - Solution:
55
61
  1. Check WebSocket connection alive
@@ -60,10 +66,12 @@
60
66
  ### Invalid Values
61
67
 
62
68
  **Negative Funding Rate**
69
+
63
70
  - Not an error - negative funding is valid (shorts pay longs)
64
71
  - Just ensure your calculations handle negative correctly
65
72
 
66
73
  **Zero Open Interest**
74
+
67
75
  - May indicate:
68
76
  - New symbol with no positions
69
77
  - Data not yet populated
@@ -71,6 +79,7 @@
71
79
  - Solution: Filter out or flag as incomplete
72
80
 
73
81
  **Implausible Values**
82
+
74
83
  - Funding rate > 10% per 8h → likely data error
75
84
  - IV > 500% → verify or exclude
76
85
  - Solution: Implement sanity checks and outlier filtering
@@ -80,9 +89,11 @@
80
89
  ### Division by Zero
81
90
 
82
91
  **Empty Exchange List**
92
+
83
93
  - Error: `Division by zero` in weighted average
84
94
  - Cause: No exchanges returned data
85
95
  - Solution:
96
+
86
97
  ```python
87
98
  if not exchanges:
88
99
  raise ValueError("No exchange data available")
@@ -94,8 +105,10 @@ if total == 0:
94
105
  ### Decimal Precision
95
106
 
96
107
  **Precision Loss**
108
+
97
109
  - Error: Incorrect basis calculations due to floating point
98
110
  - Solution: Use `Decimal` for all price/rate calculations
111
+
99
112
  ```python
100
113
  from decimal import Decimal, ROUND_HALF_UP
101
114
  basis = (futures - spot) / spot
@@ -105,9 +118,11 @@ basis_pct = float(basis.quantize(Decimal('0.0001')))
105
118
  ### Date Handling
106
119
 
107
120
  **Invalid Expiry Format**
121
+
108
122
  - Error: `strptime` fails on expiry string
109
123
  - Cause: Different exchange formats (YYYYMMDD vs YYYY-MM-DD)
110
124
  - Solution:
125
+
111
126
  ```python
112
127
  formats = ['%Y-%m-%d', '%Y%m%d', '%d%b%y']
113
128
  for fmt in formats:
@@ -119,6 +134,7 @@ raise ValueError(f"Unknown expiry format: {expiry}")
119
134
  ```
120
135
 
121
136
  **Expiry Already Passed**
137
+
122
138
  - Warning: Analyzing expired contract
123
139
  - Solution: Filter to active expiries only
124
140
 
@@ -127,6 +143,7 @@ raise ValueError(f"Unknown expiry format: {expiry}")
127
143
  ### Connection Failures
128
144
 
129
145
  **Connection Timeout**
146
+
130
147
  - Error: `Connection timed out`
131
148
  - Solution:
132
149
  1. Increase timeout: `timeout=30`
@@ -135,6 +152,7 @@ raise ValueError(f"Unknown expiry format: {expiry}")
135
152
  4. Check network connectivity
136
153
 
137
154
  **SSL Certificate Error**
155
+
138
156
  - Error: `SSL: CERTIFICATE_VERIFY_FAILED`
139
157
  - Solution:
140
158
  1. Update CA certificates
@@ -143,6 +161,7 @@ raise ValueError(f"Unknown expiry format: {expiry}")
143
161
  ### WebSocket Issues
144
162
 
145
163
  **Disconnected**
164
+
146
165
  - Error: WebSocket connection closed unexpectedly
147
166
  - Solution:
148
167
  1. Implement reconnection logic
@@ -201,22 +220,27 @@ def record_failure(exchange):
201
220
  ## Common Issues by Exchange
202
221
 
203
222
  ### Binance
223
+
204
224
  - Issue: Weight limits are complex (different endpoints cost different)
205
225
  - Solution: Track weight counter from response headers
206
226
 
207
227
  ### Bybit
228
+
208
229
  - Issue: V5 API has different structure than V3
209
230
  - Solution: Use unified V5 endpoints consistently
210
231
 
211
232
  ### OKX
233
+
212
234
  - Issue: Requires specific headers for authentication
213
235
  - Solution: Include `OK-ACCESS-*` headers correctly
214
236
 
215
237
  ### Deribit
238
+
216
239
  - Issue: Options data requires authentication
217
240
  - Solution: Use API key even for read-only data
218
241
 
219
242
  ### BitMEX
243
+
220
244
  - Issue: Rate limits are very strict
221
245
  - Solution: Aggressive caching, minimal polling
222
246
 
@@ -5,11 +5,13 @@
5
5
  ### Funding Rate Analysis
6
6
 
7
7
  **Basic funding rate check:**
8
+
8
9
  ```bash
9
10
  python derivatives_tracker.py funding BTC
10
11
  ```
11
12
 
12
13
  Output:
14
+
13
15
  ```
14
16
  ======================================================================
15
17
  BTC FUNDING RATE ANALYSIS
@@ -32,6 +34,7 @@ Sentiment: 🟢 Moderate Bullish
32
34
  ```
33
35
 
34
36
  **JSON export:**
37
+
35
38
  ```bash
36
39
  python derivatives_tracker.py funding BTC --format json
37
40
  ```
@@ -39,11 +42,13 @@ python derivatives_tracker.py funding BTC --format json
39
42
  ### Open Interest Analysis
40
43
 
41
44
  **Basic OI check:**
45
+
42
46
  ```bash
43
47
  python derivatives_tracker.py oi BTC
44
48
  ```
45
49
 
46
50
  Output:
51
+
47
52
  ```
48
53
  ======================================================================
49
54
  BTC OPEN INTEREST ANALYSIS
@@ -68,11 +73,13 @@ Dominant Exchange: Binance (41.3%)
68
73
  ```
69
74
 
70
75
  **With divergence analysis:**
76
+
71
77
  ```bash
72
78
  python derivatives_tracker.py oi BTC --price-change 3.5
73
79
  ```
74
80
 
75
81
  Output includes:
82
+
76
83
  ```
77
84
  ────────────────────────────────────────────────────────────────────────
78
85
  DIVERGENCE ANALYSIS
@@ -89,11 +96,13 @@ DIVERGENCE ANALYSIS
89
96
  ### Liquidation Monitoring
90
97
 
91
98
  **Basic liquidation summary:**
99
+
92
100
  ```bash
93
101
  python derivatives_tracker.py liquidations BTC
94
102
  ```
95
103
 
96
104
  Output:
105
+
97
106
  ```
98
107
  ======================================================================
99
108
  BTC LIQUIDATION MONITOR
@@ -127,11 +136,13 @@ SHORT LIQUIDATIONS (above $67,500):
127
136
  ```
128
137
 
129
138
  **With large liquidation history:**
139
+
130
140
  ```bash
131
141
  python derivatives_tracker.py liquidations BTC --large
132
142
  ```
133
143
 
134
144
  Adds:
145
+
135
146
  ```
136
147
  ────────────────────────────────────────────────────────────────────────
137
148
  RECENT LARGE LIQUIDATIONS (>$1M)
@@ -147,11 +158,13 @@ OKX short $68,100 $2.9M 2h ago
147
158
  ### Options Analysis
148
159
 
149
160
  **Basic options summary:**
161
+
150
162
  ```bash
151
163
  python derivatives_tracker.py options BTC
152
164
  ```
153
165
 
154
166
  Output:
167
+
155
168
  ```
156
169
  ======================================================================
157
170
  BTC OPTIONS ANALYSIS
@@ -183,6 +196,7 @@ Expiry Pressure: LOW
183
196
  ```
184
197
 
185
198
  **With max pain levels and options flow:**
199
+
186
200
  ```bash
187
201
  python derivatives_tracker.py options BTC --max-pain --flow
188
202
  ```
@@ -190,11 +204,13 @@ python derivatives_tracker.py options BTC --max-pain --flow
190
204
  ### Basis Analysis
191
205
 
192
206
  **Basic basis/spread check:**
207
+
193
208
  ```bash
194
209
  python derivatives_tracker.py basis BTC
195
210
  ```
196
211
 
197
212
  Output:
213
+
198
214
  ```
199
215
  ======================================================================
200
216
  BTC BASIS ANALYSIS
@@ -226,6 +242,7 @@ TERM STRUCTURE
226
242
  ```
227
243
 
228
244
  **With carry trade scanner:**
245
+
229
246
  ```bash
230
247
  python derivatives_tracker.py basis BTC --carry
231
248
  ```
@@ -233,11 +250,13 @@ python derivatives_tracker.py basis BTC --carry
233
250
  ### Multi-Asset Dashboard
234
251
 
235
252
  **Quick market overview:**
253
+
236
254
  ```bash
237
255
  python derivatives_tracker.py dashboard BTC ETH SOL
238
256
  ```
239
257
 
240
258
  Output:
259
+
241
260
  ```
242
261
  ======================================================================
243
262
  CRYPTO DERIVATIVES DASHBOARD
@@ -3,6 +3,7 @@
3
3
  ## Detailed Output Formats
4
4
 
5
5
  ### Funding Rate Report
6
+
6
7
  ```
7
8
  BTC PERPETUAL FUNDING RATES
8
9
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -18,6 +19,7 @@ Sentiment: Moderately Bullish
18
19
  ```
19
20
 
20
21
  ### Open Interest Report
22
+
21
23
  ```
22
24
  BTC OPEN INTEREST ANALYSIS
23
25
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -34,6 +36,7 @@ Long/Short Ratio: 1.15 (53.5% long)
34
36
  ```
35
37
 
36
38
  ### Liquidation Heatmap
39
+
37
40
  ```
38
41
  BTC LIQUIDATION LEVELS
39
42
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -55,6 +58,7 @@ SHORT LIQUIDATIONS (above):
55
58
  ## Options Analysis Deep Dive
56
59
 
57
60
  ### Options Commands
61
+
58
62
  ```bash
59
63
  # Get options overview
60
64
  python derivatives_tracker.py options BTC
@@ -70,6 +74,7 @@ python derivatives_tracker.py options BTC --flow
70
74
  ```
71
75
 
72
76
  ### Options Insights
77
+
73
78
  - **High IV rank** (>80): Options expensive, consider selling
74
79
  - **Low IV rank** (<20): Options cheap, consider buying
75
80
  - **Max pain**: Price where most options expire worthless
@@ -77,6 +82,7 @@ python derivatives_tracker.py options BTC --flow
77
82
  ## Basis Trading Guide
78
83
 
79
84
  ### Basis Commands
85
+
80
86
  ```bash
81
87
  # Get spot-perp basis
82
88
  python derivatives_tracker.py basis BTC
@@ -89,6 +95,7 @@ python derivatives_tracker.py basis --all
89
95
  ```
90
96
 
91
97
  ### Basis Trading Interpretation
98
+
92
99
  - **Positive basis**: Futures > Spot (contango, normal)
93
100
  - **Negative basis**: Futures < Spot (backwardation)
94
101
  - **Cash-and-carry**: Buy spot + sell futures when basis high
@@ -104,6 +111,7 @@ python derivatives_tracker.py basis --all
104
111
  ## Risk Warning
105
112
 
106
113
  Derivatives are leveraged instruments with high risk of loss.
114
+
107
115
  - Funding costs accumulate over time
108
116
  - Liquidations can happen rapidly
109
117
  - Options can expire worthless
@@ -12,7 +12,7 @@ Calculates futures basis and spreads with:
12
12
  from dataclasses import dataclass
13
13
  from decimal import Decimal
14
14
  from typing import Dict, List, Optional
15
- from datetime import datetime, date
15
+ from datetime import datetime
16
16
 
17
17
  from exchange_client import ExchangeClient, BasisData, Exchange
18
18
 
@@ -26,8 +26,8 @@ class BasisAnalysis:
26
26
  basis_data: List[BasisData]
27
27
  avg_basis_pct: float
28
28
  avg_annualized: float
29
- market_structure: str # "contango", "backwardation", "mixed"
30
- structure_strength: str # "strong", "moderate", "weak"
29
+ market_structure: str # "contango", "backwardation", "mixed"
30
+ structure_strength: str # "strong", "moderate", "weak"
31
31
  best_carry_expiry: Optional[str]
32
32
  best_carry_yield: float
33
33
  timestamp: datetime
@@ -45,8 +45,8 @@ class CarryOpportunity:
45
45
  basis_pct: float
46
46
  days_to_expiry: int
47
47
  annualized_yield: float
48
- direction: str # "long_basis" or "short_basis"
49
- strategy: str # Trade description
48
+ direction: str # "long_basis" or "short_basis"
49
+ strategy: str # Trade description
50
50
  risk_notes: str
51
51
 
52
52
 
@@ -62,8 +62,8 @@ class BasisCalculator:
62
62
  """
63
63
 
64
64
  # Structure interpretation
65
- STRONG_BASIS = 5.0 # >5% annualized is strong
66
- MODERATE_BASIS = 2.0 # >2% is moderate
65
+ STRONG_BASIS = 5.0 # >5% annualized is strong
66
+ MODERATE_BASIS = 2.0 # >2% is moderate
67
67
 
68
68
  def __init__(
69
69
  self,
@@ -213,19 +213,21 @@ class BasisCalculator:
213
213
  )
214
214
  risk_notes = "Borrowing costs apply; squeeze risk in tight markets"
215
215
 
216
- opportunities.append(CarryOpportunity(
217
- symbol=symbol,
218
- exchange=basis.exchange,
219
- expiry=basis.expiry,
220
- spot_price=analysis.spot_price,
221
- futures_price=basis.futures_price,
222
- basis_pct=basis.basis_pct,
223
- days_to_expiry=basis.days_to_expiry,
224
- annualized_yield=basis.annualized_pct,
225
- direction=direction,
226
- strategy=strategy,
227
- risk_notes=risk_notes,
228
- ))
216
+ opportunities.append(
217
+ CarryOpportunity(
218
+ symbol=symbol,
219
+ exchange=basis.exchange,
220
+ expiry=basis.expiry,
221
+ spot_price=analysis.spot_price,
222
+ futures_price=basis.futures_price,
223
+ basis_pct=basis.basis_pct,
224
+ days_to_expiry=basis.days_to_expiry,
225
+ annualized_yield=basis.annualized_pct,
226
+ direction=direction,
227
+ strategy=strategy,
228
+ risk_notes=risk_notes,
229
+ )
230
+ )
229
231
  except Exception:
230
232
  continue
231
233
 
@@ -251,10 +253,7 @@ class BasisCalculator:
251
253
  analysis = self.analyze(symbol, spot_price)
252
254
 
253
255
  # Sort by days to expiry
254
- sorted_basis = sorted(
255
- analysis.basis_data,
256
- key=lambda b: b.days_to_expiry
257
- )
256
+ sorted_basis = sorted(analysis.basis_data, key=lambda b: b.days_to_expiry)
258
257
 
259
258
  return [
260
259
  {