Session 5: Portfolio Metrics - Measuring Investment Performance Like a Pro#
Learning Objectives#
By the end of this session, you will be able to:
Calculate and interpret essential portfolio metrics including return, volatility, and Sharpe ratio
Analyze portfolio risk through diversification and correlation measurements
Compare portfolio performance against market benchmarks using alpha and beta
Evaluate risk-adjusted returns to make better investment decisions
Build a portfolio dashboard that tracks multiple investments simultaneously
Present portfolio analysis professionally through clear video communication
Section 1: The Financial Hook#
The $10 Million Portfolio Decision#
In March 2024, two portfolio managers at a major investment firm presented their quarterly results to the investment committee:
Manager A: “My portfolio gained 15% this quarter! I crushed the market’s 10% return.”
Manager B: “My portfolio gained 12% with a Sharpe ratio of 1.8, beta of 0.75, and maximum drawdown of only 4%. My risk-adjusted returns exceeded the benchmark by 300 basis points.”
What are basis points? A basis point equals 0.01% (one-hundredth of a percent). So 300 basis points = 3.00%. Finance professionals use basis points for precision—saying “50 basis points” is clearer than “half a percent.”
The committee allocated $10 million more to Manager B. Why?
The Professional Truth About Portfolio Management#
Raw returns tell only half the story.
Professional investors know:
A 15% return with 30% volatility is worse than 12% return with 10% volatility
Beating the market by taking excessive risk isn’t skill—it’s gambling
Risk-adjusted performance separates lucky investors from skilled ones
Proper metrics prevent career-ending losses
Real-World Impact#
Consider these portfolio disasters that metrics could have prevented:
Long-Term Capital Management (1998): Despite Nobel laureates on staff, collapsed due to excessive leverage ignored by simple risk metrics
2008 Financial Crisis: Many “star” managers lost 40%+ because they chased returns without measuring risk
ARK Innovation ETF (2022): Gained 150% in 2020, lost 67% in 2022—volatility metrics would have warned investors
Your Mission Today#
Master the metrics that separate amateur investors from professionals:
Portfolio return and volatility calculations
Risk-adjusted performance measures (Sharpe ratio)
Market sensitivity analysis (alpha and beta)
Diversification effectiveness measurement
Section 2: Foundational Financial Concepts & Models#
Core Concept: Portfolio Performance#
What is Portfolio Performance? Portfolio performance measures how well your investments are doing, considering both returns AND the risk you took to achieve them. It’s like comparing two routes to work—one might be faster but goes through dangerous neighborhoods, while another is slightly slower but much safer.
Portfolio Return#
Portfolio Return is the weighted average of individual asset returns:
Where:
\(w_i\) = weight of asset \(i\) in the portfolio
\(r_i\) = return of asset \(i\)
\(n\) = number of assets
Example: If you have 60% in stocks returning 10% and 40% in bonds returning 5%: Portfolio Return = (0.60 × 10%) + (0.40 × 5%) = 6% + 2% = 8%
Portfolio Risk (Volatility)#
What is Volatility? Volatility measures how much your portfolio value jumps around. High volatility means big swings up AND down (risky), while low volatility means steady, predictable returns (safer).
Standard Deviation is the most common measure of volatility:
Where:
\(\sigma_p\) = portfolio standard deviation
\(\sigma_i\) = standard deviation of asset \(i\)
\(\rho_{ij}\) = correlation between assets \(i\) and \(j\)
In Simple Terms: Portfolio risk depends on:
Individual asset risks
How much of each asset you own
How assets move together (correlation)
The Sharpe Ratio: Risk-Adjusted Returns#
What is the Sharpe Ratio? The Sharpe ratio tells you how much return you’re getting for each unit of risk. It’s like measuring miles per gallon for your car—higher is more efficient.
Interpretation:
Above 1.0: Good risk-adjusted returns
Above 1.5: Very good performance
Above 2.0: Excellent (rare)
Below 0.5: Poor risk-adjusted returns
Market Sensitivity: Beta#
What is Beta? Beta measures how sensitive your portfolio is to market movements. Think of it as your portfolio’s “market mood sensitivity”:
Beta = 1.0: Moves exactly with the market
Beta > 1.0: Amplifies market moves (more volatile)
Beta < 1.0: Dampens market moves (less volatile)
What is Covariance? Covariance measures how two investments move together. Positive covariance means they tend to go up and down together, negative means they move in opposite directions, and zero means no relationship.
Excess Performance: Alpha#
What is Alpha? Alpha is the extra return you earn above what your risk level (beta) would predict. It’s the “skill factor”—positive alpha means you’re beating the market after adjusting for risk.
🎯 AI Learning Support - Understanding Portfolio Metrics#
Learning Goal: Grasp why professional investors use multiple metrics, not just returns.
Starting Prompt: “What’s the difference between portfolio return and risk-adjusted return?”
🚀 Hints to Improve Your Prompt:
Specify what type of investor you are (conservative, aggressive)
Include actual numbers to make it concrete
Ask for real-world examples
Request the “so what” - why this matters for decisions
💡 Better Version Hints:
Ask about specific scenarios (bear markets, volatility spikes)
Include multiple metrics in your question
Request industry standards and benchmarks
Ask how professionals use these in practice
🎯 Your Challenge: Create a prompt that helps you understand why a portfolio with lower returns might actually be better than one with higher returns.
Section 3: The Financial Gym - Partner Practice & AI Copilot Learning#
Solo Warm-Up (15 minutes)#
Exercise 1: Manual Portfolio Calculations
You have $10,000 to invest and create this portfolio:
Apple (AAPL): $4,000 (40%)
Microsoft (MSFT): $3,000 (30%)
Johnson & Johnson (JNJ): $2,000 (20%)
Coca-Cola (KO): $1,000 (10%)
Monthly returns:
AAPL: +5%
MSFT: +3%
JNJ: +1%
KO: +2%
Calculate:
Portfolio return for the month
New value of each position
New portfolio total
AI Copilot Learning Phase (20 minutes)#
Step 1: Understanding Risk vs. Return
# SIMPLE PORTFOLIO ANALYSIS
# Comparing two different portfolios
# Portfolio A: Aggressive Growth
portfolio_a_returns = [15, -8, 20, -12, 18, -5, 22, -10]
portfolio_a_value = 10000
# Portfolio B: Balanced Conservative
portfolio_b_returns = [5, 2, 6, 1, 7, 3, 5, 2]
portfolio_b_value = 10000
# Calculate average returns
avg_return_a = sum(portfolio_a_returns) / len(portfolio_a_returns)
avg_return_b = sum(portfolio_b_returns) / len(portfolio_b_returns)
print(f"Portfolio A average return: {avg_return_a:.1f}%")
print(f"Portfolio B average return: {avg_return_b:.1f}%")
# But which is actually better?
💡 AI Learning Support - Risk Analysis#
Learning Goal: Understand why volatility matters as much as returns.
Starting Prompt: “Why should I care about volatility if returns are good?”
🚀 Improvement Hints:
Add your risk tolerance (can you handle 20% drops?)
Specify your time horizon
Include your financial goals
Ask about sleep-at-night factor
💡 Advanced Hints:
Ask about drawdown recovery time
Request behavioral finance insights
Inquire about rebalancing implications
Ask about tax consequences of volatility
🎯 Your Challenge: Develop a prompt that helps you determine your personal optimal risk-return tradeoff.
Reciprocal Teaching Component (25 minutes)#
Partner A Tasks (10 min):
Explain what the Sharpe ratio actually measures
Show why two 10% returns can be very different investments
Demonstrate portfolio return calculation with 3 stocks
Partner B Tasks (10 min):
Explain beta using real company examples
Show how diversification reduces risk
Demonstrate why correlation matters
Together (5 min):
Build a simple 4-stock portfolio
Calculate its expected return
Discuss its risk characteristics
Collaborative Challenge (20 minutes)#
The Portfolio Comparison Challenge
You have two portfolio options:
Tech Portfolio:
50% Apple, 30% Microsoft, 20% Google
Expected return: 15%
Volatility: 25%
Balanced Portfolio:
25% Stocks, 25% Bonds, 25% Real Estate, 25% Commodities
Expected return: 10%
Volatility: 12%
With a partner:
Calculate Sharpe ratio for each (assume 3% risk-free rate)
Determine which is better for a 25-year-old
Determine which is better for a 60-year-old
Explain your reasoning
Section 4: The Financial Coaching - Your DRIVER Learning Guide#
Complete DRIVER Case Study: Building a Performance Dashboard#
Scenario: You’ve been hired as a junior analyst at a wealth management firm. Your first task: build a portfolio performance dashboard that tracks client investments and compares them to market benchmarks. The senior partner wants “something that actually helps us make decisions, not just pretty charts.”
D - Define & Discover#
Understanding Portfolio Analytics Requirements
Professional portfolio analysis requires:
Accurate return calculations
Risk measurement tools
Benchmark comparisons
Clear visual reporting
🎯 AI Learning Support - Problem Discovery
Learning Goal: Understand what makes a portfolio dashboard useful vs. just decorative.
Starting Prompt: “What metrics should I show on a portfolio dashboard?”
🚀 Enhancement Hints:
Specify the audience (clients, managers, regulators)
Include decision-making context
Ask about update frequency needs
Mention regulatory requirements
💡 Professional Hints:
Ask about GIPS compliance standards
Request client communication best practices
Inquire about risk limit monitoring
Ask about attribution analysis needs
🎯 Your Challenge: Create a prompt that helps you design a dashboard that would impress a Chief Investment Officer.
Design Requirements:
Track 5-8 stock portfolio
Compare to S&P 500 benchmark
Calculate key risk metrics
Show 1-year performance
R - Represent#
Dashboard Logic Flow
1. Data Collection
├── Download stock prices
├── Download benchmark data
└── Align dates properly
2. Return Calculations
├── Individual stock returns
├── Portfolio returns
└── Benchmark returns
3. Risk Metrics
├── Volatility (standard deviation)
├── Maximum drawdown
└── Correlation matrix
4. Performance Metrics
├── Sharpe ratio
├── Alpha and beta
└── Information ratio
5. Visualization
├── Performance chart
├── Risk-return scatter
└── Metrics summary table
🚀 AI Learning Support - System Design
Learning Goal: Plan a complete portfolio analytics system.
Starting Prompt: “How should I organize my portfolio analysis code?”
🚀 Better Planning Hints:
List the specific calculations needed
Specify data sources and formats
Ask about error handling
Request modular design tips
💡 Professional Elements:
Ask about audit trail requirements
Request calculation documentation
Inquire about version control
Ask about scalability needs
🎯 Your Challenge: Create a prompt that helps you design a system that could analyze 100 portfolios, not just one.
I - Implement#
Simple Portfolio Dashboard Implementation
# PORTFOLIO PERFORMANCE DASHBOARD
# Professional analysis in simple steps
# Step 1: Setup and data collection
import yfinance as yf
import pandas as pd
import numpy as np
# Define our portfolio
portfolio = {
'AAPL': 0.25, # 25% Apple
'MSFT': 0.20, # 20% Microsoft
'JNJ': 0.20, # 20% Johnson & Johnson
'JPM': 0.15, # 15% JP Morgan
'PG': 0.20 # 20% Procter & Gamble
}
# Download 1 year of data
end_date = pd.Timestamp.now()
start_date = end_date - pd.DateOffset(years=1)
print("PORTFOLIO PERFORMANCE DASHBOARD")
print("=" * 40)
# Get price data
prices = pd.DataFrame()
for symbol in portfolio.keys():
data = yf.download(symbol, start=start_date, end=end_date, progress=False)
prices[symbol] = data['Adj Close']
# Get benchmark (S&P 500)
benchmark = yf.download('SPY', start=start_date, end=end_date, progress=False)['Adj Close']
# Step 2: Calculate returns
daily_returns = prices.pct_change().dropna()
benchmark_returns = benchmark.pct_change().dropna()
# Portfolio returns (weighted)
portfolio_returns = pd.Series(0, index=daily_returns.index)
for symbol, weight in portfolio.items():
portfolio_returns += daily_returns[symbol] * weight
# Step 3: Calculate metrics
# Annual return
portfolio_total = (1 + portfolio_returns).prod() - 1
benchmark_total = (1 + benchmark_returns).prod() - 1
# Volatility (annualized)
portfolio_vol = portfolio_returns.std() * np.sqrt(252)
benchmark_vol = benchmark_returns.std() * np.sqrt(252)
# Sharpe ratio (assume 3% risk-free rate)
risk_free = 0.03
portfolio_sharpe = (portfolio_total - risk_free) / portfolio_vol
benchmark_sharpe = (benchmark_total - risk_free) / benchmark_vol
# Display results
print(f"\nPORTFOLIO METRICS (1 Year)")
print("-" * 40)
print(f"Total Return: {portfolio_total:.2%}")
print(f"Benchmark Return: {benchmark_total:.2%}")
print(f"Outperformance: {portfolio_total - benchmark_total:.2%}")
print(f"\nVolatility: {portfolio_vol:.2%}")
print(f"Benchmark Volatility: {benchmark_vol:.2%}")
print(f"\nSharpe Ratio: {portfolio_sharpe:.2f}")
print(f"Benchmark Sharpe: {benchmark_sharpe:.2f}")
Risk Analysis
# RISK ANALYSIS
# Understanding portfolio risk
# Maximum drawdown calculation
# What is Maximum Drawdown?
# It's the largest peak-to-trough decline in portfolio value
# Example: If your portfolio goes from $100 to $120 then drops to $90,
# the drawdown is -25% (from $120 to $90)
cumulative = (1 + portfolio_returns).cumprod()
running_max = cumulative.expanding().max()
drawdown = (cumulative - running_max) / running_max
max_drawdown = drawdown.min()
print(f"\nRISK METRICS")
print("-" * 40)
print(f"Maximum Drawdown: {max_drawdown:.2%}")
print(f"Best Day: {portfolio_returns.max():.2%}")
print(f"Worst Day: {portfolio_returns.min():.2%}")
# Calculate beta
# Align dates
common_dates = portfolio_returns.index.intersection(benchmark_returns.index)
port_aligned = portfolio_returns[common_dates]
bench_aligned = benchmark_returns[common_dates]
# Beta calculation
covariance = np.cov(port_aligned, bench_aligned)[0,1]
benchmark_variance = bench_aligned.var()
beta = covariance / benchmark_variance
# Alpha calculation
portfolio_annual = portfolio_total
benchmark_annual = benchmark_total
alpha = portfolio_annual - (risk_free + beta * (benchmark_annual - risk_free))
print(f"\nMARKET SENSITIVITY")
print("-" * 40)
print(f"Beta: {beta:.2f}")
print(f"Alpha: {alpha:.2%}")
if beta > 1:
print("→ Portfolio is MORE volatile than market")
elif beta < 1:
print("→ Portfolio is LESS volatile than market")
else:
print("→ Portfolio moves with market")
💻 AI Learning Support - Code Understanding
Learning Goal: Understand what each metric tells you about the portfolio.
Starting Prompt: “What does a beta of 0.8 mean for my portfolio?”
🚀 Context Improvements:
Include your investment goals
Specify your risk tolerance
Ask about market conditions
Request practical implications
💡 Deeper Understanding:
Ask about beta in different market cycles
Request sector-specific beta insights
Inquire about beta stability over time
Ask about hedging implications
🎯 Your Challenge: Create a prompt that helps you understand when high beta is good vs. bad.
V - Validate#
Validation Checks
# VALIDATION
# Ensure our calculations are correct
# Check 1: Weights sum to 100%
total_weight = sum(portfolio.values())
print(f"\nVALIDATION CHECKS")
print("-" * 40)
print(f"Portfolio weights sum: {total_weight:.1%}")
if abs(total_weight - 1.0) < 0.001:
print("✓ Weights correct")
else:
print("✗ Weight error!")
# Check 2: Reasonable metrics
if -50 < portfolio_total < 100:
print("✓ Returns reasonable")
else:
print("✗ Returns unrealistic!")
if 0 < portfolio_vol < 1:
print("✓ Volatility reasonable")
else:
print("✗ Volatility error!")
# Check 3: Data completeness
missing_data = prices.isnull().sum().sum()
print(f"\nMissing data points: {missing_data}")
if missing_data == 0:
print("✓ Data complete")
else:
print("✗ Data gaps found")
🔍 AI Learning Support - Validation
Learning Goal: Learn to spot calculation errors before they matter.
Starting Prompt: “How do I know if my portfolio metrics are calculated correctly?”
🚀 Specific Improvements:
Include your actual calculations
Ask about reasonable ranges
Request common error patterns
Ask for cross-validation methods
💡 Professional Validation:
Ask about audit requirements
Request GIPS compliance checks
Inquire about reconciliation methods
Ask about error tolerances
🎯 Your Challenge: Develop a prompt that helps you build validation checks a regulator would approve.
E - Evolve#
Enhancement Opportunities
Your dashboard can evolve to include:
Multiple time period analysis
Sector allocation breakdown
Currency exposure tracking
Factor analysis (value, growth, size)
Monte Carlo simulations
🎯 AI Learning Support - Evolution
Learning Goal: Identify valuable enhancements vs. complexity for complexity’s sake.
Starting Prompt: “What features should I add to my portfolio dashboard?”
🚀 Priority Hints:
Describe current capabilities
Specify user needs
Ask about implementation effort
Request ROI on features
💡 Strategic Thinking:
Ask about client value
Request competitive analysis
Inquire about regulatory trends
Ask about technology constraints
🎯 Your Challenge: Create a prompt that helps you prioritize features like a product manager at BlackRock.
R - Reflect#
Key Insights from Portfolio Analysis
Returns Without Risk = Incomplete Picture: High returns mean nothing if risk is excessive
Diversification Works: Proper asset mix reduces risk without proportionally reducing returns
Benchmarks Matter: Performance is relative, not absolute
Simple Metrics Tell Big Stories: A few well-chosen metrics beat complex analysis
Professional Applications:
Client portfolio reviews
Investment committee presentations
Risk limit monitoring
Performance attribution analysis
📋 AI Learning Support - Synthesis
Learning Goal: Connect metrics to real investment decisions.
Starting Prompt: “How do portfolio metrics guide investment decisions?”
🚀 Decision Context:
Include specific scenarios
Ask about different market conditions
Request decision rules
Inquire about exceptions
💡 Professional Reality:
Ask about client conversations
Request regulatory considerations
Inquire about career implications
Ask about ethical dimensions
🎯 Your Challenge: Develop a prompt that helps you think like a portfolio manager with $100M under management.
Section 5: Assignment#
Scenario#
You’re a portfolio analyst at an investment advisory firm. A client questions whether their portfolio is performing well despite underperforming the S&P 500. They need a comprehensive risk-adjusted performance analysis to understand the true value their portfolio provides.
Requirements#
Create a video (approximately 10-15 minutes) demonstrating:
Portfolio construction with at least 4 assets and clear rationale
Calculation of key metrics: returns, volatility, Sharpe ratio, alpha, and beta
Risk-adjusted performance analysis comparing to an appropriate benchmark
Professional recommendations based on your metric analysis
Execution Format#
Use your completed Jupyter notebook or Python script
Run your code cell-by-cell while explaining what each part does
Show outputs and interpret each metric immediately
Address either the high-risk/high-return or low-beta scenarios in your analysis
Deliverables#
Video demonstration showing code execution and analysis
Python code file (.py or .ipynb)
Section 6: Reflect & Connect - Financial Insights Discussion#
Individual Reflection (10 minutes)#
Write your thoughts on:
Why do professional investors obsess over risk-adjusted returns?
How does portfolio analysis change your view of “good” performance?
What surprised you about diversification benefits?
When would you accept lower returns for lower risk?
Small Group Discussion (15 minutes)#
In groups of 3-4, discuss:
Compare portfolio strategies
What allocation did each person choose?
How did risk levels differ?
Whose portfolio had the best Sharpe ratio?
Explore metric relationships
When do high returns justify high risk?
How much alpha is “enough”?
What beta is appropriate for different investors?
Professional applications
How would you explain Sharpe ratio to a client?
When would you recommend high-beta portfolios?
How do you balance multiple metrics?
Class Synthesis (15 minutes)#
Key Topics for Discussion:
The Efficient Frontier Dream
Is there an “optimal” portfolio?
How do constraints affect optimization?
Why do professionals still struggle?
Behavioral Challenges
Why do investors chase returns?
How do metrics help discipline?
When do metrics mislead?
Future of Portfolio Management
Will AI replace human managers?
How are metrics evolving?
What skills remain crucial?
Connecting to Practice#
Industry Insight: “At Vanguard, we manage $8 trillion using these exact metrics. The math is simple—the judgment is hard. Knowing when to trust metrics vs. when to override them separates good managers from great ones.”
Sarah Johnson, Senior Portfolio Manager, Vanguard
Key Takeaways Board#
Create class list of:
Most important metrics learned
Biggest surprises about risk
Best practices for analysis
Questions for further study
Section 7: Looking Ahead#
What You’ve Mastered#
✅ Technical Skills:
Portfolio return calculations
Risk measurement methods
Sharpe ratio analysis
Alpha and beta interpretation
✅ Professional Capabilities:
Risk-adjusted thinking
Benchmark comparison
Performance attribution
Client communication
Building Bridges to Session 6#
Next session’s Modern Portfolio Theory builds on today’s metrics:
From Single Metrics to Optimization: Today’s ratios become tomorrow’s objective functions
From Risk Measurement to Risk Management: Understanding leads to controlling
From Analysis to Construction: Measuring portfolios leads to building better ones
From Historical to Forward-Looking: Past metrics inform future allocations
The Portfolio Journey#
Session 5: Measure Performance → Session 6: Optimize Allocation → Session 7: Implement Strategy
↓ ↓ ↓
Risk-return metrics Efficient frontier Dynamic rebalancing
Individual analysis Portfolio optimization Real-world constraints
Historical assessment Expected returns Practical execution
Preview Challenge#
Before next session, think about:
Can you really optimize a portfolio mathematically?
How do you estimate future returns?
What constraints matter in real portfolios?
When does theory meet reality’s limits?
Professional Development Path#
Your portfolio analysis skills enable:
Entry Level: Performance analyst roles
2-3 Years: Portfolio analyst positions
5 Years: Assistant portfolio manager
10 Years: Lead portfolio manager
Preparation for Session 6#
Technical Prep:
Review correlation concepts
Understand covariance basics
Practice with Excel Solver
Conceptual Prep:
Research Harry Markowitz
Explore efficient frontier
Consider optimization limits
Professional Prep:
Study robo-advisors
Understand factor investing
Research ESG constraints
Section 8: Appendix - Solutions & Implementation Guide#
Complete Solution Code#
# COMPLETE PORTFOLIO ANALYSIS SOLUTION
# Professional-grade but simple to understand
# ===== SETUP =====
import yfinance as yf
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
# ===== PORTFOLIO DEFINITION =====
# Balanced portfolio with different sectors
portfolio = {
'AAPL': 0.20, # Technology
'MSFT': 0.15, # Technology
'JNJ': 0.15, # Healthcare
'JPM': 0.15, # Financial
'PG': 0.10, # Consumer
'XOM': 0.10, # Energy
'VZ': 0.10, # Telecom
'GIS': 0.05 # Consumer Staples
}
# ===== DATA COLLECTION =====
print("DOWNLOADING PORTFOLIO DATA...")
# Time period
end_date = datetime.now()
start_date = end_date - timedelta(days=365)
# Download prices
prices = pd.DataFrame()
for symbol in portfolio.keys():
try:
data = yf.download(symbol, start=start_date, end=end_date, progress=False)
prices[symbol] = data['Adj Close']
print(f"✓ {symbol}")
except:
print(f"✗ {symbol} - Error")
# Download benchmark
spy = yf.download('SPY', start=start_date, end=end_date, progress=False)
benchmark_prices = spy['Adj Close']
# ===== RETURN CALCULATIONS =====
print("\n=== PERFORMANCE ANALYSIS ===")
# Daily returns
returns = prices.pct_change().dropna()
benchmark_returns = benchmark_prices.pct_change().dropna()
# Portfolio returns
port_returns = pd.Series(0, index=returns.index)
for symbol, weight in portfolio.items():
if symbol in returns.columns:
port_returns += returns[symbol] * weight
# Total returns
total_return = (1 + port_returns).prod() - 1
bench_return = (1 + benchmark_returns).prod() - 1
print(f"Portfolio Return: {total_return:.2%}")
print(f"Benchmark Return: {bench_return:.2%}")
print(f"Excess Return: {total_return - bench_return:.2%}")
# ===== RISK METRICS =====
# Volatility
port_vol = port_returns.std() * np.sqrt(252)
bench_vol = benchmark_returns.std() * np.sqrt(252)
print(f"\nPortfolio Volatility: {port_vol:.2%}")
print(f"Benchmark Volatility: {bench_vol:.2%}")
# Sharpe Ratio
risk_free = 0.03
sharpe = (total_return - risk_free) / port_vol
bench_sharpe = (bench_return - risk_free) / bench_vol
print(f"\nSharpe Ratio: {sharpe:.2f}")
print(f"Benchmark Sharpe: {bench_sharpe:.2f}")
# ===== MARKET SENSITIVITY =====
# Align dates for beta calculation
common_idx = port_returns.index.intersection(benchmark_returns.index)
port_aligned = port_returns[common_idx]
bench_aligned = benchmark_returns[common_idx]
# Beta
covar = np.cov(port_aligned, bench_aligned)[0,1]
bench_var = bench_aligned.var()
beta = covar / bench_var
# Alpha
expected_return = risk_free + beta * (bench_return - risk_free)
alpha = total_return - expected_return
print(f"\n=== MARKET SENSITIVITY ===")
print(f"Beta: {beta:.2f}")
print(f"Alpha: {alpha:.2%} annual")
# ===== RISK ANALYSIS =====
# Maximum Drawdown
cumulative = (1 + port_returns).cumprod()
running_max = cumulative.expanding().max()
drawdown = (cumulative - running_max) / running_max
max_dd = drawdown.min()
print(f"\n=== RISK ANALYSIS ===")
print(f"Maximum Drawdown: {max_dd:.2%}")
print(f"Best Day: +{port_returns.max():.2%}")
print(f"Worst Day: {port_returns.min():.2%}")
# Value at Risk (95% confidence)
# What is VaR (Value at Risk)?
# VaR tells you the maximum loss you might expect on a normal day
# 95% VaR means: "95% of the time, we won't lose more than this amount"
# Example: 95% VaR of -2% means you have a 5% chance of losing more than 2% in a day
var_95 = np.percentile(port_returns, 5)
print(f"95% Daily VaR: {var_95:.2%}")
# ===== DIVERSIFICATION =====
print(f"\n=== DIVERSIFICATION METRICS ===")
# Correlation matrix
corr_matrix = returns.corr()
avg_correlation = corr_matrix.values[np.triu_indices_from(corr_matrix.values, k=1)].mean()
print(f"Average Correlation: {avg_correlation:.2f}")
# Position concentration
# What is the Herfindahl Index?
# It measures portfolio concentration by summing the squares of position weights
# Range: 1/n (perfectly equal weights) to 1.0 (all money in one stock)
# Lower values = more diversified, Higher values = more concentrated
weights = list(portfolio.values())
herfindahl = sum(w**2 for w in weights)
effective_n = 1 / herfindahl
print(f"Effective Number of Positions: {effective_n:.1f}")
# ===== SUMMARY =====
print(f"\n{'='*40}")
print("PORTFOLIO SCORECARD")
print(f"{'='*40}")
print(f"{'Metric':<20} {'Portfolio':>10} {'Benchmark':>10}")
print(f"{'-'*40}")
print(f"{'Annual Return':<20} {total_return:>10.1%} {bench_return:>10.1%}")
print(f"{'Volatility':<20} {port_vol:>10.1%} {bench_vol:>10.1%}")
print(f"{'Sharpe Ratio':<20} {sharpe:>10.2f} {bench_sharpe:>10.2f}")
print(f"{'Max Drawdown':<20} {max_dd:>10.1%} {'N/A':>10}")
print(f"{'Beta':<20} {beta:>10.2f} {'1.00':>10}")
print(f"{'Alpha':<20} {alpha:>10.1%} {'0.0%':>10}")
Common Student Mistakes#
Forgetting to align dates
Wrong: Comparing different time periods
Right: Use intersection of dates
Mixing return types
Wrong: Adding price returns and log returns
Right: Use consistent return calculations
Annualization errors
Wrong: Multiplying by 365
Right: Multiply by √252 for volatility
Weight normalization
Wrong: Weights summing to 90%
Right: Always normalize to 100%
Quick Reference#
Key Formulas:
Portfolio Return = Σ(weight × return)
Portfolio Volatility = √(252) × std(daily returns)
Sharpe Ratio = (Return - Risk Free) / Volatility
Beta = Covariance(Port, Market) / Variance(Market)
Alpha = Portfolio Return - [Rf + Beta × (Market - Rf)]
Interpretation Guide:
Sharpe > 1.0: Good risk-adjusted returns
Beta > 1.0: More volatile than market
Alpha > 0: Outperforming after risk adjustment
Max Drawdown < 20%: Reasonable risk control
Implementation Notes for Instructors#
Pre-Session Setup#
Ensure yfinance is installed
Test market data access
Prepare benchmark comparisons
Have calculator ready for verification
Common Teaching Points#
Start with 2-asset portfolios
Build up to full calculations
Emphasize interpretation over formula
Use current market examples
Assessment Guidelines#
Focus on understanding metrics
Allow minor calculation errors
Reward clear explanations
Test decision-making ability
Professional Resources#
CFA Institute: Portfolio management curriculum
Morningstar Direct: Professional analytics platform
Portfolio Visualizer: Free online tools
Python libraries: pandas, numpy, yfinance
End of Session 5: Portfolio Metrics
Next: Session 6 - Modern Portfolio Theory: Building Optimal Portfolios