Files
DOLPHIN/nautilus_dolphin/patch_nautilus_bug.py
hjnormey 01c19662cb 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.
2026-04-21 16:58:38 +02:00

52 lines
1.6 KiB
Python
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
Patch Nautilus 1.219.0 Bug
==========================
Fixes the Strategy.__init__ bug where Logger expects str but gets StrategyId.
Usage:
python patch_nautilus_bug.py
# Then run your backtest
"""
import sys
import nautilus_trader
from pathlib import Path
# Find Nautilus installation
nautilus_path = Path(nautilus_trader.__file__).parent
strategy_pxd = nautilus_path / "trading" / "strategy.pyx"
strategy_py = nautilus_path / "trading" / "strategy.py"
print("Nautilus Trader Bug Patch")
print("=" * 50)
print(f"Nautilus path: {nautilus_path}")
# Check if we can find the source
if strategy_pxd.exists():
print(f"Found: {strategy_pxd}")
# This is a Cython file - would need recompilation
print("Note: strategy.pyx is a Cython file - requires recompilation after patching")
elif strategy_py.exists():
print(f"Found: {strategy_py}")
# This is a Python file - can patch directly
with open(strategy_py, 'r') as f:
content = f.read()
if 'Logger(name=component_id)' in content:
print("Patching strategy.py...")
content = content.replace(
'Logger(name=component_id)',
'Logger(name=str(component_id))'
)
with open(strategy_py, 'w') as f:
f.write(content)
print("✅ Patched successfully!")
else:
print(" Already patched or different version")
else:
print("⚠️ Could not find strategy source files")
print("\nAlternative: Use the workaround in DolphinExecutionStrategy")
print("The strategy already has a try/except workaround for this bug.")