Clairvoyant
Powerful XRP price forecasting using public data. Stacking ensemble (Bi-GRU/LSTM/CNN-LSTM + LightGBM/XGBoost, RidgeR). Fuses market OHLCV (CCXT), news sentiment & top50 whale activity. No API keys or signups. Easy setup. CPU/GPU-ready. Multi-horizon single run forecasting. Backtests + Predictions visuals: plot_charts & in-depth tensorboard dash
Install / Use
/learn @kb-90/ClairvoyantQuality Score
Category
Development & EngineeringSupported Platforms
Tags
README
CLAIRVOYANT v4.0 - XRP PRICE FORECASTER
<p> <img src="/assets/clairvoyant-banner.jpg?text=Clairvoyant+Project+Banner" alt="Clairvoyant Banner"> </p> <p align="center"> <a href="https://www.python.org/" alt="Badge: Python 3.10+"><img src="https://img.shields.io/badge/-3.10%2B-grey?style=flat-square&logo=python&logoColor=white&labelColor=%233776AB"></a> <a href="https://opensource.org/licenses/MIT" alt="License: MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue?style=flat-square"></a> <a href="https://www.tensorflow.org/api_docs/python/tf/keras/layers/Bidirectional" alt="Badge: Bi-GRU"><img src="https://img.shields.io/badge/ML-BiGRU-grey?style=flat-square&labelColor=purple"></a> <a href="https://www.tensorflow.org/api_docs/python/tf/keras/layers/LSTM" alt="Badge: LSTM"><img src="https://img.shields.io/badge/ML-LSTM-grey?style=flat-square&labelColor=magenta"></a> <a href="https://www.tensorflow.org/api_docs/python/tf/keras/layers/ConvLSTM1D" alt="Badge: CNN-LSTM"><img src="https://img.shields.io/badge/ML-CNN--LSTM-grey?style=flat-square&labelColor=red"></a> <a href="https://lightgbm.readthedocs.io/en/latest/" alt="Badge: LightGBM"><img src="https://img.shields.io/badge/ML-LightGBM-grey?style=flat-square&labelColor=yellow"></a> <a href="https://xgboost.readthedocs.io/en/stable/" alt="Badge: XGBoost"><img src="https://img.shields.io/badge/ML-XGBoost-grey?style=flat-square&labelColor=limegreen" /></a> <a href="https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html" alt="Badge: Ridge Regression"><img src="https://img.shields.io/badge/ML-Ridge--Regression-grey?style=flat-square&labelColor=turquiose"></a> <a href="https://en.wikipedia.org/wiki/RSS" alt="Badge: RSS"><img src="https://img.shields.io/badge/RSS-FFA500?style=flat-square&logo=rss&logoColor=white"></a> <a href="httpshttps://github.com/ccxt/ccxt" alt="Badge: CCXT"><img src="https://img.shields.io/badge/-CCXT-black?style=flat-square&logo=x&logoColor=white&labelColor=black"></a> <a href="https://www.tensorflow.org/tensorboard" alt="Badge: TensorBoard"><img src="https://img.shields.io/badge/-TensorBoard-orange?style=flat-square&logo=tensorflow&logoColor=white&labelColor=orange"></a> <a href="https://xrpscan.com/" alt="Badge: XRPScan"><img src="https://img.shields.io/badge/XRPScan-black?style=flat-square&logo=xrp&logoColor=white"></a> <a href="https://www.paypal.com/paypalme/kb90fund" alt="Badge: Fund my dev"><img src="https://img.shields.io/badge/-support_me-blue?style=flat-square&logo=paypal&logoColor=white"></a> </p>Clairvoyant is a sophisticated cryptocurrency price forecaster that synthesizes market data, news sentiment, and dynamic on-chain metrics using a powerful stacking ensemble model.
Version 4.0 introduces significant performance enhancements, including a faster 80/20 train/test split and improved charting functionalities. It builds upon the robust, dynamic on-chain analysis engine from v3.1 that moves beyond static metrics to track the real-time activity of the wealthiest XRP accounts, providing a true insight into market-moving whale behavior.
Table of Contents
- Why Clairvoyant?
- Technology Stack
- Project Architecture
- Key Features
- Getting Started
- Configuration
- Project Structure
- Disclaimer
Why Clairvoyant?
Clairvoyant is designed to be both powerful and exceptionally easy to use. It bridges the gap between complex, institutional-grade forecasting models and the need for a simple, 'plug-and-play' user experience.
-
Zero API Key Hassle: Get started in minutes. Clairvoyant uses public, free-to-use APIs for all its data fetching (market, news, and on-chain). You don't need to sign up for any services, create API keys, or manage credentials.
-
CPU & GPU Compatible: Clairvoyant was built with accessibility in mind and runs efficiently on standard CPU-only machines. While a GPU is not required, users with a compatible NVIDIA GPU and the appropriate TensorFlow build will benefit from significantly faster model training times, allowing for quicker iterations and a more fluid data analysis experience with tools like TensorBoard.
-
All-in-One Powerhouse: While the setup is simple, the engine is not. Clairvoyant is a highly efficient script that packs a multi-model deep learning ensemble, real-time news sentiment analysis, and dynamic on-chain whale tracking into a single, cohesive pipeline.
-
Simple & Centralized Configuration: All user-adjustable settings are located in one place: the
.envfile. Tweak the target crypto, prediction horizons, or training parameters without ever needing to touch the core application logic. -
Transparent & Understandable: The core logic is contained within a single, well-documented Python file. This makes it easy for developers to understand, audit, and extend the model's capabilities.
Technology Stack
- Languages: Python (3.10+)
- Machine Learning: TensorFlow (Keras), Scikit-learn, LightGBM, XGBoost
- Data & Analysis: Pandas, NumPy, TA (Technical Analysis)
- Data Fetching: CCXT (Exchanges), aiohttp (Async Web), feedparser (RSS)
- NLP & Sentiment: NLTK, Afinn
Project Architecture
The Clairvoyant architecture is built on three core data pillars that feed into a sophisticated stacking ensemble model.
<p align="center"> <em>Data Pillars → Feature Engineering → Stacking Ensemble → Prediction</em> </p>-
Market Data Pillar: Fetches thousands of historical OHLCV (Open, High, Low, Close, Volume) data points from Binance via the
ccxtlibrary to build a baseline of price action. -
Sentiment Data Pillar: Scrapes and analyzes news articles from over 14 financial RSS feeds. Using a custom crypto-specific lexicon, it generates a sentiment score that gauges the mood of the market.
-
On-Chain Data Pillar (Dynamic): This is a key innovation introduced in v3.1 and has been optimized thoroughly since then. The system dynamically identifies the top 50 "whale" accounts by querying the
xrpscan.comAPI. It then analyzes the last 12 hours of transactions for these accounts to detect significant market pressure from major players.
These three data sources are processed into a rich feature set and fed into a two-layer stacking ensemble:
- Base Models: A diverse set of five models (Bi-GRU, Bi-LSTM, CNN-LSTM, LightGBM, XGBoost) that capture different types of patterns in the data.
- Meta-Model: A
Ridgeregressor that intelligently combines the predictions from the base models into a single, more accurate, and robust final forecast.
Key Features
- Dynamic On-Chain Analysis: Moves beyond static metrics by identifying and tracking the activity of the top 50 XRP accounts in real-time.
- Stacking Ensemble Model: Combines deep learning (for temporal patterns) and gradient-boosted trees (for non-linear relationships) for state-of-the-art prediction accuracy.
- Real-Time News Sentiment: Integrates sentiment from over a dozen financial news sources using a crypto-specific lexicon for enhanced context.
- Adaptive Confidence Intervals: Instead of a single price target, Clairvoyant provides a statistically-driven price range to express the uncertainty of its forecast. This range is dynamic, adapting to market conditions:
- In stable periods, the confidence interval may be as tight as ±2%, providing an actionable range for setting precise trading targets.
- In volatile or uncertain conditions, the interval will widen (e.g., towards ±5% or more), signaling a higher margin of error and advising a more cautious approach. This adaptive range is more reliable than a single point prediction and serves as a built-in risk indicator.
- Multi-Horizon Forecasting: Trains specialized models to predict prices for various time horizons.
- Automated Pipeline: Fully automated process from data fetching and feature engineering to training and prediction.
Getting Started
Follow these steps to get Clairvoyant running on your local machine.
[!NOTE] Python 3.10 or higher is recommended.
-
Clone the Repository
git clone https://github.com/your-username/clairvoyant.git cd clairvoyant -
Install Dependencies
pip install -r requirements.txt -
Configure the script All user-adjustable parameters are located in the
.envfile. Open this file and modify the values to tune the model's behavior before running. -
Run the Script Execute the main script from your terminal:
python clairvoyant.pyThe script will handle data fetching, training, and prediction automatically. Results, models, and logs will be saved in their respective directories (
/predictions,/models,/logs).
Configuration
All configuration is handled in the .env file. Here is a description of the available parameters:
| Parameter | Description | Default | Recommendation / Notes ----------------------------------------------- |
| -------------------------- | --------------------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------- |
| TICKER | The cryptocurrency pair to trade (as recognized by Binance). | XRP/USDT | Any valid ccxt pair (e.g., BTC/USDT, ETH/USDT). ----------------- |
| TIMEFRAME | The candle timeframe for the data. | 1h | Standard ccxt timeframes (e.g., 15m, 1h (recommended), 1d)----- |
| DATA_LIMIT | The number of historical data points (c
