Overview
CryptoView Pro is a sophisticated cryptocurrency forecasting system built with a modular architecture that combines real-time data collection, technical analysis, machine learning predictions, and user notifications. The system is designed to provide accurate short-term and long-term price predictions using hybrid ML models.System Components
The application is organized into several key modules:Data Layer
Handles data collection from cryptocurrency exchanges using CCXT
ML Layer
Three specialized models: XGBoost, Prophet, and Hybrid
Analysis Layer
Technical indicators (RSI, MACD, Bollinger Bands, EMAs)
Presentation Layer
Streamlit-based interactive dashboard
Architecture Diagram
Core Components
1. Data Collection Layer
Location:data/collectors.py
The CryptoDataCollector class manages all data retrieval operations:
- Supports multiple exchanges via CCXT (default: Kraken)
- Built-in caching with configurable TTL (60 seconds)
- Automatic rate limiting
- Error handling and retry logic
- Calculates returns and log returns automatically
- User selects cryptocurrency and timeframe in sidebar
CryptoDataCollector.fetch_ohlcv()queries exchange API- Raw OHLCV data is cached in Streamlit session
- Data is enriched with calculated returns
- DataFrame is passed to technical indicators layer
2. Technical Analysis Layer
Location:utils/indicators.py
The TechnicalIndicators class provides comprehensive technical analysis:
- RSI Signals: Overbought (>70), Oversold (<30)
- MACD Signals: Bullish (MACD > Signal), Bearish (MACD < Signal)
- Overall Signal: Aggregates multiple indicators for buy/sell/neutral
3. Machine Learning Layer
Location:models/
Three specialized predictive models work together:
- XGBoost
- Prophet
- Hybrid
Best for: 1-72 hours (short-term trading)
- Gradient boosted decision trees
- 60+ engineered features
- Fast training and inference
- High accuracy for intraday predictions
4. Visualization Layer
Location:app.py (chart functions)
Three main chart types are generated:
Main Price Chart
Candlestick chart with volume subplot
- OHLCV candlesticks
- EMA overlays (50, 200)
- Bollinger Bands
- Volume bars with direction coloring
- Time range selectors (24H, 2D, 7D, All)
Prediction Chart
Historical data with future forecasts
- Last 336 hours of historical context
- Predicted price line with confidence intervals
- “Now” marker showing current time/price
- Model comparison mode (optional)
5. Alert System
Location:utils/alerts.py, utils/telegram_notifier.py
Multi-channel alerting system:
- User creates alert with condition/threshold
- Alert stored in
st.session_state.alerts - Background check evaluates conditions
- If triggered, notification sent via Telegram
- Alert displayed in dashboard
Data Flow
Complete Request Cycle
Session State Management
The application maintains state across interactions:Configuration System
Location:config/settings.py
Centralized configuration using environment variables:
API Configuration
API Configuration
Cryptocurrency Settings
Cryptocurrency Settings
Model Parameters
Model Parameters
Technical Indicators
Technical Indicators
Performance Optimizations
Caching
Streamlit’s
@st.cache_data decorator caches:- Exchange API calls (60s TTL)
- Technical indicator calculations
- Model predictions
Lazy Loading
Models are loaded only when needed:
- XGBoost imported conditionally
- Prophet imported conditionally
- Fallback to available models
Vectorization
NumPy/Pandas operations:
- Vectorized indicator calculations
- Batch predictions
- Efficient data transformations
Session Persistence
Models persist in session:
- Train once, predict many times
- Reuse scalers and feature sets
- Avoid redundant computations
Error Handling
Robust error handling at every layer:Security Considerations
The system uses read-only API access for data collection. No trading operations are performed.
Scalability
The architecture supports scaling in several dimensions:- Horizontal: Multiple instances can run independently
- Data Sources: Easy to add new exchanges via CCXT
- Models: New ML models can be integrated with minimal changes
- Cryptos: Simply add symbols to
AVAILABLE_CRYPTOSlist - Indicators: Extend
TechnicalIndicatorsclass with new calculations
Next Steps
ML Models
Dive deep into XGBoost, Prophet, and Hybrid model architectures
Technical Indicators
Learn about RSI, MACD, Bollinger Bands, and signal generation