| assets | string[] | Column names, in the order the columns appear in `returns`. Defaults to asset_1, asset_2 and so on. Names are carried through to every per-asset figure, so supplying them is what makes a contribution table readable. |
| confidence | number | Confidence level: 0.99 means the 1% tail. The complement convention is the common mistake, and it is wrong by an amount that grows as the tail thins, so the result states the tail probability as well. |
| convention | simple | log | Whether the returns are simple (P/P-1 - 1) or logarithmic (ln(P/P)). They differ by about half the variance and aggregate in opposite directions: log returns add across time, simple returns add across a portfolio. Defaults to simple. |
| copulaDegrees | number | Fix the copula degrees of freedom instead of fitting them. Two reasons to: a stress scenario asks what a heavier joint tail would cost rather than what the sample supports, and the profile likelihood is most of this method's runtime — about twelve seconds on 1,200 observations against under one for the simulation. |
| copulaFamily | gaussian | student-t | Which copula, for 'copula'. Defaults to student-t, whose extra parameter is what lets assets arrive in their tails together; gaussian is the reference it is measured against and has no tail dependence at any correlation below one. |
| copulaMarginal | empirical | extreme-value | Where each asset's own distribution comes from, for 'copula'. Defaults to empirical, under which no single asset's draw can exceed its worst observation, so all the extrapolation is in the dependence; extreme-value splices a fitted generalised Pareto onto each loss tail and puts it back. |
| decay | number | Exponential weight on yesterday's variance, for 'filtered-historical'. Defaults to 0.94, the RiskMetrics figure for daily data. |
| degrees | number | Degrees of freedom for 'student-t'. Above two, because the variance of a t is v/(v-2) and does not exist at or below it. Defaults to 5. The distribution is scaled so its variance is the estimated one. |
| estimator | sample | ledoit-wolf | Covariance estimator, used only when returns are supplied inline. Defaults to ledoit-wolf, whose shrinkage intensity is estimated rather than tuned. Ignored when a handle is passed, since the estimate it carries was already made. |
| handle | string | A handle from estimate_return_moments, in place of `returns`. It carries the mean vector and the covariance matrix rather than the returns themselves, so it serves the parametric methods and cannot serve the ones that read the return path. It expires; estimate again if it does. |
| method | normal | student-t | cornish-fisher | historical | filtered-historical | extreme-value | copula | Which estimator. Defaults to 'normal', which understates the tail of essentially every real return series — it is the default because it is the reference, not because it is the right answer. |
| paths | integer | Simulated paths, for 'copula'. Defaults to 20,000, which costs well under a second; standardError says whether it was enough. |
| periodsPerYear | number | Periods in a year for the data's frequency: 252 for daily trading days, 52 weekly, 12 monthly. Used only to annualise, never to reinterpret the returns. There is no default because the usual 252 is wrong for every frequency but one, and annualising weekly data with it overstates volatility sevenfold. |
| quantileMethod | lower | higher | linear | weibull | How a sample quantile is interpolated, for the historical methods. Defaults to linear. It matters far out in a tail, where the neighbouring order statistics are far apart. |
| returns | number[][] | Periodic returns as decimal fractions, one row per period and one column per asset, in the same column order as `assets`. A 1% gain is 0.01, not 1. Rows must all be the same length. |
| seed | integer | Seed for the 'copula' simulation, so two identical calls agree. Defaults to 0 rather than to randomness, because a tool annotated idempotent that is not is worse than one that admits it. |
| tailFraction | number | Fraction of the sample to fit above, for 'extreme-value'. Defaults to 0.05. Raising it trades the shape's bias for its variance; below about 10 exceedances the fit is refused. The mean excess curve in the result is how to choose it. |
| tailMethod | maximum_likelihood | probability_weighted_moments | How the two tail parameters are estimated, for 'extreme-value'. Maximum likelihood is the default and the only one with a standard error; the moment estimator is steadier on a few dozen exceedances and cannot report a shape at or above one at all. |
| weights | number[] | Portfolio weights, one per asset, in the same order as the columns. They are not normalised: the sum is reported back, and a sum more than 2% away from one is refused, because weights summing to 0.98 are either a cash position or a typo and the two want opposite treatment. Negative weights are short positions. |