62 [[nodiscard]]
double sharpe() const noexcept {
80 if (beta <= -1.0 || beta >= 1.0) {
81 throw std::domain_error(
"beta must be strictly in (-1, 1)");
83 gamma = 1.0 / std::sqrt(1.0 - beta * beta);
111 const double g = lf.
gamma;
113 boosted.
ret = g * (portfolio.
ret - beta * portfolio.
vol);
114 boosted.
vol = g * (portfolio.
vol - beta * portfolio.
ret);
135 return pf.ret * pf.ret
160 [[nodiscard]]
static double find(
161 double target_sharpe,
166 double best_beta = 0.0;
167 double best_sharpe = -1e18;
169 for (
double beta = -0.99; beta <= 0.99; beta += step) {
171 if (beta <= -1.0 || beta >= 1.0)
continue;
172 const double g = 1.0 / std::sqrt(1.0 - beta * beta);
173 const double ret = g * (portfolio.
ret - beta * portfolio.
vol);
174 const double vol = g * (portfolio.
vol - beta * portfolio.
ret);
175 if (vol <= 0.0)
continue;
176 const double sharpe = ret / vol;
177 if (sharpe > best_sharpe) {
178 best_sharpe = sharpe;
static PortfolioFourVector transform(const PortfolioFourVector &portfolio, double beta)
static double find(double target_sharpe, const PortfolioFourVector &portfolio, double step=0.01) noexcept
static double compute(const PortfolioFourVector &pf) noexcept
Compute the Minkowski norm squared of pf.
PortfolioInvariant()=delete
Physical and financial constants for the SRFM system.
LorentzFactor(double beta)
double kurt
Excess kurtosis (space-like, transverse)
double sharpe() const noexcept
Sharpe ratio in this frame: ret / vol. Returns 0 if vol == 0.
double skew
Skewness (space-like, transverse)
double ret
Annualised expected return (time-like component)
double vol
Annualised volatility (space-like)
Shared primitive types for the Special Relativity in Financial Modeling (SRFM) system.