2025-03-12 00:56:32 +02:00
..
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-10 13:07:07 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-12 00:56:32 +02:00
2025-03-10 12:27:47 +02:00

Crypto Trading Bot with MEXC API Integration

This is an AI-powered cryptocurrency trading bot that can run in both simulation (demo) mode and live trading mode using the MEXC exchange API.

Features

  • Deep Reinforcement Learning agent for trading decisions
  • Technical indicators and price prediction
  • Live trading integration with MEXC exchange via mexc-api
  • Demo mode for testing without real trades
  • Real-time data streaming via websockets
  • Performance tracking and visualization

Setup

  1. Clone the repository
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Create a .env file in the root directory with your MEXC API keys:
    MEXC_API_KEY=your_api_key_here
    MEXC_SECRET_KEY=your_secret_key_here
    

Usage

The bot can be run in three different modes:

Training Mode

Train the agent on historical data:

python main.py --mode train --episodes 100

Evaluation Mode

Evaluate the trained agent on historical data:

python main.py --mode evaluate

Live Trading Mode

Run the bot in live trading mode:

python main.py --mode live

To run in demo mode (no real trades):

python main.py --mode live --demo

Live Trading Implementation

The bot uses the mexc-api package to execute trades on the MEXC exchange. The implementation includes:

  • Market order execution for opening and closing positions
  • Stop loss and take profit orders
  • Real-time balance updates
  • Trade history tracking

Configuration

You can adjust the following parameters in main.py:

  • INITIAL_BALANCE: Starting balance for simulation
  • MAX_LEVERAGE: Leverage to use for trading
  • STOP_LOSS_PERCENT: Default stop loss percentage
  • TAKE_PROFIT_PERCENT: Default take profit percentage

Architecture

  • main.py: Main entry point and trading logic
  • mexc_trading.py: MEXC API integration for live trading using mexc-api
  • models/: Directory for saved model weights

Warning

Trading cryptocurrencies involves significant risk. This bot is provided for educational purposes only. Use at your own risk.

License

MIT