routing-dex-trades
Aggregates quotes from multiple DEXs to discover optimal swap routes and minimize trade slippage.
Install
mkdir -p .claude/skills/routing-dex-trades && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4772" && unzip -o skill.zip -d .claude/skills/routing-dex-trades && rm skill.zipInstalls to .claude/skills/routing-dex-trades
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Route trades across multiple DEXs to find optimal prices with minimalKey capabilities
- →Aggregate quotes from 1inch, Paraswap, and 0x
- →Discover multi-hop routes for trades
- →Calculate split orders for large trades
- →Assess MEV risk before trade execution
- →Minimize slippage and gas costs
How it works
The skill aggregates quotes from multiple decentralized exchanges, discovers multi-hop routes, and calculates split orders. It also assesses MEV risk to optimize trade execution.
Inputs & outputs
When to use routing-dex-trades
- →Compare prices across DEXs
- →Find optimal swap routes
- →Assess trade slippage and gas costs
- →Execute split-order trading
About this skill
Routing DEX Trades
Contents
Overview | Prerequisites | Instructions | Output | Error Handling | Examples | Resources
Overview
Optimal trade routing across decentralized exchanges by aggregating quotes from 1inch, Paraswap, and 0x. Discovers multi-hop routes, calculates split orders for large trades, and assesses MEV risk to minimize slippage and gas costs.
Prerequisites
- Install Python 3.9+ with
httpx,pydantic, andrichpackages - Verify network access to aggregator APIs (1inch, Paraswap, 0x)
- Optionally add API keys for 1inch and 0x (higher rate limits)
- Copy settings:
cp ${CLAUDE_SKILL_DIR}/config/settings.yaml.example ${CLAUDE_SKILL_DIR}/config/settings.yaml
Instructions
-
Get a quick quote for the single best price with gas cost and effective rate:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 1.0 -
Compare all DEXs to see quotes ranked by effective rate (after gas):
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 5.0 --compare -
Analyze multi-hop routes to compare direct vs. multi-hop (2-3 pools) with hop-by-hop breakdown:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 10.0 --routes -
Split large orders ($10K+) across multiple DEXs to minimize total price impact:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 100.0 --split -
Assess MEV risk (sandwich attack risk score: LOW/MEDIUM/HIGH) before executing:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 50.0 --mev-check -
Run full analysis combining all features for comprehensive output:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 25.0 --full --output json
Output
- Quick Quote: Best price, output amount, gas cost, recommended venue
- Comparison: All venues ranked by effective rate with price impact and gas
- Route Analysis: Direct vs. multi-hop with hop-by-hop breakdown
- Split Mode: Optimal allocation percentages with dollar savings vs. single-venue
- MEV Assessment: Risk score, exposure estimate, protection recommendations
See ${CLAUDE_SKILL_DIR}/references/implementation.md for detailed output examples.
Error Handling
| Error | Cause | Solution |
|---|---|---|
| API Rate Limited | Too many requests | Wait 60s or add API key for higher limits |
| Quote Expired | Stale price data | Refresh before execution; quotes valid ~30s |
| No Route Found | Low liquidity token | Try larger DEXs or reduce trade size |
| Network Timeout | Aggregator down | Retry or check aggregator status page |
See ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error handling.
Examples
Compare prices for a 5 ETH swap:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 5.0 --compare
Find optimal split for a large order:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 100.0 --split
Check MEV risk before executing:
python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 50.0 --mev-check
See ${CLAUDE_SKILL_DIR}/references/examples.md for multi-hop discovery and MEV-protected execution examples.
Resources
${CLAUDE_SKILL_DIR}/references/implementation.md- Trade size guide, split optimization, MEV scoring, API config- 1inch API - Primary aggregator
- Paraswap API - Secondary aggregator
- 0x API - Third aggregator
- Flashbots Protect - MEV protection
Prerequisites
How it compares
This skill automates the process of finding optimal DEX trade routes and assessing MEV risk, which is more efficient than manually comparing prices across multiple exchanges.
Compared to similar skills
routing-dex-trades side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| routing-dex-trades (this skill) | 1 | 27d | Review | Intermediate |
| quant-analyst | 103 | 2mo | No flags | Advanced |
| stock-analyzer | 71 | 2mo | Review | Beginner |
| pair-trade-screener | 11 | 1mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by jeremylongshore
View all by jeremylongshore →You might also like
quant-analyst
zenobi-us
Expert quantitative analyst specializing in financial modeling, algorithmic trading, and risk analytics. Masters statistical methods, derivatives pricing, and high-frequency trading with focus on mathematical rigor, performance optimization, and profitable strategy development.
stock-analyzer
FrancyJGLisboa
Provides comprehensive technical analysis for stocks and ETFs using RSI, MACD, Bollinger Bands, and other indicators. Activates when user requests stock analysis, technical indicators, trading signals, or market data for specific ticker symbols.
pair-trade-screener
tradermonty
Statistical arbitrage tool for identifying and analyzing pair trading opportunities. Detects cointegrated stock pairs within sectors, analyzes spread behavior, calculates z-scores, and provides entry/exit recommendations for market-neutral strategies. Use when user requests pair trading opportunities, statistical arbitrage screening, mean-reversion strategies, or market-neutral portfolio construction. Supports correlation analysis, cointegration testing, and spread backtesting.
risk-metrics-calculation
wshobson
Calculate portfolio risk metrics including VaR, CVaR, Sharpe, Sortino, and drawdown analysis. Use when measuring portfolio risk, implementing risk limits, or building risk monitoring systems.
backtesting-trading-strategies
jeremylongshore
Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".
model-usage
openclaw
Use CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.