Skip to main content

ATR-adaptive Laguerre RSI for non-anticipative feature engineering in seq-2-seq forecasting

Project description

ATR-Adaptive Laguerre RSI

Non-anticipative volatility-adaptive momentum indicator for sequence-to-sequence forecasting.

Overview

This library implements the ATR-Adaptive Laguerre RSI indicator, designed for robust feature engineering in financial time series forecasting. The indicator combines:

  • True Range (TR) - Volatility measurement including gaps
  • ATR with Min/Max Tracking - Rolling volatility envelope
  • Adaptive Coefficient - Volatility-normalized adaptation
  • Laguerre 4-Stage Cascade - Low-lag smoothing filter
  • Laguerre RSI - Momentum from filter stage differences

Key Features

  • Non-anticipative: Guaranteed no lookahead bias
  • O(1) Incremental: Efficient streaming updates with .update() method
  • Multi-interval: Supports 1s-1d timeframes with 79-feature extraction (121 without filtering)
  • Redundancy filtering: Optional 121→79 feature reduction (|ρ| > 0.9 removed)
  • Flexible datetime: Works with DatetimeIndex, 'date' column, or custom column names
  • Validated: Information coefficient > 0.03 on k-step-ahead returns

Installation

uv add atr-adaptive-laguerre

Quick Start

Basic Usage (Single RSI Value)

from atr_adaptive_laguerre import ATRAdaptiveLaguerreRSI, ATRAdaptiveLaguerreRSIConfig
import pandas as pd

# Create indicator with flexible datetime support
config = ATRAdaptiveLaguerreRSIConfig(
    atr_period=14,
    smoothing_period=5,
    date_column='date'  # Or use DatetimeIndex
)
indicator = ATRAdaptiveLaguerreRSI(config)

# Batch processing
rsi_series = indicator.fit_transform(df)  # Returns pd.Series

# Incremental updates (O(1) streaming)
new_row = {'open': 100, 'high': 101, 'low': 99, 'close': 100.5, 'volume': 1000}
new_rsi = indicator.update(new_row)  # Returns float

Multi-Interval Feature Extraction (79 Features by Default)

# Extract features across 3 intervals (5m, 15m, 1h example)
# Default: Redundancy filtering enabled (79 features)
config = ATRAdaptiveLaguerreRSIConfig.multi_interval(
    multiplier_1=3,   # 15m features (5m × 3)
    multiplier_2=12   # 1h features (5m × 12)
)
feature = ATRAdaptiveLaguerreRSI(config)

# Returns DataFrame with 79 columns (42 redundant features removed):
# - Base, mult1, mult2 interval features (reduced from 81 to 47)
# - Cross-interval interactions (reduced from 40 to 32)
features_df = feature.fit_transform_features(df)

# Check minimum required data
print(f"Need {feature.min_lookback_base_interval} bars for multi-interval")

# To get all 121 features (no filtering):
config_unfiltered = ATRAdaptiveLaguerreRSIConfig.multi_interval(
    multiplier_1=3,
    multiplier_2=12,
    filter_redundancy=False  # Disable redundancy filtering
)

Disabling Redundancy Filtering (79 → 121 Features)

# Disable redundancy filtering to get all 121 features
config = ATRAdaptiveLaguerreRSIConfig.multi_interval(
    multiplier_1=4,
    multiplier_2=12,
    filter_redundancy=False  # Get all 121 features
)
feature = ATRAdaptiveLaguerreRSI(config)

# Returns DataFrame with 121 columns (all features, including 42 redundant ones)
features_df = feature.fit_transform_features(df)

# Verify feature count
print(f"Features: {feature.n_features}")  # 121 (79 by default)

# Redundancy filtering (enabled by default):
# - Data: 3 years of 2h OHLCV (BTCUSDT, ETHUSDT, SOLUSDT)
# - Threshold: |ρ| > 0.9 (perfect correlations and near-redundant features)
# - Removes: Base RSI values, redundant distance metrics, duplicate regime features
# - Retains: Rate-of-change, cross-interval, and temporal features
# - IC validation: +45.54% improvement (PASSED)

Documentation

License

MIT License - Eon Labs Ltd.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atr_adaptive_laguerre-1.0.2.tar.gz (252.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atr_adaptive_laguerre-1.0.2-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

Details for the file atr_adaptive_laguerre-1.0.2.tar.gz.

File metadata

File hashes

Hashes for atr_adaptive_laguerre-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3a6145108e80eea11cdb75399c8e4d03ea7d4d20c3845fd36893b7db4543aa7a
MD5 e7a34c107422cf962931efd5f8f2cd53
BLAKE2b-256 10a437aa9367ec38162a53b9253fddde6de148f4e56cb212a6d0931eb10d2a07

See more details on using hashes here.

File details

Details for the file atr_adaptive_laguerre-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for atr_adaptive_laguerre-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d5cfaf0309144049f8307851aafd571371046d9667f0529c7455013d8c391999
MD5 9494657c8d908b343a8a120dd0d56fca
BLAKE2b-256 e898dc766777a2aa2c0e9e300e07dbe8ce138bfd15411f0220f96dae6c37ca68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page