Agent skill

Market Microstructure

by agiprolabs in agiprolabs/claude-trading-skills

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

MITAuto-check passedBusiness, Finance & HR

Install Market Microstructure

skills CLI
$ npx skills add agiprolabs/claude-trading-skills --skill market-microstructure -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install agiprolabs/claude-trading-skills market-microstructure --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/market-microstructure .claude/skills/market-microstructure && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
market-microstructure
GitHub stars
410
Token cost
~2.8k tokens
SKILL.md length
951 words
Files
6 (incl. scripts, references)
Skills in repo
68
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 4 steps: Who is trading? — Whale wallets vs… → How are they trading? — Large single… → When are they trading? — Volume… → …
  • Tasks that involve Trading and backtesting
  • SKILL.md covers Overview, Why Microstructure Matters on…, Trade Classification and Volume Profiles, plus 9 more sections
  • Runs Python scripts from its folder

What it does

Market Microstructure is an agent skill from agiprolabs/claude-trading-skills. DEX orderflow analysis, trade classification, buyer/seller pressure, and microstructure signals for Solana tokens

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `references/flow_signals.md`, `references/trade_classification.md` and `references/wash_trading.md`).

It sits in Business, Finance & HR, covering Trading and backtesting. It works with Solana. The repository describes itself as: 68 trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools. The licence is MIT.

When your agent uses it

  • Tasks that involve Trading and backtesting

Example prompts

  • “/market-microstructure”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  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

What it can do on your machine

Read from SKILL.md and the folder at commit 981e1d7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Market Microstructure loads about 2.8k tokens when it runs, and up to ~8.2k if it reads all its reference files. Until then it costs about 34 tokens; SKILL.md has 951 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~34
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~8.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from agiprolabs/claude-trading-skills at commit 981e1d7, republished under its MIT licence (© agiprolabs). 951 words, ~2,821 tokens.

Download SKILL.mdSave it as .claude/skills/market-microstructure/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
market-microstructure
description
DEX orderflow analysis, trade classification, buyer/seller pressure, and microstructure signals for Solana tokens

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:

python
# 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
python
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:

python
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:

python
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:

python
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.

Show full SKILL.md (370 more words)Show less

Token Velocity

Token velocity measures how frequently tokens change hands:

python
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):

python
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

© agiprolabs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in skills/market-microstructure of agiprolabs/claude-trading-skills.

  • SKILL.md
  • references/flow_signals.md
  • references/trade_classification.md
  • references/wash_trading.md
  • scripts/trade_flow_analysis.py
  • scripts/volume_profile.py

Open the folder on GitHubat commit 981e1d7

Compare with similar skills

Market Microstructure next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Market Microstructure compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Market Microstructure this skillagiprolabs/claude-trading-skills410—~2.8kAutomated safety check: PassMIT
Prismirfndi/prism-liquidity-agent123—~1.5kAutomated safety check: PassMIT
Solana Sniper Botnpc-live/clawfirm156—~913Automated safety check: NotesNone
Solana Payments Wallets Tradingnpc-live/clawfirm1561 repos~4.7kAutomated safety check: PassMIT
Gmgn PortfolioGMGNAI/gmgn-skills607—~5.8kAutomated safety check: NotesMIT
Trading Signalbinance/binance-skills-hub1.1k—~682Automated safety check: PassNone

Similar skills

  • Prism

    irfndi/prism-liquidity-agent

    Operate Prism, an autonomous Solana DLMM liquidity agent for Meteora pools.

    123 GitHub stars~1.5k tokensUpdated 11 days ago
    Business, Finance & HRAuto-check passed
  • Solana Sniper Bot

    npc-live/clawfirm

    Autonomous Solana token sniper and trading bot. An agent skill from npc-live/clawfirm.

    156 GitHub stars~913 tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check: notes
  • Pay people in SOL or USDC, buy and sell tokens, check prices, discover trending and new tokens, create and manage Solana wallets, stake SOL, earn yield through lending and managed vaults, borrow…

    156 GitHub starsUsed in 1 repo~4.7k tokens
    Business, Finance & HRAuto-check passed
  • Gmgn Portfolio

    GMGNAI/gmgn-skills

    Analyze one or many crypto wallets by address — holdings, batch realized/unrealized P&L, win rate, trading history, performance stats, specific token balance, and tokens created by a developer…

    607 GitHub stars~5.8k tokensUpdated 11 days ago
    Business, Finance & HRAuto-check: notes
  • Trading Signal

    binance/binance-skills-hub

    Per-trade smart-money signals — each result is a discrete buy or sell event from a tracked smart-money wallet, with trigger price, current price, max gain since trigger, and exit rate.

    1.1k GitHub stars~682 tokensUpdated 28 days ago
    Business, Finance & HRAuto-check passed
  • Bags

    alsk1992/CloddsBot

    Bags.fm - Complete Solana token launchpad with creator monetization

    2.9k GitHub stars~864 tokensUpdated 6 days ago
    Business, Finance & HRAuto-check passed

More from agiprolabs/claude-trading-skills

All 68 skills in this repo
  • Backtrader

    agiprolabs/claude-trading-skills

    Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers, and custom indicators

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Birdeye API

    agiprolabs/claude-trading-skills

    Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity

    410 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Coingecko API

    agiprolabs/claude-trading-skills

    Broad crypto market data from CoinGecko covering 13,000+ tokens.

    410 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Cointegration Analysis

    agiprolabs/claude-trading-skills

    Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability analysis

    410 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Copy Trading

    agiprolabs/claude-trading-skills

    Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Correlation Analysis

    agiprolabs/claude-trading-skills

    Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Market Microstructure

What does Market Microstructure do?

DEX orderflow analysis, trade classification, buyer/seller pressure, and microstructure signals for Solana tokens. Market Microstructure is an agent skill from agiprolabs/claude-trading-skills.

When should I use Market Microstructure?

Market Microstructure fits situations like: tasks that involve Trading and backtesting.

How do I install Market Microstructure in Claude Code?

Run `npx skills add agiprolabs/claude-trading-skills --skill market-microstructure -a claude-code`. Or copy the skill folder (skills/market-microstructure in agiprolabs/claude-trading-skills) into .claude/skills/market-microstructure in your project. Claude Code loads it when a task matches its description.

How do I install Market Microstructure in Codex?

Run `npx skills add agiprolabs/claude-trading-skills --skill market-microstructure -a codex`. Or copy the skill folder (skills/market-microstructure in agiprolabs/claude-trading-skills) into .agents/skills/market-microstructure in your project. Codex loads it when a task matches its description.

Can I use Market Microstructure in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add agiprolabs/claude-trading-skills --skill market-microstructure -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/market-microstructure, .gemini/skills/market-microstructure, .github/skills/market-microstructure and .opencode/skills/market-microstructure in your project.

What does Market Microstructure need to run?

Going by SKILL.md and its folder, Market Microstructure needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Market Microstructure access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Market Microstructure safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Market Microstructure use?

Market Microstructure is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Market Microstructure use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.4k tokens, read only when the agent opens those files.

What are the alternatives to Market Microstructure?

Skills that share tags, products or a category with Market Microstructure: Prism (irfndi/prism-liquidity-agent, 123 stars), Solana Sniper Bot (npc-live/clawfirm, 156 stars), Solana Payments Wallets Trading (npc-live/clawfirm, 156 stars) and Gmgn Portfolio (GMGNAI/gmgn-skills, 607 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Market Microstructure?

agiprolabs (a GitHub user) maintains it in agiprolabs/claude-trading-skills, which has 410 GitHub stars. The repository holds 68 skills in this directory. The repository was last updated on September 3, 2026.

Source: agiprolabs/claude-trading-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.