Skip to content

nillo/mg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoneyGrabber Bot Pro v5 - The Ultimate Trading Powerhouse

Welcome to MoneyGrabber Bot Pro v5, an advanced trading bot tailored for the MEXC exchange, powered by CCXT Pro for real-time market execution. Designed for token launches, volatile markets, and pump-and-dump scenarios, this version introduces institutional-grade performance with real-time enhancements, precision timing, and robust risk management. This README guides you through setup, configuration, and optimization for various trading strategies.

What Does It Do?

MoneyGrabber Bot Pro v5 is engineered for maximum profitability in dynamic crypto markets. It leverages kernel-level optimizations, real-time volatility tracking, and microsecond-precision launches to execute trades with unmatched speed and accuracy. Key capabilities include aggressive order placement, adaptive chasing, enhanced trailing stops, and outlier orders to capture extreme price movements—all protected by a new circuit breaker mechanism.


Key Features

  • Aggressive Order Placement: Distributes capital across multiple limit buys in tight windows.
  • Volatility-Adaptive Chasing: Adjusts unfilled orders dynamically using ATR-based increments.
  • Enhanced Trailing Stops: Updates stop-loss levels with real-time ATR and panic sells for sharp drops.
  • Extreme Outlier Orders: Targets massive price spikes with high-priced orders.
  • Momentum Detection: Triggers market buys on rapid price surges.
  • Optimized Speed: Leverages uvloop, Numba, and NumPy for lightning-fast performance.
  • Real-Time Performance Enhancements: Kernel-level scheduling (SCHED_FIFO), memory locking (mlockall), and optional kernel-bypass networking (XDP) for ultra-low latency.
  • Real-Time ATR Calculation: Synthetic OHLC tracking for instantaneous volatility measurements.
  • Precision Launch Routine: Five-phase launch sequence with microsecond alignment and NTP synchronization.
  • DMA-Assisted Order Batching: Efficiently batches orders into single API calls for faster execution.
  • Circuit Breaker: Halts trading after excessive order rejections to prevent losses.
  • Precomputed Order Grid: Generates price/quantity pairs for rapid order deployment.

Installation

Follow these steps to set up MoneyGrabber Bot Pro v5 on your system.

Prerequisites

  • Python 3.11: Required for compatibility with CCXT Pro and modern asyncio features. Verify with python3 --version.
  • MEXC API Keys: Obtain your API key and secret from the MEXC dashboard.
  • Git: Optional, for cloning the repository.
  • Root Privileges: Required for real-time scheduling (SCHED_FIFO) and memory locking (mlockall). Run with sudo or set capabilities.
  • Optional: XDP Support: For kernel-bypass networking, install pyxdp and ensure XDP support (e.g., libbpf).

Installing Python 3.11

Python 3.11 is mandatory for performance and dependency compatibility. Installation steps:

macOS (Using Homebrew)

  1. Install Homebrew:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Python 3.11:
    brew install [email protected]
  3. Verify:
    python3.11 --version

Windows

  1. Download Python 3.11 from python.org.
  2. Run the installer, checking "Add Python 3.11 to PATH."
  3. Verify:
    python --version

Linux (Ubuntu/Debian)

  1. Update package lists:
    sudo apt update
  2. Install Python 3.11:
    sudo apt install python3.11 python3.11-venv python3.11-dev
  3. Verify:
    python3.11 --version

Setting Up a Virtual Environment

Isolate dependencies with a virtual environment:

  1. Create:
    python3.11 -m venv venv
  2. Activate:
    • macOS/Linux:
      source venv/bin/activate
    • Windows:
      venv\Scripts\activate
  3. Verify:
    python --version
    Expect Python 3.11.x.

Installing Dependencies

  1. Clone or Download:

    git clone <repository_url>
    cd moneygrabber-bot-pro

    Or download and extract the ZIP manually.

  2. Install Requirements:

    pip install -r requirements.txt

    Installs ccxt, ccxtpro, uvloop (Unix-only), ntplib, and optionally pyxdp.

  3. Verify:

    pip list | grep -E "ccxt|uvloop|ntplib|pyxdp"

    Confirm all packages are listed.


Configuration

The config.py file defines the bot’s behavior. Below is an updated table of all parameters, including new options from v5 and corrections to existing ones.

General Settings

Parameter Purpose Default/Example
API_KEY MEXC API key for authentication. "mx0vglNg8HAMlJKaSq"
SECRET MEXC API secret for authentication. "20b7014d4b954d89..."
SYMBOL Trading pair (e.g., "REDX/USDT"). "PEPECAT/USDT"
INITIAL_CAPITAL USDT allocated for trading (adjusted to available balance). 75.0
PAPER_TRADE If True, simulates trades; if False, uses real funds. False
MAX_ORDER_REJECTIONS Max consecutive order rejections before halting trading. 5
  • Notes:
    • MAX_ORDER_REJECTIONS triggers the circuit breaker to halt trading after excessive rejections, enhancing risk management.

Trading Strategy Parameters

Parameter Purpose Default/Example
USE_REALTIME_ATR If True, uses synthetic OHLC for real-time ATR calculation. True
ATR_PERIOD Period for ATR calculation (volatility). 14
MAX_CHASE_ATTEMPTS Max retries to adjust unfilled orders. 10
DYNAMIC_CHASE_FACTOR Multiplier for volatility-based price adjustments during chasing. 2.0
MAX_CHASE_PRICE Absolute cap on chase price (None uses ATR). None
MIN_POSITION_VALUE Minimum USDT value for a viable position. 2.0
MOMENTUM_THRESHOLD % price increase over MOMENTUM_WINDOW to trigger market buy. 0.01 (1%)
MOMENTUM_WINDOW Ticks to look back for momentum detection. 2
ATR_CHASE_FACTOR Legacy ATR multiplier for chasing (superseded by DYNAMIC_CHASE_FACTOR). 2.5
BASE_STOP_PERCENT Base stop-loss % below entry price. 0.02 (2%)
ATR_STOP_FACTOR Multiplier for ATR in dynamic stop-loss. 3.0
PROFIT_PERCENT Fixed profit target % for automatic sells. 0.2 (20%)
MAX_ORDER_WAIT Seconds to wait for order fill before rebalancing or market buy. 3
MAX_DRAWDOWN_PCT Max % loss of capital before emergency liquidation. 20
SLIPPAGE_PCT % slippage for paper trading fill prices. 0.001 (0.1%)
TRANSACTION_FEE_RATE Fee rate per trade in paper trading. 0.001 (0.1%)
  • Notes:
    • USE_REALTIME_ATR enables real-time volatility tracking using synthetic OHLC data.
    • ATR_PERIOD defines the lookback period for ATR calculations, now applicable to real-time ATR when enabled.

Launch and Timing Settings

Parameter Purpose Default/Example
LAUNCH_TIME UNIX timestamp for launch (overridden via CLI). None
PRE_LAUNCH_DURATION Seconds before launch for analysis (15 minutes default). 15 * 60 (900)
ORDER_FIRING_OFFSET Seconds before launch to place orders. 5
AGGRESSIVE_WINDOW Duration (seconds) post-launch for aggressive placement. 5
  • Notes:
    • LAUNCH_TIME now leverages NTP synchronization for microsecond precision in the v5 launch sequence.

Outlier Order Settings

Parameter Purpose Default/Example
OUTLIER_ALLOCATION % of capital for the extreme outlier order. 0.05 (5%)
OUTLIER_MULTIPLIER Multiplier on base price for outlier order. 50
  • Notes: Boost OUTLIER_ALLOCATION for pump-and-dump plays.

Miscellaneous

Parameter Purpose Default/Example
USE_WEBSOCKETS If True, uses WebSocket for real-time data; otherwise, polls REST. True
ADAPTIVE_TARGET_MULTIPLIER Clamps adaptive targets (EMA, VWAP) to this multiple of fixed targets. 2.0

Usage and Command-Line Arguments

Control the bot via main.py for live trading.

main.py - Live Trading

Syntax:

python main.py [--symbol SYMBOL] [--capital INITIAL_CAPITAL] [--launch UNIX_TIMESTAMP] [--launchdate "YYYY-MM-DD HH:MM:SS"]

Arguments:

  • --symbol: Overrides SYMBOL.
  • --capital: Overrides INITIAL_CAPITAL.
  • --launch: UNIX timestamp for launch.
  • --launchdate: Date string (e.g., "2025-03-05 13:00:00").

Examples:

  1. Default Config:

    python main.py
  2. Custom Symbol and Capital:

    python main.py --symbol BTC/USDT --capital 50
  3. Token Launch:

    python main.py --symbol NEWTOKEN/USDT --launchdate "2025-03-05 13:00:00"

Precision Launch Timing:

  • The bot now uses NTP synchronization for microsecond accuracy in its five-phase launch sequence. Ensure your system clock is NTP-synced for optimal results. Selenium scraping for launch times is deprecated; use CLI arguments or future WebSocket feeds instead.

Template Configs for Market Scenarios

Optimized configurations for different markets, updated with v5 features.

Stable Markets

Goal: Steady profits with low risk.

# config.py for Stable Markets
SYMBOL = "STEADY/USDT"
INITIAL_CAPITAL = 75.0
PAPER_TRADE = False
USE_REALTIME_ATR = True
ATR_PERIOD = 14
MAX_ORDER_REJECTIONS = 3
MAX_CHASE_ATTEMPTS = 5
DYNAMIC_CHASE_FACTOR = 1.0
ATR_STOP_FACTOR = 2.0
BASE_STOP_PERCENT = 0.01
PROFIT_PERCENT = 0.05
MAX_ORDER_WAIT = 5
OUTLIER_ALLOCATION = 0.02
OUTLIER_MULTIPLIER = 25
ORDER_FIRING_OFFSET = 5
AGGRESSIVE_WINDOW = 5
  • Adjustments:
    • MAX_ORDER_REJECTIONS = 3: Lower threshold for stable conditions.
    • USE_REALTIME_ATR = True: Ensures responsive volatility tracking.

Pump and Dump

Goal: Quick entry/exit before crashes.

# config.py for Pump and Dump
SYMBOL = "PUMPDUMP/USDT"
INITIAL_CAPITAL = 75.0
PAPER_TRADE = False
USE_REALTIME_ATR = True
ATR_PERIOD = 3
MAX_ORDER_REJECTIONS = 10
MAX_CHASE_ATTEMPTS = 20
DYNAMIC_CHASE_FACTOR = 3.0
ATR_STOP_FACTOR = 5.0
BASE_STOP_PERCENT = 0.05
PROFIT_PERCENT = 0.10
MAX_ORDER_WAIT = 2
OUTLIER_ALLOCATION = 0.15
OUTLIER_MULTIPLIER = 100
ORDER_FIRING_OFFSET = 3
AGGRESSIVE_WINDOW = 3
  • Adjustments:
    • MAX_ORDER_REJECTIONS = 10: Higher tolerance for rejections in chaotic markets.
    • ATR_PERIOD = 3: Fast volatility response for rapid price movements.

Token Launch

Goal: Secure position at launch.

# config.py for Token Launch
SYMBOL = "NEWTOKEN/USDT"
INITIAL_CAPITAL = 75.0
PAPER_TRADE = False
USE_REALTIME_ATR = True
ATR_PERIOD = 5
MAX_ORDER_REJECTIONS = 7
MAX_CHASE_ATTEMPTS = 15
DYNAMIC_CHASE_FACTOR = 2.5
ATR_STOP_FACTOR = 3.0
BASE_STOP_PERCENT = 0.03
PROFIT_PERCENT = 0.20
MAX_ORDER_WAIT = 3
OUTLIER_ALLOCATION = 0.10
OUTLIER_MULTIPLIER = 75
ORDER_FIRING_OFFSET = 5
AGGRESSIVE_WINDOW = 5
LAUNCH_TIME = None  # Set via CLI
  • Adjustments:
    • MAX_ORDER_REJECTIONS = 7: Balances safety during launch volatility.
    • USE_REALTIME_ATR = True: Adapts to initial price swings.

Volatile Markets

Goal: Capture swings with managed risk.

# config.py for Volatile Markets
SYMBOL = "HIGHVOL/USDT"
INITIAL_CAPITAL = 75.0
PAPER_TRADE = False
USE_REALTIME_ATR = True
ATR_PERIOD = 7
MAX_ORDER_REJECTIONS = 5
MAX_CHASE_ATTEMPTS = 15
DYNAMIC_CHASE_FACTOR = 2.5
ATR_STOP_FACTOR = 4.0
BASE_STOP_PERCENT = 0.03
PROFIT_PERCENT = None
MAX_ORDER_WAIT = 4
OUTLIER_ALLOCATION = 0.10
OUTLIER_MULTIPLIER = 75
ORDER_FIRING_OFFSET = 5
AGGRESSIVE_WINDOW = 5
  • Adjustments:
    • MAX_ORDER_REJECTIONS = 5: Moderate safety threshold.
    • ATR_PERIOD = 7: Balances speed and stability in volatile conditions.

Best Profit

Goal: Maximize returns.

# config.py for Best Profit
SYMBOL = "PROFIT/USDT"
INITIAL_CAPITAL = 100.0
PAPER_TRADE = False
USE_REALTIME_ATR = True
ATR_PERIOD = 5
MAX_ORDER_REJECTIONS = 5
MAX_CHASE_ATTEMPTS = 20
DYNAMIC_CHASE_FACTOR = 3.0
ATR_STOP_FACTOR = 3.5
BASE_STOP_PERCENT = 0.02
PROFIT_PERCENT = 0.25
MAX_ORDER_WAIT = 3
OUTLIER_ALLOCATION = 0.15
OUTLIER_MULTIPLIER = 100
ORDER_FIRING_OFFSET = 4
AGGRESSIVE_WINDOW = 6
  • Adjustments:
    • MAX_ORDER_REJECTIONS = 5: Standard protection level.
    • USE_REALTIME_ATR = True: Optimizes profit chasing with real-time volatility.

Trader Scenario: Token Launch Example

Scenario: Trading NEWTOKEN/USDT launching on 2025-03-05 13:00:00 with 75 USDT, aiming for 20% profit or trailing stop gains.

Steps

  1. Setup:

    • Use the Token Launch config in config.py.
    • Set API keys.
  2. Run:

    python main.py --symbol NEWTOKEN/USDT --capital 75 --launchdate "2025-03-05 13:00:00"

Sample Log Output

2025-03-05 12:59:50.123 [INFO] __main__ - Starting MoneyGrabber Bot for MEXC, symbol=NEWTOKEN/USDT, requested capital=75.00 USDT
2025-03-05 12:59:50.456 [INFO] __main__ - Synchronizing with NTP for precision timing...
2025-03-05 12:59:50.789 [INFO] __main__ - NTP offset: 0.0012 seconds
2025-03-05 12:59:55.000 [INFO] __main__ - Time remaining until launch: 5.00 seconds (Exchange time: 2025-03-05 12:59:55.000)
2025-03-05 12:59:55.250 [INFO] __main__ - Entering precision launch sequence...
2025-03-05 12:59:55.300 [INFO] __main__ - Best ask price: 0.001000 USDT, base price set to 0.001020 USDT (1.02× best ask).
2025-03-05 12:59:55.350 [INFO] __main__ - Standard Order 1: Preparing limit buy for 17647.06 tokens at 0.001020 USDT (18.00 USDT allocated).
2025-03-05 12:59:55.800 [INFO] __main__ - Outlier Order: Preparing limit buy for 98.04 tokens at 0.075000 USDT (7.50 USDT allocated).
2025-03-05 12:59:56.700 [DEBUG] __main__ - [NEWTOKEN/USDT] Chase attempt 1 for Order 1: New target price 0.001030 USDT, remaining 17647.06 tokens (Real-time ATR adjustment applied).
2025-03-05 12:59:57.200 [INFO] __main__ - [NEWTOKEN/USDT] Order 1 filled: 17647.06 tokens @ 0.001030 USDT, net cost 18.18 USDT.
2025-03-05 13:00:10.000 [INFO] __main__ - [NEWTOKEN/USDT] Updated trailing stop for 17647.06 tokens: 0.000990 -> 0.001200 (based on real-time ATR)
2025-03-05 13:00:15.000 [INFO] __main__ - [NEWTOKEN/USDT] Profit target reached: Entry 0.001030 -> Target 0.001236 reached at 0.001250; executing market sell.
2025-03-05 13:00:15.200 [INFO] __main__ - [NEWTOKEN/USDT] MARKET SELL (paper) executed for 17647.06 tokens @ ~0.001248, netProceeds=22.02 USDT

Outcome

  • Entry: 17,647 tokens at 0.001030 USDT (18.18 USDT).
  • Exit: Sold at 0.001248 USDT (22.02 USDT).
  • Profit: 3.84 USDT (21.1% return).

Logging and Monitoring

Logs now include:

  • Precision Timing: NTP sync and launch sequence details.
  • Real-Time ATR: Adjustments using synthetic OHLC.
  • Circuit Breaker: Halting events.

Redirect logs:

python main.py > bot.log 2>&1

Error Handling

  • Order Rejections: Retries 5 times for code 30001; halts at MAX_ORDER_REJECTIONS:
    [ERROR] __main__ - Circuit breaker triggered: 5 consecutive order rejections. Halting trading.
    
  • Low Balance: Adjusts to available USDT.
  • API Issues: Logs errors, retries, or exits.

Pro Tips

  • Enable Real-Time ATR: Use USE_REALTIME_ATR = True for volatile markets to adapt stop-losses and chasing dynamically.
  • Tune ATR Period: Shorten ATR_PERIOD (e.g., 5) for fast markets, lengthen (e.g., 14) for stability.
  • Set Rejection Limits: Adjust MAX_ORDER_REJECTIONS based on market activity to balance risk and persistence.
  • Run Elevated: Use sudo on Linux for real-time scheduling and memory locking to unlock ultra-low latency features.

FAQ

  • Why root privileges?
    For real-time scheduling (SCHED_FIFO) and memory locking (mlockall) on Linux, which reduce latency. Without them, these features are disabled.

  • What is real-time ATR?
    Calculates volatility using synthetic OHLC data derived from live price feeds, providing instantaneous measurements for fast markets.

  • How does the circuit breaker work?
    Halts trading after MAX_ORDER_REJECTIONS consecutive order rejections to prevent losses during exchange issues or market anomalies.

  • Can I trade multiple symbols?
    Run separate instances with distinct configs for each symbol.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages