DiscordCryptoAnalyzer
DiscordCryptoAnalyzer
Install / Use
/learn @qrak/DiscordCryptoAnalyzerREADME
Discord Crypto Analyzer
<p align="left"> <img src="https://img.shields.io/badge/python-3.11+-blue.svg" /> <img src="https://img.shields.io/badge/discord.py-2.6.3-blue.svg" /> <img src="https://img.shields.io/badge/numpy-2.2.3-blue.svg" /> <img src="https://img.shields.io/badge/pandas-2.3.2-blue.svg" /> <img src="https://img.shields.io/badge/plotly-6.3.0-blue.svg" /> <img src="https://img.shields.io/badge/ccxt-4.5.3-blue.svg" /> </p>A powerful Discord bot for real-time cryptocurrency market analysis using advanced AI models.
Try It Live
Join our Discord server to see the bot in action and test features in real time:
Channel: #ai-analysis
Overview
Discord Crypto Analyzer provides real-time cryptocurrency analysis directly to your Discord server. Using advanced AI models, it generates detailed reports, forecasts, and detects key market patterns—perfect for traders and enthusiasts seeking instant, data-driven insights.
Features
- Real-time Market Analysis: Analyze any cryptocurrency trading pair with a simple command
- AI-Powered Insights: Utilizes advanced AI models to interpret complex market data
- Visual Chart Analysis: Automatically generates candlestick charts that AI models analyze for enhanced pattern recognition and market insights
- Technical Indicators: Comprehensive analysis using RSI, MACD, Bollinger Bands, Supertrend, and many more.
- Multi-Timeframe Analysis: Examines data across multiple timeframes (1h, 2h, 4h, 6h, 8h, 12h, 1d).
- Flexible Timeframe Selection: Analyze markets on your preferred timeframe via Discord commands or config
- Support & Resistance Levels: Identifies key price levels.
- Price Targets: Provides short-term and medium-term price targets
- Sentiment Analysis: Incorporates Fear & Greed index for market sentiment
- Detailed Reports: Generates in-depth HTML reports for comprehensive analysis
- Anti-Spam Protection: Built-in measures to prevent channel spam and abuse
- Context-Aware Analysis: Uses RAG (Retrieval-Augmented Generation) for enhanced market context
- Multi-Language Support: Analyze markets in multiple languages
- Auto-Categorization: Automatically identifies and categorizes crypto assets
- Multi-Exchange Support: Fetches data from multiple exchanges including Binance, KuCoin, Gate.io, MEXC, and Hyperliquid
- Divergence Detection: Identifies bullish and bearish divergences across multiple indicators
- Streaming Analysis: Real-time streaming responses when using local AI models for faster feedback
- Automatic Cleanup: Messages and files automatically expire and are cleaned up after a configurable period
- Fault-Tolerant Design: Multiple AI model fallbacks for continuous operation
- Smart Caching: Optimized data retrieval with minimal API calls
- Educational Resources: Automated linking to indicator explanations and definitions
- Pattern Recognition: Detects common chart patterns like head and shoulders, wedges, etc.
- Market Metrics: Calculates key metrics across various timeframes
- Weekly Macro Trends: Analyzes 200-week SMA for institutional-grade macro trend analysis with cycle phase identification
Installation
Prerequisites
- Python 3.13 or higher
- Discord Bot Token
- OpenRouter API Key or Local LM Studio setup
- CryptoCompare API Key (for market data)
- Google Studio API Key (optional, for Gemini models via official Google GenAI SDK)
Steps
These installation instructions assume you have a local copy of the repository (clone or download). If you're using a fork or mirror, follow the same steps below to create a virtual environment and install dependencies.
-
Clone or download the repository to your local machine (or use your fork).
-
(Recommended) Create a Python virtual environment:
python -m venv .venv
Activate the virtual environment:
- On Windows (PowerShell):
.venv\Scripts\Activate.ps1 - On Windows (cmd):
.venv\Scripts\activate.bat - On macOS/Linux:
source .venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
-
Create configuration files:
- Copy
keys.env.exampletokeys.env - Set your API keys and Discord settings in the
keys.envfile - Adjust other settings in
config/config.inias needed
- Copy
-
Run the bot:
python start.py
Configuration
The configuration is split across two files:
keys.env
Contains sensitive information that should not be committed to version control:
BOT_TOKEN_DISCORD: Your Discord bot tokenOPENROUTER_API_KEY: API key for OpenRouter AI servicesGOOGLE_STUDIO_API_KEY: API key for Google Studio (Gemini) modelsCRYPTOCOMPARE_API_KEY: API key for CryptoCompare dataGUILD_ID_DISCORD: ID of your Discord serverMAIN_CHANNEL_ID: Main channel for bot communicationTEMPORARY_CHANNEL_ID_DISCORD: Channel for temporary file uploads
config/config.ini
Contains non-sensitive configuration that can be safely committed.
Timeframe Configuration
The bot supports flexible timeframe analysis from 1 hour to 1 day:
Supported Timeframes: 1h, 2h, 4h, 6h, 8h, 12h, 1d
Setting Default Timeframe
In config/config.ini:
[general]
timeframe = 1h # Change to 4h, 1d, etc.
This sets the default timeframe used when users don't specify one in their command.
Per-Analysis Timeframe Override
Users can specify timeframe directly in Discord commands:
!analyze BTC/USDT → Uses config default (1h)
!analyze BTC/USDT 4h → Analyzes on 4-hour timeframe
!analyze BTC/USDT 1d → Analyzes on daily timeframe
!analyze BTC/USDT 4h Polish → 4-hour timeframe in Polish
How It Works:
- Dynamic Calculations: All technical indicators, period calculations, and candle progress tracking automatically adapt to the selected timeframe
- Smart Data Fetching: System automatically adjusts candle limits to maintain ~30 days of historical data across all timeframes
- Real-time Flexibility: Users don't need to wait for bot restart to try different timeframes
Choosing Your Timeframe:
- 1h-2h: Short-term trading, high granularity, more frequent signals
- 4h-6h: Swing trading, balanced view, medium-term trends
- 8h-12h: Longer swing positions, reduced noise
- 1d: Position trading, macro trends, most stable signals
How AI Provider Selection Works
Use the provider setting in the [ai_providers] section of config/config.ini to select the AI provider. This section explains the available options and exact runtime behavior.
-
provider(string) — valid values and behavior:"local": Use LM Studio only (local models). LM Studio is the only provider used; streaming is supported when LM Studio is available. If LM Studio fails, the request will fail — there is no automatic fallback."googleai": Use Google AI Studio only (Gemini models). Google is the single provider; no automatic fallbacks to other providers on failure."openrouter": Use OpenRouter only. OpenRouter is the single provider; no automatic fallbacks to other providers on failure."all": Use the fallback chain. In this mode the runtime will try providers in this order until one returns a valid response:- Google AI Studio
- LM Studio (local)
- OpenRouter
When
provideris set to"all", the system preserves the original fallback behavior. For single-provider settings ("local","googleai","openrouter") there is no cross-provider fallback. -
lm_studio_base_url: URL for LM Studio (default: "http://localhost:1234/v1") -
lm_studio_model: Model identifier for LM Studio (default: "local-model") -
OPENROUTER_BASE_URL: Base URL for OpenRouter API (default: "https://openrouter.ai/api/v1") -
OPENROUTER_BASE_MODEL: Default OpenRouter model identifier (e.g. "google/gemini-2.5-flash") -
OPENROUTER_FALLBACK_MODEL: Fallback model identifier for OpenRouter -
GOOGLE_STUDIO_MODEL: Default Google model identifier (e.g. "gemini-2.5-flash") -
TIMEFRAME: Default timeframe for analysis (default: "1h") -
LOG_DIR: Directory for log files (default: "logs") -
LOGGER_DEBUG: Enable debug logging -
ANALYSIS_COOLDOWN_COIN: Time between analyses of the same coin (in seconds) -
ANALYSIS_COOLDOWN_USER: Time between user requests (in seconds) -
RAG_UPDATE_INTERVAL_HOURS: How often to update the RAG (Retrieval-Augmented Generation) system -
SUPPORTED_LANGUAGES: Dictionary of supported languages for analysis output
Usage
Commands
!analyze <symbol> [timeframe] [language]: Analyze a trading pair with optional timeframe and language- Basic:
!analyze BTC/USDT(uses config default timeframe, English) - With timeframe:
!analyze BTC/USDT 4h(4-hour timeframe, English) - With language:
!analyze BTC/USDT Polish(config default timeframe, Polish) - Full:
!analyze BTC/USDT 1d Polish(daily timeframe, Polish)
- Basic:
!cleanup: Force cleanup of expired messages (owner only)!unmute <user>: Unmute a user that was muted for spamming
Supported Timeframes: 1h, 2h, 4h, 6h, 8h, 12h, 1d
Admin: Custom AI Provider & Model Selection
Administrators can override the default AI provider and model for analysis. This is useful for testing different models or using specific providers:
!analyze <symbol> [timeframe] [language] <provider> <model>
Available Providers:
googleai— Google AI Studio (Gemini models)openrouter— OpenRouter (access to 500+ models: GPT, Claude, Gemini, DeepSeek, etc.)local— LM Studio (local models)all— Fallback chain (tries: Google AI → LM Studio → OpenRouter)
Admin Command Examples:
# Use specific Gemini model
!analyze BTC/USDT googleai gemini-2.5-pro
# Use OpenRouter with GPT model
!analyze BTC/USDT openrouter openai
