- Implemented portfolio engine with risk-based allocation (50/50) - Added equity-based metrics for system-level evaluation - Validated portfolio against standalone strategies - Reduced max drawdown and volatility at system level - Quantitative decision closed before paper trading phase
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
# tests/test_wf_visualizer.py
|
||
|
||
import sys
|
||
from pathlib import Path
|
||
import pandas as pd
|
||
|
||
# Añadir raíz del proyecto al path
|
||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||
|
||
from src.core.visualizers.walk_forward_visualizer import WalkForwardVisualizer
|
||
|
||
|
||
def test_wf_visualizer():
|
||
"""
|
||
Test del WalkForwardVisualizer usando los CSV existentes
|
||
"""
|
||
|
||
base_path = Path("backtest_results/walkforward")
|
||
|
||
summary_df = pd.read_csv(base_path / "walkforward_summary.csv")
|
||
windows_df = pd.read_csv(base_path / "walkforward_windows.csv")
|
||
|
||
viz = WalkForwardVisualizer(
|
||
summary_df=summary_df,
|
||
windows_df=windows_df,
|
||
name="BTC/USDT – MA + ADX"
|
||
)
|
||
|
||
# 📊 Plots
|
||
viz.plot_avg_metrics()
|
||
viz.plot_returns_by_window()
|
||
viz.plot_drawdown_by_window()
|
||
viz.plot_return_distribution()
|
||
viz.plot_parameter_stability("fast_period")
|
||
viz.plot_parameter_stability("slow_period")
|
||
viz.plot_parameter_stability("adx_threshold")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
test_wf_visualizer()
|