#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "wu.h"
Go to the source code of this file.
|
| #define | SHARPE_MIN_OBSERVATIONS 30 |
| | The Sharpe Ratio measures risk-adjusted return by comparing excess return (over risk-free rate) to total volatility (standard deviation).
|
◆ SHARPE_MIN_OBSERVATIONS
| #define SHARPE_MIN_OBSERVATIONS 30 |
The Sharpe Ratio measures risk-adjusted return by comparing excess return (over risk-free rate) to total volatility (standard deviation).
Formula: Sharpe = (R_p - R_f) / σ_p where:
R_p = mean portfolio return (annualized) R_f = risk-free rate (annualized) σ_p = portfolio standard deviation (annualized) Minimum number of observations required for statistically meaningful Sharpe ratio calculation. Below this threshold, the ratio is unreliable.
Definition at line 22 of file sharpe.c.
◆ wu_sharpe_ratio_free()
| void wu_sharpe_ratio_free |
( |
WU_SharpeRatio | self | ) |
|
|
static |
Frees resources allocated by the Sharpe Ratio object.
Definition at line 96 of file sharpe.c.
◆ wu_sharpe_ratio_new()
| WU_SharpeRatio wu_sharpe_ratio_new |
( |
double | initial_value, |
|
|
double | risk_free_rate ) |
Creates a new Sharpe Ratio calculator.
Definition at line 106 of file sharpe.c.
◆ wu_sharpe_ratio_update()
Updates the Sharpe Ratio calculation with a new portfolio value.
- Parameters
-
| self | The Sharpe Ratio object |
| perf | Performance update containing portfolio value and timestamp |
- Returns
- The updated Sharpe Ratio value, or NAN if insufficient data
Definition at line 31 of file sharpe.c.