INNER CODE UNIT · Python

render_equity_chart

alex-jb/orallexa-ai-trading-agent · app.py:196

def render_equity_chart(ticker: str, bt_train: pd.DataFrame, bt_test: pd.DataFrame):
    fig, axes = plt.subplots(2, 1, figsize=(10, 7))

    axes[0].plot(bt_train["CumulativeStrategyReturn"], label="Train Strategy")
    axes[0].plot(bt_train["CumulativeMarketReturn"],   label="Train Buy & Hold")
    axes[0].set_title(f"{ticker} Train Equity Curve")
    axes[0].legend()
    axes[0].grid(True)

    axes[1].plot(bt_test["CumulativeStrategyReturn"], label="Test Strategy")
    axes[1].plot(bt_test["CumulativeMarketReturn"],   label="Test Buy & Hold")
    axes[1].set_title(f"{ticker} Test Equity Curve")
    axes[1].legend()
    axes[1].grid(True)

    plt.tight_layout()
    return fig

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…