A tool for collecting and analyzing financial news about companies using Yahoo Finance API, with integrated support for the DeepSeek LLM and investment report generation.
- Collects financial news articles from Yahoo Finance API via yfinance library
- Stores the information in a persistent vector database (ChromaDB)
- Enables semantic search for company-specific financial information
- Extracts structured data from news articles including:
- Article titles
- URLs
- Publishers
- Content/summaries
- Publication dates
- Integrates with DeepSeek-r1 1.5B model via Ollama
- Generates Warren Buffett-style investment reports for any ticker
- Clone this repository
- Ensure you have Python 3.10+ installed
- Install dependencies using uv:
uv sync- Install Ollama (if not already installed):
curl -fsSL https://ollama.com/install.sh | shRun the main stockbot script:
uv run python src/stockbot.pyWhen prompted:
- Enter a company ticker symbol (e.g., AAPL, MSFT, TSLA)
- The system will fetch recent news about the company from Yahoo Finance
- The articles will be stored in a vector database
- You can then search for specific financial information using natural language queries
Run the DeepSeek model installer:
uv run python src/deepseek_test.pyThis script will:
- Verify Ollama is running
- Pull the DeepSeek-r1 1.5B model
- Test the model with a sample prompt
- Display information about the model
Run the investment report generator:
uv run python src/investment_report.py AAPLThis script will:
- Retrieve relevant news articles for the specified ticker from ChromaDB
- Format the articles into a context document
- Send a prompt to DeepSeek with the context and ticker information
- Generate a detailed investment report with Warren Buffett-style analysis
- Save the report to
[TICKER]_investment_report.md
Reports follow a structured format defined in src/improved_prompt.md with:
- Company Overview
- Financial Analysis
- Competitive Position
- Management Assessment
- Risk Factors
- Valuation
- Investment Recommendation (Buy/Hold/Sell)
You can modify the investment report generation by editing:
src/improved_prompt.md- Primary prompt template with structured formatcompany-info.md- Fallback prompt template
The system will first try to use the improved prompt, then fall back to the original if needed.
After loading news for a company, you can search for:
- "lawsuit" - Find news about legal issues
- "financial results" - Find articles about earnings
- "new products" - Find announcements about products
- "management changes" - Find news about executive shuffles
The system consists of several main components:
- YahooFinanceNewsCollector: Retrieves news articles for a given ticker symbol using yfinance API
- VectorDatabase: Stores and indexes articles using ChromaDB for semantic search
- NewsArticle: Data structure for representing financial news articles
- DeepSeek Integration: Connects to Ollama for accessing DeepSeek-r1 1.5B model capabilities
- InvestmentReportGenerator: Creates detailed investment analysis reports based on collected news
The vector database is stored in a directory called chroma_db in the project root. This allows for persistent storage and retrieval of financial news data across multiple runs.