WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

A TypeScript implementation of the Solana price prediction model with enhanced stacking, walk-forward validation, and hybrid windows.

Notifications You must be signed in to change notification settings

CryptomSol/solana_price_predictor

Repository files navigation

Solana Price Prediction - TypeScript Version

A TypeScript implementation of the Solana price prediction model with enhanced stacking, walk-forward validation, and hybrid windows.

Features

  • Enhanced Stacking Method: Combines multiple base models with a neural network meta-learner
  • Walk-Forward Validation: Tests models on multiple time periods without data leakage
  • Automatic Feature Engineering: Creates technical indicators, lagged features, and financial metrics
  • Hybrid Windows: Rolling window (short-term) + Expanding window (long-term patterns)
  • TEMPO-Based Improvements (NEW):
    • STL Decomposition: Separates time series into Trend, Seasonal, and Residual components
    • Component-Specific Models: Separate models for each component with additive combination
    • Soft Prompts: Learnable prompts for component-specific guidance
    • Time Series Patching: Efficient patch-based processing
  • Modular Architecture: Clean separation of concerns

Project Structure

meth/
├── src/
│   ├── data/
│   │   └── DataLoader.ts          # Data loading and preprocessing
│   ├── features/
│   │   └── FeatureEngineer.ts     # Automatic feature engineering
│   ├── models/
│   │   ├── BaseModel.ts           # Base model interface and implementations
│   │   └── EnsembleStacker.ts    # Enhanced stacking ensemble
│   ├── validation/
│   │   └── WalkForwardValidator.ts # Walk-forward validation
│   ├── training/
│   │   └── Trainer.ts             # Main training module
│   ├── utils/
│   │   └── RollingWindow.ts       # Rolling window utilities
│   └── scripts/
│       ├── train.ts               # Training script
│       └── predict.ts             # Prediction script
├── package.json
├── tsconfig.json
├── merged_dataset.csv             # Required data file
└── README.md

Installation

npm install
npm run build

Quick Start

  1. Install dependencies:

    npm install
    npm run build
  2. Train the model:

    # Standard training
    npm run train
    
    # Enhanced training (recommended)
    npm run train -- --enhanced
    
    # Return-based (best for volatile crypto)
    npm run train -- --enhanced --returns
  3. View results:

    • Check console output for metrics
    • Open validation_results.html for visualizations

📖 See USER_GUIDE.md for complete step-by-step guide!

Usage

Training Options

Standard Training (Original Method):

npm run train
  • Uses ensemble of Neural Network + Linear Regression
  • Walk-forward validation
  • Good baseline for comparison

Enhanced Training (TEMPO-based):

npm run train -- --enhanced
  • STL decomposition (Trend, Seasonal, Residual)
  • Historical decomposition patterns as features
  • More sophisticated feature engineering

Return-Based Training (Recommended for Crypto):

npm run train -- --enhanced --returns
  • Predicts returns (percentage change) instead of prices
  • More stable for volatile assets
  • Often more accurate: predicted_price = current_price * (1 + predicted_return)

See TEMPO_IMPROVEMENTS.md for technical details.

Making Predictions

npm run predict
# or
node dist/scripts/predict.js

Architecture

Enhanced Stacking Method

The stacking ensemble uses:

  • Base Models: Multiple models trained on different windows (rolling + expanding)
  • Meta-Learner: Neural network that learns to combine base model predictions
  • Out-of-Fold Predictions: Prevents overfitting by using validation set predictions

Walk-Forward Validation

  • Tests models on multiple time periods
  • No data leakage (future data never used for training)
  • Provides realistic performance estimates

Hybrid Windows

  • Rolling Window: Last N days (captures short-term trends)
  • Expanding Window: All historical data (captures long-term patterns)
  • Both windows are used to train separate models, then combined via stacking

Automatic Feature Engineering

Creates:

  • Technical indicators (RSI, MACD, Bollinger Bands)
  • Volatility and Sharpe ratio
  • Moving averages
  • Lagged features
  • Momentum indicators
  • Cross-asset ratios

Model Types

  • Neural Network: Deep learning model with dropout and regularization
  • Linear Regression: Simple but effective baseline model

Configuration

Edit src/scripts/train.ts to adjust training parameters:

  • rollingWindow: Size of rolling window (default: 365 days)
  • stepSize: Step size for walk-forward validation (default: 30 days)
  • minTrainSize: Minimum training set size (default: 180 days)
  • testSize: Percentage of data for testing (default: 0.2)

Notes

This is a TypeScript implementation that demonstrates the architecture. For production use, you may want to:

  • Add model serialization/deserialization
  • Implement more sophisticated base models
  • Add hyperparameter tuning
  • Implement real-time prediction API
  • Add comprehensive error handling

License

MIT

About

A TypeScript implementation of the Solana price prediction model with enhanced stacking, walk-forward validation, and hybrid windows.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •