Quick Start
Getting Started
This guide will walk you through setting up the AI-driven trading system, from environment configuration to running your first backtest and visualizing results on the dashboard.
1. Prerequisites
Before you begin, ensure you have the following installed:
- Python 3.10+
- Node.js & npm (for the dashboard)
- LLM Provider: An API key for Groq (recommended for speed) or a local Ollama instance.
- NewsAPI Key: (Optional) For enhanced news sentiment data.
2. Installation
Clone the repository and set up the backend and frontend environments.
Backend Setup
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
Frontend Setup
cd dashboard/frontend
npm install
cd ../..
3. Environment Configuration
Create a .env file in the root directory to store your credentials:
# LLM Configuration
GROQ_API_KEY=your_groq_api_key_here
# OR if using Ollama
OLLAMA_BASE_URL=http://localhost:11434
# Data Connectors
NEWSAPI_KEY=your_newsapi_key_here
4. Initialize Knowledge Base (RAG)
The system uses Retrieval-Augmented Generation (RAG) to provide agents with domain-specific knowledge. You must index the provided markdown files before running the agents.
from agents.rag.indexer import KnowledgeIndexer
indexer = KnowledgeIndexer()
indexer.index_all()
Alternatively, if a CLI script is provided, run: python manage_knowledge.py --index
5. Running Your First Backtest
Execute a backtest to simulate the multi-agent system's performance over a specific period. The system will orchestrate Technical, Sentiment, Fundamental, and Risk agents to make trading decisions.
# Run a 30-day backtest on Bitcoin
python run_backtest.py --days 30 --asset BTC
Once the backtest completes, a JSON report is generated in the logs/ directory. You can view a quick summary in the terminal:
python view_trades.py
6. Launching the Dashboard
To visualize the equity curve, agent reasoning, and specific trade logs, start the dashboard.
Start the Backend API
# From the root directory
uvicorn dashboard.backend.main:app --reload
The API will be available at http://localhost:8000.
Start the Frontend
# In a new terminal
cd dashboard/frontend
npm run dev
Open http://localhost:5173 in your browser. You can now select your backtest from the dropdown to see a detailed breakdown of the AI's performance and the logic behind every trade.
7. Basic Usage Example
If you wish to interact with the orchestration layer directly in your own scripts:
from orchestrator import TradingOrchestrator
# Initialize the system
orchestrator = TradingOrchestrator(backend="groq")
# Request a comprehensive analysis
query = "Bitcoin is at $62,000. RSI is 70. News sentiment is bullish but network growth is flat. Recommendation?"
result = orchestrator.analyze(query, enable_debate=True)
# Print the final consensus decision
orchestrator.print_final_decision(result)