This project retrieves news and stock price changes for a given stock symbol (e.g., AAPL) and generates a summarized market analysis report.
The system uses specialized agents working in parallel and sequential phases for comprehensive financial analysis:
flowchart TD
A["👤 User Input<br/>(Stock Symbol)"] --> B["🔄 Async Task Orchestration"]
%% Parallel Phase
B --> C["📰 Financial Assistant"]
B --> D["🔬 Research Assistant"]
%% Agent Tasks
C --> E["📊 News Retrieval<br/>& Analysis"]
D --> F["📈 Stock Price<br/>Analysis & Plotting"]
%% Tools
E --- TC["get_news_links<br/>summarize_news"]
F --- TD["Python Code Execution<br/>Data Visualization"]
%% Convergence Phase
E --> G["📝 Report Writer"]
F --> G
G --> H["📋 Market Analysis<br/>Report Generation"]
H --> I["💼 Investment<br/>Recommendation<br/>(Buy/Sell/Hold)"]
%% Styling
classDef agent fill:#e8f5e8,stroke:#28a745,stroke-width:3px
classDef process fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef tools fill:#fff3cd,stroke:#ffc107,stroke-width:2px
classDef output fill:#f8d7da,stroke:#721c24,stroke-width:2px
class C,D,G agent
class A,B,E,F,H process
class TC,TD tools
class I output
Agent | Role | Tools & Capabilities |
---|---|---|
📰 Financial Assistant | News retrieval and financial data collection. Gathers recent market news and performs initial analysis of market sentiment. | • get_news_links - Retrieves Yahoo Finance news • summarize_news - Extracts key information from articles |
🔬 Research Assistant | Quantitative analysis including stock price trends, technical indicators, and data visualization through Python code execution. | • Python Code Execution • Data Visualization (matplotlib/pandas) • Price Change Calculations |
📝 Report Writer | Synthesizes findings from news analysis and price research to generate comprehensive market analysis reports with investment recommendations. | • Report Synthesis • Investment Decision Logic • Markdown Report Generation |
🤖 User Proxy | Orchestrates the entire workflow, manages code execution environment, and coordinates async communication between agents. | • Async Task Coordination • Code Execution Management • Workflow Orchestration |
⚠️ Disclaimer: This analysis is for demonstration purposes only and should not be considered as financial advice. Always consult with financial professionals before making investment decisions.
This project uses the following AG2 features:
financial analysis, tool-use, async chat, stock-market, data-visualization, news-retrieval, investment-analysis, decision-support, market-trends
uv sync
cp .env.example .env
# Edit .env with your API key
The primary dependency is the ag2
library.
Before running the demo, you need to set up your OpenAI API configuration:
uv run python main.py
At the Enter the stock you want to investigate:
prompt, enter the stock symbol or stock name you want to investigate. For example, you can enter AAPL
for Apple Inc. stock.
Checkout the generated market_analysis_report.md
file for the summarized market analysis report.
For more information or any questions, please refer to the documentation or reach out to us!
This project is also licensed under the Apache License 2.0 LICENSE.