Docs
Core Concepts - Performance Metrics
Core Concepts - Performance Metrics
Understanding the performance metrics and calculation methodologies used in Wealthfolio.
Wealthfolio employs several performance metrics and calculation methods to provide a comprehensive view of your portfolio’s performance. Understanding these concepts is key to interpreting your financial progress accurately.
Key Performance Metrics
Here are the primary metrics used throughout the application:
1. Time-Weighted Return (TWR)
- Definition: Time-Weighted Return (TWR) measures the compound growth rate of a portfolio. Its calculation aims to remove the distorting effects of cash inflows (deposits) and outflows (withdrawals), thereby reflecting the performance of the underlying investments and the manager’s ability to select them.
- Use Case: TWR is ideal for comparing the performance of investment managers or strategies because it focuses purely on investment decisions, not on the timing or size of investor cash flows. The
calculate_performance_history
andcalculate_symbol_performance
functions prominently feature TWR. - Calculation Insight: It geometrically links sub-period returns, where each sub-period is defined by a cash flow.
2. Money-Weighted Return (MWR)
- Definition: Money-Weighted Return (MWR), also known as the Internal Rate of Return (IRR), measures the performance of a portfolio taking into account the size and timing of cash flows. It is the discount rate at which the present value of all cash flows (both inflows and outflows) equals the present value of the ending investment value.
- Use Case: MWR reflects the investor’s actual return experience, as it’s sensitive to when money was added to or removed from the portfolio. The
calculate_account_performance
function (called bycalculate_performance_history
for accounts) calculates MWR. - Calculation Insight: It solves for the rate
r
in the equation:Ending Value = Σ (CashFlow_i * (1+r)^(t_i))
, wheret_i
is the time period for each cash flow.
3. Simple Return
- Definition: Simple Return is a basic measure of the gain or loss on an investment relative to its initial cost. It’s calculated as:
(Ending Value - Starting Value - Net Cash Flows) / Starting Value
. - Use Case: Provides a quick, straightforward understanding of overall return. It’s used in
calculate_account_performance_summary
andcalculate_simple_performance
. - Limitations: Can be misleading if there are significant cash flows during the period, as it doesn’t account for the timing of those flows.
4. Annualized Return
- Definition: Annualized Return shows the geometric average amount of money earned by an investment each year over a selected period, as if the returns were compounded annually. It standardizes returns over different time frames for comparison.
- Use Case: Allows for comparing investments held for different periods by expressing their returns on a common yearly basis. Wealthfolio calculates annualized versions of TWR, MWR, and Simple Return.
- Calculation Insight: Calculated as
(1 + Total Return)^(1 / Number of Years) - 1
. If the period is less than a year, it’s often not annualized or annualized with caution. Thecalculate_annualized_return
function handles this logic.
5. Volatility
- Definition: Volatility measures the dispersion of returns for a given investment or portfolio. It’s typically calculated as the standard deviation of returns. Higher volatility means the investment’s price can change dramatically over a short time period in either direction.
- Use Case: Indicates the level of risk associated with an investment. High volatility suggests higher risk. Calculated by
calculate_volatility
and included incalculate_performance_history
andcalculate_symbol_performance
. - Calculation Insight: It involves calculating the average return, the squared differences from this average, the variance, and then the square root of the variance (standard deviation). This daily volatility is then typically annualized by multiplying by the square root of the number of trading days in a year (e.g., 252).
6. Maximum Drawdown (Max DD)
- Definition: Maximum Drawdown represents the largest percentage decline from a peak to a subsequent trough in portfolio value during a specified period.
- Use Case: Indicates the downside risk an investor might have experienced. A larger Max DD means the investment has suffered more significant drops from its highs. Calculated by
calculate_max_drawdown
and included incalculate_performance_history
andcalculate_symbol_performance
. - Calculation Insight: Tracks the cumulative return, notes the highest peak achieved, and measures the largest drop from any peak to a subsequent low before a new peak is established.
7. Gain/Loss Amount
- Definition: The absolute monetary gain or loss on an investment or portfolio over a specific period.
- Use Case: Provides a clear, absolute measure of profit or loss. Calculated in various performance functions.
- Calculation Insight:
Ending Value - Starting Value - Net Cash Flows
.
8. Daily Returns / Modified Dietz Method
- Definition: For daily performance, especially when intraday cash flows might occur, a precise return calculation is needed. The Modified Dietz method is often used as an approximation. It estimates the return by considering cash flows to be halfway through the period.
- Use Case: The
calculate_simple_performance
function calculatesday_return_percent_mod_dietz
to give an estimated daily percentage change adjusted for cash flows. - Calculation Insight:
Day's Gain / (Starting Value + 0.5 * Day's Net Cash Flow)
.
9. Portfolio Weight
- Definition: The proportion an account’s value represents of the total portfolio value (or a specified base value).
- Use Case: Helps understand asset allocation and concentration. Calculated in
calculate_simple_performance
whentotal_portfolio_value_base
is provided. - Calculation Insight:
(Account Value in Base Currency / Total Portfolio Value in Base Currency)
.
Understanding the Differences
- TWR vs. MWR: TWR is best for judging investment strategy performance in isolation from cash flow timing. MWR tells you your actual personal rate of return, influenced by when you added or withdrew funds.
- History vs. Summary:
calculate_performance_history
gives a deep dive with charts and risk metrics.calculate_performance_summary
gives a quick, high-level profit/loss and simple return. - Symbol vs. Account Performance: Symbol performance is based purely on price movements from market data. Account performance incorporates your actual transactions, cash flows, and holdings.
By understanding these metrics and how they are calculated, you can gain deeper insights into your investment journey with Wealthfolio.