Skip to content

Latest commit

Β 

History

46 Commits

Folders and files

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

Repository files navigation

πŸš€ Algorithmic Memecoin Trading Bot for Solana

A high-performance trading bot designed for Solana memecoin markets using pure algorithmic intelligence, optimized execution, and comprehensive risk management. No external AI dependencies required!


πŸš€ Quick Deployment to Production Server

Server Information

  • Production Server: 38.242.239.150
  • Quick Connect: ssh root@38.242.239.150

⚑ One-Command Deployment

# From your local machine
./scripts/deploy_to_server.sh

# Or on the server directly
ssh root@38.242.239.150
curl -sSL https://raw.githubusercontent.com/SynergiaOS/MojoRust/main/scripts/quick_deploy.sh | bash

πŸ“– Quick Links

πŸ› οΈ Deployment Options

  • Full build & deploy: ./scripts/build_and_deploy.sh - Complete automated build and deployment
  • Automated deployment: ./scripts/deploy_to_server.sh
  • Manual VPS setup: ./scripts/vps_setup.sh
  • Quick deploy: ./scripts/quick_deploy.sh
  • Filtered deployment: ./scripts/deploy_with_filters.sh
  • Docker deployment: docker-compose up -d

πŸ”§ Build Scripts

  • Rust modules: ./scripts/build_rust_modules.sh - Build high-performance Rust components
  • Mojo binary: ./scripts/build_mojo_binary.sh - Build Mojo trading bot binary
  • Complete build: ./scripts/build_and_deploy.sh - Orchestrate full build pipeline

πŸ” Health Monitoring

# Check server health
./scripts/server_health.sh --remote

# CPU usage diagnostic
./scripts/diagnose_cpu_usage.sh

# View logs
ssh root@38.242.239.150 'tail -f ~/mojo-trading-bot/logs/trading-bot-*.log'

πŸ”§ Port Conflict Resolution

The MojoRust Trading Bot uses multiple services that require specific ports. Port conflicts can prevent deployment or cause service failures.

Common Port Conflicts:

  • TimescaleDB: Port 5432 (most common conflict with system PostgreSQL)
  • Grafana: Port 3000/3001
  • Prometheus: Port 9090
  • Trading Bot: Port 8082
  • Data Consumer: Port 9191

Quick Resolution Commands:

# Diagnose port conflicts
./scripts/diagnose_port_conflict.sh --verbose

# Resolve conflicts interactively
./scripts/resolve_port_conflict.sh

# Verify port availability
./scripts/verify_port_availability.sh --pre-deploy

Manual Resolution:

# Stop conflicting PostgreSQL service
sudo systemctl stop postgresql

# Or reconfigure TimescaleDB port
echo "TIMESCALEDB_PORT=5433" >> .env
docker-compose down && docker-compose up -d

For complete troubleshooting: See Port Conflict Resolution Guide

⚠️ Pre-Deployment Requirements

  • βœ… Infisical account at https://app.infisical.com
  • βœ… Helius API key
  • βœ… QuickNode RPC endpoint
  • βœ… Solana wallet configured
  • βœ… SSH access to 38.242.239.150
  • βœ… Port availability verified (see above)

🚨 WARNING: Always start with PAPER TRADING MODE. Monitor for at least 24 hours before switching to LIVE trading with real funds.


🎯 Performance Targets

  • Daily ROI: 2-5%
  • Win Rate: 65-75%
  • Max Drawdown: <15%
  • Execution Latency: <100ms (50-100ms typical)
  • Strategy: RSI + Support/Resistance confluence detection
  • Processing Speed: 10x faster than AI-powered solutions
  • Cost Efficiency: $0/month in AI fees (saves $25+/month)

🎯 Algorithmic-Only Benefits

  • Ultra-Low Latency: 50-100ms execution without external API calls
  • Complete Determinism: Reproducible results without AI randomness
  • Cost Optimization: $25+/month savings on AI API fees
  • Privacy & Security: No data sharing with external AI services
  • Reliability: No dependency on third-party AI availability

⚑ Quick Start (5 Minutes)

Get the trading bot running in just 5 minutes with our streamlined setup process.

πŸš€ One-Command Quick Start

# Clone and setup in seconds
git clone https://github.com/SynergiaOS/MojoRust.git
cd MojoRust
chmod +x scripts/*.sh

# Configure API keys (minimum required)
cp .env.example .env
nano .env

# Environment setup for basic functionality
export HELIUS_API_KEY=your_helius_api_key_here
export QUICKNODE_PRIMARY_RPC=your_quicknode_rpc_here
export GEYSER_ENDPOINT=your_geyser_endpoint_here
export TWITTER_API_KEY=your_twitter_api_key_here

# Add your required API keys to .env file. At a minimum, you will need:
# - HELIUS_API_KEY
# - QUICKNODE_PRIMARY_RPC
# For advanced features, you will also need:
# - GEYSER_ENDPOINT and GEYSER_TOKEN
# - TWITTER_API_KEY, TWITTER_API_SECRET, etc.

# Start trading in safe paper mode
./scripts/start_bot.sh --mode=paper --verbose

πŸ“‹ What You Need (2 minutes)

  • API Keys:
  • Solana Wallet: Automatically detected or create new one
  • Basic Tools: git, curl, command line

🎯 Instant Results

Your bot will immediately start:

  • βœ… Analyzing Solana memecoin markets
  • βœ… Executing paper trades (no real money)
  • βœ… Providing real-time metrics at http://localhost:8080
  • βœ… Logging activity to logs/trading-bot-*.log

πŸ“Š Monitor Your Bot

# Check bot status
curl http://localhost:8080/api/health

# View recent activity
curl http://localhost:8080/api/status

# Watch real-time logs
tail -f logs/trading-bot-*.log

πŸ”§ Need Help?


πŸ—οΈ System Architecture

Data Layer (APIs) β†’ Processing Layer (Algorithmic Engines) β†’ Execution Layer (Trading)

πŸ›οΈ Advanced Architecture Guides

For comprehensive understanding of the bot's architecture, refer to these detailed guides:

πŸ› οΈ Technology Layer Responsibilities

This project uses a polyglot architecture where each language has specific responsibilities:

  • Python (🐍): Orchestration Layer

    • Responsibilities: API clients, task scheduling, webhooks, database interactions, main application loop
    • Why?: Python's rich ecosystem and mature asyncio framework perfect for managing complex workflows
  • Mojo (πŸ”₯): Intelligence Layer

    • Responsibilities: Filters/ML inference, signal generation, data analysis, pattern recognition
    • Why?: Mojo's Python-like syntax with C-level performance for computationally intensive tasks
    • Note: Mojo handles intelligence but NOT execution - it provides data to Rust
  • Rust (πŸ¦€): Secure Execution Layer

    • Responsibilities: Private keys, transaction signing, CPI calls, Jito bundles, portfolio management
    • Why?: Rust's ownership model and compile-time guarantees ensure security of funds and safe execution
    • NEW: High-performance Geyser data consumer for filtering on-chain events at the source.

πŸš€ New: Free Data Sources & High-Performance Ingestion

The bot now features a powerful data ingestion pipeline that leverages free, real-time data from Solana's Geyser stream, significantly reducing reliance on paid APIs.

Architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Solana Geyser    β”œβ”€β”€β”€β”€β”€β–Ίβ”‚ Rust Data         β”œβ”€β”€β”€β”€β”€β–Ίβ”‚ Redis Pub/Sub    β”œβ”€β”€β”€β”€β”€β–Ίβ”‚ Python           β”‚
β”‚ (gRPC Stream)    β”‚      β”‚ Consumer          β”‚      β”‚ (Channels)       β”‚      β”‚ TaskPoolManager  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚ (Filtering >99%)  β”‚      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚ (Subscriber)     β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

This design offloads the heavy lifting of event filtering to a compiled Rust binary, allowing the Python layer to focus on complex analysis and orchestration.

πŸ“– Read the Full Guide: docs/FREE_DATA_SOURCES_GUIDE.md

Core Components

  • Data Collection: Helius (blockchain), QuickNode (RPC), DexScreener (market data), Jupiter (DEX aggregator)
  • Algorithmic Analysis:
    • Sentiment Analyzer (market-based sentiment, no external AI)
    • Pattern Recognition Engine (technical and manipulation patterns)
    • Whale Behavior Tracker (on-chain analysis)
    • Volume Analysis Engine (anomaly detection)
  • Strategy Engines:
    • Enhanced Context Engine (RSI+Support confluence)
    • Spam Filter (wash trading detection)
    • Strategy Engine (signal generation)
  • Risk Management: Kelly Criterion position sizing, portfolio diversification, drawdown monitoring
  • Execution: Optimized trade execution via Jupiter with slippage control

🎯 Advanced Sniper Trading System

Overview

The PumpFun Sniper Trading System is a specialized high-frequency trading module designed for memecoin markets on Solana. It combines advanced filtering, real-time monitoring, and MEV extraction to identify and execute profitable trades on newly launched tokens.

🎯 Key Features

Advanced Sniper Filters

  • LP Burn Analysis: Verifies β‰₯90% LP tokens are burned to prevent rug pulls
  • Authority Revocation: Ensures mint/freeze authorities are revoked for token security
  • Holder Distribution: Analyzes top 5 holder concentration (<30% threshold)
  • Social Mentions: Monitors X/Twitter for minimum social activity (10+ mentions)
  • Honeypot Detection: Integrated API checks for contract security
  • Volume Requirements: Minimum active volume of $5,000 in 5 minutes

Trading Modes

1. PumpPortal Real-Time Trader

  • WebSocket-based real-time token monitoring
  • Sub-100ms signal processing
  • Automatic TP/SL execution (1.5x TP, 0.8x SL)
  • Position management with timeout controls

2. Jito MEV Extractor

  • Bundle-based MEV extraction
  • Optimized transaction ordering
  • Dynamic tip calculation based on profit potential
  • Sub-30ms bundle submission

πŸ“Š Sniper Performance Metrics

# Typical sniper performance:
- Signal Processing: 50-100ms latency
- Win Rate: 70-85% (with filters)
- Average ROI: 5-15% per trade
- Rejection Rate: 90-95% (quality filtering)
- Bundle Success Rate: 80-90%

πŸš€ Quick Start for Sniper Trading

1. API Requirements

# Required API keys for sniper trading:
HONEYPOT_API_KEY=your_honeypot_api_key_here
TWITTER_API_KEY=your_twitter_api_key_here
PUMPPORTAL_API_KEY=your_pumpportal_api_key_here
JITO_AUTH_KEY=your_jito_auth_key_here

2. Configuration

[arbitrage.sniper_filters]
min_lp_burn_rate = 90.0
revoke_authority_required = true
max_top_holders_share = 30.0
min_social_mentions = 10
social_check_enabled = true
honeypot_check = true
tp_threshold = 1.5
sl_threshold = 0.8

3. Launch Sniper Traders

# PumpPortal real-time trader
python pumpportal_realtime_trader.py

# Jito MEV extractor
python jito_pumpfun_trader.py

# Or run both with monitoring
./scripts/start_sniper_trading.sh --monitor

πŸ›‘οΈ Sniper Safety Features

Multi-Layer Security

  1. Pre-Trade Validation: All tokens pass through 5 security checks
  2. Real-time Monitoring: Continuous position tracking and exit conditions
  3. Circuit Breakers: Automatic position limits and drawdown protection
  4. Fail-Safe Defaults: Reject on API errors or insufficient data

Risk Management

# Built-in safety limits:
- Max Open Positions: 5 simultaneous trades
- Max Position Size: 10% of portfolio
- Minimum Trade Interval: 30 seconds
- Maximum Token Age: 5 minutes
- Stop Loss: 20% (automatic)
- Take Profit: 50% (automatic)

πŸ“ˆ Sniper Monitoring Dashboard

Access comprehensive sniper monitoring at http://localhost:3000:

  • Signal Processing: Real-time filter performance
  • API Health: Status of all external APIs
  • Trading Metrics: Win rate, P&L, position tracking
  • MEV Performance: Bundle success rates and tip costs
  • Risk Metrics: Drawdown, concentration, exposure

Key Metrics

  • sniper_filter_rejections_total - Filter rejection reasons
  • sniper_trades_won_total - Successful trade count
  • jito_bundles_confirmed_total - MEV bundle confirmations
  • sniper_portfolio_balance_sol - Current portfolio value
  • sniper_signal_quality_score - Overall signal quality

⚠️ Sniper Trading Risks

High-Risk Activity: Sniper trading is extremely high-risk and should only be attempted with:

  • Capital you can afford to lose completely
  • Extensive testing in paper trading mode
  • Understanding of memecoin market dynamics
  • Proper risk management procedures

Recommended Approach:

  1. Start with 0.1 SOL maximum capital
  2. Run in paper trading mode for at least 48 hours
  3. Monitor win rate and rejection rates
  4. Gradually increase capital only after consistent performance
  5. Never risk more than 5% of total portfolio on sniper trading

πŸ”§ Sniper Troubleshooting

Common Issues

# High rejection rate (95%+)
- Check API key validity
- Verify filter thresholds aren't too strict
- Monitor social API status

# Low win rate (<60%)
- Adjust TP/SL thresholds
- Review market conditions
- Check honeypot API accuracy

# Bundle failures
- Increase tip amounts
- Check network congestion
- Verify Jito endpoint status

Health Checks

# API health monitoring
curl http://localhost:8080/api/sniper/health

# Filter performance
curl http://localhost:8080/api/sniper/filters/stats

# Active positions
curl http://localhost:8080/api/sniper/positions

πŸ›‘οΈ Production Safety & Monitoring

Circuit Breakers

Automated trading halt mechanisms to protect capital:

  • Max Drawdown Protection: Halts trading if portfolio drops >15%
  • Consecutive Loss Protection: Stops after 5 consecutive losing trades
  • Daily Loss Limit: Halts if daily losses exceed 10%
  • Position Concentration: Prevents over-exposure to single positions
  • Trade Velocity Control: Limits rapid-fire trading on same symbol
  • Rapid Drawdown Detection: Catches sudden portfolio drops

Performance Analytics

Comprehensive performance tracking and analysis:

  • Win Rate: Percentage of profitable trades
  • Sharpe Ratio: Risk-adjusted return metric
  • Sortino Ratio: Downside risk-adjusted return
  • Max Drawdown: Peak-to-trough portfolio decline
  • Profit Factor: Gross profit / gross loss ratio
  • Expectancy: Expected value per trade
  • Trade Distribution Analysis: Win/loss patterns
  • Equity Curve Tracking: Portfolio value over time

Data Persistence

TimescaleDB/PostgreSQL integration for:

  • Trade History: Complete record of all trades
  • Portfolio Snapshots: Regular portfolio state saves
  • Market Data Archive: Historical market data storage
  • Performance Metrics: Time-series performance tracking
  • Backup & Recovery: Automatic portfolio state restoration

Alert System

Multi-channel notifications for:

  • Trade Execution: Real-time trade confirmations
  • Error Alerts: Critical error notifications
  • Performance Alerts: Threshold breach warnings
  • Circuit Breaker Triggers: Trading halt notifications
  • Daily Summaries: End-of-day performance reports

Supported channels:

  • Console (always enabled)
  • Discord/Slack webhooks
  • Telegram bot
  • Email (coming soon)

Data Ingestion Pipeline Monitoring

The health and performance of the Rust data-consumer and Python TaskPoolManager are critical. We provide a pre-built Grafana dashboard and Prometheus alerts to monitor this pipeline.

Grafana Dashboard

A dedicated "Data Ingestion Pipeline" dashboard is available in Grafana (config/grafana/dashboards/data_ingestion.json). It visualizes key metrics, including:

  • Rust Consumer (Geyser):

    • Event Throughput (received vs. published)
    • Event Filter Rate (%)
    • Processing Latency (p95)
    • Geyser Connection Status
  • Python Consumer (Task Manager):

    • Redis Pub/Sub Lag (ms)
    • Task Queue Size
    • Dropped Events Rate (due to backpressure)

Prometheus Alerts

Alerting rules are defined in config/prometheus_rules/data_ingestion_alerts.yml to notify you of potential issues:

  • HighRedisPubSubLag: Fires if the lag between the Rust producer and Python consumer exceeds 5 seconds, indicating the Python service is falling behind.
  • HighRateOfDroppedEvents: Fires if the Python service is dropping events due to a full task queue, indicating sustained high load.

Strategy Adaptation

Dynamic parameter adjustment based on performance:

  • Confidence Threshold Tuning: Adjust selectivity based on win rate
  • Position Sizing Adaptation: Scale up/down based on performance
  • Stop Loss/Take Profit Optimization: Adjust risk/reward ratios
  • Market Regime Detection: Adapt to trending vs ranging markets
  • Performance-Based Learning: Improve over time without external AI

πŸ“Š Complete Trading Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    DATA INGESTION                           β”‚
β”‚  DexScreener β†’ QuickNode β†’ Helius β†’ Market Data            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 CIRCUIT BREAKER CHECK                       β”‚
β”‚  βœ“ Drawdown OK  βœ“ No consecutive losses  βœ“ Velocity OK     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  CONTEXT ANALYSIS                           β”‚
β”‚  RSI + Support/Resistance + Market Regime Detection         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 SIGNAL GENERATION                           β”‚
β”‚  Strategy Engine β†’ Raw Signals (100-1000/hour)             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              MASTER FILTER PIPELINE                         β”‚
β”‚  Instant Filter β†’ Aggressive Filter β†’ Micro Filter          β”‚
β”‚  (90-95% rejection rate)                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 RISK MANAGEMENT                             β”‚
β”‚  Position Sizing + Stop Loss + Portfolio Limits             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              TRADE EXECUTION                                β”‚
β”‚  Jupiter Swap β†’ Blockchain β†’ Confirmation                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          MONITORING & PERSISTENCE                           β”‚
β”‚  β€’ Record trade in database                                 β”‚
β”‚  β€’ Update performance analytics                             β”‚
β”‚  β€’ Send alerts                                              β”‚
β”‚  β€’ Update circuit breakers                                  β”‚
β”‚  β€’ Save portfolio snapshot                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            STRATEGY ADAPTATION (24h)                        β”‚
β”‚  Analyze performance β†’ Adjust parameters β†’ Optimize         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—„οΈ Database Setup

TimescaleDB Installation

# Install TimescaleDB (PostgreSQL extension)
sudo apt-get install timescaledb-postgresql-14

# Create database
sudo -u postgres psql
CREATE DATABASE trading_bot;
CREATE USER trader WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE trading_bot TO trader;
\c trading_bot
CREATE EXTENSION IF NOT EXISTS timescaledb;

Environment Variables

export DB_PASSWORD="your_database_password"
export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
export TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
export TELEGRAM_CHAT_ID="your_telegram_chat_id"

Database Schema

The bot automatically creates required tables on first run:

  • trades - Complete trade history
  • portfolio_snapshots - Portfolio state over time
  • market_data - Historical market data (TimescaleDB hypertable)
  • performance_metrics - Performance statistics over time

πŸ“± Alert Configuration

Discord Webhook

  1. Go to Discord Server Settings β†’ Integrations β†’ Webhooks
  2. Create new webhook, copy URL
  3. Set DISCORD_WEBHOOK_URL environment variable
  4. Enable in config/trading.toml: channels = ["console", "webhook"]

Telegram Bot

  1. Create bot via @BotFather
  2. Get bot token
  3. Get your chat ID via @userinfobot
  4. Set environment variables:
    export TELEGRAM_BOT_TOKEN="your_token"
    export TELEGRAM_CHAT_ID="your_chat_id"
  5. Enable in config: channels = ["console", "telegram"]

🎯 Strategy Adaptation

The bot automatically adapts its strategy every 24 hours based on recent performance:

Low Win Rate (<40%)

  • Increases confidence threshold (more selective)
  • Reduces position sizes (lower risk)
  • Reason: "Low win rate - increasing selectivity"

High Win Rate (>70%)

  • Decreases confidence threshold (more trades)
  • Increases position sizes (higher returns)
  • Reason: "High win rate - increasing aggression"

Poor Profit Factor (<1.5)

  • Tightens stop losses
  • Widens take profit targets
  • Reason: "Poor profit factor - adjusting risk/reward"

High Volatility Market

  • Reduces position sizes
  • Decreases max concurrent positions
  • Reason: "High volatility - reducing exposure"

Adaptation can be disabled in config/trading.toml:

[strategy_adaptation]
enabled = false

πŸ› οΈ Tech Stack

  • Performance: Mojo 24.4+ (for hot paths and computational efficiency)
  • Security: Rust 1.70+ (for cryptographic operations and critical components)
  • Blockchain: Solana Web3.js, Anchor Framework
  • Database: TimescaleDB (time-series data), Redis (caching)
  • Algorithmic Intelligence: Built-in algorithmic analysis (no external AI dependencies)
  • Monitoring: Prometheus/Grafana (metrics, dashboards)
  • Infrastructure: Docker, Kubernetes

⚑ CPU Performance Optimization

The MojoRust Trading Bot includes comprehensive CPU optimization tools to ensure maximum performance:

πŸ“Š CPU Diagnostic Tools

# Comprehensive CPU usage analysis
./scripts/diagnose_cpu_usage.sh

# Real-time monitoring
./scripts/diagnose_cpu_usage.sh --watch

# JSON output for automation
./scripts/diagnose_cpu_usage.sh --json

πŸš€ VS Code Optimization

# Interactive VS Code optimization
./scripts/optimize_vscode_cpu.sh

# Automatic optimization
./scripts/optimize_vscode_cpu.sh --auto

# Optimize without backup
./scripts/optimize_vscode_cpu.sh --auto --no-backup

βš™οΈ System Optimization

# Preview system optimizations
sudo ./scripts/apply_system_optimizations.sh --dry-run

# Apply comprehensive system optimizations
sudo ./scripts/apply_system_optimizations.sh

# Verbose output
sudo ./scripts/apply_system_optimizations.sh --verbose

πŸ“ˆ Continuous Monitoring

# Interactive monitoring dashboard
./scripts/monitor_cpu_continuous.sh

# Run as daemon with logging
./scripts/monitor_cpu_continuous.sh --daemon

# Configure alerts
./scripts/monitor_cpu_continuous.sh --slack-webhook $SLACK_WEBHOOK

πŸ“‹ Quick CPU Optimization Checklist

  1. Run diagnostic: ./scripts/diagnose_cpu_usage.sh
  2. Optimize VS Code: ./scripts/optimize_vscode_cpu.sh --auto
  3. Apply system tuning: sudo ./scripts/apply_system_optimizations.sh
  4. Start monitoring: ./scripts/monitor_cpu_continuous.sh --daemon

For comprehensive guide: See CPU Optimization Guide

πŸ’» Hardware Requirements

  • CPU: 8+ cores (Intel i7/AMD Ryzen 7 or better)
  • RAM: 32GB+ DDR4
  • Storage: 1TB+ NVMe SSD
  • Network: Stable internet connection with <50ms latency to Solana RPCs

πŸš€ Quick Start

Prerequisites

  1. Mojo 24.4+ installed: Download Mojo
  2. Rust 1.70+ installed: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  3. Docker 24.0+ and Docker Compose
  4. API Accounts:
    • Helius Premium ($49/mo)
    • QuickNode Premium ($49/mo)
    • DexScreener (free)
    • Jupiter (free)

Installation

# Clone repository
git clone https://github.com/your-org/mojo-trading-bot.git
cd mojo-trading-bot

# Configure environment
cp .env.example .env
# Edit .env with your API keys and configuration

# Option 1: Complete automated build and deployment
./scripts/build_and_deploy.sh --mode=paper --capital=1.0

# Option 2: Step-by-step manual build
./scripts/build_rust_modules.sh     # Build Rust modules
./scripts/build_mojo_binary.sh      # Build Mojo binary
docker-compose up -d                # Deploy services

# Option 3: Quick start (no build)
./scripts/deploy.sh --mode=paper --capital=1.0

Environment Configuration

Copy .env.example to .env and configure:

# Trading mode
TRADING_ENV=paper  # development/staging/production

# API Keys
HELIUS_API_KEY=your_helius_api_key
QUICKNODE_PRIMARY_RPC=https://your-endpoint.solana-mainnet.quiknode.pro/

# Wallet Configuration
WALLET_ADDRESS=your_solana_wallet_address
WALLET_PRIVATE_KEY_PATH=/secure/path/to/keypair.json

# Trading Parameters
INITIAL_CAPITAL=1.0  # SOL
MAX_POSITION_SIZE=0.1  # 10%
MAX_DRAWDOWN=0.15  # 15%

πŸ“Š Project Structure

β”œβ”€β”€ src/                    # Mojo source code
β”‚   β”œβ”€β”€ main.mojo          # Application entry point
β”‚   β”œβ”€β”€ core/              # Core data structures and utilities
β”‚   β”‚   β”œβ”€β”€ config.mojo    # Configuration management
β”‚   β”‚   β”œβ”€β”€ types.mojo     # Core data types
β”‚   β”‚   └── logger.mojo    # Structured logging
β”‚   β”œβ”€β”€ data/              # External API clients
β”‚   β”‚   β”œβ”€β”€ helius_client.mojo
β”‚   β”‚   β”œβ”€β”€ quicknode_client.mojo
β”‚   β”‚   β”œβ”€β”€ dexscreener_client.mojo
β”‚   β”‚   └── jupiter_client.mojo
β”‚   β”œβ”€β”€ engine/            # Trading and analysis engines
β”‚   β”‚   β”œβ”€β”€ enhanced_context_engine.mojo
β”‚   β”‚   β”œβ”€β”€ master_filter.mojo
β”‚   β”‚   β”œβ”€β”€ strategy_engine.mojo
β”‚   β”‚   β”œβ”€β”€ spam_filter.mojo
β”‚   β”‚   β”œβ”€β”€ instant_spam_detector.mojo
β”‚   β”‚   β”œβ”€β”€ micro_timeframe_filter.mojo
β”‚   β”‚   └── strategy_adaptation.mojo
β”‚   β”œβ”€β”€ risk/              # Risk management
β”‚   β”‚   β”œβ”€β”€ risk_manager.mojo
β”‚   β”‚   └── circuit_breakers.mojo
β”‚   β”œβ”€β”€ monitoring/        # Production monitoring components
β”‚   β”‚   β”œβ”€β”€ performance_analytics.mojo
β”‚   β”‚   └── alert_system.mojo
β”‚   β”œβ”€β”€ persistence/       # Data persistence
β”‚   β”‚   └── database_manager.mojo
β”‚   β”œβ”€β”€ execution/         # Trade execution
β”‚   β”‚   └── execution_engine.mojo
β”‚   └── analysis/          # Algorithmic analysis engines
β”‚       β”œβ”€β”€ sentiment_analyzer.mojo
β”‚       β”œβ”€β”€ pattern_recognizer.mojo
β”‚       └── whale_tracker.mojo
β”œβ”€β”€ rust-modules/          # Rust security modules
β”œβ”€β”€ config/                # Configuration files
β”‚   └── trading.toml       # Main configuration
β”œβ”€β”€ tests/                 # Unit and integration tests
β”œβ”€β”€ scripts/               # Deployment and utility scripts
└── docs/                  # Documentation

πŸ§ͺ Testing

# Run all tests
mojo test tests/

# Run specific test suite
mojo test tests/test_context_engine.mojo
mojo test tests/test_risk_manager.mojo

# Run backtests
mojo run tests/backtest/backtest_engine.mojo --start=2024-01-01 --end=2024-03-01

# Performance tests
mojo run tests/performance/latency_test.mojo

πŸ“ˆ Development Roadmap (12 Weeks)

Phase 1: Foundation (Week 1-2)

  • Project structure and environment setup
  • Core data models and configuration
  • Basic API integrations
  • Context Engine MVP
  • Simple spam filtering

Phase 2: Core Engine (Week 3-4)

  • Advanced spam detection (wash trading, pump/dump)
  • Strategy Engine implementation
  • Risk management system
  • Paper trading framework
  • Performance monitoring

Phase 3: Algorithmic Enhancements (Week 5-6)

  • Algorithmic sentiment analysis (src/analysis/sentiment_analyzer.mojo)
  • Pattern recognition engine (src/analysis/pattern_recognizer.mojo)
  • Whale behavior tracking (src/analysis/whale_tracker.mojo)
  • Volume anomaly detection (src/analysis/volume_analyzer.mojo)
  • Real-time signal processing and optimization

Phase 4: Production (Week 7-8)

  • Live trading with small capital
  • Execution optimization
  • Comprehensive monitoring
  • Scaling and performance tuning

Phase 5: Enhancement (Week 9-12)

  • Multi-strategy optimization
  • Advanced risk models
  • Machine learning integration
  • Institutional features

πŸ” Monitoring & Observability

The MojoRust Trading Bot includes a comprehensive monitoring stack built with industry-standard tools to provide complete visibility into system performance, trading activity, and health metrics.

πŸ“Š Monitoring Stack Overview

Core Components:

  • Prometheus (port 9090): Metrics collection and storage with 30-day retention
  • Grafana (port 3001): Visualization dashboards with auto-provisioning
  • AlertManager (port 9093): Alert routing and notification management
  • Node Exporter (port 9100): System metrics collection from host
  • Docker Exporter (port 9323): Container metrics collection
  • Trading Bot Metrics (port 8082): Application metrics from the trading bot
  • Data Consumer Metrics (port 9191): Rust data pipeline metrics

πŸš€ Quick Monitoring Start

# Start the complete monitoring stack
./scripts/start_monitoring_stack.sh

# Verify monitoring stack health
./scripts/verify_monitoring_stack.sh

# Access dashboards
echo "πŸ“Š Grafana: http://localhost:3001 (admin/trading_admin)"
echo "πŸ“ˆ Prometheus: http://localhost:9090"
echo "🚨 AlertManager: http://localhost:9093"

πŸ“ˆ Essential Grafana Dashboards

Primary Dashboards:

  1. Trading Performance (http://localhost:3001/d/trading-performance)

    • Portfolio value and P&L tracking
    • Win rate and trade frequency analysis
    • Filter rejection rate monitoring
    • Daily/weekly performance metrics
  2. System Health (http://localhost:3001/d/system-health)

    • CPU, memory, and disk usage
    • Load average and network traffic
    • Uptime and service status
    • Resource utilization trends
  3. Docker Services (http://localhost:3001/d/docker-services)

    • Container status and resource usage
    • Service health checks
    • Network I/O metrics
    • Container restart tracking
  4. Data Ingestion Pipeline (http://localhost:3001/d/data-ingestion)

    • Rust consumer performance metrics
    • Redis Pub/Sub lag monitoring
    • Event processing throughput
    • Filter efficiency tracking
  5. API Performance (http://localhost:3001/d/api-performance)

    • API response times and error rates
    • External service connectivity
    • Rate limiting and throttling metrics
    • Integration health status
  6. Alert Management (http://localhost:3001/d/alerts)

    • Active alerts and firing rules
    • Alert delivery success rates
    • Notification channel status
    • Alert history and trends

πŸ”§ Monitoring Management

Service Management:

# Start all monitoring services
./scripts/start_monitoring_stack.sh

# Start specific service
./scripts/start_monitoring_stack.sh --service=prometheus
./scripts/start_monitoring_stack.sh --service=grafana
./scripts/start_monitoring_stack.sh --service=alertmanager

# Verify monitoring health
./scripts/verify_monitoring_stack.sh --detailed

# Import dashboards manually if needed
./scripts/import_grafana_dashboards.sh --force

Health Verification:

# Quick health checks
curl -s http://localhost:9090/-/healthy && echo "βœ… Prometheus OK"
curl -s http://localhost:3001/api/health && echo "βœ… Grafana OK"
curl -s http://localhost:9093/-/healthy && echo "βœ… AlertManager OK"

# Comprehensive verification
./scripts/verify_monitoring_stack.sh --json

🚨 Alert Configuration

Default Alert Rules:

  • System Alerts: CPU > 80%, Memory > 85%, Disk > 90%
  • Trading Alerts: High error rates, API failures, filter performance issues
  • Data Pipeline: Redis lag, event drops, consumer failures
  • Monitoring Stack: Service down, data gaps, notification failures

Alert Channels:

  • Console output (always active)
  • Email notifications (configurable)
  • Webhook integrations (Slack, Discord, etc.)
  • Telegram bot integration

Testing Alerts:

# Test alert delivery
curl -XPOST http://localhost:9093/api/v1/alerts -H 'Content-Type: application/json' -d '[{
  "labels": {"alertname":"TestAlert","severity":"warning"},
  "annotations": {"summary":"Test alert notification"}
}]'

πŸ“Š Key Metrics

Trading Metrics:

  • trading_bot_trades_total - Total number of trades executed
  • trading_bot_portfolio_value_sol - Current portfolio value in SOL
  • trading_bot_win_rate - Trading success percentage
  • trading_bot_filter_rejection_rate - Signal filter efficiency

System Metrics:

  • node_cpu_seconds_total - CPU usage by mode
  • node_memory_MemAvailable_bytes - Available memory
  • node_filesystem_avail_bytes - Available disk space
  • container_cpu_usage_seconds_total - Per-container CPU usage

Application Metrics:

  • http_requests_total - API request count by endpoint
  • http_request_duration_seconds - API response times
  • redis_connected_clients - Redis connection count
  • prometheus_tsdb_head_samples_appended_total - Prometheus ingestion rate

πŸ› οΈ Monitoring Maintenance

Daily Checks:

# Morning monitoring health check
echo "πŸ“Š Monitoring Stack Health Check:"
./scripts/verify_monitoring_stack.sh

# Check active alerts
curl -s http://localhost:9093/api/v1/alerts | jq '.data.alerts[] | select(.state == "firing")'

Weekly Maintenance:

# Monitoring stack audit
./scripts/verify_monitoring_stack.sh --json > /tmp/monitoring_audit.json

# Dashboard data availability check
curl -s -G 'http://localhost:9090/api/v1/query' \
  --data-urlencode 'query=up' | jq -r '.data.result[] | select(.value[1] == "1") | .metric.job'

# Verify alert rules are active
curl -s http://localhost:9090/api/v1/rules | jq -r '.data.groups[].rules[] | select(.state == "firing") | .name' | wc -l

πŸ” Troubleshooting Monitoring Issues

Common Problems:

  1. Services Not Starting: Check port conflicts with ./scripts/diagnose_port_conflict.sh
  2. Dashboards Show No Data: Verify Prometheus targets and data source configuration
  3. Alerts Not Firing: Check AlertManager configuration and notification routes
  4. High Resource Usage: Monitor retention policies and consider data pruning

Quick Diagnostics:

# Comprehensive monitoring troubleshooting
./scripts/verify_monitoring_stack.sh --detailed

# Service-specific issues
docker-compose logs prometheus
docker-compose logs grafana
docker-compose logs alertmanager

Emergency Recovery:

# Complete monitoring stack recovery
./scripts/emergency_monitoring_recovery.sh

# Service-specific recovery
docker-compose restart prometheus grafana alertmanager node-exporter
./scripts/import_grafana_dashboards.sh --force

πŸ“š Monitoring Documentation

πŸ”— Integration with Operations

The monitoring stack is fully integrated into the daily operations workflow:

Morning Routine:

  • Automatic monitoring stack health verification
  • Dashboard data availability checks
  • Active alert review

Incident Response:

  • Monitoring-specific incident procedures
  • Emergency recovery workflows
  • Alert notification testing

Weekly Maintenance:

  • Monitoring stack audit and verification
  • Performance optimization checks
  • Configuration backup and review

Access Points:

⚠️ Risk Management

The bot implements multiple safety layers:

  1. Position Sizing: Kelly Criterion with 50% fraction (conservative)
  2. Stop Losses: Support-based with 15% buffer
  3. Drawdown Protection: Stops trading at 15% drawdown
  4. Diversification: Max 10 positions, sector caps
  5. Spam Filtering: Removes 80-90% of low-quality signals
  6. Circuit Breakers: Halts trading on extreme volatility

πŸ“Š Performance Metrics

Target metrics during backtesting and live trading:

  • Win Rate: 65-75%
  • Profit Factor: >2.0
  • Sharpe Ratio: >2.0
  • Max Drawdown: <15%
  • Average Trade Duration: 5-30 minutes
  • Execution Latency: <100ms

🚨 Alerts

Configurable alerts for:

  • Drawdown >10%
  • Execution failure rate >5%
  • API error rate >10%
  • Low wallet balance
  • Unusual trading patterns

πŸ”’ Security

  • Private keys stored securely in Rust module
  • No credential logging
  • Rate limiting on all APIs
  • Encrypted wallet storage
  • Audit logging for all trades
  • Regular security patches

πŸ“š Documentation

🀝 Contributing

We welcome contributions! Please read our guidelines before submitting.

πŸ“š Contribution Resources

πŸš€ Quick Contribution Guide

For Code Contributions:

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/your-feature
  3. Install development tools: make setup-dev
  4. Make changes following our code style guidelines
  5. Write tests (70%+ coverage required)
  6. Run checks: make ci
  7. Commit with conventional format: type(scope): description
  8. Push and open Pull Request
  9. Address review feedback
  10. Celebrate when merged! πŸŽ‰

For Non-Code Contributions:

  • πŸ› Report bugs via GitHub Issues
  • πŸ’‘ Suggest features via GitHub Discussions
  • πŸ“– Improve documentation (typos, clarity, examples)
  • 🌍 Add translations (Polish, English, others)
  • πŸ’¬ Help others in community channels
  • ⭐ Star the repository if you find it useful!

βœ… Contribution Requirements

Before Submitting PR:

  • All tests pass: make test-all
  • Code coverage β‰₯70%: make test-coverage-report
  • No linting errors: make lint
  • No security issues: make validate-secrets
  • CHANGELOG.md updated (for notable changes)
  • Documentation updated (for user-facing changes)
  • Conventional commit messages used
  • No hardcoded secrets or credentials

Code Review:

  • At least 1 approval from maintainer required
  • CI checks must pass (lint, security, build, test, coverage)
  • Security-sensitive changes require additional review
  • Performance changes require benchmarks

🎯 Good First Issues

New to the project? Look for issues labeled:

  • good first issue - Beginner-friendly tasks
  • documentation - Documentation improvements
  • help wanted - Community help needed
  • bug - Bug fixes (great for learning codebase)

πŸ’¬ Community

Get Help:

Code of Conduct: All contributors must follow our Code of Conduct. We are committed to providing a welcoming and inclusive environment.

πŸ† Recognition

Contributors are recognized through:

  • GitHub contributors page
  • Release notes acknowledgments
  • Security Hall of Fame (for vulnerability reports)

πŸ“„ License Agreement

By contributing, you agree that your contributions will be licensed under the MIT License.

Thank you for contributing to MojoRust! πŸ™

βš–οΈ License

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

What This Means

You are free to:

  • βœ… Use this software for personal or commercial purposes
  • βœ… Modify and adapt the code to your needs
  • βœ… Distribute copies of the software
  • βœ… Sublicense and sell copies

Under these conditions:

  • πŸ“„ Include the original copyright notice and license in any copies
  • πŸ“„ Provide attribution to the original authors

Limitations:

  • ⚠️ The software is provided "AS IS" without warranty
  • ⚠️ Authors are not liable for any damages or losses
  • ⚠️ No patent rights granted (consider Apache 2.0 if needed)

Third-Party Licenses

This project uses open-source dependencies. See:

  • Rust dependencies: rust-modules/Cargo.toml
  • Python dependencies: requirements.txt
  • Mojo dependencies: mojo.toml

All dependencies are compatible with MIT License.

🚨 Disclaimer & Risk Warnings

⚠️ CRITICAL FINANCIAL RISK WARNING

READ THIS CAREFULLY BEFORE USING THIS SOFTWARE

This trading bot is provided for EDUCATIONAL AND RESEARCH PURPOSES ONLY. Trading cryptocurrencies, especially volatile memecoin markets, involves SUBSTANTIAL RISK OF LOSS and is not suitable for all investors.

Financial Risks

Market Risks:

  • πŸ’Έ Total Loss Possible: You can lose 100% of your invested capital
  • πŸ“‰ High Volatility: Memecoin prices can drop 90%+ in minutes
  • 🎒 Extreme Price Swings: Prices can change dramatically between execution and confirmation
  • πŸ‹ Manipulation: Whale activity, pump-and-dump schemes, rug pulls are common
  • πŸ’§ Liquidity Risk: Low liquidity can prevent trade execution or cause extreme slippage

Technical Risks:

  • πŸ› Software Bugs: This software may contain bugs that cause financial losses
  • ⚑ Execution Failures: Network issues, API failures, or smart contract errors can prevent trades
  • πŸ• Latency: Delays in execution can result in unfavorable prices
  • πŸ”Œ Downtime: System failures may prevent closing positions during critical moments
  • πŸ” Security Vulnerabilities: Despite security measures, vulnerabilities may exist

Operational Risks:

  • πŸ”‘ Wallet Security: Improper key management can lead to theft of funds
  • 🌐 API Dependencies: Third-party API failures (Helius, QuickNode, Jupiter) can disrupt trading
  • πŸ’Ύ Data Loss: Database or configuration errors may cause loss of trading history
  • βš™οΈ Configuration Errors: Incorrect settings can lead to unintended trading behavior

Regulatory Risks:

  • βš–οΈ Legal Compliance: Cryptocurrency trading may be restricted or illegal in your jurisdiction
  • πŸ“‹ Tax Obligations: You are responsible for reporting and paying taxes on trading profits
  • πŸ›οΈ Regulatory Changes: Laws and regulations may change, affecting legality of automated trading

No Guarantees

Past Performance:

  • πŸ“Š Past performance does NOT guarantee future results
  • 🎯 Target metrics (2-5% daily ROI, 65-75% win rate) are aspirational, not guaranteed
  • πŸ“ˆ Backtesting results may not reflect live trading performance
  • πŸ”„ Market conditions change constantly

Software Warranty:

  • ⚠️ This software is provided "AS IS" without warranty of any kind
  • ⚠️ No warranty of merchantability or fitness for a particular purpose
  • ⚠️ Authors and contributors are NOT responsible for any financial losses
  • ⚠️ Use at your own risk

Liability Limitations

The authors, contributors, and maintainers of this software:

  • ❌ Are NOT financial advisors
  • ❌ Do NOT provide investment advice
  • ❌ Are NOT responsible for your trading decisions
  • ❌ Are NOT liable for any direct, indirect, incidental, or consequential damages
  • ❌ Make NO representations about profitability or success

By using this software, you acknowledge:

  • βœ… You understand the risks involved in cryptocurrency trading
  • βœ… You are solely responsible for your trading decisions
  • βœ… You will not hold authors liable for any losses
  • βœ… You have consulted with financial and legal advisors (if appropriate)
  • βœ… You comply with all applicable laws and regulations in your jurisdiction

Recommended Safety Measures

Before Live Trading:

  1. βœ… Start with Paper Trading: Test for at least 24-48 hours with no real money
  2. βœ… Use Small Amounts: Start with capital you can afford to lose completely (0.1-1 SOL)
  3. βœ… Understand the Code: Review the trading logic and risk management
  4. βœ… Test Thoroughly: Run all tests, monitor in paper mode, verify filter performance
  5. βœ… Set Conservative Limits: Use strict stop losses, position limits, and drawdown protection
  6. βœ… Monitor Constantly: Watch the bot closely, especially in first days
  7. βœ… Have Exit Plan: Know how to emergency stop and withdraw funds
  8. βœ… Secure Your Wallet: Use dedicated wallet, never your main wallet
  9. βœ… Enable Alerts: Configure Telegram/Discord for real-time notifications
  10. βœ… Regular Backups: Backup configuration and trading data

During Live Trading:

  • πŸ‘€ Monitor performance daily
  • πŸ“Š Review trading logs and metrics
  • πŸ›‘ Stop immediately if unusual behavior detected
  • πŸ’° Withdraw profits regularly
  • πŸ”„ Adjust parameters based on performance
  • 🚨 Respect circuit breaker triggers

Regulatory Compliance

Your Responsibilities:

  • πŸ“‹ Verify cryptocurrency trading is legal in your jurisdiction
  • πŸ’΅ Report and pay taxes on trading profits
  • 🏦 Comply with anti-money laundering (AML) regulations
  • πŸ†” Complete KYC (Know Your Customer) requirements if applicable
  • πŸ“œ Maintain records for tax and regulatory purposes

Jurisdictional Warnings:

  • πŸ‡ΊπŸ‡Έ USA: Cryptocurrency trading may be subject to SEC/CFTC regulations
  • πŸ‡ͺπŸ‡Ί EU: MiCA regulations may apply
  • πŸ‡¨πŸ‡³ China: Cryptocurrency trading is restricted
  • 🌍 Other: Check local laws before using

Not Financial Advice

IMPORTANT: Nothing in this repository constitutes financial, investment, legal, or tax advice. This software is a tool for algorithmic trading research and education. All trading decisions are your own responsibility.

Consult Professionals:

  • πŸ’Ό Financial advisor for investment decisions
  • βš–οΈ Legal counsel for regulatory compliance
  • πŸ’° Tax professional for tax obligations

BY USING THIS SOFTWARE, YOU ACKNOWLEDGE THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO THIS DISCLAIMER AND ALL ASSOCIATED RISKS.

NEVER TRADE WITH MONEY YOU CANNOT AFFORD TO LOSE.

πŸ“‹ Project Status

Current Version: 1.0.0 (see CHANGELOG.md)

Development Status: βœ… Production Ready

Maintenance: 🟒 Actively Maintained

Security: πŸ”’ Security updates provided (see SECURITY.md)

Community: πŸ‘₯ Contributions welcome (see CONTRIBUTING.md)

πŸ†˜ Support & Community

πŸ“š Documentation

πŸ’¬ Get Help

🀝 Contributing

See CONTRIBUTING.md for contribution guidelines.

πŸ“œ Legal


Built with ❀️ and Mojo + Rust

Project Structure

MojoRust/
β”œβ”€β”€ src/                    # Main source code (Mojo)
β”‚   β”œβ”€β”€ core/              # Core functionality
β”‚   β”œβ”€β”€ data/              # Data layer (Mojo + typed DTOs)
β”‚   β”œβ”€β”€ engine/            # Trading engines
β”‚   β”œβ”€β”€ risk/              # Risk management
β”‚   β”œβ”€β”€ monitoring/        # Monitoring & alerting
β”‚   └── orchestration/     # Task orchestration (Python)
β”‚
β”œβ”€β”€ python/                # Pure Python modules
β”‚   β”œβ”€β”€ social_intelligence_engine.py
β”‚   β”œβ”€β”€ geyser_client.py
β”‚   └── jupiter_price_api.py
β”‚
β”œβ”€β”€ rust-modules/          # High-performance Rust components
β”œβ”€β”€ tests/                 # Comprehensive test suite
β”œβ”€β”€ config/                # Configuration files
β”œβ”€β”€ scripts/               # Utility scripts
└── docs/                  # Documentation

Technology Stack

  • Mojo: High-performance core components
  • Python: Orchestration and external integrations
  • Rust: Ultra-performance data processing
  • Docker: Containerized deployment
  • Prometheus/Grafana: Monitoring stack

Getting Started

  1. Clone and setup:

    git clone <repository-url>
    cd MojoRust
    make dev-setup
  2. Configure environment:

    cp .env.example .env
    # Edit .env with your API keys
  3. Run tests:

    make test
  4. Start the bot:

    make run

Development

  • Code formatting: make format
  • Linting: make lint
  • Testing: make test
  • Coverage: make test-coverage
  • Docker: make docker-build && make docker-run

See PROJECT_STRUCTURE.md for detailed information.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages