feat: фиксированный датасет + per-asset K бэктест (BTC=3, ADA=3)
- common/dataset.py: сохранение/загрузка фиксированного датасета для воспроизводимых экспериментов (данные больше не плывут между запусками) - exp18 run.py, run_per_asset_k.py: переведены на load_or_fetch() - exp18b результат: BTC=3+ADA=3 даёт +$23 (+20.4%) при DD -0.6% (Equity $265.45 vs $242.26 uniform K=2) - Применено в продакшн: config.yaml BTC K=3, ADA K=3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import torch
|
||||
from remizov_trader.core import model as model_mod, signals, risk
|
||||
from remizov_trader.config import ModelConfig
|
||||
from common.metrics import compute_metrics, save_results, compare_results, print_metrics
|
||||
from common.dataset import load_or_fetch, ASSETS as DATASET_ASSETS
|
||||
|
||||
TOTAL_CAPITAL = 114.0
|
||||
CORR_THRESH = 0.5
|
||||
@@ -316,21 +317,25 @@ def main():
|
||||
print(f"Capital: ${TOTAL_CAPITAL} | Stop scales: {STOP_SCALES} | K values: {K_VALUES}")
|
||||
print()
|
||||
|
||||
# Fetch data + train models (once, shared across all K variants)
|
||||
# Load fixed dataset + train models
|
||||
dataset = load_or_fetch()
|
||||
asset_data = {}
|
||||
max_k = max(K_VALUES)
|
||||
|
||||
for a in ASSETS:
|
||||
ticker, symbol, tf = a["ticker"], a["symbol"], a["tf"]
|
||||
ticker = a["ticker"]
|
||||
ws, leverage, weight = a["ws"], a["leverage"], a["weight"]
|
||||
tf = a["tf"]
|
||||
|
||||
print(f" {ticker} ({tf}, ws={ws})...", end=" ", flush=True)
|
||||
try:
|
||||
prices, dates = signals.fetch_prices_ccxt(symbol, tf, "max")
|
||||
except Exception as e:
|
||||
print(f"FETCH ERROR: {e}")
|
||||
if ticker not in dataset:
|
||||
print(f" {ticker}: not in dataset")
|
||||
continue
|
||||
if prices is None or len(prices) < ws + max_k + SHIFT + 30:
|
||||
|
||||
ds = dataset[ticker]
|
||||
prices, dates = ds["prices"], ds["dates"]
|
||||
print(f" {ticker} ({tf}, ws={ws})...", end=" ", flush=True)
|
||||
|
||||
if len(prices) < ws + max_k + SHIFT + 30:
|
||||
print("not enough data")
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user