Build a programmable trading system using CoinMarketCap API for signals and Uniswap V4 Hooks for on-chain execution.
Introduction
Uniswap V4 introduces hooks, which let you attach custom logic to pool events.
Execution becomes programmable. The missing piece is timing.
CoinMarketCap API fills that gap by surfacing price, liquidity, and activity across DEXs.
- CoinMarketCap API powers the signal layer
- Uniswap V4 Hooks execute strategy logic on-chain
Why Combine CoinMarketCap and Uniswap V4?
Hooks will define behavior and signals decide when to act.
CoinMarketCap API Provides
- DEX-native pricing
- liquidity and volume
- pool-level data
- transaction activity
- discovery endpoints
Uniswap V4 Hooks Provide
- programmable execution
- dynamic fees and logic
- automated strategies inside pools
System Architecture
CoinMarketCap API (Signal Layer)
├─ Discovery
├─ Price and Volume
├─ Liquidity Checks
├─ Transaction Activity
└─ Risk Filters
↓
Signal Engine
↓
Uniswap V4 Hooks (Execution Layer)
↓
On-chain Strategy Execution
Step 1 Discover Tokens
Use DEX discovery endpoints (POST with JSON body):
- /v1/dex/new/list
- /v1/dex/meme/list
- /v1/dex/tokens/trending/list
- /v1/dex/gainer-loser/list
To run the automated token discovery using the /v1/dex/new/list endpoint, your CoinMarketCap API key must be on a paid commercial tier (e.g., Startup plan or higher).
HTTP 403 Forbidden
Error 1006: Plan Not Authorized
Attempting to call this endpoint with a Free (Basic) plan will result in the error above.
Make sure your API plan includes access to DEX discovery endpoints before implementing automated token scanning.
Step 2 Detect Volatility
Use OHLCV data to measure price movement strength.
Endpoint:
/v4/dex/pairs/ohlcv/historical
This returns:
- open
- high
- low
- close
- volume
Use parameters such as contract_address, network_slug, interval (e.g. 1m, 5m, 1h), time_start, and time_end to control the dataset.
Step 3 Detect Momentum
Identify tokens gaining traction.
Endpoints:
/v1/dex/tokens/trending/list
/v1/dex/gainer-loser/list
Look for:
- rising volume
- increasing trader count
- strong price change
Step 4 Analyze Liquidity
Liquidity determines execution quality.
Endpoint:
/v1/dex/token/pools
Key fields:
- exn (DEX name)
- liqUsd (liquidity per pool)
- v24 (24h volume)
Focus on tokens with multiple strong pools.
Step 5 Evaluate Trading Activity
Use transaction data to confirm real activity.
Endpoint:
/v4/dex/spot-pairs/latest
⚠️ Required parameters:
- network_slug (e.g. "ethereum")
- base_asset_contract_address (token contract)
- dex_slug (optional, e.g. "uniswap-v3")
Without these parameters, the request will fail.
Metrics:
- num_transactions_24h
- 24h_no_of_buys
- 24h_no_of_sells
Strong buy pressure often signals continuation.
Step 6 Get DEX Price
Avoid global averages. Use on-chain pricing.
Endpoints:
- /v1/dex/token/price
- /v4/dex/pairs/quotes/latest
These return:
- real pool price
- buy_tax and sell_tax
- pair-level data
Step 7 Generate Trading Signal
Combine all inputs:
- sufficient liquidity
- rising volume
- strong buy ratio
- positive momentum
Filter out tokens with high taxes or weak liquidity.
Step 8 Execute with Hooks
Execute With Hooks (On-Chain)
It is important to separate the layers.
CoinMarketCap API operates off-chain and provides signals through REST.
Uniswap V4 Hooks operate on-chain as smart contracts.
You do not execute trades via HTTP requests.
Instead, your bot must:
- Receive a signal from CoinMarketCap (e.g. strong momentum)
- Use a Web3 library such as web3.py or ethers.js
- Construct and send a blockchain transaction
- Trigger your custom Hook smart contract
Once executed, the Hook can run logic such as:
- adjusting fees based on volatility
- splitting execution over time
- reacting dynamically to pool conditions
Rate Limit Strategy
CoinMarketCap API uses REST polling.
Best practices:
- poll every 30 to 60 seconds
- cache results
- batch requests
- use backoff strategies
Common Mistakes
Missing Liquidity Checks
Low liquidity breaks execution.
Using Global Prices
Always use DEX-native endpoints.
Ignoring Taxes
buy_tax and sell_tax can remove profits.
Over-polling
Leads to rate limits and wasted credits.
Final Thoughts
A strong trading system combines signal quality with execution control.
CoinMarketCap API helps you find better opportunities.
Uniswap V4 Hooks let you act on them directly on-chain.
Together, they create programmable trading systems that adapt to market conditions.
Next Steps
- refine signal thresholds
- test strategies on historical data
- track execution outcomes
- improve risk filters
Remember, better signals drive better performance!
