Skip to main content
Glama
SwapHunt crypto market context

SwapHunt crypto market context

Official

SwapHunt x402 examples

SwapHunt's x402 API sells crypto market context per call (prices, market regime, volatility, funding, coin strength vs BTC and anti-FOMO sanity checks computed from Hyperliquid perpetuals, alt season, the Crypto Fear & Greed Index, the halving countdown, trading session and weekend liquidity), paid in USDC on Base, Polygon, Arbitrum or Solana with the x402 protocol. No account, no API key: the payment is the credential.

The examples pay on Base. Every endpoint has the same price on all four networks; see docs/endpoints.md for the network list.

These examples get you from zero to a paid call in a few minutes, and show how to build on it.

Examples

Example

Language

What it does

Cost per run

quickstart

Python, TypeScript

One paid call to /v1/market/fear-greed

$0.005

daily-brief

Python

Fear & Greed with its 1, 7 and 30-day changes, halving countdown, trading session and weekend liquidity, summarized by an LLM and delivered to stdout, Telegram, Discord or email

$0.013 + LLM tokens

mcp-server

Python (uvx swaphunt-mcp)

30 SwapHunt tools (Hyperliquid prices, regime, volatility, funding, coin strength, dip/breakout/FOMO checks; Fear & Greed) for Claude and other AI agents, paid per call with a session cap

$0.001-0.015 per tool call

alert-bot

Python

Checks one price on an interval and messages you on Telegram when it crosses a threshold

$0.005 per check

The API has 30 paid endpoints, from $0.001 to $0.015 per call; the live list with parameters is in the OpenAPI docs. Prices, parameters and example responses for the core endpoints: docs/endpoints.md.

Fear & Greed data comes from Alternative.me, which asks for attribution next to its data. The responses include an attribution field with the text to show.

Related MCP server: cerebrus-pulse-mcp

Quickstart

You need a wallet with a few dollars of USDC on Base mainnet (see Security).

git clone https://github.com/swaphunt/x402-examples.git
cd x402-examples/quickstart/python
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt

.venv/bin/python quickstart.py          # dry run: shows the price, pays nothing

cp ../../.env.example ../../.env        # put your PRIVATE_KEY in ../../.env
set -a; . ../../.env; set +a
.venv/bin/python quickstart.py --pay    # pays $0.005

Output of the paid call:

Price: $0.005 USDC on eip155:8453, payTo 0x<swaphunt-address>
200 {'value': 30, 'label': 'Fear', 'timestamp': '2026-10-31T00:00:00', 'source': 'alternative.me', ...}
This run cost $0.005 (tx https://basescan.org/tx/0x<transaction-hash>)

The TypeScript version and a 10-line minimal snippet are in quickstart/.

How x402 works

  1. You call an endpoint without paying and get 402 Payment Required, with the price, network and receiving address in the PAYMENT-REQUIRED header.

  2. Your x402 client signs a USDC transfer for exactly that amount.

  3. You retry with the signed payment. A facilitator settles it on Base, and you get 200 with the data and the transaction hash.

The official x402 client libraries (Python, TypeScript) do steps 2 and 3 for you.

Security

  • Use a dedicated wallet with a few dollars of USDC on Base mainnet. Never your main wallet. The facilitator pays the gas, so the wallet only needs USDC.

  • Dry run by default. Every example shows what it would pay and stops. It only pays with --pay or X402_PAY=1.

  • Spending cap. Every example refuses to spend more than MAX_SPEND_USD per run (default $0.10) and prints what the run cost.

  • Payee allowlist (MCP server). With PAYTO_ALLOWLIST set, the MCP server pays only the addresses you list and refuses any other payTo before signing. See mcp-server.

  • Never commit keys. Put PRIVATE_KEY and API keys in .env (ignored by git), using .env.example as the template.

License

MIT

Nothing here is investment advice.

Available Tools

32 tools
get_alt_seasonA

Use when the user asks if it is alt season. Returns the SwapHunt Alt Season Index (0-100, daily): share of the top 100 Hyperliquid perpetuals by 30-day volume beating BTC over 90 days; 75 or above is alt season, 25 or below is bitcoin season. Ex: no parameters Costs $0.003 USDC per call.

Inputs: no named parameters.

get_chop_detectionA

Use when the user asks whether a coin is trending or stuck in a range. Returns is_chop, chop level, ADX, +DI/-DI, trend direction and a verdict on 1h, 4h or 1d candles of Hyperliquid perpetuals. Any active market. Ex: symbol=SOL, timeframe=4h Costs $0.003 USDC per call.

Inputs: symbol, timeframe.

get_coin_strengthA

Use when the user asks if a coin is outperforming or lagging BTC. Returns its return minus BTC's over 24h, 7d or 30d, a rating (very_strong to very_weak) and the ratio. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=SOL, period=7d Costs $0.015 USDC per call.

Inputs: period, symbol.

get_compression_alertA

Use when the user asks whether a coin is in a volatility squeeze before a breakout. Returns is_squeeze, level (extreme, strong, moderate, none), Bollinger width and its percentile on 1h, 4h or 1d candles of Hyperliquid perpetuals. Setup, not direction. Ex: symbol=BTC, timeframe=1d Costs $0.003 USDC per call.

Inputs: symbol, timeframe.

get_correlationA

Use when the user asks if a coin just tracks BTC. Returns Pearson correlation (-1 to +1) of returns vs BTC over 7d (1h candles) or 30d (4h); no 24h. With strength label. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=ETH, period=30d Costs $0.003 USDC per call.

Inputs: period, symbol.

get_expected_moveA

Use when the user asks how far a coin may move, or where to put targets and stops. Returns ATR(14)-based 68% and 95% price ranges in USDC around the current price on Hyperliquid perpetuals for the next 4h, 1d or 1w. A statistical range, not a forecast. Ex: symbol=BTC, period=1w Costs $0.003 USDC per call.

Inputs: period, symbol.

get_fear_greedA

Use when the user asks how fearful or greedy the crypto market is today. Returns the Crypto Fear & Greed Index (0-100), its label (Extreme Fear to Extreme Greed) and the attribution to show with it; daily. For trend use get_fear_greed_compare. Show attribution with the values. Ex: no parameters Costs $0.005 USDC per call.

Inputs: no named parameters.

get_fear_greed_compareA

Use when the user asks whether crypto sentiment is improving or worsening. Returns Fear & Greed now with its label, the values yesterday, 7 and 30 days ago, the changes (change_1d, change_7d, change_30d) and the attribution. Show attribution with the values. Ex: no parameters Costs $0.002 USDC per call.

Inputs: no named parameters.

get_fear_greed_historyA

Use when the user wants the Fear & Greed time series to chart, backtest or compare with price. Returns daily value and classification for the last days (max 365) or start_date to end_date (YYYY-MM-DD), with attribution. Raw series, no summary. Show attribution with the values. Ex: days=90 Costs $0.005 USDC per call.

Inputs: days, end_date, start_date.

get_funding_historyA

Use when the user asks whether a coin's funding is unusual for it. Returns settled hourly funding on Hyperliquid perpetuals for the last days (1-365): average, min/max, annualized (x 8760), share of positive hours and the latest rate's percentile. Ex: symbol=ETH, days=90 Costs $0.004 USDC per call.

Inputs: days, symbol.

get_funding_ratesA

Use when the user asks the funding rate of specific coins or whether longs or shorts are crowded. Returns per coin (max 20) hourly funding % on Hyperliquid perpetuals, annualized (x 8760), 7d/30d averages, mark price and a crowding signal; positive = longs pay. Ex: symbols=BTC,ETH,SOL Costs $0.015 USDC per call.

Inputs: symbols.

get_green_candle_streakA

Use when the user asks how many green candles in a row a coin has. Returns the streak on 1h, 4h or 1d and how often the next candle was green after such streaks. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=BTC, interval=1d Costs $0.003 USDC per call.

Inputs: symbol, interval.

get_halvingA

Use when the user asks when the next Bitcoin or Litecoin halving is. Returns current and halving block, blocks and days remaining, estimated date, progress % and block reward before and after. Estimated from block time, not an exact timestamp. Ex: symbol=LTC Costs $0.001 USDC per call.

Inputs: symbol.

get_market_regimeA

Use when the user asks whether the crypto market (BTC) is bullish, bearish or neutral. Returns the regime from the BTC price on Hyperliquid perpetuals vs its 20-period EMA on 12h candles, with EMA, distance and slope; updates 00:00 and 12:00 UTC. BTC only. Ex: no parameters Costs $0.010 USDC per call.

Inputs: no named parameters.

get_market_silenceA

Use when the user asks whether a coin is unusually quiet. Returns a 0-1 silence score, level and advice from today's volume vs the period average, volatility and 24h change on Hyperliquid perpetuals (7d, 14d, 30d). For a squeeze use get_compression_alert. Ex: symbol=ETH, period=14d Costs $0.002 USDC per call.

Inputs: period, symbol.

get_momentum_rankA

Use when the user asks which coins are the biggest gainers or losers. Returns coins ranked by 24h, 7d or 30d return: limit (1-20) top and bottom, full list, average. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: period=7d, limit=5 Costs $0.015 USDC per call.

Inputs: limit, period.

get_priceA

Use when the user asks the current price of one coin. Returns the mark price (or order-book mid with price_type=mid) on Hyperliquid perpetuals in USDC, 24h change % and 24h notional volume; high/low are null. For several coins use get_prices. Ex: symbol=ETH Costs $0.005 USDC per call.

Inputs: symbol, price_type.

get_pricesA

Use when the user asks the prices of several coins or a portfolio. Returns, keyed by symbol (max 20), the mark or mid price on Hyperliquid perpetuals in USDC, 24h change % and 24h notional volume; unknown symbols are skipped. Works with one symbol too. Ex: symbols=BTC,ETH,SOL Costs $0.003 USDC per call.

Inputs: symbols, price_type.

get_pump_ageA

Use when the user asks if a coin is pumping now and how old the move is. Returns is_pumping, start, duration and size vs the average pump in the last 24h of 15m candles. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=SOL Costs $0.003 USDC per call.

Inputs: symbol.

get_spendingA

Free, runs locally (no API call, no payment). Use when the user asks how much this session has spent or what budget is left. Returns whether payments are enabled, USDC spent, paid calls, the MAX_SPEND_USD cap and the remaining budget. Ex: no parameters

Inputs: no named parameters.

get_supported_assetsA

Use when the user asks which coins are supported, or a symbol is uncertain (Hyperliquid names, e.g. kPEPE = 1,000 PEPE). Returns every active Hyperliquid perpetuals market, the count and covered: the top 50 by 30-day volume that analysis routes accept. Ex: no parameters Costs $0.001 USDC per call.

Inputs: no named parameters.

get_top_funding_ratesA

Use when the user asks which coins have the most extreme funding right now. Returns the top limit (1-50) current hourly funding rates across all Hyperliquid perpetuals, annualized (x 8760), sort=highest (crowded longs) or lowest (crowded shorts). Ex: sort=lowest, limit=10 Costs $0.003 USDC per call.

Inputs: sort, limit.

get_trading_sessionA

Use when the user asks which trading session is active or how volatile this time of day usually is. Returns the session (Asian, London, New York, Off-hours), overlap, minutes left, the next session and its typical volatility multiplier, from the UTC clock. Ex: no parameters Costs $0.005 USDC per call.

Inputs: no named parameters.

get_volatilityA

Use when the user asks how volatile a coin has been. Returns daily and annualized realized volatility % over 7d, 14d or 30d of daily candles on Hyperliquid perpetuals, a low/normal/high/extreme level and today's UTC range vs open. Not implied vol. Ex: symbol=BTC, period=30d Costs $0.010 USDC per call.

Inputs: period, symbol.

get_weekend_liquidityA

Use when the user asks whether crypto liquidity is thin right now, e.g. on a weekend or in off-hours. Returns is_weekend, is_low_liquidity, the session, a 0-100 liquidity score and a verdict, from the UTC clock (no market data). Ex: no parameters Costs $0.005 USDC per call.

Inputs: no named parameters.

how_late_am_iA

Use when the user asks if they are too late to buy after a run-up. Returns the move from the 4h swing low in % and ATR, its percentile vs past moves, early/middle/late verdict. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=SOL Costs $0.003 USDC per call.

Inputs: symbol.

is_price_extendedA

Use when the user asks if price is stretched far from its average. Returns distance from MA20 and MA50, Bollinger position, z-score on 4h candles, is_extended and a verdict. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=ETH Costs $0.003 USDC per call.

Inputs: symbol.

is_this_a_breakoutA

Use when the user asks if a break of a price level is real or a fakeout. Returns is_confirmed, fakeout odds, verdict from volume and 1h closes past the level (USDC, required). Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=BTC, level=100000 Costs $0.003 USDC per call.

Inputs: level (required), symbol, direction.

is_this_a_dipA

Use when the user asks if a drop is a real dip or noise. Returns is_dip, drop % from the 14-day high, 14-day ATR %, drop/ATR and a verdict on daily candles. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=SOL Costs $0.003 USDC per call.

Inputs: symbol.

is_this_oversoldA

Use when the user asks if a coin is oversold. Returns is_oversold, RSI(14) on 1h, 4h and 1d, a weighted RSI (20/30/50%) and a verdict; not a buy signal alone. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=BTC Costs $0.003 USDC per call.

Inputs: symbol.

is_this_supportA

Use when the user asks if a price level is real support. Returns touches within 0.5% over 90 daily candles, recency, bounce quality, verdict. Level in USDC, required. Top 50 Hyperliquid perpetuals by 30-day volume only (see get_supported_assets), others unpaid. Ex: symbol=ETH, level=3000 Costs $0.003 USDC per call.

Inputs: level (required), symbol.

pm_feesA
Read-only

Free, runs locally (no API call, no payment). Use when the user asks the fee for an order on Kalshi, Polymarket US or polymarket.com. Returns fee_usd, fee %, break-even exit, rates as_of. contracts = USD / price; polymarket needs category; at = fill time (default now). Ex: platform=polymarket, price=0.4, contracts=250, category=Politics

Inputs: price (required), platform (required), contracts (required), at, +5 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      24/7 autonomous monitoring and edge detection for prediction markets (Kalshi & Polymarket). Features causal tree analysis, orderbook depth tracking, cross-venue comparison, and real-time alerts.
      16
      196 npm
      12
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Real-time crypto intelligence for AI agents. Technical analysis, liquidation heatmaps, sentiment, and funding rates for 50+ Hyperliquid perpetuals via x402 micropayments.
      15
      39 PyPI
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Read-only crypto perps microstructure for AI agents: normalized cross-exchange market state (funding + multi-year percentile, OI, volume, CVD, order-book imbalance, liquidations, basis), OHLCV, 15-min state history, and measured conditional outcomes (historical base rates, not predictions) — 6 assets across Binance, Bybit, OKX and Hyperliquid, every metric with self-declared coverage and freshness
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Provides free Polymarket discovery data alongside paid deep-market intelligence tools via live x402 HTTP handshakes on Base mainnet. It allows AI agents to securely settle real, ultra-low-cost USDC micro-payments (0.05 USDC) directly over the Model Context Protocol.
      4
      MIT