Portfolio Performance Measurement › Rolling Performance Analysis
Quantitative FinanceAll chapters Portfolio Performance Measurement › Rolling Performance AnalysisSection view · Sections in this chapter7 / 11 ↓
Reading tools Definitions, links & notes
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Static performance metrics over the full period can mask time-varying behavior. A manager might have excellent performance in one regime but poor performance in another. Rolling analysis captures this dynamic by computing metrics over moving windows.
PythonIn [29]Expand
def rolling_sharpe(returns, risk_free_rate, window, periods_per_year=252):
"""Calculate rolling Sharpe ratio."""
rolling_mean = pd.Series(returns).rolling(window).mean()
rolling_std = pd.Series(returns).rolling(window).std()
rolling_sr = (
(rolling_mean - risk_free_rate)
/ rolling_std
* np.sqrt(periods_per_year)
)
return rolling_sr.values
def rolling_max_drawdown(returns, window):
"""Calculate rolling maximum drawdown."""
cumulative = (1 + pd.Series(returns)).cumprod()
rolling_max = cumulative.rolling(window, min_periods=1).max()
drawdown = (rolling_max - cumulative) / rolling_max
rolling_max_dd = drawdown.rolling(window).max()
return rolling_max_dd.valuesPythonIn [30]Expand
# Calculate rolling metrics with 252-day (1 year) window
window = 252
df["rolling_sharpe_portfolio"] = rolling_sharpe(
df["portfolio"].values, daily_rf, window
)
df["rolling_sharpe_benchmark"] = rolling_sharpe(
df["benchmark"].values, daily_rf, window
)
df["rolling_maxdd_portfolio"] = rolling_max_drawdown(
df["portfolio"].values, window
)
df["rolling_maxdd_benchmark"] = rolling_max_drawdown(
df["benchmark"].values, window
)VisualizationsOut [31]Expand


Rolling analysis reveals that performance metrics are not constants; they fluctuate with market conditions. A manager with an impressive full-period Sharpe ratio might have experienced extended periods of negative Sharpe, which rolling analysis would reveal.
VisualizationOut [32]Expand

Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!