- Extend regime detection to top 10 cryptocurrencies (45 pairs) - Dynamic pair selection based on divergence score (|z_score| * probability) - Universal ML model trained on all pairs - Correlation-based filtering to avoid redundant positions - Funding rate integration from OKX for all 10 assets - ATR-based dynamic stop-loss and take-profit - Walk-forward training with 70/30 split Performance: +35.69% return (vs +28.66% baseline), 63.6% win rate
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Download historical data for Multi-Pair Divergence Strategy.
|
|
|
|
Downloads 1h OHLCV data for top 10 cryptocurrencies from OKX.
|
|
"""
|
|
import sys
|
|
sys.path.insert(0, '.')
|
|
|
|
from engine.data_manager import DataManager
|
|
from engine.market import MarketType
|
|
from engine.logging_config import setup_logging, get_logger
|
|
from strategies.multi_pair import MultiPairConfig
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
def main():
|
|
"""Download data for all configured assets."""
|
|
setup_logging()
|
|
|
|
config = MultiPairConfig()
|
|
dm = DataManager()
|
|
|
|
logger.info("Downloading data for %d assets...", len(config.assets))
|
|
|
|
for symbol in config.assets:
|
|
logger.info("Downloading %s perpetual 1h data...", symbol)
|
|
try:
|
|
df = dm.download_data(
|
|
exchange_id=config.exchange_id,
|
|
symbol=symbol,
|
|
timeframe=config.timeframe,
|
|
market_type=MarketType.PERPETUAL
|
|
)
|
|
if df is not None:
|
|
logger.info("Downloaded %d candles for %s", len(df), symbol)
|
|
else:
|
|
logger.warning("No data downloaded for %s", symbol)
|
|
except Exception as e:
|
|
logger.error("Failed to download %s: %s", symbol, e)
|
|
|
|
logger.info("Download complete!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|