CryptoTrader is an AI-driven cryptocurrency trading plan generator powered by crewAI. The system employs multiple AI agents that collaborate to analyze cryptocurrency market data, research news and sentiment, and develop actionable trading strategies.
crypto_trader/
├── output/ # Directory for storing generated trading plans
├── .venv/ # Python virtual environment
├── knowledge/ # Knowledge base for the project
├── src/ # Source code
│ └── crypto_trader/
│ ├── config/
│ │ ├── agents.yaml # Agent configurations
│ │ └── tasks.yaml # Task configurations
│ ├── tools/
│ │ └── binance_rapidapi_tool.py # Tool for Binance API interactions
│ ├── crew.py # Main crew definition with agents and tasks
│ ├── main.py # Entry point and CLI interface
│ └── __init__.py
├── tests/ # Unit tests directory
├── README.md # Project documentation
├── pyproject.toml # Project configuration
└── .gitignore # Git ignore file
- Python 3.10 or higher (< 3.13)
- UV for dependency management
- Install UV:
pip install uv-
Clone the repository and navigate to the project directory
-
Install dependencies:
crewai install- Configure API keys:
- Add
OPENAI_API_KEYto.envfile (for LLM access) - Add
RAPIDAPI_KEYandRAPIDAPI_BINANCE_HOSTto.envfile (for Binance data access) - Add
SERPER_API_KEYto.envfile (for web search capabilities)
- Add
The system employs four specialized AI agents:
-
Binance Data Analyst
- Role: Fetch and process cryptocurrency market data from Binance
- Tools: BinanceRapidApiTool
- LLM: nvidia_nim/meta/llama-3.3-70b-instruct
-
News and Sentiment Researcher
- Role: Research and analyze news and market sentiment
- Tools: SerperDevTool, ScrapeWebsiteTool
- LLM: nvidia_nim/meta/llama-3.3-70b-instruct
-
Crypto Analyst
- Role: Analyze market data and news to provide comprehensive insights
- LLM: nvidia_nim/deepseek-ai/deepseek-r1
-
Trading Plan Strategist
- Role: Develop actionable trading plans based on analysis
- LLM: nvidia_nim/deepseek-ai/deepseek-r1
The agents collaborate on a sequence of tasks:
- Fetch Binance Klines Task: Retrieve historical candlestick data
- Fetch Binance Price Ticker Task: Get current price information
- Fetch Binance 24hr Stats Task: Get 24-hour market statistics
- Research News and Sentiment Task: Gather and analyze recent news
- Analyze Crypto Data Task: Synthesize market data and news
- Develop Trading Plan Task: Create an actionable trading strategy
The project uses custom and third-party tools:
- BinanceRapidApiTool: Custom tool for accessing Binance cryptocurrency data via RapidAPI
- SerperDevTool: For web searching capabilities (from crewai_tools)
- ScrapeWebsiteTool: For extracting information from web pages (from crewai_tools)
Run the project with default configuration:
crewai runThis will:
- Generate a trading plan for the default cryptocurrency (PEPEUSDT)
- Save the report to the
output/directory
Customize the execution with command-line arguments:
python -m src.crypto_trader.main --symbol BTCUSDT --interval 1h --limit 100 --output custom_output --verboseAvailable parameters:
--symbolor-s: Cryptocurrency trading symbol (default: PEPEUSDT)--intervalor-i: Kline interval (default: 4h)--limitor-l: Number of klines to fetch (default: 72)--outputor-o: Output directory (default: output)--verboseor-v: Enable verbose logging
The system generates a comprehensive trading plan in Markdown format containing:
- Market data analysis (price, volume, trends)
- News and sentiment analysis
- Support and resistance levels
- Entry and exit points
- Risk management strategies
- Profit targets
The output is saved to a file named trading_plan_{target_symbol}_{datetime}.md in the output directory.
- Define the agent in
src/crypto_trader/config/agents.yaml - Implement the agent class in
src/crypto_trader/crew.py - Add associated tasks in
src/crypto_trader/config/tasks.yaml
- Create a new tool in
src/crypto_trader/tools/ - Implement the tool following the crewAI BaseTool pattern
- Add the tool to the appropriate agent in
src/crypto_trader/crew.py
Common issues:
- API Key Errors: Ensure all required API keys are properly set in the
.envfile - Dependency Issues: Make sure UV is installed and dependencies are properly locked
- Rate Limiting: If hitting RapidAPI rate limits, consider implementing retry logic or upgrading your plan
- crewai: Framework for multi-agent AI systems
- requests: For API interactions
- pydantic: For data validation
- python-dotenv: For environment variable management
See LICENSE file for details.