AcyLa's picture
Upload config.py with huggingface_hub
689f895 verified
Raw History Blame Contribute Delete
4.54 kB
"""
High-Volatility Asset Predictive Model Configuration
Covers: Leveraged ETFs, VIX products, crypto miners, biotech, high-beta tech, single-stock futures
Architecture: Nadaraya-Watson + Bollinger + LightGBM/LSTM ensemble
"""
from dataclasses import dataclass, field
from typing import List, Dict
@dataclass
class VolAssetConfig:
# ─── Assets β€” highest volatility instruments on Yahoo Finance ───
# Leveraged ETFs (3x daily leverage β€” extreme volatility)
# VIX products (volatility of volatility)
# Crypto miners (3-5x Bitcoin's volatility)
# Biotech (binary event-driven: FDA approvals, trial results)
# High-beta tech (semiconductors, AI, growth)
tickers: List[str] = field(default_factory=lambda: [
# ── Leveraged ETFs (3x) ──
"TQQQ", # ProShares UltraPro QQQ (3x Nasdaq-100)
"SQQQ", # ProShares UltraPro Short QQQ (-3x Nasdaq-100)
"UPRO", # ProShares UltraPro S&P500 (3x S&P 500)
"SPXU", # ProShares UltraPro Short S&P500 (-3x)
"SOXL", # Direxion Semiconductor Bull 3x
"TNA", # Direxion Small Cap Bull 3x
# ── VIX & Volatility ──
"UVXY", # ProShares Ultra VIX Short-Term Futures (1.5x VIX)
"VIXY", # ProShares VIX Short-Term Futures
# ── Crypto Miners ──
"MSTR", # MicroStrategy (Bitcoin proxy, extreme vol)
"MARA", # Marathon Digital (Bitcoin mining)
"RIOT", # Riot Platforms (Bitcoin mining)
"CLSK", # CleanSpark (Bitcoin mining)
# ── Biotech (binary event-driven) ──
"XBI", # SPDR S&P Biotech ETF (equal-weight, high vol)
# ── High-Beta Tech ──
"NVDA", # NVIDIA (semiconductor/AI leader, high beta)
"AMD", # Advanced Micro Devices
"TSLA", # Tesla (high beta, extreme swings)
"PLTR", # Palantir (high-beta data/AI)
"COIN", # Coinbase (crypto exchange, high vol)
"APP", # AppLovin (high-beta adtech/AI)
])
primary_ticker: str = "TQQQ"
period: str = "max"
interval: str = "1d"
# ─── Nadaraya-Watson ───
nw_bandwidth: float = 8.0
nw_lookback: int = 200
nw_envelope_mult: float = 1.5
# ─── Bollinger Bands ───
bb_windows: List[int] = field(default_factory=lambda: [20, 50, 100])
bb_std_mult: List[float] = field(default_factory=lambda: [2.0, 2.5, 3.0])
# ─── Indicator windows ───
rsi_windows: List[int] = field(default_factory=lambda: [7, 14, 21])
macd_fast: int = 12; macd_slow: int = 26; macd_signal: int = 9
atr_windows: List[int] = field(default_factory=lambda: [14, 21, 50])
stoch_windows: List[int] = field(default_factory=lambda: [14, 21])
ema_windows: List[int] = field(default_factory=lambda: [9, 21, 50, 100, 200])
sma_windows: List[int] = field(default_factory=lambda: [20, 50, 100, 200])
# ─── Labels ───
horizons: List[int] = field(default_factory=lambda: [1, 5, 21])
# 1-day, 1-week, 1-month
classification_threshold: float = 0.04 # 4% move = directional (higher for vol assets)
# ─── Walk-Forward ───
train_window: int = 756 # ~3 years trading days
val_window: int = 126 # ~6 months
test_window: int = 63 # ~3 months
step_size: int = 126 # ~6 months rolling
purge_gap: int = 21 # 1 month purge
# ─── LightGBM ───
lgbm_params: Dict = field(default_factory=lambda: {
"objective": "regression", "metric": "rmse", "boosting_type": "gbdt",
"num_leaves": 127, "learning_rate": 0.01, "feature_fraction": 0.7,
"bagging_fraction": 0.8, "bagging_freq": 5, "verbose": -1,
"min_data_in_leaf": 50, "lambda_l1": 0.1, "lambda_l2": 1.0,
"max_depth": -1, "n_estimators": 300, "early_stopping_rounds": 30,
})
# ─── LSTM ───
lstm_seq_len: int = 60
lstm_hidden_size: int = 128
lstm_num_layers: int = 2
lstm_dropout: float = 0.2
lstm_learning_rate: float = 0.001
lstm_batch_size: int = 64
lstm_epochs: int = 10
lstm_patience: int = 10
# ─── Ensemble ───
ensemble_weights: List[float] = field(default_factory=lambda: [0.6, 0.4])
# ─── Output ───
model_dir: str = "vol_models"
results_dir: str = "vol_results"
cfg = VolAssetConfig()