Skip to content

Latest commit

Β 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ USDT Arbitrage Bot

License: MIT Node.js Version TypeScript

A real-time cryptocurrency arbitrage bot that monitors USDT/USDC price differences across multiple exchanges to identify profitable trading opportunities.

Dashboard Screenshot

✨ Features

  • πŸ”„ 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

πŸš€ Quick Start (No API Keys Required)

# Clone the repository
git clone https://github.com/srijanarya/usdt-arbitrage-bot.git
cd usdt-arbitrage-bot

# Quick start with no setup
./start-simple.sh

Open http://localhost:3000 in your browser to see the live dashboard!

πŸ“‹ Prerequisites

  • Node.js 18+
  • npm or yarn
  • PostgreSQL (optional, for full features)
  • Exchange API keys (optional, for trading)

πŸ”§ Installation

Basic Setup

# Install dependencies
npm install

# Copy environment variables
cp .env.example .env

# Start the development server
npm run dev

Full Setup (with Database)

# 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 dev

πŸ”‘ Configuration

Create 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=false

πŸ“Š Usage

Web Dashboard

Access the dashboard at http://localhost:3000 to:

  • View real-time prices
  • Monitor arbitrage opportunities
  • Track profit potential
  • Analyze market trends

API Endpoints

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

Example API Request

curl http://localhost:3000/api/opportunities

Response:

{
  "success": true,
  "data": [
    {
      "type": "USDT/USDC Binance",
      "spread": 0.15,
      "profitable": true,
      "buyExchange": "Binance",
      "sellExchange": "KuCoin",
      "netProfit": 0.12
    }
  ]
}

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Web Dashboard │────▢│  Express Server │────▢│   PostgreSQL    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Exchange APIs     β”‚
                    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
                    β”‚ β€’ CoinDCX          β”‚
                    β”‚ β€’ ZebPay           β”‚
                    β”‚ β€’ Binance          β”‚
                    β”‚ β€’ KuCoin           β”‚
                    β”‚ β€’ CoinSwitch       β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ˆ How It Works

  1. Price Collection: The bot connects to multiple exchanges via WebSocket/REST APIs
  2. Arbitrage Detection: Continuously analyzes price differences between exchanges
  3. Profit Calculation: Factors in trading fees, network fees, and TDS
  4. Opportunity Alert: Notifies when profit exceeds minimum threshold
  5. Risk Management: Validates opportunities against safety parameters

Arbitrage Formula

Profit = (Sell Price - Buy Price) - Trading Fees - Network Fees - TDS
ROI% = (Profit / Investment) Γ— 100

πŸ§ͺ Testing

# Run all tests
npm test

# Run specific test suite
npm test -- exchanges

# Test with coverage
npm run test:coverage

🐳 Docker Support

# Build the image
docker build -t usdt-arbitrage-bot .

# Run the container
docker run -p 3000:3000 --env-file .env usdt-arbitrage-bot

πŸ“š Project Structure

usdt-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

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

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

πŸ™ Acknowledgments

  • Exchange APIs documentation
  • Node.js and TypeScript communities
  • Open source contributors

πŸ“ž Support


Made with ❀️ by Srijan Arya

About

No description, website, or topics provided.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages