initial: import DOLPHIN baseline 2026-04-21 from dolphinng5_predict working tree
Includes core prod + GREEN/BLUE subsystems: - prod/ (BLUE harness, configs, scripts, docs) - nautilus_dolphin/ (GREEN Nautilus-native impl + dvae/ preserved) - adaptive_exit/ (AEM engine + models/bucket_assignments.pkl) - Observability/ (EsoF advisor, TUI, dashboards) - external_factors/ (EsoF producer) - mc_forewarning_qlabs_fork/ (MC regime/envelope) Excludes runtime caches, logs, backups, and reproducible artifacts per .gitignore.
This commit is contained in:
67
nautilus_dolphin/test_mini_5y.py
Executable file
67
nautilus_dolphin/test_mini_5y.py
Executable file
@@ -0,0 +1,67 @@
|
||||
"""Mini 5Y test - first 10 dates only"""
|
||||
import sys, time
|
||||
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
||||
print('MINI 5Y BACKTEST (first 10 dates only)')
|
||||
print('='*50)
|
||||
|
||||
t0 = time.time()
|
||||
from pathlib import Path
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from nautilus_dolphin.nautilus.esf_alpha_orchestrator import NDAlphaEngine
|
||||
from nautilus_dolphin.nautilus.adaptive_circuit_breaker import AdaptiveCircuitBreaker
|
||||
|
||||
VBT_DIR = Path(r"C:\Users\Lenovo\Documents\- DOLPHIN NG HD HCM TSF Predict\vbt_cache_klines")
|
||||
META_COLS = {'timestamp', 'scan_number', 'v50_lambda_max_velocity', 'v150_lambda_max_velocity',
|
||||
'v300_lambda_max_velocity', 'v750_lambda_max_velocity', 'vel_div',
|
||||
'instability_50', 'instability_150'}
|
||||
|
||||
parquet_files = sorted(VBT_DIR.glob("*.parquet"))[:10] # Only 10 files
|
||||
print(f'Processing {len(parquet_files)} files...')
|
||||
|
||||
# ACB
|
||||
acb = AdaptiveCircuitBreaker()
|
||||
date_strings = [pf.stem for pf in parquet_files]
|
||||
acb.preload_w750(date_strings)
|
||||
print(f'ACB w750 threshold: {acb._w750_threshold:.6f}')
|
||||
|
||||
# Engine
|
||||
engine = NDAlphaEngine(
|
||||
initial_capital=25000.0, vel_div_threshold=-0.02, vel_div_extreme=-0.05,
|
||||
min_leverage=0.5, max_leverage=5.0, leverage_convexity=3.0,
|
||||
fraction=0.20, fixed_tp_pct=0.0095, stop_pct=1.0, max_hold_bars=120,
|
||||
use_direction_confirm=True, dc_lookback_bars=7, dc_min_magnitude_bps=0.75,
|
||||
dc_skip_contradicts=True, dc_leverage_boost=1.0, dc_leverage_reduce=0.5,
|
||||
use_asset_selection=True, min_irp_alignment=0.45,
|
||||
use_sp_fees=True, use_sp_slippage=True,
|
||||
sp_maker_entry_rate=0.62, sp_maker_exit_rate=0.50,
|
||||
use_ob_edge=True, ob_edge_bps=5.0, ob_confirm_rate=0.40,
|
||||
lookback=100, use_alpha_layers=True, use_dynamic_leverage=True, seed=42,
|
||||
)
|
||||
engine.set_acb(acb)
|
||||
engine.set_esoteric_hazard_multiplier(0.0)
|
||||
|
||||
# Process
|
||||
for i, pf in enumerate(parquet_files):
|
||||
ds = pf.stem
|
||||
df = pd.read_parquet(pf)
|
||||
acols = [c for c in df.columns if c not in META_COLS]
|
||||
|
||||
# Compute vol regime
|
||||
bp = df['BTCUSDT'].values if 'BTCUSDT' in df.columns else None
|
||||
dvol = np.full(len(df), np.nan)
|
||||
if bp is not None:
|
||||
for j in range(50, len(bp)):
|
||||
seg = bp[max(0,j-50):j]
|
||||
if len(seg)<10: continue
|
||||
dvol[j] = float(np.std(np.diff(seg)/seg[:-1]))
|
||||
vol_p60 = 0.001 # Fixed for mini test
|
||||
vol_ok = np.where(np.isfinite(dvol), dvol > vol_p60, False)
|
||||
|
||||
stats = engine.process_day(ds, df, acols, vol_regime_ok=vol_ok)
|
||||
print(f" [{i+1}] {ds}: trades={stats['trades']} P&L=${stats['pnl']:+.0f} cap=${engine.capital:,.0f}")
|
||||
|
||||
print('='*50)
|
||||
print(f'DONE in {time.time()-t0:.1f}s')
|
||||
print(f'Final capital: ${engine.capital:,.2f}')
|
||||
print(f'Total trades: {len(engine.trade_history)}')
|
||||
Reference in New Issue
Block a user