Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VeriTrade

Autonomous Trading System Verification Framework

VeriTrade - AI-Powered Trading System Verification Framework

Python 3.10+ License: MIT Code Style: Black

🎯 Mission

VeriTrade is a production-ready verification framework for algorithmic trading systems (Expert Advisors) on MetaTrader 5. The system autonomously verifies that a trading strategy executes correctly, safely, and profitably before deployment.

Verify before you trade - Never deploy an untested EA again.

✨ Features

  • 🔍 Static Analysis - Code review and compliance checking
  • 🏃 Runtime Testing - Execute EA and observe behavior in real-time
  • ⚔️ Adversarial Testing - Edge cases and attack scenarios
  • 🔄 Recovery Testing - Restart and recovery scenarios
  • 📊 Evidence Collection - Screenshots, logs, and data capture
  • 📈 Backtesting - Historical performance validation
  • 🎯 Decision Engine - GO/NO-GO/NOT-PROVEN verdicts
  • 🔒 Secure API - API key authentication and rate limiting
  • 📝 Comprehensive Reports - HTML/JSON/Markdown output

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                    VeriTrade Framework                      │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────────────────────────────────────────────┐   │
│  │          1. MCP Server Layer                         │   │
│  │     - MT5 Control with Error Handling                │   │
│  │     - Tool Definitions                              │   │
│  │     - API Security                                  │   │
│  └──────────────────────────────────────────────────────┘   │
│                         │                                   │
│  ┌──────────────────────────────────────────────────────┐   │
│  │          2. Verification Controller                  │   │
│  │     - Static Analysis                               │   │
│  │     - Runtime Testing                               │   │
│  │     - Backtesting                                   │   │
│  │     - Evidence Collection                           │   │
│  └──────────────────────────────────────────────────────┘   │
│                         │                                   │
│  ┌──────────────────────────────────────────────────────┐   │
│  │          3. Reporting & Decision Engine              │   │
│  │     - Test Results                                  │   │
│  │     - Risk Assessment                               │   │
│  │     - GO/NO-GO/NOT-PROVEN Decision                  │   │
│  └──────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

🚀 Quick Start

Installation

# Clone the repository
git clone https://github.com/yourusername/veritrade.git
cd veritrade

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install package
pip install -e .

Configuration

# Copy environment example
cp .env.example .env

# Edit with your MT5 credentials
nano .env

Usage

Start MCP Server

python scripts/run_server.py --port 8080 --host 0.0.0.0

Run Verification

python scripts/run_verification.py --ea GridEA_PathB.mq5 --symbol EURUSD --timeframe H1

Generate Report

python scripts/generate_report.py --run-id RUN-20260828-001 --format html

Programmatic Usage

from veritrade import VeriTrade

# Initialize
veritrade = VeriTrade()

# Run verification
result = veritrade.verify(
    ea_file="GridEA_PathB.mq5",
    symbol="EURUSD",
    timeframe="H1",
    test_types=["static", "runtime", "adversarial"]
)

# Check result
if result.verdict == "GO":
    print("✅ Ready for production deployment")
elif result.verdict == "NO-GO":
    print("❌ Needs fixes before deployment")
else:
    print("⚠️ More testing required")

📁 Project Structure

VeriTrade/
├── src/
│   ├── mcp_server/         # MCP server implementation
│   ├── controllers/        # MT5 and verification controllers
│   ├── core/              # Core utilities (error handling, logging, config)
│   ├── models/            # Data models and schemas
│   ├── tests/             # Test implementations
│   └── utils/             # Utility functions
├── scripts/               # CLI scripts
├── configs/               # Configuration files
├── tests/                 # Unit and integration tests
├── docs/                  # Documentation
├── examples/              # Example EAs and notebooks
└── .claude/commands/      # Claude agent commands

🧪 Testing

# Run unit tests
pytest tests/unit/

# Run integration tests
pytest tests/integration/

# Run with coverage
pytest --cov=src tests/

📊 Success Criteria

The system is production-ready when:

  • ✅ All 6 phases implemented
  • ✅ 80%+ code coverage
  • ✅ End-to-end workflows work
  • ✅ Complete documentation
  • ✅ Security audit passed
  • ✅ Verification < 30 minutes
  • ✅ 99.9% uptime in testing
  • ✅ All error scenarios handled
  • ✅ Evidence collection working
  • ✅ Accurate GO/NO-GO decisions
  • ✅ Docker/PyPI deployment ready

📖 Documentation

⚠️ Important Warnings

  1. Never trade on live accounts during verification
  2. Never skip error handling for speed
  3. Never ignore evidence collection
  4. Never assume tests pass without verification
  5. Never deploy without GO decision
  6. Never modify production EA during verification
  7. Never use hardcoded credentials

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

📄 License

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

🙏 Acknowledgments

  • MetaTrader5 team for the excellent Python integration
  • MCP protocol contributors
  • Trading community for best practices and insights

Remember: Verify before you trade! 🎯

About

Autonomous Trading System Verification Framework

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages