- pump-and-dump detector + bullish stock predictor**
Real time anomaly detection, social sentiment analysis, and AI powered trading signals
CrashGuard AI is an enterprise grade market surveillance platform designed to detect fraudulent trading patterns, identify pump-and-dump schemes, and provide AI powered buy/sell recommendations based on:
- π Technical Analysis: Candlestick patterns, moving averages, volume anomalies, volatility metrics
- π± Social Sentiment: Real time X (Twitter) feeds, Reddit discussions, sentiment scoring
- π Anomaly Detection: ML powered Isolation Forest algorithm detecting unusual price/volume behavior
β οΈ Crash Detection: Historical analysis flagging stocks that crashed >70% with visual warnings- π‘ AI Signals: Composite scoring engine combining technical + social + momentum indicators
- π Backtesting: Historical strategy validation with Sharpe ratio, max drawdown, win rate metrics
Target Use Case: Retail traders, risk managers, and institutional investors who need to identify market manipulation before it happens.
- Live Price Monitoring: Current price, 52 week high/low, market cap, volume ratios
- Stock Search: Search any publicly traded symbol with instant data retrieval
- Professional Dashboard: Dark-themed UI with cyan accents and metric cards
- Historical Crash Warnings: Flags stocks that lost >70% of value with peak/trough analysis
- Real time Anomalies: Detects unusual price jumps (>10%), volume spikes (>3x), gaps (>5%), volatility shifts
- Visual Highlighting: Annotated candlestick charts showing crash periods, peaks, and anomaly points
- Severity Scoring: Risk stratification (HIGH/MEDIUM/LOW alerts)
- X/Twitter Integration: Connects to 8 target accounts (@unusual_whales, @deltaone, @StockMKTNewz, etc.)
- Reddit Monitoring: 9 target communities (r/wallstreetbets, r/pennystocks, r/stocks, etc.)
- Sentiment Scoring: VADER based compound sentiment (-1 to +1) on all posts
- Hype Metrics: Mention volume, engagement rate, author diversity, positive bias tracking
- Composite Scoring: BUY/HOLD/SELL recommendations with confidence % (0-100%)
- Bullish Candidates: Ranks stocks by: hype (35%) + sentiment (25%) + momentum (15%) + price (15%) + volume (10%)
- Backtesting Engine: Test strategies on historical data; calculate returns, Sharpe ratio, max drawdown, win rate
- Moving Averages: 20-day, 50-day, 200-day tracking
- Volatility Analysis: Daily standard deviation, Bollinger Bands
- Volume Ratios: Current vs 20-day average; spike detection
- Correlation Analysis: Social sentiment vs price movement correlation
| Component | Technology | Purpose |
|---|---|---|
| Frontend | Streamlit 1.52.2 | Web dashboard UI |
| Data Collection | yfinance 1.0 | Stock price & company data |
| Social APIs | Tweepy 4.14, PRAW (pending) | X/Twitter & Reddit feeds |
| ML/Analytics | scikit learn 1.8, pandas 2.3 | Anomaly detection, predictions |
| Visualization | Plotly 6.5 | Interactive candlestick charts |
| Sentiment | VADER (nltk 3.8) | Social post sentiment analysis |
| Database | SQLite | Historical data persistence |
| Environment | Python 3.10+ | Runtime |
- Python 3.10+
- pip (Python package manager)
- Git
# Clone repository
git clone https://github.com/munadirkhan/CrashGuard-AI.git
cd CrashGuard-AI
# Create virtual environment
python -m venv .venv
# Activate virtual environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
# Install dependencies
pip install -r Setup&Testing/requirements.txtCreate a .env file in the root directory:
# Required: X/Twitter API (get from https://developer.twitter.com/)
TWITTER_BEARER_TOKEN=your_bearer_token_here
# Optional: Reddit API (get from https://www.reddit.com/prefs/apps)
REDDIT_CLIENT_ID=your_client_id_here
REDDIT_CLIENT_SECRET=your_client_secret_here
REDDIT_USER_AGENT=CrashGuardAI/0.9
# Optional: NewsAPI (get from https://newsapi.org/)
NEWS_API_KEY=your_api_key_hereObtaining API Credentials:
- X/Twitter: Developer Portal - Create an app, generate Bearer Token
- Reddit: App Registration - Create "script" app, use client ID/secret
- NewsAPI: NewsAPI Dashboard - Free tier available
cd "Main Components"
python -m streamlit run app.pyDashboard will open at: http://localhost:8505
1. Detect if a Stock Crashed
Search β "OST" or "PHH" β π΄ CRASH BANNER appears with 70%+ warning
2. Check Real Time Social Sentiment
Tab: "Social Feed" β See latest X posts from monitored accounts + sentiment
3. Get Buy/Sell Signal
Right panel: "π― AI Recommendation" β BUY/HOLD/SELL with confidence score
4. Analyze Technical Setup
Chart: Candlestick + moving averages β Spot trends, anomalies, volume spikes
CrashGuard-AI/
βββ Main Components/
β βββ app.py # π― Main Streamlit dashboard (PRODUCTION)
β βββ data_fetcher.py # Yahoo Finance data collection
β βββ anomaly_detector.py # ML-based anomaly detection (Isolation Forest)
β βββ sentiment_analyzer.py # NewsAPI sentiment analysis
β βββ social_data_fetcher.py # X/Twitter & Reddit data fetching
β βββ target_sources.py # Target X accounts & Reddit communities
β βββ hype_analyzer.py # Social hype score calculation
β βββ correlation_engine.py # Price-to-sentiment correlation & signals
β βββ backtest_engine.py # Historical strategy backtesting
βββ Setup&Testing/
β βββ requirements.txt # All dependencies
β βββ setup_local.py # Local setup script
β βββ test_system.py # Validation tests
βββ Documentation/
β βββ README.md # (This file)
β βββ deploy.md # Deployment guide (Streamlit Cloud)
βββ .env # API credentials (DO NOT COMMIT)
βββ .gitignore # Exclude sensitive files
βββ setup.py # Package configuration
Detects suspicious trading patterns using:
- Rule based checks: Price jumps >10%, volume >3x, gaps >5%, volatility spikes
- ML (Isolation Forest): Unsupervised learning on normalized OHLCV features
- Output: Severity score (0-100), alert type (pump/dump/volatility), date
Real time social signal collection:
- X/Twitter v2 API: Searches tweets from 8 target accounts using symbol filters
- Reddit PRAW: Searches 9 target subreddits for discussions
- Sentiment: VADER analysis on each post (-1 to +1 compound score)
- Fallback: Auto generates realistic mock data if APIs unavailable
Quantifies social media momentum:
- Formula: (post_volume Γ 0.1) + (sentiment Γ 0.1) + (engagement Γ 0.1) + (author_diversity Γ 0.1) + (time_concentration Γ 0.02) + (positive_bias Γ 0.03)
- Output: 0-100 hype score; alerts if >60 (suspicious spike)
Bridges social signals β price predictions:
- Correlation: Computes R-squared between hype trends and price momentum
- ML Prediction: Linear/Random Forest regression predicts 2-day price move
- Signals: STRONG/MODERATE/WEAK based on predictive score + social metrics
- Ranking: Scores stocks for buy/hold/sell based on composite metrics
Historical pattern recognition:
- Peak Finding: Identifies all-time high from available data
- Drawdown: Calculates % loss from peak to lowest point
- Alert: Flags if max drawdown >70% with visual markers on chart
- Context: Shows peak date, crash date, severity
User Input (Stock Symbol)
β
yfinance Data Fetch (OHLCV + Company Info)
β
βββ Anomaly Detection (ML + Rules)
βββ Crash Detection (Historical Analysis)
βββ Social Data Fetch (X/Reddit APIs)
β βββ VADER Sentiment Analysis
β βββ Hype Score Calculation
βββ Technical Indicators (MAs, Volatility)
β
Correlation Engine
βββ Price-Sentiment Correlation
βββ ML Price Prediction
βββ Trading Signal Generation
β
AI Recommendation Engine
βββ Composite Score (40% sentiment + 30% anomaly + 30% momentum)
βββ BUY/HOLD/SELL with % confidence
β
Visualization (Streamlit Dashboard)
βββ Candlestick Chart (with anomalies, crash zones)
βββ Metrics Cards (price, volatility, volume ratio)
βββ Social Feed (latest X/Reddit posts)
βββ Risk Alerts (crash warnings, volume spikes)
βββ Backtest Results (historical performance)
- Professional dark-themed dashboard UI
- Real-time stock data integration (yfinance)
- Candlestick charting with volume overlay
- Anomaly detection (ML + rule-based)
- Crash detection for >70% drops
- X/Twitter v2 API integration (8 target accounts)
- Social sentiment analysis (VADER)
- Hype score calculation
- AI recommendation engine (BUY/HOLD/SELL)
- Backtesting framework
- SQLite data persistence
- Environment variable management
- Reddit API full integration (awaiting user approval)
- Real Reddit data collection from 9 target subreddits
- Email/SMS alert system (UI ready, backend pending)
- Portfolio tracker persistence (session β SQLite)
- Advanced technical indicators (RSI, MACD, Bollinger Bands)
- News sentiment integration (NewsAPI)
- Mobile-responsive UI improvements
- Perplexity AI integration (market narrative analysis)
- Discord bot for alerts
- Telegram bot integration
- Options data & Greeks analysis
- Institutional fund tracking
- Custom watchlist management (persistent storage)
- Historical trade logging & performance tracking
- Machine learning model fine-tuning (user feedback loop)
- v0.9 (Current): MVP with core anomaly detection + social signals
- v1.0 (Late January): Full Reddit integration + email alerts + backtesting validation
- v1.1+ (February+): AI chat, advanced ML models, deployment to Streamlit Cloud
| API | Rate Limit | Free Tier | Status |
|---|---|---|---|
| yfinance | ~2000/day | β Unlimited | β Working |
| X v2 API | 450/15min | β Included | β Connected |
| Reddit PRAW | 60/min | β Unlimited | β³ Awaiting setup |
| NewsAPI | 100/day | β Free tier |
Note: All APIs have auto-fallback to mock data if unavailableβdashboard never breaks.
cd Setup&Testing
python test_system.py# Install in editable mode
pip install -e .
# Run with debug logging
streamlit run app.py --logger.level=debug- Modular Design: Each analyzer is independent; easy to swap/extend
- Caching: yfinance data cached for 5 min; reduces API calls
- Error Handling: Graceful degradation with mock data fallback
- Type Hints: Python 3.10+ with type annotations for clarity
# 1. Push to GitHub (done β
)
# 2. Connect GitHub repo to Streamlit Cloud
# 3. Add secrets in Streamlit dashboard:
# TWITTER_BEARER_TOKEN=...
# REDDIT_CLIENT_ID=...
# REDDIT_CLIENT_SECRET=...
# 4. Deploy at: https://crashguard-ai.streamlit.appSee deploy.md for detailed instructions.
- GitHub Issues: Create an issue
- Email: rdetonate@gmail.com
- Status: Active Developmentβexpect frequent updates & improvements
- yfinance: Yahoo Finance data fetching
- Streamlit: Rapid web app development
- Plotly: Interactive charting
- scikit-learn: Machine learning algorithms
- VADER: Sentiment analysis
- X API & Reddit PRAW: Social data access
| Metric | 7-Day | 30-Day | 90-Day |
|---|---|---|---|
| Win Rate | 65% | 58% | 62% |
| Total Return | +3.2% | +7.8% | +11.5% |
| Max Drawdown | -2.1% | -4.3% | -5.8% |
| Sharpe Ratio | 1.2 | 1.5 | 1.8 |
| Trades Generated | 3 | 12 | 28 |
Note: Backtested on historical data with simulated social metrics. Past performance β future results.
CrashGuard AI is for educational and research purposes only. It is NOT financial advice. Always conduct your own due diligence before trading. The creators are not responsible for financial losses. Use at your own risk.
Made by Munadir Khan
Active Development 2026 | Demo Coming Soonβ’