Skip to content

groverInnovate/agent

Repository files navigation

Crypto Trading AI Agent

An intelligent AI agent that analyzes social media sentiment from Twitter, Discord, and Telegram to provide crypto trading insights and recommendations. The agent fetches real-time data, performs sentiment analysis, detects alpha signals, and generates trade plans for various cryptocurrencies and memecoins.

🚀 Features

Core Capabilities

  • Multi-Platform Data Fetching: Collects data from Twitter, Discord, and Telegram
  • Sentiment Analysis: Analyzes social media posts for bullish/bearish/neutral sentiment
  • Alpha Signal Detection: Identifies potential trading opportunities and market signals
  • Trade Planning: Generates buy/sell/hold recommendations based on sentiment analysis
  • Dynamic Coin Support: Works with any cryptocurrency or memecoin
  • Real-time Analysis: Continuously monitors social media for market-moving information

Technical Features

  • AI-Powered Analysis: Uses advanced language models for sentiment detection
  • Risk Assessment: Evaluates risk levels and potential impact of trading signals
  • Engagement Scoring: Considers social media engagement metrics in analysis
  • Keyword Detection: Identifies crypto-specific trading keywords and signals
  • Modular Architecture: Easy to extend with new data sources and analysis methods

📋 Prerequisites

  • Node.js (version 22 or higher)
  • pnpm package manager
  • Docker (optional, for containerized deployment)
  • API Keys for social media platforms (see Configuration section)

🛠️ Installation

Option 1: Local Installation

  1. Clone the repository

    git clone <repository-url>
    cd eliza-starter
  2. Install dependencies

    pnpm install
  3. Set up environment variables

    cp .env.example .env
    # Edit .env with your API keys (see Configuration section)
  4. Start the agent

    pnpm start

Option 2: Docker Installation (Recommended)

  1. Clone the repository

    git clone <repository-url>
    cd eliza-starter
  2. Configure environment variables

    cp .env.example .env
    # Edit .env with your API keys
  3. Run with Docker Compose

    docker compose up

⚙️ Configuration

Required API Keys

Create a .env file in the project root with the following variables:

AI Model (Choose one)

# Option 1: OpenAI (you already have this)
OPENAI_API_KEY=your_openai_api_key

# Option 2: Google Gemini (you already have this)
GOOGLE_GENERATIVE_AI_API_KEY=your_gemini_api_key

# Option 3: Together AI (free tier available)
TOGETHER_API_KEY=your_together_api_key

# Option 4: Ollama (local, completely free)
OLLAMA_SERVER_URL=http://localhost:11434
OLLAMA_MODEL=llama3.2

Social Media APIs

# Twitter (for fetching tweets)
TWITTER_USERNAME=your_twitter_username
TWITTER_PASSWORD=your_twitter_password
TWITTER_EMAIL=your_twitter_email

# Discord (for fetching messages)
DISCORD_APPLICATION_ID=your_discord_app_id
DISCORD_API_TOKEN=your_discord_bot_token

# Telegram (for fetching messages)
TELEGRAM_BOT_TOKEN=your_telegram_bot_token

Optional: Crypto Data APIs

# BirdEye (Solana data)
BIRDEYE_API_KEY=your_birdeye_api_key

# Helius (Solana RPC)
HELIUS_API_KEY=your_helius_api_key

Getting API Keys

Discord Bot Setup

  1. Go to Discord Developer Portal
  2. Create a new application
  3. Go to "Bot" section and create a bot
  4. Copy the Application ID and Bot Token

Telegram Bot Setup

  1. Message @BotFather on Telegram
  2. Use /newbot command
  3. Follow instructions to create your bot
  4. Copy the bot token

Free AI Model Options

  • Ollama: Install locally with curl -fsSL https://ollama.ai/install.sh | sh
  • Together AI: Sign up at together.ai for free credits
  • Google Gemini: You already have this configured

🎯 Usage

Basic Usage

  1. Start the agent

    pnpm start
  2. Interact with the agent

    • The agent will start a chat interface
    • Ask questions like: "What do you think about Bitcoin?"
    • Request analysis: "Analyze sentiment for ETH"

Advanced Usage

Custom Character Configuration

# Use a specific character file
pnpm start --character=./characters/trading-bot.json

# Use multiple characters
pnpm start --characters="./characters/bot1.json,./characters/bot2.json"

Docker with Custom Configuration

# Build and run with custom environment
docker compose -f docker-compose-image.yaml up

Example Interactions

You: What's the sentiment around Bitcoin right now?
TradeBot: let me analyze the current sentiment around Bitcoin. checking social media and market data...

You: ETH is going to moon!
TradeBot: strong bullish sentiment detected! generating trade plan...

You: Can you analyze these posts for trading signals?
TradeBot: analyzing multiple posts for trading signals...

🔧 Skills and Capabilities

Available Skills

  1. fetch_tweets: Fetches tweets for any cryptocurrency
  2. fetch_discord: Fetches Discord messages (stubbed, ready for API integration)
  3. fetch_telegram: Fetches Telegram messages (stubbed, ready for API integration)
  4. analyze_sentiment: Analyzes sentiment with crypto-specific keywords
  5. detect_alphas: Identifies alpha signals and trading opportunities
  6. plan_trade: Generates buy/sell/hold recommendations

Sentiment Analysis Features

  • Bullish Keywords: pump, moon, bullish, buy, long, hodl, diamond hands, etc.
  • Bearish Keywords: crash, rug, bearish, sell, short, dump, scam, etc.
  • Engagement Scoring: Considers retweets, replies, likes, and quotes
  • Confidence Scoring: Measures the strength of sentiment signals

Alpha Signal Detection

  • Technical Signals: breakout, support, resistance, volume spike
  • Fundamental Signals: partnership, adoption, institutional, audit
  • Social Signals: viral, trending, fomo, influencer, whale
  • Risk Assessment: Evaluates scam, rug, manipulation signals

🐛 Troubleshooting

Common Issues

SQLite Database Error

If you encounter SQLite binding errors:

# Option 1: Use Docker (recommended)
docker compose up

# Option 2: Rebuild SQLite
pnpm rebuild better-sqlite3

# Option 3: Install system dependencies
sudo apt-get install -y python3 make g++ build-essential

API Key Issues

  • Ensure all required API keys are set in .env
  • Check API key permissions and rate limits
  • Verify social media account credentials

Port Conflicts

  • The agent runs on port 3000 by default
  • If port 3000 is busy, it will automatically try port 3001
  • You can set a custom port with SERVER_PORT=3001 in .env

Testing Individual Skills

Run the test script to verify skills work independently:

node --loader ts-node/esm test-skills.js

📁 Project Structure

eliza-starter/
├── src/
│   ├── skills/           # Trading analysis skills
│   │   ├── fetch_tweets.ts
│   │   ├── fetch_discord.ts
│   │   ├── fetch_telegram.ts
│   │   ├── analyze_sentiments.ts
│   │   ├── detect_alphas.ts
│   │   └── plan_trade.ts
│   ├── character.ts      # Agent personality configuration
│   ├── index.ts          # Main application entry point
│   └── ...
├── characters/           # Character configuration files
├── data/                 # Database and cache files
├── docker-compose.yaml   # Docker configuration
├── Dockerfile           # Docker build instructions
└── .env                 # Environment variables

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

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

⚠️ Disclaimer

This AI agent is for educational and research purposes only. It should not be considered as financial advice. Always do your own research and consult with financial professionals before making trading decisions. Cryptocurrency trading involves significant risk and you can lose your entire investment.

🆘 Support

If you encounter issues:

  1. Check the troubleshooting section above
  2. Review the logs for error messages
  3. Ensure all dependencies are properly installed
  4. Verify API keys and credentials are correct

For additional help, please open an issue in the repository.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 33