File size: 4,541 Bytes
689f895 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | """
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()
|