MCPInstall

market-microstructure

DEX orderflow analysis, trade classification, buyer/seller pressure, and microstructure signals for Solana tokens

Installs
519
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/agiprolabs/claude-trading-skills --skill market-microstructure
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads market-microstructure automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Market Microstructure — DEX Orderflow Analysis

Overview

Market microstructure on Solana DEXes differs fundamentally from traditional finance. There are no orderbooks on AMMs — every trade is a swap against a liquidity pool. Yet trade flow analysis remains powerful: the sequence, size, and direction of swaps reveal accumulation, distribution, whale activity, and wash trading patterns.

This skill covers:

  • Trade classification — identifying buys vs sells from swap direction
  • Volume profiles — time-based and size-based breakdowns
  • Buyer/seller pressure — ratio metrics, net flow, trade count asymmetry
  • Trade size distribution — whale detection, retail vs institutional flow
  • Flow momentum signals — acceleration, volume spikes, composite scores
  • Token velocity — turnover rate as a sentiment proxy
  • Wash trading detection — spotting fake volume and bot patterns

Why Microstructure Matters on DEXes

On CEXes, microstructure means orderbook depth, bid-ask spread, and queue position. On AMMs, liquidity sits in pool curves — there is no spread or queue. But the trade tape (the chronological list of swaps) contains rich signal:

  1. Who is trading? — Whale wallets vs retail, smart money vs bots
  2. How are they trading? — Large single swaps vs DCA-style splits
  3. When are they trading? — Volume clustering around events or time zones
  4. What direction? — Net buy vs sell pressure over sliding windows

These signals feed into entry/exit timing, position sizing, and token quality scoring.

Trade Classification

Buy vs Sell Identification

On Solana DEXes, every swap has an input token and output token:

Swap DirectionClassificationMeaning
SOL → TokenBuyTrader spending SOL to acquire token
USDC → TokenBuyTrader spending stables to acquire token
Token → SOLSellTrader converting token back to SOL
Token → USDCSellTrader converting token to stables
Token A → Token BContext-dependentClassify based on which token you're analyzing

From API Data Sources

Birdeye Trade History (/defi/txs/token):

  • Returns side field: "buy" or "sell"
  • Includes from (input token) and to (output token) amounts

DexScreener Pair Trades:

  • Returns type field indicating swap direction relative to the pair

Helius Parsed Transactions:

  • Parse swap instructions to extract input/output mints and amounts
  • Classify based on which mint matches your target token

See references/trade_classification.md for detailed classification logic and size buckets.

Volume Profiles

Time-Based Profiles

Aggregate trade volume into fixed time buckets to identify patterns:

# Hourly volume profile
hourly_volume = {}
for trade in trades:
    hour = trade["timestamp"] // 3600 * 3600
    hourly_volume.setdefault(hour, {"buy_vol": 0, "sell_vol": 0})
    if trade["side"] == "buy":
        hourly_volume[hour]["buy_vol"] += trade["volume_usd"]
    else:
        hourly_volume[hour]["sell_vol"] += trade["volume_usd"]

Key metrics from time profiles:

  • Peak hours — when is the token most actively traded?
  • Volume trend — is volume increasing, decreasing, or stable?
  • Volume anomalies — spikes exceeding 3x the rolling average

Size-Based Profiles

Classify trades into size buckets to separate whale activity from retail:

BucketSOL RangeTypical Actor
Micro< 0.1 SOLDust / test trades
Small0.1 – 1 SOLRetail traders
Medium1 – 10 SOLActive traders
Large10 – 50 SOLSerious positions
Whale50+ SOLWhales / institutions

Buyer/Seller Pressure Metrics

Core Ratios

def compute_pressure(trades: list[dict], period_seconds: int = 3600) -> dict:
    """Compute buy/sell pressure metrics over a time period."""
    buy_vol = sum(t["volume_usd"] for t in trades if t["side"] == "buy")
    sell_vol = sum(t["volume_usd"] for t in trades if t["side"] == "sell")
    total_vol = buy_vol + sell_vol

    buy_trades = sum(1 for t in trades if t["side"] == "buy")
    sell_trades = sum(1 for t in trades if t["side"] == "sell")
    total_trades = buy_trades + sell_trades

    return {
        "buy_sell_ratio": buy_vol / sell_vol if sell_vol > 0 else float("inf"),
        "buy_volume_pct": buy_vol / total_vol if total_vol > 0 else 0.5,
        "net_flow_usd": buy_vol - sell_vol,
        "trade_count_ratio": buy_trades / total_trades if total_trades > 0 else 0.5,
    }

Signal Interpretation

MetricBullishNeutralBearish
Buy Volume %> 60%40–60%< 40%
Net FlowPositive, increasingNear zeroNegative, increasing
Trade Count Ratio> 0.550.45–0.55< 0.45
Large Trade RatioHigh buy-sideBalancedHigh sell-side

See references/flow_signals.md for the full signal catalog and composite scoring.

Trade Size Distribution

Analyzing the distribution of trade sizes reveals market structure:

import statistics

def analyze_trade_sizes(trades: list[dict]) -> dict:
    """Analyze trade size distribution."""
    sizes = [t["volume_usd"] for t in trades]
    if not sizes:
        return {}

    return {
        "mean": statistics.mean(sizes),
        "median": statistics.median(sizes),
        "stdev": statistics.stdev(sizes) if len(sizes) > 1 else 0,
        "skew_indicator": statistics.mean(sizes) / statistics.median(sizes),
        "max_trade": max(sizes),
        "whale_pct": sum(s for s in sizes if s > 5000) / sum(sizes),
    }

Interpreting skew: A skew_indicator (mean/median) well above 1.0 indicates a fat-tailed distribution — a few large trades dominate. This is normal for tokens with whale interest but can also signal manipulation.

Momentum Signals from Trade Flow

Volume Acceleration

Compare current period volume to the previous period:

acceleration = current_volume / previous_volume if previous_volume > 0 else 0
  • acceleration > 2.0 — volume surge, potential breakout or dump
  • acceleration 0.8–1.2 — stable activity
  • acceleration < 0.5 — dying interest

Buy Pressure Acceleration

Track how the buy ratio changes over time:

current_buy_ratio = current_buy_vol / current_total_vol
previous_buy_ratio = prev_buy_vol / prev_total_vol
buy_momentum = current_buy_ratio - previous_buy_ratio

Positive buy_momentum with increasing volume is a strong accumulation signal.

Token Velocity

Token velocity measures how frequently tokens change hands:

velocity = daily_volume / circulating_supply
VelocityInterpretation
< 0.01Low activity, illiquid, or strong holders
0.01–0.05Normal trading activity
0.05–0.20Active trading, possible speculation
> 0.20Very high turnover, potential wash trading

High velocity combined with low unique trader count is a wash trading red flag.

Wash Trading Detection

Wash trading inflates volume to make a token appear more active than it truly is. Key detection signals:

  1. Low unique trader ratio — unique_wallets / trade_count < 0.3
  2. Volume/TVL anomaly — daily_volume / tvl > 10 (volume vastly exceeds liquidity)
  3. Uniform trade sizes — low entropy in trade size distribution
  4. Self-trading — same wallet on both sides within short windows
  5. Funded-together clusters — multiple wallets funded from the same source

See references/wash_trading.md for detailed detection methods and scoring.

Data Sources

Birdeye API

Primary source for trade history on Solana tokens:

  • GET /defi/txs/token — recent trades for a token
  • GET /defi/ohlcv — candle data with volume
  • GET /defi/price/volume — aggregated volume data

Requires API key. See the birdeye-api skill for endpoint details.

DexScreener API

Free, no-auth alternative for pair-level data:

  • GET /latest/dex/tokens/{address} — token pairs with volume
  • GET /latest/dex/pairs/solana/{pairAddress} — pair details

Helius API

For wallet-level trade analysis and parsed transactions:

  • Parse swap transactions to extract trade details
  • Attribute trades to specific wallets
  • See the helius-api skill for transaction parsing.

Composite Momentum Score

Combine multiple flow signals into a single score (range: -100 to +100):

def compute_momentum_score(
    buy_ratio: float,
    volume_accel: float,
    whale_buy_pct: float,
    unique_trader_trend: float,
) -> float:
    """Compute composite momentum score from flow signals.

    Args:
        buy_ratio: Buy volume / total volume (0 to 1).
        volume_accel: Current vol / previous vol.
        whale_buy_pct: Whale buy volume / total whale volume (0 to 1).
        unique_trader_trend: Change in unique traders vs previous period.

    Returns:
        Score from -100 (strong sell pressure) to +100 (strong buy pressure).
    """
    # Buy ratio component: 0.5 = neutral, maps to [-40, +40]
    buy_component = (buy_ratio - 0.5) * 80

    # Volume acceleration: >1 = growing, maps to [-20, +20]
    vol_component = min(max((volume_accel - 1.0) * 20, -20), 20)

    # Whale direction: 0.5 = neutral, maps to [-25, +25]
    whale_component = (whale_buy_pct - 0.5) * 50

    # Unique trader growth: positive = healthy, maps to [-15, +15]
    trader_component = min(max(unique_trader_trend * 15, -15), 15)

    score = buy_component + vol_component + whale_component + trader_component
    return max(-100, min(100, score))
Score RangeInterpretation
+60 to +100Strong accumulation — heavy buy pressure
+20 to +60Moderate buying — cautious accumulation
-20 to +20Neutral / balanced flow
-60 to -20Moderate selling — distribution underway
-100 to -60Strong distribution — heavy sell pressure

Integration with Other Skills

SkillHow It Connects
birdeye-apiPrimary data source for trade history and volume
helius-apiWallet-attributed trade data from parsed transactions
liquidity-analysisVolume/TVL ratios, liquidity context for flow signals
whale-trackingIdentify whale wallets for large trade attribution
token-holder-analysisSupply distribution context for velocity metrics
position-sizingUse flow signals to adjust entry sizing
regime-detectionCombine flow momentum with regime classification

Files

References

  • references/trade_classification.md — Buy/sell classification logic, size buckets, aggregation
  • references/flow_signals.md — Complete signal catalog with formulas and interpretation
  • references/wash_trading.md — Detection methods, metrics, and risk scoring

Scripts

  • scripts/trade_flow_analysis.py — Fetch trades, classify, compute flow signals and momentum
  • scripts/volume_profile.py — Hourly volume profiles, trend detection, anomaly identification

FAQ

What does the market-microstructure skill do?

DEX orderflow analysis, trade classification, buyer/seller pressure, and microstructure signals for Solana tokens

How do I install market-microstructure?

Run npx skills add https://github.com/agiprolabs/claude-trading-skills --skill market-microstructure in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/market-microstructure/ (personal) or .claude/skills/market-microstructure/ (project).

Which AI agents can use market-microstructure?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is market-microstructure safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains market-microstructure?

It is published by agiprolabs in agiprolabs/claude-trading-skills. It has 519 recorded installs.

More from agiprolabs/claude-trading-skills

View all →

walk-forward-validation

agiprolabs/claude-trading-skills

Walk-forward validation framework for trading strategies and ML models with time-series-aware splits, overfit detection, and regime-aware validation

Business & Finance714 installs

risk-management

agiprolabs/claude-trading-skills

Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading

Business & Finance637 installs

pandas-ta

agiprolabs/claude-trading-skills

Technical analysis with 130+ indicators using pandas-ta for crypto market data

Data & Databases593 installs

position-sizing

agiprolabs/claude-trading-skills

Trade sizing methods including fixed fractional, volatility-adjusted, Kelly criterion, and liquidity-constrained sizing

Business & Finance581 installs

regime-detection

agiprolabs/claude-trading-skills

Market regime identification using volatility clustering, trend detection, and statistical methods for adaptive trading

Business & Finance578 installs

kelly-criterion

agiprolabs/claude-trading-skills

Kelly criterion optimal sizing with fractional variants, edge estimation, and practical application for crypto trading

Business & Finance534 installs

Popular business & finance skills

View category →

sales-enablement

coreyhaines31/marketingskills

When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),

Business & Finance119.5K installs

revops

coreyhaines31/marketingskills

When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.

Business & Finance114.1K installs

sales-funnel-blueprint

autonnel/autonnel-skills

Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.

Business & Finance104.5K installs

pricing

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.

Business & Finance80K installs

cross-border-ecommerce

nexscope-ai/ecommerce-skills

Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.

Business & Finance62.9K installs

pricing-strategy

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' or 'should I offer a free plan.' Use this whenever someone is figuring out what to charge or how to structure their plans. For in-app upgrade screens, see paywall-upgrade-cro.

Business & Finance61.2K installs