A simple multi-agent system built using CrewAI that analyzes stock data and generates trading decisions using real-time market information.
This project simulates a collaborative AI trading workflow using two specialized agents:
- 📊 Analyst Agent → Gathers and interprets live stock data
- 📈 Trader Agent → Makes Buy/Sell/Hold decisions based on analysis
The system uses real-time stock data via Yahoo Finance and processes it through a structured agent pipeline.
- User provides a stock name (e.g.,
TSLA) - The Analyst Agent:
- Fetches live stock data (price, change, volume, etc.)
- Summarizes key insights
- The Trader Agent:
- Uses the analysis
- Outputs a trading decision:
- ✅ Buy
- ❌ Sell
- 🤝 Hold
- CrewAI → Multi-agent orchestration
- LiteLLM / Groq → LLM backend
- yfinance → Real-time stock data
- Python → Core implementation
Crew_AI_multi_agents/
│
├── agents/
│ ├── analyst_agent.py
│ └── trader_agent.py
│
├── tasks/
│ ├── analyse_task.py
│ └── trader_task.py
│
├── tools/
│ └── stock_research_tool.py
│
├── crew.py
├── main.py
├── requirements.txt
└── .env
- Multi-agent collaboration using CrewAI
- Real-time stock data via Yahoo Finance (
yfinance) - Modular architecture (agents, tasks, tools separation)
- Extensible for more financial indicators or strategies
git clone <your-repo-url>
cd Crew_AI_multi_agentspy -3.12 -m venv venv
.\venv\Scripts\activatepip install -r requirements.txtCreate a .env file:
GROQ_API_KEY=your_api_key_here
Run the system:
python main.pyDefault example (to be input inside main.py):
run("TESLA")Stock: TSLA
Price: 245.32 USD
Change: +3.45 (1.43%)
Recommendation: BUY
Reason:
- Strong upward momentum
- Positive daily change
- High trading volume
- Add technical indicators (RSI, MACD, moving averages)
- Introduce risk management agent
- Backtesting on historical data
- Multi-stock portfolio optimization
- Add memory between agents
This project is for educational and experimental purposes.