A real-time cryptocurrency arbitrage bot that monitors USDT/USDC price differences across multiple exchanges to identify profitable trading opportunities.
- π Real-time Price Monitoring - WebSocket connections for instant price updates
- πΉ Multi-Exchange Support - CoinDCX, ZebPay, Binance, KuCoin, CoinSwitch
- π Live Web Dashboard - Beautiful UI with auto-refresh capabilities
- π― Smart Arbitrage Detection - Considers trading fees and TDS (1% for Indian exchanges)
- π REST API - Access all data programmatically
- πΎ Database Integration - PostgreSQL for historical data storage
- π Profit Alerts - Get notified when opportunities arise
- π‘οΈ Risk Management - Built-in safety thresholds and limits
# Clone the repository
git clone https://github.com/srijanarya/usdt-arbitrage-bot.git
cd usdt-arbitrage-bot
# Quick start with no setup
./start-simple.shOpen http://localhost:3000 in your browser to see the live dashboard!
- Node.js 18+
- npm or yarn
- PostgreSQL (optional, for full features)
- Exchange API keys (optional, for trading)
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env
# Start the development server
npm run dev# Install dependencies
npm install
# Setup PostgreSQL database
npm run db:setup
# Configure your .env file with API keys
nano .env
# Start the application
npm run devCreate a .env file with your API credentials:
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=arbitrage_bot
DB_USER=postgres
DB_PASSWORD=your_password
# Exchange APIs (Optional)
COINDCX_API_KEY=your_key
COINDCX_API_SECRET=your_secret
ZEBPAY_API_KEY=your_key
ZEBPAY_API_SECRET=your_secret
BINANCE_API_KEY=your_key
BINANCE_API_SECRET=your_secret
KUCOIN_API_KEY=your_key
KUCOIN_API_SECRET=your_secret
KUCOIN_PASSPHRASE=your_passphrase
# Trading Settings
MIN_PROFIT_THRESHOLD=0.1
MAX_TRADE_AMOUNT=10000
ENABLE_AUTO_TRADING=falseAccess the dashboard at http://localhost:3000 to:
- View real-time prices
- Monitor arbitrage opportunities
- Track profit potential
- Analyze market trends
| Endpoint | Description |
|---|---|
GET /api/prices |
Current prices from all exchanges |
GET /api/opportunities |
Active arbitrage opportunities |
GET /api/system-status |
System health and uptime |
GET /api/metrics |
Performance statistics |
GET /api/historical |
Historical arbitrage data |
curl http://localhost:3000/api/opportunitiesResponse:
{
"success": true,
"data": [
{
"type": "USDT/USDC Binance",
"spread": 0.15,
"profitable": true,
"buyExchange": "Binance",
"sellExchange": "KuCoin",
"netProfit": 0.12
}
]
}βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Web Dashboard ββββββΆβ Express Server ββββββΆβ PostgreSQL β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββ
β Exchange APIs β
ββββββββββββββββββββββ€
β β’ CoinDCX β
β β’ ZebPay β
β β’ Binance β
β β’ KuCoin β
β β’ CoinSwitch β
ββββββββββββββββββββββ
- Price Collection: The bot connects to multiple exchanges via WebSocket/REST APIs
- Arbitrage Detection: Continuously analyzes price differences between exchanges
- Profit Calculation: Factors in trading fees, network fees, and TDS
- Opportunity Alert: Notifies when profit exceeds minimum threshold
- Risk Management: Validates opportunities against safety parameters
Profit = (Sell Price - Buy Price) - Trading Fees - Network Fees - TDS
ROI% = (Profit / Investment) Γ 100
# Run all tests
npm test
# Run specific test suite
npm test -- exchanges
# Test with coverage
npm run test:coverage# Build the image
docker build -t usdt-arbitrage-bot .
# Run the container
docker run -p 3000:3000 --env-file .env usdt-arbitrage-botusdt-arbitrage-bot/
βββ src/
β βββ index.ts # Main application entry
β βββ api/exchanges/ # Exchange integrations
β βββ services/ # Core business logic
β βββ routes/ # API routes
β βββ config/ # Configuration files
β βββ utils/ # Helper functions
βββ public/ # Frontend assets
βββ tests/ # Test files
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This bot is for educational purposes only. Cryptocurrency trading carries significant risks. Always:
- Test with small amounts first
- Understand the tax implications in your jurisdiction
- Never invest more than you can afford to lose
- Verify all transactions before execution
- Exchange APIs documentation
- Node.js and TypeScript communities
- Open source contributors
- π§ Email: your-email@example.com
- π¬ Telegram: @your-telegram
- π Issues: GitHub Issues
Made with β€οΈ by Srijan Arya