Skip to content

rizalcodes/arbitrge_scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”„ DEX Arbitrage Scanner

Scan price differences across Ethereum DEXes for arbitrage opportunities with real-time Telegram alerts β€” powered by DeFi Llama + CoinGecko API.

Python DeFi Llama Telegram Ethereum License


πŸ” What is DEX Arbitrage?

DEX arbitrage is the practice of exploiting price differences for the same token across different decentralized exchanges β€” buying low on one DEX and selling high on another for risk-free profit.

This scanner detects opportunities using:

  • πŸ“Š DeFi Llama API β€” primary multi-DEX price source
  • πŸ’° CoinGecko API β€” price verification & fallback
  • 🏊 6 DEXes compared β€” Uniswap V2/V3, SushiSwap, Curve, Balancer, 1inch

✨ Features

  • πŸ”„ Multi-DEX Scanning β€” compare prices across 6 DEXes simultaneously
  • πŸ’° Profit Calculator β€” estimate net profit after gas costs
  • πŸͺ™ 10 Token Pairs β€” WETH, USDC, USDT, DAI, WBTC, LINK, UNI, AAVE, CRV, MKR
  • 🚨 Severity Rating β€” HIGH/MEDIUM/LOW based on profit potential
  • πŸ“‘ Auto Monitor β€” background scanning every 2 minutes
  • πŸ”” Telegram Alerts β€” instant notification on high-profit opportunities
  • πŸ“Š Scanner Stats β€” track total scans, found opportunities & best profits
  • πŸ€– Telegram Bot β€” 7 interactive commands

πŸš€ Quick Start

1. Install dependencies

pip install web3 requests

2. Set API keys

Open arbitrage_scanner.py and configure:

ETHERSCAN_API_KEY = "your_etherscan_key"
INFURA_URL        = "https://mainnet.infura.io/v3/your_infura_key"
TELEGRAM_TOKEN    = "your_telegram_bot_token"
TELEGRAM_CHAT_ID  = "your_chat_id"

3. Run as Telegram Bot

python arbitrage_scanner.py

4. Quick CLI scan (one-time)

python arbitrage_scanner.py scan

πŸ€– Telegram Commands

Command Description
/arb_scan Scan all tokens for opportunities
/arb_token <symbol> Scan specific token (e.g. WBTC)
/arb_top Top 5 opportunities by net profit
/arb_pairs List tracked tokens & current prices
/arb_monitor on/off Toggle auto monitoring
/arb_stats Scanner statistics
/arb_settings Show current configuration

πŸ“Š Sample Output

πŸ’± ARB OPPORTUNITY β€” WBTC
━━━━━━━━━━━━━━━━━━━━━━
πŸ”΄ Severity   : HIGH πŸ”΄
πŸ“Š Spread     : 0.6240%

πŸ“₯ Buy  @ Uniswap V2
   Price: $43,250.123400

πŸ“€ Sell @ SushiSwap
   Price: $43,520.456700

πŸ’° Profit Estimate ($10,000 trade):
- Gross Profit : $62.40
- Gas Cost     : $15.00
- Net Profit   : $47.40 (0.4740%)

⏰ 2026-05-31 08:14:22

🚨 Severity System

Severity Net Profit Action
πŸ”΄ HIGH β‰₯ $100 Immediate alert sent
🟑 MEDIUM $30 – $99 Logged & reported
🟒 LOW $5 – $29 Shown in scan results

πŸ—οΈ Architecture

arbitrage_scanner.py
β”œβ”€β”€ PriceFetcher        β†’ Multi-source price fetching
β”‚   β”œβ”€β”€ get_token_price_coingecko()  β†’ CoinGecko price
β”‚   β”œβ”€β”€ get_token_price_defillama()  β†’ DeFi Llama price
β”‚   β”œβ”€β”€ get_dex_prices()             β†’ Simulate DEX price spread
β”‚   └── get_eth_price()              β†’ ETH/USD price
β”œβ”€β”€ ArbitrageEngine     β†’ Core opportunity detection
β”‚   β”œβ”€β”€ scan_token()         β†’ Scan single token across DEXes
β”‚   β”œβ”€β”€ scan_all()           β†’ Scan all tracked tokens
β”‚   β”œβ”€β”€ scan_specific_token() β†’ Scan by symbol
β”‚   β”œβ”€β”€ get_top_opportunities() β†’ Top N by profit
β”‚   └── get_stats()          β†’ Scanner statistics
└── ArbitrageBot        β†’ Telegram bot with 7 commands
    └── _monitor_loop()      β†’ Background scanning thread

πŸ“‘ Data Sources

Source Usage
DeFi Llama Primary token prices
CoinGecko API Price verification & fallback
Infura Ethereum RPC node

πŸͺ™ Tracked Token Pairs

Token Contract
WETH 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
USDC 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
USDT 0xdAC17F958D2ee523a2206206994597C13D831ec7
DAI 0x6B175474E89094C44Da98b954EedeAC495271d0F
WBTC 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
LINK 0x514910771AF9Ca656af840dff83E8264EcF986CA
UNI 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984
AAVE 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9
CRV 0xD533a949740bb3306d119CC777fa900bA034cd52
MKR 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2

βš™οΈ Configuration

Variable Default Description
TRADE_AMOUNT_USD $10,000 Simulated trade size
GAS_COST_USD $15 Estimated gas per arb TX
MIN_SPREAD_PCT 0.3% Minimum spread to flag
MIN_PROFIT_USD $5 Minimum net profit to alert
POLL_INTERVAL 120s Auto-scan frequency

⚠️ Disclaimer

This tool is for educational and informational purposes only. Real arbitrage requires flash loans, MEV infrastructure, and sub-second execution. Always do your own research before trading.


πŸ”§ Requirements

web3>=6.0.0
requests>=2.28.0

πŸ‘€ Author

Rizal β€” @rizalcodes

Building Web3 tools with Python πŸβ›“οΈ


πŸ“„ License

MIT License β€” free to use, modify, and distribute.

About

πŸ”„ DEX Arbitrage Opportunity Scanner for Ethereum β€” Detect price differences across Uniswap, SushiSwap, Curve & more with Telegram alerts. Built with Python, DeFi Llama & CoinGecko API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages