๐Ÿšง BerryBot Pi is an experimental trading research project - Use paper trading mode to avoid financial losses ๐Ÿšง
BERRYBOT > TUTORIAL_MODE >

How to Set Up BerryBotPi AI Trading Bot - Complete Tutorial

Step-by-step guide to install and configure multi-LLM consensus trading on Raspberry Pi

๐Ÿ“‹ Prerequisites & Requirements

โš ๏ธ CRITICAL: This tutorial sets up PAPER TRADING ONLY. Never use real money initially.

๐Ÿ› ๏ธ Hardware Requirements

  • Raspberry Pi 5 (Recommended): 4GB RAM minimum, 8GB preferred
  • MicroSD Card: 32GB+ Class 10 or better
  • Power Supply: Official Raspberry Pi power adapter
  • Internet Connection: Ethernet or WiFi
  • Optional: External SSD for better performance

๐Ÿ’ป Alternative Hardware

  • Desktop/Laptop: Linux, macOS, or Windows with Python 3.11+
  • VPS/Cloud: AWS, Digital Ocean, or similar (always-on)
  • Docker: Any system supporting Docker containers

๐Ÿง  Knowledge Prerequisites

  • Basic Command Line: Navigate directories, edit files
  • Text Editing: Use nano, vim, or similar editors
  • Understanding of Risk: This is experimental software
  • Trading Basics: Know what BUY/SELL/HOLD means

๐Ÿ”‘ API Requirements

  • Exchange API Keys: Binance, Coinbase Pro, or Kraken
  • AI Model APIs: OpenAI, Anthropic, Google (optional)
  • Local LLM Option: Ollama for privacy-focused setup

๐Ÿš€ Installation Guide

Step 1: Prepare Raspberry Pi

# Download Raspberry Pi Imager # Flash Raspberry Pi OS Lite (64-bit) to microSD # Enable SSH during imaging process # Set username: pi # Set password: [your-secure-password] # Configure WiFi if needed

Step 2: First Boot Setup

# SSH into your Raspberry Pi ssh pi@[your-pi-ip-address] # Update system sudo apt update && sudo apt upgrade -y # Install essential packages sudo apt install -y python3.11 python3.11-venv python3-pip git curl # Install Docker (optional but recommended) curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker pi

Step 3: Clone BerryBotPi Repository

# Create projects directory mkdir ~/projects && cd ~/projects # Clone the repository git clone https://github.com/berrybot-ai/berrybot-mk3.git cd berrybot-mk3 # Check repository structure ls -la # Should see: src/, config/, docs/, requirements.txt, README.md

Step 4: Python Environment Setup

# Create virtual environment python3.11 -m venv venv # Activate virtual environment source venv/bin/activate # Upgrade pip pip install --upgrade pip # Install BerryBotPi dependencies pip install -r requirements.txt # Verify installation python -c "import berrybot; print('BerryBotPi installed successfully')"

Step 5: Install Local LLMs (Optional)

# Install Ollama for local AI models curl -fsSL https://ollama.ai/install.sh | sh # Download recommended models (this takes time) ollama pull llama3.1:8b ollama pull qwen2.5:7b ollama pull gemma2:9b # Verify Ollama installation ollama list

โš™๏ธ Configuration Setup

โœ… SAFETY FIRST: All configuration starts in paper trading mode.

Step 1: Basic Configuration

# Copy example configuration cp config/config.example.json config/config.json # Edit configuration file nano config/config.json # CRITICAL: Ensure these settings { "trading_mode": "paper", # NEVER change this initially "paper_balance": 10000, # Start with $10,000 fake money "max_position_size": 0.05, # Max 5% per trade "stop_loss_percentage": 0.02, # 2% stop loss "take_profit_percentage": 0.04, # 4% take profit "safety_checks": true, "confirm_all_trades": true }

Step 2: Exchange Configuration

# Edit exchange settings nano config/exchanges.json { "binance": { "enabled": true, "api_key": "your-api-key-here", "api_secret": "your-api-secret-here", "testnet": true, # Use testnet for safety "paper_trading": true # Double safety check } } # IMPORTANT: Start with read-only API keys # Add trading permissions only after extensive paper testing

Step 3: LLM Configuration

# Configure AI models nano config/llms.json { "enabled_llms": [ "ollama_llama3.1", # Local model (free) "ollama_qwen2.5", # Local model (free) "openai_gpt4o_mini" # Cloud model (paid) ], "ollama": { "base_url": "http://localhost:11434", "timeout": 120 }, "openai": { "api_key": "your-openai-api-key", "model": "gpt-4o-mini", # Cheaper option "max_tokens": 500 }, "consensus": { "minimum_votes": 2, # At least 2 models must agree "confidence_threshold": 0.6 # 60% minimum confidence } }

Step 4: Risk Management Setup

# Configure risk parameters nano config/risk.json { "max_daily_trades": 5, # Limit trading frequency "max_daily_loss": 0.02, # Stop if lose 2% in one day "max_position_size": 0.05, # Never more than 5% per trade "blackout_periods": [ # Don't trade during major events "2024-12-25", # Christmas "2024-01-01" # New Year ], "emergency_stop": { "enabled": true, "max_consecutive_losses": 3, # Stop after 3 losses in a row "volatility_threshold": 0.1 # Stop if market too volatile } }

Step 5: Logging Configuration

# Set up comprehensive logging nano config/logging.json { "level": "INFO", "log_to_file": true, "log_directory": "./logs", "max_file_size": "10MB", "backup_count": 30, "loggers": { "trading_decisions": "logs/decisions.log", "ai_responses": "logs/ai_responses.log", "api_calls": "logs/api_calls.log", "errors": "logs/errors.log", "performance": "logs/performance.log" } } # Create logs directory mkdir -p logs

๐Ÿงช Testing & Validation

Step 1: System Validation

# Activate virtual environment source venv/bin/activate # Run system checks python src/berrybot/main.py --validate-config python src/berrybot/main.py --test-apis python src/berrybot/main.py --test-llms # All tests should pass before proceeding

Step 2: Paper Trading Test

# Start paper trading mode python src/berrybot/main.py --paper-trading # In another terminal, monitor logs tail -f logs/decisions.log # Should see output like: # [2024-01-08 10:00:01] PAPER MODE: Analyzing BTC/USDT # [2024-01-08 10:02:15] CONSENSUS: 3/3 models vote HOLD (confidence: 72%) # [2024-01-08 10:02:16] PAPER TRADE: No action taken

Step 3: Performance Monitoring

# Check paper trading results python scripts/analyze_performance.py --paper-only # View trading dashboard (if web interface enabled) python src/web_ui/app.py # Visit: http://your-pi-ip:8501 # Daily status check python scripts/daily_report.py

Step 4: Safety Verification

# Verify paper trading mode is active python scripts/verify_safety.py # Output should be: # โœ… PAPER TRADING MODE: ACTIVE # โœ… API KEYS: READ-ONLY # โœ… REAL TRADING: DISABLED # โœ… SAFETY CHECKS: ENABLED # If any check fails, DO NOT PROCEED

Step 5: Set Up Monitoring

# Install system service (optional) sudo cp scripts/berrybot.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable berrybot.service # Start service sudo systemctl start berrybot.service # Check status sudo systemctl status berrybot.service # View logs journalctl -u berrybot.service -f

๐ŸŽฏ Next Steps & Best Practices

๐Ÿ“š LEARNING PHASE: Paper trade for minimum 3 months before considering real money.

Immediate Actions (Week 1)

  • Monitor Daily: Check logs and decisions every day
  • Understand Votes: Read AI reasoning for each decision
  • Track Performance: Record wins/losses in paper trading
  • Join Community: Discord, Reddit for questions and support

Short-term Goals (Month 1-3)

  • Market Analysis: Learn how AI reacts to different conditions
  • Fine-tuning: Adjust parameters based on results
  • Emergency Drills: Practice stopping the system quickly
  • Backup Systems: Set up monitoring and alerts

Long-term Preparation (Month 3+)

  • Performance Review: Analyze 3+ months of data
  • Risk Assessment: Understand failure modes
  • Decision Making: Determine if system is reliable enough
  • Micro Testing: If results are positive, consider tiny real amounts

Red Flags - Stop Immediately If:

  • Paper trading loses more than 10% in any month
  • System has frequent technical failures
  • AI models consistently make poor decisions
  • You don't understand why decisions are being made
  • Market conditions change significantly

Resources & Support

# Final safety check command python scripts/final_safety_check.py # Should output: # ๐Ÿ”’ BerryBotPi Safety Status Report # โœ… Paper trading mode: ACTIVE # โœ… Real trading: DISABLED # โœ… API permissions: READ-ONLY # โœ… Emergency stop: CONFIGURED # โœ… Monitoring: ENABLED # # ๐ŸŽ“ READY FOR EDUCATIONAL USE # โš ๏ธ NEVER USE REAL MONEY WITHOUT MONTHS OF TESTING