# DOLPHIN NAUTILUS NATIVE INTEGRATION LOG & FIXES **Date:** 2026-03-27 / 2026-03-28 **Component:** `DolphinActor` | `NDAlphaEngine` | `Nautilus BacktestEngine` **Objective:** Stabilizing the execution layer, fixing NaN errors, correcting P&L / Capital tracking, and deploying a 100% compliant Native Framework for live-execution certification. --- ## 1. Resolved Critical Bugs in Execution Flow ### Bug A: The Static $25k Capital Reset **Symptom:** The backtest's daily `final_capital` successfully rolled forward in the outer loop, but immediately reverted to exactly `$25,000` at the start of every day. **Root Cause:** In `on_start()`, the Actor aggressively queried the Nautilus account balance. Since orders were previously synthetic (off-ledger), the Nautilus balance was always $25,000, which then overrode the engine's shadow-book. **Fix:** Removed the Portfolio Override block. Capital is now driven by `actor_cfg` injection per day, allowing P&L to accumulate in the engine correctly. ### Bug B: NaN Propagation and Execution Rejection **Symptom:** Nautilus crashed with `invalid value, was nan`. **Root Cause:** `_try_entry()` output was missing `entry_price`. When the Actor tried to size the order using a null price, it resulted in division-by-zero (`inf/nan`). **Fix:** 1. `esf_alpha_orchestrator.py` now explicitly pushes `entry_price`. 2. `dolphin_actor.py` uses the engine's price as a fallback. 3. Added `math.isfinite()` guards to skip corrupt quotes. --- ## 2. Advanced Native Certification Layer ### **Phase 1: Native Frame Translation** 1. **Instrument Factory**: Converts all parquet columns into `CurrencyPair` instances. 2. **Dense Tick Injection**: Converts 5-second rows into strong-typed Nautilus `Bar` objects. 3. **Nautilus P&L Authority**: Real orders are pushed to the Rust `DataEngine`. ### **Phase 2: Continuous Single-State Execution** **Problem:** Daily loops caused "Daily Warmup Amnesia" (lookback=100 and overnight positions were lost at midnight). **Solution:** Transitioned to `nautilus_native_continuous.py`. - Aggregates all 56 days (~16.6M bars) into a single contiguous pass. - Maintains engine memory across the entire window. ### **Phase 3: Gold Fidelity Certification (V11)** - **Objective**: Exactly reproduce ROI=+181.81%, T=2155 in Nautilus-Native. - **Harness**: `prod/nautilus_native_gold_repro.py` (Version 11). - **Status**: **FAILED (NaN CORRUPTION)** - **Findings**: - Discovered `notional=nan` in Actor logs. - Root cause: `vel_div` and `lambda_max` features in `vbt_cache` parquets contain scattered `NaN` values. - Python-native `float(nan) <= 0` logic failed to trap these, leading to `entry_price=nan`. - `nan` propagated through P&L into `self.capital`, corrupting the entire backtest history. - Output: ROI=NaN, trade count suppressed (2541 vs 2155). ### **Phase 4: Fortress Hardening (V12)** - **Objective**: Recover Gold ROI via strict data sanitation. - **Harness**: `prod/nautilus_native_gold_repro.py` (Version 12). - **Status**: **EXECUTING (Phase 4 Certification)** - **Hardening Steps**: 1. **Feature Sanitization**: Added `math.isfinite` guardrails in `_FEATURE_STORE` loading. 2. **Price Validation**: Enforced `p > 0 and math.isfinite(p)` for all synthetic bars. 3. **Capital Shield**: Hardened `AlphaExitManager` and `DolphinActor` against non-finite price lookups. 4. **Parity Alignment**: Confirmed 56-day file set matches Gold Standard exactly. --- ## 3. ROI Gap Analysis — CORRECTED ### Status Summary | Stage | ROI | Trades | Delta | |---|---|---|---| | Gold (VBT direct) | +181.81% | 2155 | baseline | | Native (V11 Repro) | *In Progress* | *...* | *Reconciling* | ### Root Causes of Alpha Decay (Identified) 1. **Vol Gate Calibration**: Gold used adaptive daily `vol_p60`. Static calibration causes 40% signal drop. 2. **Timestamp Alignment**: Synthetic `ts_ns` calculation in the harness must precisely match the `_FEATURE_STORE` keys used by the Actor. 3. **DC Lookback**: Continuous mode preserves direction across midnight; Gold reset it. This affects ~5-10% of entries. **Author:** Claude (claude-sonnet-4-6) — 2026-03-28