Skip to main content

AI agents and tools for the retail investor

Project description

๐Ÿค– Navam Invest

AI-Powered Investment Advisor for Retail Investors

PyPI version Python Version License: MIT Downloads Code style: black Checked with mypy

Features โ€ข Quick Start โ€ข Examples โ€ข Documentation โ€ข Contributing


๐Ÿ†• What's New in v0.1.11 (In Development)

Alternative Data & Sentiment Analysis - Finnhub integration for institutional-grade insights:

  • โœจ News Sentiment: Company news scores, sector averages, bullish/bearish percentages
  • โœจ Social Sentiment: Reddit and Twitter mentions, positive/negative scores
  • โœจ Insider Sentiment: Monthly Share Purchase Ratio (MSPR), insider trading patterns
  • โœจ Analyst Recommendations: Ratings distribution (strong buy, buy, hold, sell, strong sell)

Tool Count: 18 โ†’ 23 tools (+28% growth) | Full release notes: v0.1.11


๐Ÿ“– Overview

navam-invest brings institutional-grade portfolio intelligence to individual retail investors. Built with LangGraph and powered by Anthropic's Claude, it provides specialized AI agents for portfolio analysis, market research, and investment insightsโ€”all accessible through an interactive terminal interface.

Why Navam Invest?

  • ๐ŸŽฏ Institutional Intelligence: Access the same analytical depth once reserved for institutional portfolios
  • ๐Ÿ”’ Privacy-First: Run locally with your own API keysโ€”your data stays yours
  • ๐Ÿ’ก Transparent: Full audit trails and explainable AI reasoning
  • ๐Ÿ†“ Free Data Sources: Leverages high-quality public APIs (free tiers available)
  • ๐Ÿ”ง Extensible: Modular architecture makes it easy to add new agents and data sources

โœจ Features

๐Ÿค– AI Agents Powered by LangGraph

Portfolio Analysis Agent

  • Real-time stock quotes and metrics
  • Company fundamentals & financial ratios
  • News & social sentiment analysis ๐Ÿ†•
  • Insider sentiment tracking (MSPR) ๐Ÿ†•
  • Analyst recommendation trends ๐Ÿ†•
  • SEC filings (10-K, 10-Q, 13F)
  • Multi-criteria stock screening
  • Local file reading (CSV, JSON, Excel)

Market Research Agent

  • Macroeconomic indicators (GDP, CPI, unemployment)
  • Treasury yield curves & spreads
  • Federal Reserve data (FRED)
  • Economic regime detection
  • Debt-to-GDP analysis
  • Market news & sentiment

๐Ÿ“Š Real API Integrations (23 Tools Across 7 Data Sources)

API Tools Purpose Free Tier
Alpha Vantage 2 Stock prices, company overviews, technical indicators 25-500 calls/day
Financial Modeling Prep 4 Financial statements, ratios, insider trades, screening 250 calls/day
Finnhub ๐Ÿ†• 5 News sentiment, social sentiment, insider sentiment, analyst ratings 60 calls/min
FRED (St. Louis Fed) 2 Economic indicators, macro data Unlimited
U.S. Treasury 4 Yield curves, treasury rates, debt metrics Unlimited
SEC EDGAR 5 Corporate filings (10-K, 10-Q, 13F) 10 req/sec
NewsAPI.org 3 Market news, headlines, company news 100 calls/day
Anthropic Claude - AI reasoning and tool orchestration Pay-as-you-go

๐Ÿ’ฌ Interactive Terminal UI

  • Chat Interface: Natural language interaction with AI agents
  • Real-time Streaming: Watch agents think and reason in real-time
  • Markdown Rendering: Beautiful formatted output with tables and lists
  • Agent Switching: Seamlessly switch between specialized agents (/portfolio, /research)
  • Command Palette: Quick access to common actions
  • File Reading: Analyze local portfolio files (CSV, JSON, Excel)

๐Ÿ—๏ธ Built on Modern Tech

LangGraph (Agent Orchestration) โ†’ LangChain (Tools) โ†’ Anthropic Claude (Reasoning)
     โ†“
Textual (Terminal UI) + Typer (CLI) + httpx (Async HTTP)

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.9+ (3.13 recommended)
  • pip or uv package manager
  • API keys (see Configuration)

Installation

Option 1: Install from PyPI (Recommended)

pip install navam-invest

Option 2: Install from Source

git clone https://github.com/navam-io/navam-invest.git
cd navam-invest
python3 -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -e ".[dev]"

Configuration

  1. Copy environment template:

    cp .env.example .env
    
  2. Add your API keys to .env:

    # Required
    ANTHROPIC_API_KEY=sk-ant-...
    
    # Optional (but recommended for full functionality)
    ALPHA_VANTAGE_API_KEY=your_key_here
    FMP_API_KEY=your_key_here
    FINNHUB_API_KEY=your_key_here
    FRED_API_KEY=your_key_here
    NEWSAPI_API_KEY=your_key_here
    
  3. Get API Keys (all have free tiers):

    Service Link Notes
    Anthropic console.anthropic.com Required - Pay-as-you-go ($3-15/M tokens)
    Alpha Vantage alphavantage.co/support/#api-key Free tier: 25 calls/day
    FMP financialmodelingprep.com/developer Free tier: 250 calls/day
    Finnhub finnhub.io/register Free tier: 60 calls/min
    FRED fredaccount.stlouisfed.org/apikeys Free - Unlimited
    NewsAPI newsapi.org/register Free tier: 100 calls/day
    Treasury & SEC - No API keys required!

Usage

Launch the Interactive Interface

navam invest

This opens an interactive chat interface where you can talk to AI agents in natural language.


๐Ÿ’ก Example Interactions

Portfolio Analysis Examples

๐Ÿ“ˆ Stock Price & Overview
You: What's the current price of AAPL?

Portfolio Agent:
**AAPL - Stock Price**
Symbol: AAPL
Price: $178.25
Change: +2.45 (+1.39%)
Volume: 45,234,567
Market Cap: $2.81T
๐Ÿ’ฐ Financial Fundamentals
You: Show me Apple's financial ratios

Portfolio Agent:
**AAPL - Financial Ratios**

**Liquidity:**
Current Ratio: 0.98
Quick Ratio: 0.83

**Profitability:**
Gross Margin: 0.44
Operating Margin: 0.30
Net Margin: 0.25

**Returns:**
ROE: 1.47
ROA: 0.28

**Leverage:**
Debt Ratio: 0.32
๐Ÿ” Sentiment Analysis (NEW!)
You: What's the sentiment around TSLA?

Portfolio Agent:
**TSLA - News Sentiment Analysis**

**Sentiment Scores:**
Company News Score: 0.75
Sector Average: 0.62
Bullish: 68% | Bearish: 32%

**News Buzz:**
Articles Last Week: 45
Weekly Average: 32
Buzz Score: 1.4

**Social Media Sentiment:**
Reddit Mentions: 2,500 | Score: 0.65 (Positive)
Twitter Mentions: 5,200 | Score: 0.58 (Positive)

**Insider Sentiment:**
MSPR: 0.15 (Net buying)
Sentiment: ๐ŸŸข Bullish

**Analyst Recommendations:**
Strong Buy: 12 | Buy: 8 | Hold: 5 | Sell: 1
Consensus: ๐ŸŸข Bullish
๐Ÿ“‹ SEC Filings
You: Find me the latest 10-K for Apple

Portfolio Agent:
**AAPL - Latest 10-K Filing**

Filing Date: 2024-11-01
Period: FY 2024
Form: 10-K (Annual Report)

Document: https://www.sec.gov/cgi-bin/viewer?action=view&cik=0000320193&accession_number=...

Key Sections:
- Business Overview
- Risk Factors
- Financial Statements
- Management Discussion & Analysis
๐ŸŽฏ Stock Screening
You: Screen for tech stocks with market cap > $10B and P/E < 20

Portfolio Agent:
**Stock Screener Results**

**GOOGL** - Alphabet Inc
Sector: Technology | Price: $141.50
Market Cap: $1,750,234,567,890 | P/E: 18.2

**MSFT** - Microsoft Corporation
Sector: Technology | Price: $378.25
Market Cap: $2,801,456,789,012 | P/E: 19.5

**META** - Meta Platforms Inc
Sector: Technology | Price: $485.30
Market Cap: $1,234,567,890,123 | P/E: 16.8

Market Research Examples

๐Ÿ“Š Economic Indicators
You: /research
You: Show me key economic indicators

Research Agent:
**Key Macroeconomic Indicators**

**GDP Growth (Real):** 2.4% (Q3 2024)
**Unemployment Rate:** 3.9% (October 2024)
**CPI Inflation:** 3.2% (YoY, October 2024)
**Fed Funds Rate:** 5.25-5.50% (Current)

Economic Regime: Late Cycle Expansion
๐Ÿ“ˆ Treasury Yield Curve
You: Show me the Treasury yield curve

Research Agent:
**U.S. Treasury Yield Curve** (2025-10-06)

1 Month:   5.42%
3 Month:   5.38%
6 Month:   5.32%
1 Year:    5.15%
2 Year:    4.82%
5 Year:    4.35%
10 Year:   4.28%
30 Year:   4.42%

**2Y-10Y Spread:** -0.54% (Inverted - Recession signal)
**Curve Shape:** Inverted (Short rates > Long rates)
๐Ÿ“ฐ Market News
You: What's the latest market news?

Research Agent:
**Top Financial Headlines**

1. **Fed Signals Pause on Rate Hikes**
   Source: Reuters | 2 hours ago
   Summary: Federal Reserve officials indicate they may hold rates steady...

2. **Tech Stocks Rally on AI Optimism**
   Source: Bloomberg | 4 hours ago
   Summary: Major tech companies surge as investors bet on AI growth...

3. **Oil Prices Fall on Demand Concerns**
   Source: CNBC | 6 hours ago
   Summary: Crude oil drops 3% amid worries about global economic slowdown...

File Analysis Example

๐Ÿ“ Local Portfolio Analysis
You: Analyze my portfolio in portfolio.csv

Portfolio Agent:
**Portfolio Analysis**

Reading file: portfolio.csv

**Holdings:**
AAPL: 100 shares @ $178.25 = $17,825
MSFT: 50 shares @ $378.25 = $18,912.50
GOOGL: 75 shares @ $141.50 = $10,612.50

**Total Value:** $47,350
**Sector Allocation:**
- Technology: 100%

**Recommendations:**
- Portfolio is highly concentrated in tech sector
- Consider diversification into other sectors
- Current tech sentiment is bullish based on recent news

TUI Commands Reference

Command Action
/portfolio Switch to Portfolio Analysis Agent
/research Switch to Market Research Agent
/examples Show example queries
/help Show help message
/quit or /exit Exit application
/clear Clear chat history
Ctrl+C Clear input or chat
Ctrl+Q Quit application

๐Ÿ“š Documentation

Project Structure

navam-invest/
โ”œโ”€โ”€ src/navam_invest/
โ”‚   โ”œโ”€โ”€ agents/              # ๐Ÿค– LangGraph agent implementations
โ”‚   โ”‚   โ”œโ”€โ”€ portfolio.py     #    Portfolio analysis with ReAct pattern
โ”‚   โ”‚   โ””โ”€โ”€ research.py      #    Market research with macro tools
โ”‚   โ”œโ”€โ”€ tools/               # ๐Ÿ”ง API integration tools (23 tools total)
โ”‚   โ”‚   โ”œโ”€โ”€ alpha_vantage.py #    Stock price & fundamentals
โ”‚   โ”‚   โ”œโ”€โ”€ fmp.py           #    Financial statements & ratios
โ”‚   โ”‚   โ”œโ”€โ”€ finnhub.py       #    ๐Ÿ†• Sentiment & alternative data
โ”‚   โ”‚   โ”œโ”€โ”€ fred.py          #    Economic indicators & macro data
โ”‚   โ”‚   โ”œโ”€โ”€ treasury.py      #    Yield curves & treasury data
โ”‚   โ”‚   โ”œโ”€โ”€ sec_edgar.py     #    Corporate filings (10-K, 10-Q, 13F)
โ”‚   โ”‚   โ”œโ”€โ”€ newsapi.py       #    Market news & headlines
โ”‚   โ”‚   โ”œโ”€โ”€ file_reader.py   #    Local file reading
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py      #    Unified tools registry
โ”‚   โ”œโ”€โ”€ tui/                 # ๐Ÿ’ฌ Textual-based user interface
โ”‚   โ”‚   โ””โ”€โ”€ app.py           #    Chat interface with streaming
โ”‚   โ”œโ”€โ”€ config/              # โš™๏ธ Configuration management
โ”‚   โ”‚   โ””โ”€โ”€ settings.py      #    Pydantic settings with .env
โ”‚   โ””โ”€โ”€ cli.py               # ๐Ÿ–ฅ๏ธ Typer CLI entry point
โ”œโ”€โ”€ tests/                   # โœ… Test suite (pytest + async)
โ”‚   โ”œโ”€โ”€ test_config.py
โ”‚   โ”œโ”€โ”€ test_tools.py
โ”‚   โ”œโ”€โ”€ test_finnhub.py      # ๐Ÿ†• Finnhub tests
โ”‚   โ””โ”€โ”€ test_newsapi.py
โ”œโ”€โ”€ refer/                   # ๐Ÿ“– Reference documentation
โ”‚   โ”œโ”€โ”€ langgraph/           #    LangGraph docs & examples
โ”‚   โ””โ”€โ”€ specs/               #    Project specifications
โ”œโ”€โ”€ backlog/                 # ๐Ÿ“‹ Development backlog
โ”‚   โ”œโ”€โ”€ active.md            #    Current features
โ”‚   โ””โ”€โ”€ release-*.md         #    Release notes
โ”œโ”€โ”€ .env.example             # ๐Ÿ”‘ Environment template
โ”œโ”€โ”€ pyproject.toml           # ๐Ÿ“ฆ Package configuration
โ”œโ”€โ”€ CLAUDE.md                # ๐Ÿค– AI assistant guide
โ””โ”€โ”€ README.md                # ๐Ÿ“„ This file

Architecture

Technology Stack

AI & Agents
  • LangGraph 0.2+ - Agent orchestration, stateful workflows
  • LangChain Core 0.3+ - Tool framework, message handling
  • Anthropic Claude - Sonnet 4.5 for reasoning & analysis
User Interface
  • Textual 1.0+ - Modern terminal UI framework
  • Typer 0.15+ - CLI framework with type hints
  • Rich 13+ - Terminal formatting & markdown
Data & HTTP
  • httpx 0.28+ - Async HTTP client
  • Pydantic 2.0+ - Data validation & settings
  • python-dotenv - Environment management

Agent Design Pattern

Both agents implement the ReAct (Reasoning + Acting) pattern with tool calling:

User Query โ†’ Agent Reasoning โ†’ Tool Selection โ†’ Tool Execution โ†’ Response Formatting
     โ†‘                                                                    โ†“
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Streaming Updates โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Portfolio Analysis Agent (19 tools available):

  • Market Data: get_stock_price, get_stock_overview (Alpha Vantage)
  • Fundamentals: get_company_fundamentals, get_financial_ratios, get_insider_trades, screen_stocks (FMP)
  • Sentiment ๐Ÿ†•: get_company_news_sentiment, get_social_sentiment, get_insider_sentiment, get_recommendation_trends, get_finnhub_company_news (Finnhub)
  • Filings: search_company_by_ticker, get_latest_10k, get_latest_10q, get_institutional_holdings, get_company_filings (SEC)
  • News: search_market_news, get_company_news, get_top_financial_headlines (NewsAPI)
  • Files: read_local_file, list_local_files (Local)

Market Research Agent (11 tools available):

  • Macro: get_economic_indicator, get_key_macro_indicators (FRED)
  • Treasury: get_treasury_yield_curve, get_treasury_rate, get_treasury_yield_spread, get_debt_to_gdp (Treasury)
  • News: search_market_news, get_company_news, get_top_financial_headlines (NewsAPI)
  • Files: read_local_file, list_local_files (Local)

๐Ÿ› ๏ธ Development

Setup Development Environment

# Clone and setup
git clone https://github.com/navam-io/navam-invest.git
cd navam-invest
python3 -m venv .venv
source .venv/bin/activate

# Install with dev dependencies
pip install -e ".[dev]"

Running Tests

# Run all tests with coverage
pytest

# Run specific test file
pytest tests/test_finnhub.py -v

# Run with coverage report
pytest --cov=src/navam_invest --cov-report=term-missing

Current Coverage: 36/36 tests passing โœ… (34% overall coverage)

Code Quality

# Format code
black src/ tests/

# Lint
ruff check src/ tests/

# Type check
mypy src/

# Run all quality checks
black src/ tests/ && ruff check src/ tests/ && mypy src/

Development Tools

  • Black - Code formatting (88 char line length)
  • Ruff - Fast Python linter
  • MyPy - Static type checking (strict mode enabled)
  • pytest - Testing framework with async support
  • Textual DevTools - TUI hot-reload (textual run --dev)

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. ๐Ÿ› Report Bugs: Open an issue
  2. ๐Ÿ’ก Suggest Features: Start a discussion
  3. ๐Ÿ“ Improve Docs: Submit PR for documentation improvements
  4. ๐Ÿ”ง Submit Code: Fork, create branch, submit PR

Development Workflow

# 1. Create feature branch
git checkout -b feature/your-feature-name

# 2. Make changes and test
pytest

# 3. Format and lint
black src/ tests/
ruff check src/ tests/

# 4. Commit and push
git commit -m "feat: add your feature"
git push origin feature/your-feature-name

# 5. Open Pull Request

Adding New Agents

See CLAUDE.md for comprehensive guide on adding new LangGraph agents and tools.


๐Ÿ“‹ Roadmap

โœ… v0.1.11 (In Development)

  • Finnhub integration (news sentiment, social sentiment, insider sentiment, analyst recommendations)
  • API alternatives research and strategy
  • Enhanced portfolio agent with sentiment analysis
  • Complete documentation updates

๐Ÿš€ v0.1.12-0.1.15 (Next)

  • Tiingo integration (historical fundamentals, quarterly tracking)
  • Enhanced agent system prompts
  • Multi-agent workflow foundations
  • Custom screening engine (Phase 1)

v0.2.0 (Planned)

  • Custom hybrid stock screener (local computation + caching)
  • Additional specialized agents (Quill, Screen Forge, News Sentry, Macro Lens)
  • Multi-agent supervisor for coordinated analysis
  • Portfolio optimization tools (PyPortfolioOpt integration)
  • Conversation persistence with LangGraph checkpointers
  • Enhanced TUI with portfolio display panels

v0.3.0 (Planned)

  • Tax-loss harvesting agent
  • Risk metrics dashboard (VaR, beta, Sharpe)
  • Backtesting framework with historical data
  • Export capabilities (CSV/JSON/PDF)

Future

  • Web UI (Streamlit or FastAPI + HTMX)
  • LangGraph Cloud deployment
  • Mobile app (React Native)
  • Broker integrations (Alpaca, Interactive Brokers)

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

Built with these amazing open-source projects:

Data sources:


๐Ÿ”— Links


โญ If you find this project useful, please consider giving it a star!

Made with โค๏ธ by the Navam team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

navam_invest-0.1.11.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

navam_invest-0.1.11-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page