An AI-powered trading agent system for simulated stock and ETF trading, built with the Agno framework.
Ultimate Trader is an automated trading system that uses real market data from Yahoo Finance to execute simulated trades. The system features comprehensive risk management, automated daily routines, and detailed reporting capabilities.
- AI-Powered Trading Agent: Uses an LLM-based agent to analyze market data and execute trades
- Risk Management: Stop-loss monitoring, daily spending limits, and volatility assessment
- Automated Scheduling: Daily trading routines based on the trading calendar
- Portfolio Reporting: Excel export and email notifications for portfolio status
- Backtesting Framework: Unit tests for trading engine components
- Python 3.12 or higher
- Ollama (for local LLM inference)
- Yahoo Finance API access
-
Clone the repository:
git clone <repository-url> cd Ultimate_Trader
-
Install dependencies using uv:
uv sync
-
Configure Ollama:
- Ensure Ollama is running locally
- Pull the qwen2.5 model:
ollama pull qwen2.5
-
Configure email settings (optional):
- Edit
main.pyand updateemail_configwith your SMTP settings
- Edit
Run the application:
python main.pyThe system provides three execution modes:
- Single Execution: Run one trading session immediately
- Automated Scheduler: Run daily trading at 09:05 UTC
- Manual Query: Execute custom trading queries
The system follows a diversified investment strategy:
- Asset Allocation: 60% World ETF (VWCE/EUNL), 20% Bond ETFs, 20% Blue Chips
- Risk Limits:
- Sector exposure: Maximum 25% of capital in a single sector
- Weighted Beta: Target range 0.8 to 1.0
- Individual position: Maximum 10% of portfolio
- Stop-Loss: 5% threshold for automatic position closure
- Daily Budget: Maximum €2,000 per trading day
The TradingEngine class provides core functionality:
check_budget(): Validates daily spending limitscalculate_trade(): Computes exact share quantities and fees (0.1%)check_volatility(): Assesses risk via Beta factormonitor_stop_loss(): Tracks positions for stop-loss triggersexport_to_excel(): Generates portfolio status reportssend_email_report(): Sends status notifications
Run unit tests:
uv run python -m unittest test_trading_engine.pyUltimate_Trader/
├── main.py # Core trading agent and engine
├── test_trading_engine.py # Unit tests for trading engine
├── pyproject.toml # Project dependencies and configuration
├── .gitignore # Git ignore rules
└── README.md # Project documentation
- agno >= 1.0.0
- yfinance >= 0.2.40
- schedule >= 1.2.0
- pandas >= 2.0.0
- openpyxl >= 3.1.0
- openai >= 1.0.0
This project is provided as-is for educational and simulation purposes only.
This system is designed for simulated trading only. Do not use with real money or live trading accounts without thorough testing and validation.