CVaRPortfolioObjective<T>
Models & Types · AiDotNet.Finance.Portfolio
SIT’s decision-focused training objective: the Conditional Value-at-Risk of the realized portfolio loss (Hwang and Zohren, arXiv:2510.03129).
For Beginners
Value-at-Risk is a loss level you only exceed rarely. CVaR is the AVERAGE loss in those rare bad cases, so it cares about how bad the bad days are rather than just how often they happen.
How It Works
This is the paper’s central argument made concrete. Predict-then-optimize pipelines minimize a forecasting error and let a downstream optimizer turn small inaccuracies into fragile allocations; SIT instead trains on the portfolio’s own tail risk, so the training signal and the financial goal are the same quantity.
CVaR is the sole training signal. The paper is explicit that no auxiliary prediction losses are used. Adding an MSE, expected-return or turnover term would reintroduce exactly the objective mismatch the method exists to remove, so this class has no such terms and none should be added.
Transaction costs appear in the paper only as a post-hoc sensitivity analysis, not in the training
objective (the reference implementation defaults to zero basis points). Turnover and
TransactionCost are provided for that evaluation, deliberately separate from
ConditionalValueAtRisk.
Constructors
| Constructor | Summary |
|---|---|
CVaRPortfolioObjective(double alpha) |
Creates the objective. |
Properties
| Property | Summary |
|---|---|
double Alpha { get; } |
Gets the confidence level alpha. |
Methods
| Method | Summary |
|---|---|
T ConditionalValueAtRisk(Vector<T> losses) |
Conditional Value-at-Risk: the mean loss in the worst (1 - alpha) tail. |
T DualObjective(Vector<T> losses, T nu) |
The Rockafellar-Uryasev dual objective at a given threshold nu: nu + 1/(1 - alpha) * mean((Z - nu)+). |
T Loss(Vector<T> weights, Vector<T> returns) |
Per-step portfolio loss L = -(w^T r): the NEGATIVE realized return. |
T OptimalNu(Vector<T> losses) |
The nu minimizing DualObjective, which is the VaR of the sample. |
T TransactionCost(Vector<T> previousWeights, Vector<T> newWeights, double basisPoints) |
Transaction cost of a rebalance, in return units, at the given cost in basis points. |
T Turnover(Vector<T> previousWeights, Vector<T> newWeights) |
One-way turnover between consecutive allocations: 0.5 * sum |w_new - w_old|. |
T ValueAtRisk(Vector<T> losses) |
Value-at-Risk: the alpha-quantile of the loss sample. |
Vector<T> Weights(Vector<T> scores, double temperature) |
Long-only, fully invested weights: softmax(scores / tau). |
Fields
| Field | Summary |
|---|---|
double ConventionalAlpha |
Conventional CVaR confidence level, used as the default. |