LLM-powered trading research assistant for technical and fundamental analysis
Technical Analysis • Fundamental Analysis • LLM-Powered Insights • Trade Journal • Automated Reports
Trading Research Assistant is a production-ready automated financial market analysis system that uses Large Language Models (LLM) to generate trading recommendations based on technical and fundamental analysis. Built with clean architecture principles and designed for extensibility.
- 📊 Technical Analysis - Automatic indicator calculation and chart analysis via LLM
- 📰 Fundamental Analysis - News aggregation and analysis from various sources (GDELT, NewsAPI)
- 🤖 LLM Agents - Use of local or remote LLM models (Ollama) for analysis
- 💾 Trade Journal - Track trading results and statistics
- 📈 Reports - Generate trading operation statistics
- 🔄 Fallback Providers - Automatic switching between data sources (OANDA, Twelve Data)
- 🏗️ Clean Architecture - Domain-driven design with ports & adapters pattern
- 🧪 Testable - Each layer can be tested independently
- Python 3.11 or higher
- uv (recommended) or pip
- Ollama installed and running (for LLM features)
- API keys for data providers (OANDA, Twelve Data)
-
Create virtual environment with Python 3.11:
Windows (PowerShell):
uv venv --python 3.11 .venv\Scripts\Activate.ps1
Linux/macOS:
uv venv --python 3.11 source .venv/bin/activate -
Install dependencies:
# Base dependencies (required) uv sync # With dev dependencies (testing, linting) uv sync --extra dev
# Base dependencies
pip install -e .
# With dev dependencies
pip install -e ".[dev]"-
Create and activate virtual environment:
Windows (PowerShell):
uv venv --python 3.11 .venv\Scripts\Activate.ps1
Linux/macOS:
uv venv --python 3.11 source .venv/bin/activate -
Install dependencies:
uv sync --extra dev
-
Configure environment variables: Copy
.env.exampleto.envand fill in your API keys:Windows (PowerShell):
Copy-Item .env.example .envLinux/macOS:
cp .env.example .env
Then edit
.envand replace placeholder values with your actual API keys. -
Initialize database:
python src/app/main.py init-db
-
Run analysis:
python src/app/main.py analyze --symbol EURUSD --timeframe 1h
-
View latest recommendation:
python src/app/main.py show-latest
init-db- Initialize database and run migrationsanalyze --symbol SYMBOL [--timeframe TIMEFRAME] [--verbose]- Run full analysis pipeline- Example:
analyze --symbol EURUSD --timeframe 1h - Supported timeframes:
1m,5m,15m,1h,1d - Use
--verboseto show detailed analysis output during execution
- Example:
show-latest [--details]- Display the latest recommendation with color-coded action and confidence- Use
--detailsto show full rationales (technical analysis, news context, synthesis)
- Use
journal- Interactive command for logging trading decisionsreport- View trading statistics and reports
- Base (required):
pydantic,pydantic-settings,httpx,tenacity,numpy,pandas,ta,ollama,rich - dev (optional):
pytest,ruff,mypy- for development and testing
Comprehensive documentation is available in the docs/ directory:
English:
- 📖 Overview - Project overview and key features
- 🏗️ Architecture - Project structure and design patterns
- 📚 Usage Guide - Installation and usage instructions
- ⚙️ Environment Configuration - Complete description of all .env variables
- 🤖 LLM Task Routing - LLM routing by tasks and branches
- 🔧 Troubleshooting - Common issues and solutions
- 🔒 Safety Policy - Safety policy and risk management
- 📋 Import Rules - Import rules and dependency graph
Русский:
- 📖 Обзор - Обзор проекта и основные возможности
- 🏗️ Архитектура - Структура проекта и паттерны проектирования
- 📚 Руководство по использованию - Инструкции по установке и использованию
- ⚙️ Конфигурация переменных окружения - Полное описание всех переменных .env
- 🤖 LLM Task Routing - Маршрутизация LLM по задачам и веткам
- 🔧 Устранение неполадок - Распространенные проблемы и решения
- 🔒 Политика безопасности - Политика безопасности и управление рисками
- 📋 Правила импортов - Правила импортов и граф зависимостей
| Category | Technology |
|---|---|
| Language | Python 3.11+ |
| Package Manager | uv |
| Data Validation | Pydantic 2.0+ |
| HTTP Client | httpx 0.25+ |
| Retry Logic | tenacity 8.2+ |
| Data Processing | pandas 2.0+, numpy 1.24+ |
| Technical Analysis | ta 0.11+ |
| LLM Provider | Ollama (local or remote) |
| CLI Interface | Rich 13.0+ |
| Database | SQLite 3 |
| Testing | pytest 7.4+ |
| Linting | ruff 0.1+ |
| Type Checking | mypy 1.5+ |
Trading-research-assistant/
├── src/
│ ├── core/ # Domain logic (models, ports, services, policies)
│ ├── data_providers/ # Market data adapters (OANDA, Twelve Data)
│ ├── news_providers/ # News adapters (GDELT, NewsAPI)
│ ├── features/ # Technical indicators, volatility, regime detection
│ ├── agents/ # LLM agents for analysis
│ ├── llm/ # LLM providers (Ollama)
│ ├── storage/ # SQLite repositories and artifact store
│ ├── runtime/ # Orchestration and jobs
│ ├── ui/ # CLI interface (Rich)
│ ├── app/ # Entry point and settings
│ ├── broker_journal/ # Trade journal management
│ └── utils/ # Utilities (logging, retry, time)
├── tests/ # Unit and integration tests
├── docs/ # Documentation (en/ru)
│ ├── en/ # English documentation
│ └── ru/ # Russian documentation
├── scripts/ # Utility scripts
├── db/ # SQLite database directory
└── pyproject.toml # Project configuration
For detailed structure, see Architecture Documentation.
The project is built on Clean Architecture principles using the Ports & Adapters pattern. The system core (core) is completely isolated from external dependencies and only knows about business logic.
Key Rule: core does not know about external integrations. External modules implement interfaces from core/ports.
Dependency Graph:
app → runtime → (features, agents, storage, providers, llm) → core
For detailed architecture documentation, see:
- OANDA — primary provider for Forex
- Twelve Data — fallback provider
- GDELT — global news database
- NewsAPI — news aggregator
- Multi-provider routing — Support for Ollama (local/server) and DeepSeek API
- Task-based routing — Configure different models for different tasks (tech analysis, news analysis, synthesis, verification)
- Automatic fallback — Falls back to available providers if primary fails
- Health checks — Provider availability checking with caching
- Verification stage — Optional LLM-based verification of agent outputs
- Legacy support — Backward compatible with
OLLAMA_BASE_URLandOLLAMA_MODELduring transition
The system includes a safety policy that validates recommendations before issuing them. See Safety Policy Documentation for details.
- Ollama for local LLM capabilities
- Rich for beautiful CLI interface
- Pydantic for data validation
- uv for fast Python package management
- OANDA and Twelve Data for market data APIs
- GDELT for news data
Made with ❤️ using Python, Clean Architecture, and LLM