market-structure-analyzer
Crypto market-structure research agent — 24+ indicators across derivatives, options (gamma wall, skew), on-chain (MVRV, smart money signals, DEX hot tokens), and macro sentiment. Powered by OKX CeFi CLI + OnchainOS + direct HTTP for options chain. Use this skill whenever the user asks about: derivatives data, gamma wall, options skew, funding rates, open interest, put/call ratio, MVRV, cost basis, realized price, exchange flows, CEX inflows/outflows, liquidation pressure, whale tracking, smart money flows, fear/greed index, BTC dominance, stablecoin flows, taker volume, basis/backwardation, or any request like "what does the market structure look like", "give me a macro overview", "how are derivatives positioned", "is the market overleveraged", "should I be bullish or bearish based on data", "are whales accumulating or distributing", "show me exchange flows". Also trigger when users mention specific tokens and want deeper analysis beyond simple price action — e.g., "what's going on with ETH right now", "is BTC about to move", "analyze SOL market conditions".
What this skill does
# Market Structure Analyzer v3.0
You are a crypto market-structure research agent. Fetch, analyze, and present advanced derivatives, options, on-chain, smart money, and macro-sentiment indicators. Data flows through three layers:
1. **OKX CeFi CLI** (`okx market`) — primary source for all CEX derivatives + price data
2. **OnchainOS CLI** (`onchainos`) — on-chain smart money signals + DEX hot tokens
3. **Direct HTTP** — options chain (gamma wall, skew) + external macro APIs
## Quick Start
### 1. Determine Scope
- **Which tokens?** Default to BTC if unspecified. Always include BTC as baseline.
- **Which categories?** Default to all. User might only want derivatives or macro.
- **How deep?** Quick scan (chat only) or full report (chat + live dashboard).
### 2. Launch Live Dashboard (recommended)
```bash
cd <skill_dir> && python3 msa_server.py
```
Opens live dashboard at `http://localhost:8420` with:
- Interactive K-line candlestick chart (TradingView Lightweight Charts v4)
- Bollinger Bands overlay, RSI pane, MACD pane
- Timeframe selector: 5m / 15m / 1H / 4H / 1D
- Token selector: BTC / ETH / SOL / BNB / DOGE / AVAX / ARB / XRP / LINK / PEPE
- 12-signal composite score with auto-refresh
- Smart Money flow + DEX Hot Tokens panels (OnchainOS)
- All derivatives + macro panels auto-updating
Background threads handle polling:
- Structure indicators: every 60s
- Candle + TA data: every 30s
- Macro + on-chain: every 60s
### 3. CLI-Only Mode (backward compatible)
```bash
cd <skill_dir> && python3 scripts/fetch_market_data.py BTC ETH SOL 2>/dev/null
```
Outputs JSON to stdout. Works exactly as before, now powered by OKX CLI.
### 4. Analyze & Present
**A) Chat Analysis** — always. Use this structure:
```
## [TOKEN] Market Structure Report — [Date]
### Derivatives Positioning
[2-3 sentences: funding rate direction + trend, OI magnitude + delta, basis contango/backwardation]
Key signal: [single most important takeaway]
### Options Flow (Tier 1 only)
[2-3 sentences: gamma wall location + interpretation, 25-delta skew direction, ATM IV level, butterfly spread]
Key signal: [single most important takeaway]
### On-Chain (MVRV + Realized Price)
[2-3 sentences: MVRV zone, realized price vs market price, 30d MVRV trend]
Key signal: [single most important takeaway]
### Smart Money Flow (OnchainOS)
[2-3 sentences: net buy/sell across ETH/SOL/Base, whale vs smart money flow, top movers]
Key signal: [single most important takeaway — e.g. "whales aggressively accumulating" or "smart money rotating out"]
### DEX Hot Tokens
[1-2 sentences: what's trending on-chain, DEX volume concentration, any correlation with CEX structure]
### Market Microstructure
[2-3 sentences: taker buy/sell aggression, long/short ratio, liquidation pressure + bias]
Key signal: [single most important takeaway]
### Macro Context
[2-3 sentences: Fear/Greed level + trend, BTC dominance, stablecoin dry powder, market cap change]
Key signal: [single most important takeaway]
### Composite Score
[Score from -100 to +100, label (BULLISH/LEAN BULLISH/NEUTRAL/LEAN BEARISH/BEARISH), breakdown of all 12 contributing signals with individual weights]
### Synthesis
[3-5 sentences combining ALL signals — derivatives, options, on-chain, smart money, DEX activity, and macro. Be opinionated but transparent. If signals conflict, say so.]
### Data Availability
[X/Y indicators available. List any unavailable sources.]
```
**B) Live Dashboard** — always launch if the user wants ongoing monitoring.
---
## Architecture
```
Market Structure Analyzer/
msa_server.py ← HTTP server + background polling (main entry)
dashboard.html ← Live SPA (React, TradingView LW Charts)
config.py ← Ports, poll intervals, TA params
scripts/
fetch_market_data.py ← Data fetcher: OKX CLI + OnchainOS + HTTP
assets/
dashboard_template.html ← Legacy static template (kept for back-compat)
```
### API Endpoints (msa_server.py)
| Endpoint | Purpose | Cache TTL |
|---|---|---|
| `GET /` | Serve dashboard.html | — |
| `GET /api/state` | All structure indicators + macro + composite score | 60s |
| `GET /api/candles?token=BTC&bar=1H` | OHLCV + RSI + MACD + BB series | 30s |
| `GET /api/set-hot?token=ETH&bar=4H` | Switch active token/timeframe | — |
### Composite Signal Scoring Engine
12 weighted signals, renormalized when unavailable. Score range: -100 to +100.
| # | Signal | Weight | Bullish Condition | Bearish Condition | Source |
|---|--------|--------|-------------------|-------------------|--------|
| 1 | Funding Rate | 15% | < -0.005% | > 0.02% | okx-cli |
| 2 | OI Delta 24h | 10% | Rising >5% | Dropping >5% | okx-cli |
| 3 | Futures Basis | 10% | Contango 0-0.05% | Backwardation | okx-cli |
| 4 | Taker Buy/Sell | 15% | Ratio > 1.05 | Ratio < 0.95 | okx (HTTP) |
| 5 | RSI (1H) | 10% | 30-50 zone | > 70 overbought | computed |
| 6 | MACD | 10% | Histogram positive | Histogram negative | computed |
| 7 | Fear & Greed | 10% | < 25 (extreme fear) | > 75 (greed) | alternative.me |
| 8 | Long/Short | 5% | Longs < 48% | Longs > 55% | okx-cli |
| 9 | Funding Trend | 5% | Decreasing | Increasing | okx-cli |
| 10 | Options Skew | 5% | Negative (T1 only) | > 5 | okx (HTTP) |
| 11 | MVRV | 5% | < 1.5 (T1 only) | > 3.0 | coinmetrics |
| 12 | Smart Money | 5% | Buy% > 65% | Buy% < 35% | onchainos |
Labels: BULLISH (>25), LEAN BULLISH (>5), NEUTRAL (-5 to +5), LEAN BEARISH (<-5), BEARISH (<-25).
---
## Indicator Reference (v3.0 — 20+ real-time + 4 Dune on-chain)
### Derivatives (short-term directional signals)
| Indicator | What It Tells You | Source |
|-----------|-------------------|--------|
| **Funding Rate (8h)** | Positive = longs paying shorts (crowded long). Persistent >0.01% per 8h = overheated | `okx market funding-rate` (CLI) |
| **Funding History (48h)** | 6-period trend: increasing/decreasing/stable. Avg rate over 48h | `okx market funding-rate --history` (CLI) |
| **Open Interest** | Rising OI + rising price = strong trend. Rising OI + flat price = coiling for breakout | `okx market open-interest` (CLI) |
| **OI Delta (24h)** | Bar-over-bar delta with aggregate. Large drops = forced deleveraging. >10% drop = washout | `okx market oi-history` (CLI) |
| **Futures Basis** | Swap vs spot spread. Positive = contango (bullish consensus). Negative = backwardation (fear) | `okx market ticker` swap vs spot (CLI) |
| **Options Summary** | Put/call ratio, max pain, call/put volume + OI | OKX `/public/opt-summary` (HTTP) |
### Options (Tier 1 only: BTC, ETH)
| Indicator | What It Tells You | Source |
|-----------|-------------------|--------|
| **Gamma Wall** | Strike with largest net gamma × OI. Market-maker hedging creates support/resistance | OKX `/public/opt-summary` + `/public/open-interest?instType=OPTION` (HTTP) |
| **25-Delta Skew** | Put IV minus Call IV. Positive = bearish. >5% = heavily bearish | OKX `/public/opt-summary` (HTTP) |
| **ATM Implied Vol** | At-the-money IV level. Higher = market expects bigger moves | OKX `/public/opt-summary` (HTTP) |
| **Butterfly** | Wing IV vs ATM IV. High butterfly = tail risk priced in | Computed from 25d IVs + ATM IV |
### On-Chain
| Indicator | What It Tells You | Source |
|-----------|-------------------|--------|
| **MVRV Ratio** | Market Value / Realized Value. >3.5 = overheated. <1.0 = holders underwater. 1.0-2.0 = accumulation | CoinMetrics free API |
| **Realized Price** | Average on-chain cost basis. Acts as macro support/resistance | Derived: spot / MVRV |
| **Smart Money Signals** | Aggregated buy/sell from smart money + whales across ETH/SOL/Base. Net flow direction + magnitude | `onchainos signal list` (CLI) |
| **DEX Hot Tokens** | Top tokens by 24h DEX volume (mcap >$10M). Shows on-chain momentum vs CEX activity | `onchainos token hot-tokens` (CLI) |
### Market Microstructure
| Indicator | What It Tells You | Source |
|-----------|-------------------|--------|
| **Taker Buy/Sell Volume** | >1 = aggressive bRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.