gittech. site

for different kinds of informations and explorations.

FinAgents - An AI based investment committee

Published at
1 day ago

FinAgents

A multi-agent system that simulates a debate between famous investors analyzing stock investment opportunities.

Overview

FinAgents creates a virtual investment committee where AI agents with personas of famous investors like Warren Buffett and Cathie Wood debate whether stocks are good investments. The system:

  1. Gathers real financial data using yfinance
  2. Has specialized analyst agents evaluate different aspects of the stock
  3. Has investor agents with unique investment philosophies debate the merits
  4. Synthesizes a comprehensive investment recommendation

Key Features

  • Parallel Processing: Agents run concurrently for faster analysis
  • Diverse Perspectives: 5 famous investor personas with unique philosophies
  • Specialized Analysis: 5 types of analyst agents focus on different aspects
  • Real Market Data: Uses yfinance to pull actual stock information
  • Comprehensive Output: Generates detailed reports saved as Markdown files

Investor Personas

  • Warren Buffett: Value investing, long-term perspective
  • Ray Dalio: Macro investing, economic cycles
  • Cathie Wood: Growth and disruptive innovation
  • Peter Lynch: Growth at a reasonable price
  • Michael Burry: Contrarian investing, spotting market inefficiencies

Setup

  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables: Create a .env file with:
ANTHROPIC_API_KEY=your_api_key_here
DEFAULT_MODEL=claude-3-7-sonnet-20250219
STOCK_DATA_SOURCE=yfinance

Usage

Run the main script:

python main.py

The system will analyze Microsoft (MSFT) by default, using all agents in parallel, and save detailed reports to the results directory.

Output Files

For each analyzed stock (e.g., MSFT):

  • results/MSFT_decision.md: Final synthesized investment recommendation
  • results/MSFT_detailed_analysis.md: Detailed reports from all analysts and investors

Project Structure

finagents/
β”œβ”€β”€ main.py                      # Main script to run the system
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ investor_agents.py   # Famous investor personas
β”‚   β”‚   β”œβ”€β”€ analyst_agents.py    # Financial analyst agents
β”‚   β”‚   β”œβ”€β”€ debate_manager.py    # Orchestrates the analysis process
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ stock_data.py        # Functions for retrieving stock data
β”œβ”€β”€ tests/                       # Comprehensive test suite
β”‚   β”œβ”€β”€ unit/                    # Unit tests for individual components
β”‚   β”œβ”€β”€ integration/             # Integration tests for the whole system
β”œβ”€β”€ results/                     # Output directory for analysis reports
β”œβ”€β”€ requirements.txt             # Project dependencies
β”œβ”€β”€ .env                         # Environment variables (API keys)
β”œβ”€β”€ run_tests.py                 # Script to run all tests
β”œβ”€β”€ README.md                    # This file
β”œβ”€β”€ ARCHITECTURE.md              # Detailed system architecture
β”œβ”€β”€ QUICKSTART.md                # Quick start guide
β”œβ”€β”€ PERSONAS.md                  # Detailed guide to agent personas
β”œβ”€β”€ EXTENDING.md                 # Guide for extending the system

Requirements

  • Python 3.8+
  • Anthropic API key (for Claude 3.7)
  • Internet connection (for financial data retrieval)

Running Tests

The project includes a test suite focusing on core data utilities and file operations:

python run_tests.py

This will run the stock data utility tests and output file tests, providing a detailed report.

License

MIT

DISCLAIMER:

This project is purely educational. The AI-generated personas are fictional and do not represent real statements or endorsements from Warren Buffett, Ray Dalio, Cathie Wood, Peter Lynch, or Michael Burry.