A real-time cryptocurrency arbitrage bot that monitors price differences across multiple exchanges (Binance, Bybit, and MEXC) for both spot and futures markets.
- Real-time price monitoring across multiple exchanges
- Support for both spot and futures markets
- WebSocket-based price updates
- Redis-based cooldown system
- Telegram notifications for arbitrage opportunities
- Web dashboard for monitoring opportunities
- Separate tracking for spot and futures markets
- Configurable profit thresholds
- Automatic reconnection to exchanges
- Docker support for easy deployment
- Binance (Spot & Futures)
- Bybit (Spot & Futures)
- MEXC (Spot)
- Node.js 18 or higher
- Redis server
- Docker and Docker Compose (optional)
- Clone the repository:
git clone https://github.com/ramilexe/crypto-arbitrage-bot.git
cd crypto-arbitrage-bot- Copy the environment file:
cp .env.example .env- Edit the
.envfile with your configuration:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
REDIS_PASSWORD=your_redis_password- Start the services:
docker-compose up -d- Clone the repository:
git clone https://github.com/ramilexe/crypto-arbitrage-bot.git
cd crypto-arbitrage-bot- Install dependencies:
npm install- Copy the environment file:
cp .env.example .env-
Edit the
.envfile with your configuration -
Start Redis server:
# Using Docker
docker run -d --name redis -p 6379:6379 redis:7-alpine --requirepass your_redis_password
# Or install and start Redis locally- Start the bot:
npm startThe bot can be configured through the following files:
.env: Environment variablessrc/bot/config.ts: Exchange configurations and other settings
TELEGRAM_BOT_TOKEN: Your Telegram bot tokenTELEGRAM_CHAT_ID: Your Telegram chat IDREDIS_PASSWORD: Redis server passwordREDIS_HOST: Redis server host (default: localhost)REDIS_PORT: Redis server port (default: 6379)
The bot includes a web dashboard that can be accessed at http://localhost:3001.
The dashboard provides:
- Real-time arbitrage opportunities
- Separate views for spot and futures markets
- Last update timestamps for each market
- Opportunity count
- Connection status
- Exchange Integration: Each exchange is implemented as a separate class extending a base exchange class
- WebSocket Service: Handles real-time price updates from exchanges
- Redis Service: Manages cooldown periods for notifications
- Telegram Service: Sends notifications about arbitrage opportunities
- Arbitrage Analyzer: Identifies profitable arbitrage opportunities
- Web Dashboard: Provides real-time monitoring interface
src/
├── bot/
│ ├── exchanges/ # Exchange implementations
│ ├── services/ # Redis, Telegram, WebSocket services
│ ├── arbitrage.ts # Arbitrage analysis logic
│ ├── config.ts # Configuration
│ ├── index.ts # Main bot entry point
│ └── types.ts # Type definitions
public/
├── app.js # Dashboard frontend
├── index.html # Dashboard HTML
└── styles.css # Dashboard styles
To add a new exchange:
- Create a new class in
src/bot/exchanges/extendingBaseExchange - Implement the required methods:
connect()subscribeToSymbols()handleMessage()fetchTradingPairs()
- Add the exchange configuration to
src/bot/config.ts
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This software is available under a dual-license model:
-
Personal Use License: Free for personal, non-commercial use. The web interface must run locally on your personal machine only.
-
Commercial Use License: Requires a paid license for any business or revenue-generating use.
For commercial licensing inquiries:
- Email: [email protected]
- Telegram: @ramilexe
See the LICENSE file for detailed terms and conditions.
This bot is for educational purposes only. Use at your own risk. Cryptocurrency trading involves significant risk of loss and is not suitable for all investors.
