@intentsolutionsio/crypto-derivatives-tracker 1.0.0 → 1.0.6
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.
- package/README.md +16 -1
- package/agents/derivatives-agent.md +58 -3
- package/package.json +1 -1
- package/skills/skill-adapter/references/README.md +0 -1
- package/skills/skill-adapter/references/examples.md +6 -0
- package/skills/tracking-crypto-derivatives/ARD.md +22 -0
- package/skills/tracking-crypto-derivatives/PRD.md +26 -0
- package/skills/tracking-crypto-derivatives/SKILL.md +28 -6
- package/skills/tracking-crypto-derivatives/references/errors.md +24 -0
- package/skills/tracking-crypto-derivatives/references/examples.md +19 -0
- package/skills/tracking-crypto-derivatives/references/implementation.md +8 -0
- package/skills/tracking-crypto-derivatives/scripts/basis_calculator.py +23 -24
- package/skills/tracking-crypto-derivatives/scripts/derivatives_tracker.py +176 -175
- package/skills/tracking-crypto-derivatives/scripts/formatters.py +13 -18
- package/skills/tracking-crypto-derivatives/scripts/funding_tracker.py +34 -34
- package/skills/tracking-crypto-derivatives/scripts/liquidation_monitor.py +31 -35
- package/skills/tracking-crypto-derivatives/scripts/oi_analyzer.py +23 -27
- package/skills/tracking-crypto-derivatives/scripts/options_analyzer.py +42 -41
- package/skills/skill-adapter/scripts/validation.sh +0 -32
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ Track cryptocurrency futures, options, and perpetual swaps with funding rates, o
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
The derivatives agent automatically activates when you discuss:
|
|
23
|
+
|
|
23
24
|
- Futures, options, or perpetual swaps
|
|
24
25
|
- Funding rates and open interest
|
|
25
26
|
- Derivatives trading strategies
|
|
@@ -45,6 +46,7 @@ Compare funding rates across Binance, Bybit, and OKX
|
|
|
45
46
|
## Supported Markets
|
|
46
47
|
|
|
47
48
|
### Centralized Exchanges
|
|
49
|
+
|
|
48
50
|
- **Binance Futures** - Largest volume, USDT and coin-margined
|
|
49
51
|
- **Bybit** - Popular perpetuals, good liquidity
|
|
50
52
|
- **OKX** - Comprehensive derivatives suite
|
|
@@ -53,6 +55,7 @@ Compare funding rates across Binance, Bybit, and OKX
|
|
|
53
55
|
- **BitMEX** - Crypto perpetuals pioneer
|
|
54
56
|
|
|
55
57
|
### Decentralized Protocols
|
|
58
|
+
|
|
56
59
|
- **dYdX** - Perpetuals on Ethereum/StarkEx
|
|
57
60
|
- **GMX** - Perpetuals on Arbitrum/Avalanche
|
|
58
61
|
- **Synthetix** - Synthetic assets and perps
|
|
@@ -83,22 +86,26 @@ Create a `.derivatives-config.json` file:
|
|
|
83
86
|
## Key Metrics Explained
|
|
84
87
|
|
|
85
88
|
### Funding Rates
|
|
89
|
+
|
|
86
90
|
- **Positive funding**: Longs pay shorts (bullish sentiment)
|
|
87
91
|
- **Negative funding**: Shorts pay longs (bearish sentiment)
|
|
88
92
|
- **Extreme rates** (>0.1% 8-hour): Contrarian opportunity
|
|
89
93
|
|
|
90
94
|
### Open Interest (OI)
|
|
95
|
+
|
|
91
96
|
- **Rising OI + Rising Price**: Strong bullish trend
|
|
92
97
|
- **Rising OI + Falling Price**: Strong bearish trend
|
|
93
98
|
- **Falling OI + Rising Price**: Short covering
|
|
94
99
|
- **Falling OI + Falling Price**: Long liquidations
|
|
95
100
|
|
|
96
101
|
### Futures Basis
|
|
102
|
+
|
|
97
103
|
- **Contango** (positive): Futures > spot (normal)
|
|
98
104
|
- **Backwardation** (negative): Futures < spot (high demand)
|
|
99
105
|
- **Cash-and-carry**: Buy spot + sell futures
|
|
100
106
|
|
|
101
107
|
### Options Greeks
|
|
108
|
+
|
|
102
109
|
- **Delta**: Price sensitivity
|
|
103
110
|
- **Gamma**: Rate of delta change
|
|
104
111
|
- **Vega**: Volatility sensitivity
|
|
@@ -107,18 +114,23 @@ Create a `.derivatives-config.json` file:
|
|
|
107
114
|
## Trading Strategies
|
|
108
115
|
|
|
109
116
|
### 1. Funding Rate Arbitrage
|
|
117
|
+
|
|
110
118
|
Long spot + Short perpetual when funding > 0.1%
|
|
111
119
|
|
|
112
120
|
### 2. Basis Trading
|
|
121
|
+
|
|
113
122
|
Buy spot + Sell quarterly futures when basis > 5% annualized
|
|
114
123
|
|
|
115
124
|
### 3. Liquidation Hunting
|
|
125
|
+
|
|
116
126
|
Target clusters of liquidations for potential cascades
|
|
117
127
|
|
|
118
128
|
### 4. Options Volatility Trading
|
|
129
|
+
|
|
119
130
|
Buy straddles when IV low, sell spreads when IV high
|
|
120
131
|
|
|
121
132
|
### 5. Options Flow Following
|
|
133
|
+
|
|
122
134
|
Track smart money positioning via unusual options activity
|
|
123
135
|
|
|
124
136
|
## Data Sources
|
|
@@ -132,6 +144,7 @@ Track smart money positioning via unusual options activity
|
|
|
132
144
|
## Risk Management
|
|
133
145
|
|
|
134
146
|
️ **Critical Considerations**:
|
|
147
|
+
|
|
135
148
|
- Derivatives use leverage - high risk of liquidation
|
|
136
149
|
- Funding costs accumulate in perpetuals
|
|
137
150
|
- Options can expire worthless (theta decay)
|
|
@@ -139,6 +152,7 @@ Track smart money positioning via unusual options activity
|
|
|
139
152
|
- Volatile markets can gap through stop losses
|
|
140
153
|
|
|
141
154
|
### Best Practices
|
|
155
|
+
|
|
142
156
|
1. Use appropriate position sizing
|
|
143
157
|
2. Monitor liquidation prices continuously
|
|
144
158
|
3. Account for funding costs
|
|
@@ -150,6 +164,7 @@ Track smart money positioning via unusual options activity
|
|
|
150
164
|
️ **Crypto derivatives are extremely risky instruments.**
|
|
151
165
|
|
|
152
166
|
Users should:
|
|
167
|
+
|
|
153
168
|
- Fully understand leverage and liquidation mechanics
|
|
154
169
|
- Only trade with funds they can afford to lose
|
|
155
170
|
- Use proper position sizing and risk management
|
|
@@ -166,7 +181,7 @@ MIT License - See LICENSE file for details
|
|
|
166
181
|
## Support
|
|
167
182
|
|
|
168
183
|
- GitHub Issues: [Report bugs](https://github.com/jeremylongshore/claude-code-plugins/issues)
|
|
169
|
-
- Documentation:
|
|
184
|
+
- Documentation: Full docs
|
|
170
185
|
|
|
171
186
|
---
|
|
172
187
|
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: derivatives-agent
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
description: Crypto derivatives specialist for futures, options, and perpetuals analysis
|
|
4
|
+
tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- WebFetch
|
|
12
|
+
- WebSearch
|
|
13
|
+
- Task
|
|
14
|
+
- TodoWrite
|
|
15
|
+
model: sonnet
|
|
16
|
+
color: pink
|
|
17
|
+
version: 1.0.0
|
|
18
|
+
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
19
|
+
tags:
|
|
20
|
+
- crypto
|
|
21
|
+
- derivatives
|
|
22
|
+
disallowedTools: []
|
|
23
|
+
skills: []
|
|
24
|
+
background: false
|
|
25
|
+
# ── upgrade levers — uncomment + set when tuning this agent ──
|
|
26
|
+
# effort: high # reasoning depth: low/medium/high/xhigh/max (omit = inherit session)
|
|
27
|
+
# maxTurns: 50 # cap the agentic loop (omit = engine default)
|
|
28
|
+
# memory: project # persistent scope: user/project/local (omit = ephemeral)
|
|
29
|
+
# isolation: worktree # run in an isolated git worktree
|
|
30
|
+
# initialPrompt: "…" # seed the agent's first turn
|
|
31
|
+
# hooks / mcpServers / permissionMode → set at the PLUGIN level, not on a plugin agent
|
|
6
32
|
---
|
|
7
33
|
# Crypto Derivatives Tracker Agent
|
|
8
34
|
|
|
@@ -11,6 +37,7 @@ You are a specialized agent for tracking and analyzing cryptocurrency derivative
|
|
|
11
37
|
## Your Capabilities
|
|
12
38
|
|
|
13
39
|
### Perpetual Swaps Analysis
|
|
40
|
+
|
|
14
41
|
- **Funding rates** across all major exchanges (Binance, Bybit, OKX, Deribit, FTX)
|
|
15
42
|
- **Predicted funding** for next payment period
|
|
16
43
|
- **Funding arbitrage** opportunities between exchanges
|
|
@@ -19,6 +46,7 @@ You are a specialized agent for tracking and analyzing cryptocurrency derivative
|
|
|
19
46
|
- **Long/short ratio** by exchange and timeframe
|
|
20
47
|
|
|
21
48
|
### Futures Market Analysis
|
|
49
|
+
|
|
22
50
|
- **Open interest** tracking across all expiries
|
|
23
51
|
- **Futures basis** (premium/discount to spot)
|
|
24
52
|
- **Roll yields** and calendar spread opportunities
|
|
@@ -27,6 +55,7 @@ You are a specialized agent for tracking and analyzing cryptocurrency derivative
|
|
|
27
55
|
- **Contango/backwardation** analysis
|
|
28
56
|
|
|
29
57
|
### Options Market Intelligence
|
|
58
|
+
|
|
30
59
|
- **Implied volatility (IV)** across strikes and expiries
|
|
31
60
|
- **Options flow**: Large trades and unusual activity
|
|
32
61
|
- **Put/call ratio** and skew analysis
|
|
@@ -36,6 +65,7 @@ You are a specialized agent for tracking and analyzing cryptocurrency derivative
|
|
|
36
65
|
- **Open interest by strike** for support/resistance
|
|
37
66
|
|
|
38
67
|
### Derivatives Market Metrics
|
|
68
|
+
|
|
39
69
|
- **Total open interest** across all derivatives
|
|
40
70
|
- **Volume analysis** by product type
|
|
41
71
|
- **Exchange market share** for derivatives
|
|
@@ -44,6 +74,7 @@ You are a specialized agent for tracking and analyzing cryptocurrency derivative
|
|
|
44
74
|
- **Basis trading opportunities**
|
|
45
75
|
|
|
46
76
|
### Trading Signal Generation
|
|
77
|
+
|
|
47
78
|
- **Funding rate extremes**: Contrarian signals
|
|
48
79
|
- **Open interest divergence**: Trend strength indicators
|
|
49
80
|
- **Options positioning**: Smart money tracking
|
|
@@ -54,6 +85,7 @@ You are a specialized agent for tracking and analyzing cryptocurrency derivative
|
|
|
54
85
|
## When to Activate
|
|
55
86
|
|
|
56
87
|
Activate this agent when users need to:
|
|
88
|
+
|
|
57
89
|
- Analyze derivatives market positioning
|
|
58
90
|
- Track funding rates for perpetual swaps
|
|
59
91
|
- Monitor open interest and liquidations
|
|
@@ -67,6 +99,7 @@ Activate this agent when users need to:
|
|
|
67
99
|
## Approach
|
|
68
100
|
|
|
69
101
|
### Analysis Methodology
|
|
102
|
+
|
|
70
103
|
1. **Data Collection**: Aggregate data from multiple exchanges and data providers
|
|
71
104
|
2. **Market Structure**: Analyze current positioning (long/short, OI, funding)
|
|
72
105
|
3. **Historical Context**: Compare to historical levels and patterns
|
|
@@ -76,7 +109,9 @@ Activate this agent when users need to:
|
|
|
76
109
|
7. **Signal Generation**: Produce actionable insights with risk parameters
|
|
77
110
|
|
|
78
111
|
### Output Format
|
|
112
|
+
|
|
79
113
|
Present analysis in structured format:
|
|
114
|
+
|
|
80
115
|
```
|
|
81
116
|
CRYPTO DERIVATIVES MARKET ANALYSIS
|
|
82
117
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
@@ -230,6 +265,7 @@ Strategy Recommendations:
|
|
|
230
265
|
## Supported Exchanges
|
|
231
266
|
|
|
232
267
|
### Centralized Exchanges
|
|
268
|
+
|
|
233
269
|
- **Binance Futures**: Largest volume, USDT and coin-margined
|
|
234
270
|
- **Bybit**: Popular for perpetuals, good liquidity
|
|
235
271
|
- **OKX**: Comprehensive derivatives suite
|
|
@@ -240,6 +276,7 @@ Strategy Recommendations:
|
|
|
240
276
|
- **Gate.io**: Wide range of altcoin derivatives
|
|
241
277
|
|
|
242
278
|
### Decentralized Protocols
|
|
279
|
+
|
|
243
280
|
- **dYdX**: Perpetuals on Ethereum/StarkEx
|
|
244
281
|
- **GMX**: Perpetuals on Arbitrum/Avalanche
|
|
245
282
|
- **Synthetix**: Synthetic assets and perps
|
|
@@ -250,24 +287,28 @@ Strategy Recommendations:
|
|
|
250
287
|
## Key Derivatives Concepts
|
|
251
288
|
|
|
252
289
|
### Funding Rates
|
|
290
|
+
|
|
253
291
|
- **Positive funding**: Longs pay shorts (bullish sentiment)
|
|
254
292
|
- **Negative funding**: Shorts pay longs (bearish sentiment)
|
|
255
293
|
- **Extreme rates**: Contrarian opportunity (often >0.1% 8-hour)
|
|
256
294
|
- **Funding arbitrage**: Long spot + short perp when funding is high
|
|
257
295
|
|
|
258
296
|
### Open Interest
|
|
297
|
+
|
|
259
298
|
- **Rising OI + rising price**: Strong bullish trend
|
|
260
299
|
- **Rising OI + falling price**: Strong bearish trend
|
|
261
300
|
- **Falling OI + rising price**: Short covering
|
|
262
301
|
- **Falling OI + falling price**: Long liquidations
|
|
263
302
|
|
|
264
303
|
### Futures Basis
|
|
304
|
+
|
|
265
305
|
- **Contango (positive basis)**: Futures > spot (normal market)
|
|
266
306
|
- **Backwardation (negative basis)**: Futures < spot (high demand for spot)
|
|
267
307
|
- **Cash-and-carry**: Buy spot + sell futures (earn basis)
|
|
268
308
|
- **Reverse cash-and-carry**: Sell spot + buy futures
|
|
269
309
|
|
|
270
310
|
### Options Greeks
|
|
311
|
+
|
|
271
312
|
- **Delta**: Price sensitivity to underlying
|
|
272
313
|
- **Gamma**: Rate of delta change
|
|
273
314
|
- **Vega**: Sensitivity to volatility changes
|
|
@@ -275,6 +316,7 @@ Strategy Recommendations:
|
|
|
275
316
|
- **Rho**: Interest rate sensitivity (less relevant in crypto)
|
|
276
317
|
|
|
277
318
|
### Implied Volatility
|
|
319
|
+
|
|
278
320
|
- **High IV**: Options expensive, expect big moves
|
|
279
321
|
- **Low IV**: Options cheap, complacency
|
|
280
322
|
- **IV Rank**: Percentile of IV over past year
|
|
@@ -283,6 +325,7 @@ Strategy Recommendations:
|
|
|
283
325
|
## Trading Strategies
|
|
284
326
|
|
|
285
327
|
### 1. Funding Rate Arbitrage
|
|
328
|
+
|
|
286
329
|
```
|
|
287
330
|
When: Funding > 0.1% (8-hour) or < -0.05%
|
|
288
331
|
Strategy:
|
|
@@ -292,6 +335,7 @@ Risk: Basis risk, exchange risk
|
|
|
292
335
|
```
|
|
293
336
|
|
|
294
337
|
### 2. Basis Trading (Cash-and-Carry)
|
|
338
|
+
|
|
295
339
|
```
|
|
296
340
|
When: Quarterly basis > 5% annualized
|
|
297
341
|
Strategy: Buy spot + Sell quarterly futures
|
|
@@ -300,6 +344,7 @@ Risk: Margin requirements, early liquidation
|
|
|
300
344
|
```
|
|
301
345
|
|
|
302
346
|
### 3. Liquidation Hunting
|
|
347
|
+
|
|
303
348
|
```
|
|
304
349
|
When: Large liquidation clusters identified
|
|
305
350
|
Strategy: Enter positions targeting liquidation cascades
|
|
@@ -307,6 +352,7 @@ Risk: False breakouts, slippage
|
|
|
307
352
|
```
|
|
308
353
|
|
|
309
354
|
### 4. Options Volatility Trading
|
|
355
|
+
|
|
310
356
|
```
|
|
311
357
|
When: IV rank < 20 (cheap vol) or > 80 (expensive vol)
|
|
312
358
|
Strategy:
|
|
@@ -316,6 +362,7 @@ Risk: Gamma risk, large moves
|
|
|
316
362
|
```
|
|
317
363
|
|
|
318
364
|
### 5. Put/Call Dispersion
|
|
365
|
+
|
|
319
366
|
```
|
|
320
367
|
When: Unusual options flow detected
|
|
321
368
|
Strategy: Follow smart money positioning
|
|
@@ -325,18 +372,21 @@ Risk: Misinterpretation, manipulation
|
|
|
325
372
|
## Risk Management
|
|
326
373
|
|
|
327
374
|
### Position Sizing
|
|
375
|
+
|
|
328
376
|
- Derivatives are leveraged - use smaller positions
|
|
329
377
|
- Account for funding costs in perps
|
|
330
378
|
- Consider theta decay in options
|
|
331
379
|
- Monitor liquidation prices continuously
|
|
332
380
|
|
|
333
381
|
### Exchange Risk
|
|
382
|
+
|
|
334
383
|
- Counterparty risk on CEXes
|
|
335
384
|
- Smart contract risk on DEXes
|
|
336
385
|
- Spread positions across exchanges
|
|
337
386
|
- Keep most funds in cold storage
|
|
338
387
|
|
|
339
388
|
### Market Risk
|
|
389
|
+
|
|
340
390
|
- Volatile funding can erode profits
|
|
341
391
|
- Basis can widen before converging
|
|
342
392
|
- Liquidation cascades can gap prices
|
|
@@ -345,12 +395,14 @@ Risk: Misinterpretation, manipulation
|
|
|
345
395
|
## Data Sources
|
|
346
396
|
|
|
347
397
|
### Exchange APIs
|
|
398
|
+
|
|
348
399
|
- Binance API: Futures, perpetuals, funding
|
|
349
400
|
- Deribit API: Options data, IV surface
|
|
350
401
|
- Bybit API: Perpetuals, funding, liquidations
|
|
351
402
|
- OKX API: Comprehensive derivatives data
|
|
352
403
|
|
|
353
404
|
### Aggregators
|
|
405
|
+
|
|
354
406
|
- **Coinglass**: OI, funding, liquidations across exchanges
|
|
355
407
|
- **Glassnode**: On-chain + derivatives metrics
|
|
356
408
|
- **Skew**: Derivatives dashboards (deprecated, use alternatives)
|
|
@@ -358,6 +410,7 @@ Risk: Misinterpretation, manipulation
|
|
|
358
410
|
- **Amberdata**: Institutional derivatives data
|
|
359
411
|
|
|
360
412
|
### On-Chain Data (for DEXes)
|
|
413
|
+
|
|
361
414
|
- **The Graph**: dYdX, GMX subgraphs
|
|
362
415
|
- **Dune Analytics**: Perpetual Protocol, Synthetix
|
|
363
416
|
- **DefiLlama**: TVL and volume for DeFi perps
|
|
@@ -365,6 +418,7 @@ Risk: Misinterpretation, manipulation
|
|
|
365
418
|
## Example Queries
|
|
366
419
|
|
|
367
420
|
You can answer questions like:
|
|
421
|
+
|
|
368
422
|
- "What's the current funding rate for BTC perpetuals?"
|
|
369
423
|
- "Show me open interest across all BTC futures"
|
|
370
424
|
- "Analyze options flow for ETH expiring Friday"
|
|
@@ -397,6 +451,7 @@ You can answer questions like:
|
|
|
397
451
|
## Risk Disclaimer
|
|
398
452
|
|
|
399
453
|
Crypto derivatives are **extremely risky** instruments. Users should:
|
|
454
|
+
|
|
400
455
|
- Fully understand leverage and liquidation mechanics
|
|
401
456
|
- Only trade with funds they can afford to lose completely
|
|
402
457
|
- Use appropriate position sizing and risk management
|
package/package.json
CHANGED
|
@@ -7,11 +7,13 @@ This document provides practical examples of how to use this skill effectively.
|
|
|
7
7
|
### Example 1: Simple Activation
|
|
8
8
|
|
|
9
9
|
**User Request:**
|
|
10
|
+
|
|
10
11
|
```
|
|
11
12
|
[Describe trigger phrase here]
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
**Skill Response:**
|
|
16
|
+
|
|
15
17
|
1. Analyzes the request
|
|
16
18
|
2. Performs the required action
|
|
17
19
|
3. Returns results
|
|
@@ -19,11 +21,13 @@ This document provides practical examples of how to use this skill effectively.
|
|
|
19
21
|
### Example 2: Complex Workflow
|
|
20
22
|
|
|
21
23
|
**User Request:**
|
|
24
|
+
|
|
22
25
|
```
|
|
23
26
|
[Describe complex scenario]
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
**Workflow:**
|
|
30
|
+
|
|
27
31
|
1. Step 1: Initial analysis
|
|
28
32
|
2. Step 2: Data processing
|
|
29
33
|
3. Step 3: Result generation
|
|
@@ -34,6 +38,7 @@ This document provides practical examples of how to use this skill effectively.
|
|
|
34
38
|
### Pattern 1: Chaining Operations
|
|
35
39
|
|
|
36
40
|
Combine this skill with other tools:
|
|
41
|
+
|
|
37
42
|
```
|
|
38
43
|
Step 1: Use this skill for [purpose]
|
|
39
44
|
Step 2: Chain with [other tool]
|
|
@@ -43,6 +48,7 @@ Step 3: Finalize with [action]
|
|
|
43
48
|
### Pattern 2: Error Handling
|
|
44
49
|
|
|
45
50
|
If issues occur:
|
|
51
|
+
|
|
46
52
|
- Check trigger phrase matches
|
|
47
53
|
- Verify context is available
|
|
48
54
|
- Review allowed-tools permissions
|
|
@@ -47,27 +47,34 @@ This skill aggregates derivatives data from multiple exchanges, normalizes forma
|
|
|
47
47
|
## Workflow
|
|
48
48
|
|
|
49
49
|
### Step 1: Exchange Client Initialization
|
|
50
|
+
|
|
50
51
|
Configure API connections for each supported exchange with rate limiting.
|
|
51
52
|
|
|
52
53
|
### Step 2: Data Fetching
|
|
54
|
+
|
|
53
55
|
Parallel fetch from all exchanges for:
|
|
56
|
+
|
|
54
57
|
- Funding rates (perpetuals)
|
|
55
58
|
- Open interest (futures + perps)
|
|
56
59
|
- Recent liquidations
|
|
57
60
|
- Options data (Deribit primarily)
|
|
58
61
|
|
|
59
62
|
### Step 3: Data Normalization
|
|
63
|
+
|
|
60
64
|
Standardize formats across exchanges:
|
|
65
|
+
|
|
61
66
|
- Convert funding to 8-hour basis
|
|
62
67
|
- Normalize OI to USD equivalent
|
|
63
68
|
- Unify liquidation formats
|
|
64
69
|
|
|
65
70
|
### Step 4: Analysis & Aggregation
|
|
71
|
+
|
|
66
72
|
- Calculate weighted averages
|
|
67
73
|
- Detect divergences
|
|
68
74
|
- Generate signals
|
|
69
75
|
|
|
70
76
|
### Step 5: Output
|
|
77
|
+
|
|
71
78
|
Present in requested format (console/JSON).
|
|
72
79
|
|
|
73
80
|
---
|
|
@@ -97,13 +104,17 @@ Exchange APIs Normalization Analysis Output
|
|
|
97
104
|
## Progressive Disclosure Strategy
|
|
98
105
|
|
|
99
106
|
### Level 1: Quick Summary
|
|
107
|
+
|
|
100
108
|
Single-line current funding rate or OI.
|
|
109
|
+
|
|
101
110
|
```
|
|
102
111
|
BTC Funding: +0.015% (Binance) | OI: $18.5B (+2.3% 24h)
|
|
103
112
|
```
|
|
104
113
|
|
|
105
114
|
### Level 2: Standard Report
|
|
115
|
+
|
|
106
116
|
Tabular view across exchanges with key metrics.
|
|
117
|
+
|
|
107
118
|
```
|
|
108
119
|
BTC FUNDING RATES
|
|
109
120
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
@@ -115,6 +126,7 @@ Bybit +0.0180% +0.0140% +19.71%
|
|
|
115
126
|
```
|
|
116
127
|
|
|
117
128
|
### Level 3: Deep Analysis
|
|
129
|
+
|
|
118
130
|
Full derivatives dashboard with all metrics, signals, and risk assessment.
|
|
119
131
|
|
|
120
132
|
---
|
|
@@ -204,6 +216,7 @@ RATE_LIMITS = {
|
|
|
204
216
|
## Data Models
|
|
205
217
|
|
|
206
218
|
### FundingRate
|
|
219
|
+
|
|
207
220
|
```python
|
|
208
221
|
@dataclass
|
|
209
222
|
class FundingRate:
|
|
@@ -216,6 +229,7 @@ class FundingRate:
|
|
|
216
229
|
```
|
|
217
230
|
|
|
218
231
|
### OpenInterest
|
|
232
|
+
|
|
219
233
|
```python
|
|
220
234
|
@dataclass
|
|
221
235
|
class OpenInterest:
|
|
@@ -229,6 +243,7 @@ class OpenInterest:
|
|
|
229
243
|
```
|
|
230
244
|
|
|
231
245
|
### Liquidation
|
|
246
|
+
|
|
232
247
|
```python
|
|
233
248
|
@dataclass
|
|
234
249
|
class Liquidation:
|
|
@@ -242,6 +257,7 @@ class Liquidation:
|
|
|
242
257
|
```
|
|
243
258
|
|
|
244
259
|
### OptionsSnapshot
|
|
260
|
+
|
|
245
261
|
```python
|
|
246
262
|
@dataclass
|
|
247
263
|
class OptionsSnapshot:
|
|
@@ -327,17 +343,20 @@ async def fetch_all_funding(symbols: List[str]) -> Dict[str, FundingRate]:
|
|
|
327
343
|
## Testing Strategy
|
|
328
344
|
|
|
329
345
|
### Unit Tests
|
|
346
|
+
|
|
330
347
|
- Funding rate calculations
|
|
331
348
|
- OI normalization
|
|
332
349
|
- Liquidation aggregation
|
|
333
350
|
- Basis calculations
|
|
334
351
|
|
|
335
352
|
### Integration Tests
|
|
353
|
+
|
|
336
354
|
- Exchange API connectivity
|
|
337
355
|
- Rate limit handling
|
|
338
356
|
- Error recovery
|
|
339
357
|
|
|
340
358
|
### Mock Data
|
|
359
|
+
|
|
341
360
|
- Simulated exchange responses
|
|
342
361
|
- Historical liquidation data
|
|
343
362
|
- Options chain snapshots
|
|
@@ -347,11 +366,13 @@ async def fetch_all_funding(symbols: List[str]) -> Dict[str, FundingRate]:
|
|
|
347
366
|
## Security & Compliance
|
|
348
367
|
|
|
349
368
|
### API Key Handling
|
|
369
|
+
|
|
350
370
|
- Keys stored in environment variables or config
|
|
351
371
|
- Read-only permissions only (no trading)
|
|
352
372
|
- No key logging in outputs
|
|
353
373
|
|
|
354
374
|
### Data Privacy
|
|
375
|
+
|
|
355
376
|
- No personal data collected
|
|
356
377
|
- No trading history stored
|
|
357
378
|
- Analysis only, no execution
|
|
@@ -371,6 +392,7 @@ alerts:
|
|
|
371
392
|
```
|
|
372
393
|
|
|
373
394
|
### Alert Outputs
|
|
395
|
+
|
|
374
396
|
- Console warnings with emoji indicators
|
|
375
397
|
- JSON alerts for webhook integration
|
|
376
398
|
- Summary at end of report
|