Skip to content

ironcladgeek/FalconSignals

Repository files navigation

FalconSignals

AI-powered financial analysis and investment recommendation system using multi-agent AI orchestration (CrewAI). Analyzes global markets to generate daily investment signals with confidence scores.

πŸ“– Complete CLI Documentation

Overview

FalconSignals is designed to help investors make informed decisions by providing daily, data-driven investment analysis. The system combines fundamental analysis, technical indicators, and news sentiment to generate actionable investment signals with confidence scores.

Key Features:

  • πŸ€– Multi-agent AI system with 5 specialized analysis agents
  • πŸ“Š Dual analysis modes: LLM-powered (AI) and Rule-based (technical indicators)
  • 🌐 Static website publishing with MkDocs + GitHub Pages
  • πŸ’° Cost-conscious design: Target €50-90/month operational cost
  • 🌍 Global market coverage: 1000+ US, Nordic, and EU instruments
  • ⚑ Fast execution: Complete analysis in <15 minutes
  • πŸ“ˆ Confidence-scored recommendations with detailed reasoning

Quick Start

Prerequisites

  • Python 3.12+
  • UV package manager
  • API keys:
    • ANTHROPIC_API_KEY or OPENAI_API_KEY (required for LLM mode)
    • ALPHA_VANTAGE_API_KEY (required - Premium tier recommended for news + earnings)
    • FINNHUB_API_KEY (optional - for analyst recommendations)

Installation

# Clone and setup
git clone <repository>
cd falconsignals

# Install dependencies
uv sync

# Initialize configuration
uv run python -m src.main config-init

# Edit configuration (optional)
# nano config/local.yaml

Environment Variables

# LLM API Key (choose one - Anthropic recommended)
export ANTHROPIC_API_KEY=your_key        # For AI-powered analysis
# OR
export OPENAI_API_KEY=your_key           # Alternative to Anthropic

# Financial Data APIs
export ALPHA_VANTAGE_API_KEY=your_key    # Premium tier: 75 requests/min, news + earnings
export FINNHUB_API_KEY=your_key          # Optional: analyst recommendations

Or create .env file in project root:

ANTHROPIC_API_KEY=your_key
FINNHUB_API_KEY=your_key
ALPHA_VANTAGE_API_KEY=your_key

πŸ’‘ Note on Analysis Modes:

  • LLM Mode (--llm flag): AI-powered analysis with enhanced sentiment and qualitative insights
  • Rule-Based Mode (default): Technical indicators and quantitative methods
  • Both modes generate valid trading signals

Usage

Validate Configuration

uv run python -m src.main validate-config

Run Analysis

Rule-Based Analysis (Default)

# Quick test
uv run python -m src.main analyze --test

# Analyze specific market
uv run python -m src.main analyze --market us --limit 20

# Analyze global markets
uv run python -m src.main analyze --market global

# Analyze specific stocks
uv run python -m src.main analyze --ticker AAPL,MSFT,GOOGL

# Analyze by category
uv run python -m src.main analyze --group us_tech_software
uv run python -m src.main analyze --group us_ai_ml,us_cybersecurity --limit 30

LLM-Powered Analysis πŸ€–

Use intelligent CrewAI agents with Claude/GPT reasoning:

# Quick test with LLM
uv run python -m src.main analyze --test --llm

# Single stock with LLM analysis
uv run python -m src.main analyze --ticker INTU --llm

# Multiple stocks with LLM
uv run python -m src.main analyze --ticker AAPL,MSFT,GOOGL --llm

# With custom config
uv run python -m src.main analyze --ticker INTU --llm --config config/local.yaml

# JSON output instead of Markdown
uv run python -m src.main analyze --ticker INTU --llm --format json

# With LLM debug mode (saves inputs/outputs)
uv run python -m src.main analyze --ticker INTU --llm --debug-llm

What LLM mode does:

  • Activates 5 intelligent agents: Market Scanner, Technical Analyst, Fundamental Analyst, Sentiment Analyst, Signal Synthesizer
  • Each agent uses Claude/GPT to reason about the analysis
  • Combines insights with proper weighting (35% fundamental, 35% technical, 30% sentiment)
  • Tracks token usage and costs in EUR
  • Falls back to rule-based analysis if LLM fails

Cost: ~€0.65 per stock analyzed (adjustable by model choice)

List Available Categories

uv run python -m src.main list-categories

Generate Reports

# Generate report from cached data
uv run python -m src.main report --date 2024-01-15

Publish to Website

Publish analysis results to a static website:

# Publish and deploy to GitHub Pages
uv run python -m src.main publish --session-id 123

# Publish specific date
uv run python -m src.main publish --date 2025-12-10

# Build only (no deployment)
uv run python -m src.main publish --session-id 123 --build-only

Features:

  • 🌐 Static site with MkDocs + Material theme
  • 🏷️ Tag-based filtering (ticker, signal type, date)
  • πŸ”’ Privacy-first (removes portfolio allocations)
  • πŸš€ Automated GitHub Actions deployment
  • πŸ“± Responsive design with dark/light mode

See Website Publishing Guide for setup and deployment details.

CLI Help

uv run python -m src.main --help
uv run python -m src.main analyze --help

Configuration

Create config/local.yaml from template:

uv run python -m src.main config-init --output config/local.yaml

Key settings:

capital:
  starting_capital_eur: 2000
  monthly_deposit_eur: 500

risk:
  tolerance: moderate              # conservative, moderate, aggressive
  max_position_size_percent: 10
  max_sector_concentration_percent: 20

markets:
  included: [nordic, eu, us]       # Available markets
  included_instruments: [stocks, etfs]

analysis:
  weight_fundamental: 0.35
  weight_technical: 0.35
  weight_sentiment: 0.30

llm:
  provider: anthropic              # anthropic, openai, local
  model: claude-sonnet-4-20250514
  temperature: 0.7

Architecture

FalconSignals uses a multi-agent CrewAI architecture:

Configuration Layer (YAML/CLI)
    ↓
Data Fetching (Multiple APIs + Caching)
    ↓
Analysis Mode Selection
    β”œβ”€ LLM Mode: CrewAI Multi-Agent System
    β”‚   β”œβ”€ Market Scanner Agent (anomaly detection, screening)
    β”‚   β”œβ”€ Fundamental Analysis Agent (earnings, valuations, growth)
    β”‚   β”œβ”€ Technical Analysis Agent (indicators: SMA, RSI, MACD, ATR)
    β”‚   β”œβ”€ News & Sentiment Agent (news processing, sentiment scoring)
    β”‚   └─ Signal Synthesis Agent (weighted scoring + confidence)
    β”‚
    └─ Rule-Based Mode: Direct Analysis Pipeline
        β”œβ”€ Technical Indicators (SMA, RSI, MACD, ATR)
        β”œβ”€ Fundamental Metrics (P/E, EV/EBITDA, margins)
        └─ Signal Scoring (weighted combination)
    ↓
Report Generation (Markdown/JSON)
    ↓
Output (Files, Terminal)

For detailed architecture diagrams, see:

Project Structure

falconsignals/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py              # CLI entry point
β”‚   β”œβ”€β”€ config/              # Configuration system
β”‚   β”‚   β”œβ”€β”€ schemas.py       # Pydantic validation
β”‚   β”‚   β”œβ”€β”€ loader.py        # YAML loading
β”‚   β”‚   └── llm.py           # LLM client initialization
β”‚   β”œβ”€β”€ data/                # Data layer
β”‚   β”‚   β”œβ”€β”€ models.py        # Pydantic data models
β”‚   β”‚   β”œβ”€β”€ providers.py     # Abstract provider
β”‚   β”‚   β”œβ”€β”€ yahoo_finance.py # Yahoo Finance impl
β”‚   β”‚   β”œβ”€β”€ alpha_vantage.py # Alpha Vantage impl
β”‚   β”‚   β”œβ”€β”€ finnhub.py       # Finnhub impl (analyst recommendations only)
β”‚   β”‚   β”œβ”€β”€ screening.py     # Instrument filtering
β”‚   β”‚   β”œβ”€β”€ normalization.py # Data cleaning
β”‚   β”‚   └── portfolio.py     # Portfolio state
β”‚   β”œβ”€β”€ cache/               # Caching layer
β”‚   β”‚   └── manager.py       # Cache management
β”‚   β”œβ”€β”€ agents/              # Agent system
β”‚   β”‚   β”œβ”€β”€ base.py          # BaseAgent and AgentConfig
β”‚   β”‚   β”œβ”€β”€ crew.py          # AnalysisCrew orchestrator
β”‚   β”‚   β”œβ”€β”€ scanner.py       # MarketScannerAgent
β”‚   β”‚   β”œβ”€β”€ analysis.py      # Technical & Fundamental agents
β”‚   β”‚   β”œβ”€β”€ sentiment.py     # Sentiment & Signal Synthesis agents
β”‚   β”‚   β”œβ”€β”€ crewai_agents.py # CrewAI Agent factory
β”‚   β”‚   └── hybrid.py        # Hybrid intelligence wrapper
β”‚   β”œβ”€β”€ tools/               # Agent tools
β”‚   β”‚   β”œβ”€β”€ base.py          # BaseTool and ToolRegistry
β”‚   β”‚   β”œβ”€β”€ fetchers.py      # PriceFetcherTool, NewsFetcherTool
β”‚   β”‚   β”œβ”€β”€ analysis.py      # Technical & Sentiment tools
β”‚   β”‚   └── reporting.py     # ReportGeneratorTool
β”‚   β”œβ”€β”€ llm/                 # LLM integration
β”‚   β”‚   β”œβ”€β”€ token_tracker.py # Token usage & cost tracking
β”‚   β”‚   β”œβ”€β”€ prompts.py       # Prompt templates
β”‚   β”‚   └── tools.py         # CrewAI tool adapters
β”‚   β”œβ”€β”€ orchestration/       # Analysis orchestration
β”‚   β”‚   └── unified.py       # UnifiedAnalysisOrchestrator (LLM + rule-based)
β”‚   β”œβ”€β”€ analysis/            # Analysis modules
β”‚   β”‚   β”œβ”€β”€ technical.py     # Technical indicators
β”‚   β”‚   β”œβ”€β”€ fundamental.py   # Fundamental analysis
β”‚   β”‚   β”œβ”€β”€ signals.py       # Signal generation
β”‚   β”‚   └── report.py        # Report generation
β”‚   β”œβ”€β”€ pipeline/            # Pipeline orchestration
β”‚   β”‚   └── orchestrator.py  # AnalysisPipeline
β”‚   └── utils/               # Utilities
β”‚       β”œβ”€β”€ logging.py       # Logging setup
β”‚       └── llm_check.py     # LLM configuration check
β”œβ”€β”€ config/
β”‚   └── default.yaml         # Configuration template
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ cache/               # API response cache
β”‚   β”œβ”€β”€ features/            # Preprocessed data
β”‚   β”œβ”€β”€ reports/             # Generated reports
β”‚   └── tracking/            # Token usage tracking
β”œβ”€β”€ tests/                   # Test suite
└── docs/
    β”œβ”€β”€ architecture.mermaid     # System architecture
    β”œβ”€β”€ analyze_workflow.mermaid # Analyze command workflow
    β”œβ”€β”€ roadmap.md               # Implementation plan
    └── CLI_GUIDE.md             # CLI guide

Development

Code Quality

# Format and lint
uv run poe lint

# Run pre-commit hooks
uv run poe pre-commit

Testing

# Run all tests
pytest

# Run single test file
pytest tests/unit/data/test_models.py

# Run with coverage
pytest --cov=src

Troubleshooting

"API key not found"

echo $ANTHROPIC_API_KEY
echo $ALPHA_VANTAGE_API_KEY
echo $FINNHUB_API_KEY

"Config file not found"

uv run python -m src.main config-init

"Cache permission denied"

mkdir -p data/cache data/features data/reports

"Pre-commit hooks failing"

uv run poe lint

Documentation

Technology Stack

Component Technology
CLI Typer
Config Pydantic + YAML
Data Pydantic models
Providers yfinance, requests
Caching JSON (local)
AI/LLM CrewAI + Anthropic/OpenAI
Logging Loguru
Package Manager UV
Code Quality Black, Ruff, Pre-commit

About

AI-powered financial analysis and investment recommendation system using multi-agent AI orchestration.

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages