Migration guide
This page lists every change that can break code written against an earlier release, and the code to write instead. Each version has its own section. Read the section for the version you upgrade from, and every section after it.
From v0.30 to v0.31
v0.31 is a large release. The changes fall into seven groups, and most code needs at most the first three.
- Names that were removed, and what replaces each.
- Loading prices.
prices_to_returnsnow converts prices and nothing else. Joining, filling and filtering are separate steps. - Asset features. An asset panel, one object that holds every feature of every asset, replaces the feature matrix
Z. - Fees. The fixed fees are charged once per holding period, and
calc_feesreturns a pair. - Renamed keywords and changed defaults.
- Calls that now raise an error where they used to return a value.
- Results that move. These are the configurations whose numbers differ from v0.30, and the reason for each.
Two more sections cover code that extends the library with its own estimators, and links into the documentation.
v0.31 supports Julia 1.11, 1.12 and 1.13.
Names that were removed
| Removed | Write instead |
|---|---|
Imputer, ImputerResult, and the Impute extension | PriceGapFill(; fill = CarriedPrice()) on prices, or MissingDataFilter to drop rather than fill. See Loading prices. |
FeaturePrior | Nothing wraps the prior any more. Put the features on the returns as an asset panel, and select them on the distance. See Asset features. |
RegressionFeatures | FeatureDistance(; ape = RegressionPanel()) |
PhylogenyFeatures | FeatureDistance(; ape = PhylogenyPanel(; pl, alg)) |
AssetSetsFeatures, asset_sets_features, asset_sets_feature_names, resolve_feature_value | panel_input(sets, key) builds the input of one panel field from a UniverseSets key, and asset_panel(inputs) builds the panel. |
Scale | A graded classification is a TensorPanelInput with its own labels. |
MuEllipsoidalUncertaintySet, SigmaEllipsoidalUncertaintySet | MuUncertaintySetClass, SigmaUncertaintySetClass. These are the same tags, renamed because they now also class the norm-ball sets. |
The nz and Z keywords of prices_to_returns, ReturnsResult and PricesResult, and the Z field of LowOrderPrior | The pnl keyword, an AssetPanel. |
The z_src keyword of JuMPOptimiser, HierarchicalOptimiser, NestedClustered and every optimiser that took it | Gone. Features reach a distance through the panel on the returns, or through FeatureDistance(; ape). |
The zkey keyword and field of UniverseSets | Gone. A classification enters through panel_input. |
feature_matrix(ze, pr, X, F, sets) | feature_matrix(pnl) and feature_matrix(pnl, sel) stack an asset panel, and feature_labels names the columns. |
calc_fees(w, p, …), calc_asset_fees(w, p, …) and the other fee methods that take prices | The finite allocation charges its fees inside its own model, on the shares it buys. Read them from DiscreteAllocationResult.fees or GreedyAllocationResult.fees. |
Loading prices
prices_to_returns used to do five jobs with one keyword list: join the factor and benchmark tables onto the assets, collapse to a lower frequency, impute or delete gaps, apply a function, and compute returns. It now computes returns, and each of the other jobs is a named step you compose. The keywords that remain are ret_method and padding, plus a new gap_return_alg.
In v0.30:
rd = prices_to_returns(X, F; B = B, iv = iv, ivpa = ivpa, join_method = :outer, collapse_args = (week, last), missing_col_percent = 0.9, missing_row_percent = 0.9, impute_method = Impute.Interpolate(), map_func = f)In v0.31:
pr = price_ingestion(PriceIngestion(; join_method = :outer, collapse_args = (week, last)), X; F = F, B = B, iv = iv, ivpa = ivpa)#! Keep one of the next two lines: the first drops the assets and rows with too many gaps, the second fills the gaps.mdf = fit_preprocessing(MissingDataFilter(; col_thr = 0.9, row_thr = 0.9), pr)mdf = fit_preprocessing(PriceGapFill(; fill = CarriedPrice()), pr)rd = prices_to_returns(apply_preprocessing(mdf, pr))The one-line form prices_to_returns(X; kwargs...) still works. It ingests the prices with the default PriceIngestion() and passes kwargs to the conversion. The factor, benchmark and implied-volatility tables now go through price_ingestion.
These are the changes to the conversion, and what each one does to a result.
- Gaps are no longer deleted. An asset that lists late, delists, or is suspended stays in the table, with
NaNwhere it had no price. TheReturnsResultholds anAssetPanelwhose two masks say which assets are in the universe at each date, and which of them can be estimated. Every optimiser reads those masks, fits on the assets it can trade, and gives the other assets a weight of exactly zero. So a walk-forward over such a table runs each fold on the assets listed in that fold. v0.30 either dropped the asset from the whole run, or held it after it delisted. On a table with no gaps, nothing changes. - The join is
:leftby default, where it was:outer. A factor or benchmark table with more dates than the assets no longer adds dates to the observations. The ingestion pads it onto the asset dates and reports the padding. PassPriceIngestion(; join_method = :outer)for the old dates. missing_row_percent = nothinghas no counterpart. It kept the columns whose count of missing rows equalled the most common count.MissingDataFilter(; col_thr = 0.0)states the condition that it approximated.map_funchas no counterpart. Apply the function to theTimeArraybefore the ingestion.nan_to_missingis gone, because the ingestion writes every missing price asNaN.- A price of
Infraises an error at the ingestion. In v0.30 it reached the conversion and gave a-100 %return. - A column name that two tables share, or that a table shares with the timestamp column, raises an error. v0.30 matched such columns by position.
If you build a PricesResult or a ReturnsResult by hand, the pnl keyword replaces the nz and Z keywords. PricesResult also gains span, a Boolean matrix that says which assets are listed at each observation, and the conversion reads it.
Asset features
In v0.30 a feature reached a clustering optimiser as a matrix Z and its labels nz, stored on the returns. The z_src keyword of the optimiser chose between the data and a FeaturePrior that made the features. One object replaces all of that. The asset panel is stored on the returns as rd.pnl, and it holds each feature as a named field. A field is numeric, categorical, or a tensor with its own labels.
In v0.30:
rd = prices_to_returns(X; nz = ["nx_sector"], Z = Z)pe = FeaturePrior(; pe = EmpiricalPrior(), ze = AssetSetsFeatures(; vals = ["nx_sector"]), sets = sets)opt = HierarchicalOptimiser(; pe = pe, cle = ClustersEstimator(; de = FeatureDistance()), z_src = :prior)In v0.31:
rd = ReturnsResult(; nx = rd.nx, X = rd.X, ts = rd.ts, pnl = asset_panel([panel_input(sets, "nx_sector")]))opt = HierarchicalOptimiser(; pe = EmpiricalPrior(), cle = ClustersEstimator(; de = FeatureDistance(; sel = ["sector"])))The name of a field built from UniverseSets is the key without its prefix, so "nx_sector" becomes "sector". A numeric feature that you hold as a vector or a matrix is a NumericPanelInput(; name, vals). A graded classification with its own column labels is a TensorPanelInput(; name, vals, axis, labels).
FeatureDistance()with noselstacks every field of the panel.seltakes field names,name => [levels],name => levelorname => :observed. It no longer takes an integer column index, sosel = [3]becomes the name of the column.- The
apekeyword replaces the two feature producers.FeatureDistance(; ape = RegressionPanel())clusters on the factor loadings of the prior's regression.FeatureDistance(; ape = PhylogenyPanel(; pl, alg))clusters on a phylogeny thatPhylogenyPanelbuilds when the distance is computed. - A blank in a feature is
missing,nothingorNaN. The field's fill policy fills it, so no blank reaches the code that reads the panel. The policies areNoPanelFill,ConstantPanelFill,ForwardPanelFillandBackwardPanelFill. The fill policy of a categorical field must name a level.CategoricalPanelInput(; alg = ForwardPanelFill())without a value raises an error. The table of calls that now raise gives the v0.30 behaviour. feature_matrix(pnl)stacks a panel, andfeature_labels(pnl)names its columns. The labels are also a selector, sofeature_matrix(pnl, feature_labels(pnl))builds the same matrix again.
Fees
v0.31 changes when each fee is charged. The proportional fees l and s and the turnover fee tn are charged on every observation. The fixed fees fl and fs are charged once for the holding period. v0.30 charged the fixed fees on every observation and the turnover fee once, so a fold of T rows paid a fixed fee T times. Any backtest with a fixed fee reports a different net return.
calc_fees(w, fees)is nowcalc_fees(w, T, fees), and it returns the pair(periodic, one_off). The one number that a caller used to read iscalc_total_fees(w, T, fees), the cost of the whole holding period.calc_total_asset_feesgives the same cost per asset. On one observation,calc_total_fees(w, 1, fees)gives the old sum whenfees.faisnothing.Fees(; fa = AmortisedFees())spreads the one-off charge over the period instead.FirstObservationFees()andnothingcharge it on the first observation. A cross-validation scheme's ownfaoverrides the fee'sfaon each fold's return series.FeesandFeesEstimatorgainlqandflq, a proportional and a fixed charge on the position of an asset that leaves the universe during a fold. Each one is aTurnoverstated over the full universe. A walk-forward over a delisting reports a return that is lower by the liquidation charge of each exit.- The finite allocations,
DiscreteAllocationandGreedyAllocation, price their fees on the shares they buy, inside their own models. Thecalc_fees(w, p, …)methods that took prices are deleted, and thefeesfield of the result holds the charge.
Renamed keywords and changed defaults
| Where | v0.30 | v0.31 |
|---|---|---|
UniverseSets | fkey, ufkey | tfkey, utfkey (time-series factors). cfkey, ucfkey (cross-sectional factors) and nikey (assets that left the universe) are new. The default key strings are unchanged, so a dict built for v0.30 still resolves. |
ConditionalValueatRiskRange and every other …Range measure | beta = 0.05 regardless of alpha | beta = alpha. A call that states alpha and not beta now gets a symmetric range. State both to keep the old measure. |
RelativisticValueatRiskRange | kappa_b = 0.3 | kappa_b = kappa_a, likewise. |
RegimeAdjustedExpWeightedVariance | regime_lohi_mult = (0.7, 1.6), but the clamp never ran | regime_lohi_mult = nothing. An estimator built with the defaults returns the same variance. A caller who set the bounds now gets the clamp they asked for, and a different variance. |
RegimeAdjustedExpWeightedVariance | A covariance estimator | A variance estimator, with std. You can still pass it to every ve keyword. A call of cov or cor on it throws a MethodError, and RegimeAdjustedExpWeightedCovariance is the covariance form. |
PriceIngestion (was prices_to_returns) | join_method = :outer | join_method = :left |
ResourceLimits | No such keyword | max_ep_grid = 10_000 caps the K of a grid entropy-pooling view. A larger K raises an error at construction. |
| Printing | A field holding nothing printed as w ┴ nothing | The field is hidden. PortfolioOptimisers.set_show_nothing_fields!(true) restores it. |
PredictionReturnsResult | iv, ivpa documented as "investment vehicle" | Documented as implied volatility. The fields did not change. |
Calls that now raise
In v0.30 each of these calls returned a value that did not follow the configuration. In v0.31 each call raises an error that names the cause and, where one exists, the fix, or it does what the table says.
| Call | v0.30 | v0.31 |
|---|---|---|
A moment estimator (cov, mean, …) on a sample that contains NaN | Some estimators passed the NaN into the result, some raised an error from inside LAPACK, and GerberIQCovariance spread it into the other assets | An IsNonFiniteError that gives the count and the first position of the non-finite entries. Use an estimator of the exponentially weighted family (ExpWeightedExpectedReturns, ExpWeightedVariance, ExpWeightedCovariance), which handles a masked sample. You can also put a CoveragePolicy on the estimator, or let the prior fit on the assets that have a price at every row of the window, which is the default. |
A bound vector shorter than the universe on WeightBounds | Assets past the end were unbounded | DimensionMismatch |
WeightBounds(; lb = Inf) or (; ub = -Inf) | The infinite bound became the free bound of its side, so the tightest bound became the loosest | The bound keeps the value you give it. |
risk_budget_constraints with a vector for the :rkb target | Accepted | MethodError. The target takes a scalar. |
JuMPOptimiser with an empty l2, lp or lpc vector | Silent no-op | ArgumentError |
ShrunkExpectedReturns on a degenerate sample | NaN, or a wrong-signed coefficient | DomainError |
SmythBrobyCovariance with a negative severity exponent | Accepted | DomainError |
A dimension-reduction regression whose maxoutdim equals the factor count | A bare LAPACK error from inside the fit | DomainError naming maxoutdim and the factor count |
A Black-Litterman view set in which no name resolves, under strict = false | FieldError | An IsNothingError that names the universe and the strict keyword |
An entropy-pooling covariance or correlation view that names an unknown asset, under strict = false | Raised an error whose message named an empty equation | The view drops the row and reports it, as the linear views already did |
CategoricalPanelInput(; alg = ForwardPanelFill()) | Made up a level "0.0" | ArgumentError. Name the level. |
A walk-forward with test_size = 0 | Ran forever | ArgumentError |
A hyperparameter search key on a Pipeline that does not start with steps | Silently matched nothing | ArgumentError |
| A calibration rule that reads the sample length under a dynamic observation weight | MethodError | ObservationWeightsError |
A price of Inf, or a column name that two price tables share | A -100 % return for the price, and a match by position for the name | DomainError for the price, and ArgumentError for the name |
A predict on a fold that still holds an asset with a missing return | The NaN propagated | The weight of that asset goes to cash for that row, and the fold warns once. strict = true on the scheme makes it an ArgumentError. |
Results that move
A result from v0.30 is approximate where a correction moved a number, and wrong where the old answer did not follow the configuration. Recompute any of the following.
These results were wrong in v0.30:
AugmentedBlackLittermanPriorin any configuration, because the prior added the regression intercept twice.FactorBlackLittermanPriorandAugmentedBlackLittermanPriorwith a non-zerorfare approximate.- An entropy-pooling value-at-risk view whose coefficient is not one selected the wrong tail. A view with a target of
0was dropped with no warning.OptimEntropyPoolingignored asc1other than the default. WeightBoundswith an infinite scalar bound, or a vector bound shorter than the universe (now an error, see the table above).- A weighted pipeline holding
ImpliedVolatilityRegressioncomputed the realised volatility unweighted. - A hyperparameter search over
"opti[1].opt.l2". The penalty never entered the model, and the search reported success. - The effective-asset norm ceiling at any
p != 2. The ceiling was weaker than asked. distance_wei, the private shortest-path function of DBHT, returned a wrong edge count for each path inB, its second output. DBHT uses only the path lengths, and this defect moved no cluster. Three more DBHT defects moved clusters on a tie and on a repeated call.- A
KFoldrun through the Pipeline passed the weights of the previous fold to the next fold, where a run of the optimiser alone did not.FeesEstimator.tnpassed the turnover through unchanged, so every fold charged the turnover fee against old reference weights. MultipleRandomisedwith a seed draws different subsets, because it now draws from the assets listed in each window.
These results were approximate in v0.30:
- A moment estimator with observation weights (
SimpleVariance,Covariance,Coskewness,Cokurtosis) now weights its centre as well as its spread. - A co-movement matrix of the Gerber or Smyth-Broby kind has a diagonal of ones, and a return of exactly zero at a zero band edge is neutral rather than a crossing.
GerberIQCovarianceunderGerber2now reads the bound for each pair.- The library widens a histogram edge by one ulp rather than by
eps. So mutual information, and every caller ofcalc_hist_dataon standardised data, prices or levels, moves in the last digits. coron an implied-volatility estimator,collapse_featureswithMedianCollapseover a narrow element type, and the output element type ofpre_orderwith a custom traversal strategy.- A weighted
RelativisticValueatRisk, its range, and the two relativistic drawdown measures. - A
Feesresolved from aFeesEstimatorcarrying a non-defaultkwargs. - An upper-bound
GridRelativisticValueatRiskView. - An
EntropyPoolingPriorover aFactorPriorwith aStepwiseRegression. The nested prior now fits first, so it selects the same factors as theFactorPrioralone. - Every backtest with a fixed fee, a turnover fee, or a delisting. See Fees.
- A walk-forward search (
GridSearchCrossValidation,RandomisedSearchCrossValidation) over an optimiser with aTimeDependentschedule, or with aTurnover, tracking or fee term that reads the previous weights. The search now scores each candidate with one run of its folds in order, and no longer fits each fold on its own. - A walk-forward in which a fold failed and a later fold read the previous weights. The later fold now reads the last solved fold's weights instead of raising an error.
These results keep their numbers, but their meaning changed:
- The
Maxand log-sum-exp scalarisers put an upper bound onmodel[:risk], somodel[:risk]is not the aggregate. Read the exact value withexpected_risk. - The order-
peffective number of assets behind anlpcceiling is(sum_i |w_i|^p)^(1/(1 - p)), where v0.30 used1 / sum_i |w_i|^p. To ask for at leastmsuch assets, setval = m^(1/p - 1), notm^(-1/p). res.fbon an optimisation result holds the fallbacks that failed before the answer, as(estimator, result)pairs. In v0.30 it was alwaysnothing.- Every optimisation result has
imsk, the assets it was allowed to trade. On a table with no gaps it is alltrue.
If you extend the library
- A prior estimator's method on a returns matrix takes the asset panel as its third positional argument. The signature is
prior(pe, X, F = nothing, pnl = nothing; kwargs...). When you pass aReturnsResult, the library calls this method with all three arguments. A method that takes only two arguments raises aMethodError. Give it a third argument, even one it ignores. - An uncertainty-set estimator for which
reads_prior_resultreturnstruereceives anrdkeyword, which it can ignore. LowOrderPrior.rrnow takes anAbstractLoadingsRegressionResult. A regression result that is anAbstractRegressionResultbut not a loadings result raises aMethodErrorwhen you store it there.Regressiongains a fourth field,esigma, the idiosyncratic variances, when the regression is fitted withrsd = true. Code that constructs or compares it by position must handle the extra field.SubsetResamplingResult,NestedClusteredResultandStackingResulthaveimskbeforefb. Keyword construction is unaffected.- Weight bounds are validated against the stated asset count with
DimensionMismatch, so a constraint generator outside the library that relied on truncation now raises an error.
Links into the documentation
The API pages follow the new source layout, and each source file has a public page under public_api/ and a private page under private_api/. The build writes no page under api/, and a bookmark into api/24_Plotting, api/25_Aliases, api/19_RiskMeasures or api/20_Optimisation on the stable site finds no page. The public pages are now public_api/22_Plotting, public_api/23_Aliases, and the directories public_api/16_RiskMeasures and public_api/17_Optimisation. Find a page from the API introduction rather than by its number.
From v0.31 to v0.32
v0.32 adds the online portfolio selection family. It also removes OnlineStep, the ff keyword, the ddof keyword of LInfNorm, the dims keyword of every call on a ReturnsResult or a prior result, and some unexported functions. It gives the naive optimisers a fees field and adds fields to some results. The rank statistics give a tie its mean rank. Some calls that ran in v0.31 now raise an error, some calls that raised now answer, and the results in Results that move change.
Names that were removed
| Removed | Write instead |
|---|---|
OnlineStep, and the ff keyword of IndexWalkForward and DateWalkForward | The online step is a scheme wrapped in Online, and each scheme has its own constructor. OnlineIndexWalkForward(train_size, test_size; …) and OnlineDateWalkForward(train_size, test_size; …) take every keyword of the plain scheme except expand_train, which an online run sets. IndexWalkForward(60, 1; ff = OnlineStep()) becomes OnlineIndexWalkForward(60, 1). An Online(cv) that you write by hand on a scheme raises an error that names the three constructors. |
The derived expand_train, which was nothing on the two walk-forwards | expand_train is a plain Bool keyword again, false by default, as in v0.30. |
fold_fit, cv_online_info, cv_resume_info (unexported) | Nothing replaces them. The fold loop reads the type of the scheme to decide whether it steps online. |
The ddof keyword and field of LInfNorm | LInfNorm(). The largest single-period difference carries no degrees of freedom, so the norm is not scaled. LInfNorm(; ddof = 1) raises a MethodError. |
The dims keyword of optimise on every optimiser, of prior, ucs, mu_ucs and sigma_ucs on a ReturnsResult, and of clusterise, phylogeny_matrix, phylogeny_constraints, centrality_vector, average_centrality, asset_phylogeny, centrality_constraints, plot_dendrogram and plot_clusters on a prior result | Nothing. A ReturnsResult and a prior result hold the observations along the rows, so dims = 1 is the one correct value. These calls ignore a dims that you pass. A method that takes a matrix keeps dims. |
find_complete_indices (unexported) | CompleteAssetSelector keeps the assets with no gap, and MissingDataFilter drops rows and columns. The function counted a column with an Inf as complete. |
assert_returns_result_dims (unexported) | Nothing replaces it, because no call takes dims on a ReturnsResult. |
has_X, get_X, has_Xap1, get_Xap1, has_ddap1, get_ddap1, has_dd, get_dd and set_asset_neg_returns_plus_one! (unexported) | Keep the value that the builder of the entry returns. For the negated returns, pass -X to set_asset_returns_plus_one! under a prefix of your own. No code in the library called these functions. |
Renamed keywords and changed defaults
- The naive optimisers charge fees.
EqualWeighted,InverseVolatility,RandomWeightedandPreviousWeightstakefees, andNaiveOptimisationResultstores it. The keyword constructor does not change. The positional constructor ofNaiveOptimisationResulttakesfeesas its third argument,NaiveOptimisationResult(pr, wb, fees, retcode, w, imsk, fb). PerformanceSummaryResulthas four more fields,excess_ret,tracking_error,information_ratioandturnover, so its positional constructor takes sixteen arguments.performance_summarytakes abenchmarkand fills the first three. Without a benchmark they areNaN, andturnoverisnothingunless the result holds the path of the weights.plot_performance_summaryis one method over an array, anOptimisationResultor a prediction result, withbenchmarkas a keyword. v0.31 had six methods with different numbers of arguments. Every call written against v0.31 still works.- The
optargument of the risk-measure builders is aRiskConstraintOwner, which is a JuMP optimiser or aProgrammeAllocationSet. Every method keeps its argument list, and a method that you added under the old type bound still dispatches. LpNormdefaults toddof = 1, where v0.31 used0. SoLpNorm(; p = 2)equalsL2Norm(). AtT = 252the factor ofLpNorm()is251^(1/3), not252^(1/3). Stateddof = 0to keep the v0.31 error.L1Normgains addofkeyword whose default0keeps the v0.31 factorT.GridEntropicValueatRiskViewandGridRelativisticValueatRiskViewtakeM = 1, where v0.31 used10.Mnow multiplies the smallest constant that releases each row, so it must be at least1.- An upper bound over several assets on an EVaR or RLVaR view, and an equality below the prior value, take the sequential formulation when
alg = nothing. v0.31 sent them to the grid, which holds one asset, so the view raised anArgumentError. A group lower bound stays conic. plot_histogram(…; reference = true)draws the pdf of the Normal fitted to the returns, andreference = falsedraws no curve. v0.31 drew a kernel density under the label "Normal" fortrue, and the Normal forfalse.plot_factor_risk_contributionnames its last bar "Off-factor", where v0.31 named it "Constant". The factor names apply only when they count the columns of the loadings. Otherwise the bars are numbered.plot_performance_summarydraws four more bars: the excess return, the tracking error, the information ratio and the turnover.- The rank statistics give a tie its mean rank.
forecast_evaluation,exposure_ic,exposure_ic_summary,idio_vol_icandidio_vol_residual_dependencetaketies = :averageby default, andforecast_ic,forecast_factor_correlationand the:rankbook offorecast_portfolioread thetiesof the evaluation. v0.31 ranked a tie by the order of the assets, so a constant forecast scored a Spearman coefficient of1or-1. Stateties = :ordinalto keep the v0.31 numbers. covariance_forecast_comparecaps its defaultlagsat the number of steps less one. So a run with fewer steps than the horizon no longer refuses its own default.- A finite allocation below a unit budget splits the cash by the new collateral algorithm,
ProceedsCollateralby default. See Results that move. - The keyword
Nof the plots that keep the largest assets counts the effective number of assets from the shares of the magnitudes. So the count no longer changes when you scale the weights.
Calls that now raise
In v0.31 each of these calls returned a value that did not follow the configuration, or raised an error that did not name the cause. In v0.32 each call raises an error that names the cause.
| Call | v0.31 | v0.32 |
|---|---|---|
cross_val_predict on HierarchicalRiskParity, HierarchicalEqualRiskContribution or SchurComplementHierarchicalRiskParity whose opt.pe is a prior result | Every fold used the prior of the full sample, so each fold read its own test rows. Under KFold all five folds gave the same weights. | ArgumentError. Give an estimator, such as EmpiricalPrior(), so each fold fits its own prior. |
search_cross_validation on an optimiser whose prior is a prior result, or a grid that writes one | The search scored every candidate on the prior of the full sample | ArgumentError, before any candidate is scored |
A TimeDependent schedule whose entries or default hold a prior result, in the fold loop | Accepted, and every fold read the full-sample prior | ArgumentError. A callable schedule still runs. |
A walk-forward on a Frontier sweep with a term that reads the previous weights, such as Turnover(; w) | Ran, and charged every fold against the stated w, because no one portfolio of the sweep is the previous one | ArgumentError. A fixed = true turnover still runs. |
GridEntropicValueatRiskView(; M) or GridRelativisticValueatRiskView(; M) with M < 1 | Accepted | DomainError |
ExpWeightedExpectedReturns, ExpWeightedVariance, ExpWeightedCovariance, RegimeAdjustedExpWeightedVariance or RegimeAdjustedExpWeightedCovariance with a decay outside (0, 1) | decay > 1 was accepted, and the estimate could be negative. On one example, decay = 1.5 gave the variances -1.5e12 and -1.24e12. decay = 1 raised InexactError: Int64(Inf), and a negative decay raised a DomainError of log2 that did not name decay. | DomainError that names decay |
Fees with a tn, lq or flq whose val is not finite | Accepted. Inf gave a model with an infinite coefficient and NaN weights. | DomainError that names the field |
GridSearchCrossValidation or RandomisedSearchCrossValidation with an empty vector of values, such as "opt.l1" => Float64[] | The search fitted nothing, and it raised an error that said that every candidate failed | IsEmptyError that names the key, before the search builds the grid |
AssetPanel whose fields derive one column name of the feature matrix twice, such as "beta=size" beside a tensor field beta with the label size | panel_feature_matrix gave the name twice | ArgumentError that names the column and both fields |
ReturnsResult(; X, nb) with no B | Accepted | IsNothingError that names nb and B |
UncertaintySetVariance with a sigma that is not square | Accepted, and a box set ran | DimensionMismatch, as Variance gives |
DistributionallyRobustConditionalValueatRisk(; w) with a negative or non-finite weight | Accepted | DomainError |
prior(CrossSectionalFactorPrior(…), rd) whose regression fits an intercept | Accepted. mu, sigma and the scenarios dropped the share of the intercept. | ArgumentError that names the remedy |
cross_sectional_factor_sets with a factor label that starts with a key prefix of the universe, or that equals its nikey | A label such as "ni" became an axis. Other labels gave an unrelated DimensionMismatch or KeyError. | ArgumentError that names the label |
IntegerPhylogeny in the frc_ple of FactorRiskContribution when the asset bounds are nothing or not finite | The phylogeny had no effect | ArgumentError. With finite bounds the phylogeny now binds the factor weights, and it needs a MIP solver. |
ResidualInflation with no dof on a hand-built Regression that records no edof | The radius took a count of degrees of freedom from the type of the block | IsNothingError |
MissingDataFilter applied to a window that lacks a fitted asset | The filter dropped the asset with no error | ArgumentError |
merge_states of two returns buffers with different caps | Merged to the smaller cap | ArgumentError |
PriceIngestion(; join_method) with :right or a misspelt symbol | Accepted. :right let a covariate set the clock. | ArgumentError |
panel_dataframe on a panel whose field name or asset name equals a column that the table writes, such as "asset" or "observation" | The table replaced the column with no error | ArgumentError that names the column |
A Pipeline with a capped Online prior two levels down, such as opt.pe.pe, after a PriceGapFill step | Ran, although the same prior one level down raised an error | ArgumentError |
partial_fit! on a Pipeline whose Online step no warm-up resolved | The step dropped the wrapper and its cap. Online(EmpiricalPrior(); max_history = 30) folded 80 rows. | ArgumentError |
plot_rolling_drawdowns with a window longer than the series | Drew an empty plot | DomainError |
RollingLogReturn, Reversal, RollingMax or MaxReturn on returns that hold an infinite value | Accepted. RollingLogReturn gave NaN in every later window, also in a window that does not hold the infinite return, and RollingMax gave Inf. | DomainError that names the observation and the asset |
EWResidualVolatility(; beta_half_life = Inf) | DomainError that named half_life | DomainError that names beta_half_life |
factor_family_basis when the dropped member of a family has a zero benchmark-weighted exposure | DivideError on Rational data, and on floating-point data an IsNonFiniteError that did not name the member | IsNonFiniteError that names the member, the family and the observation |
PredictionReturnsResult(; iv) with no X | MethodError | IsNothingError that names X and iv |
Calls that now answer
| Call | v0.31 | v0.32 |
|---|---|---|
A library estimator that holds a bare StatsBase covariance estimator, such as Covariance(; ce = SimpleCovariance()), inside a prior or an optimiser | MethodError, because the bare estimator refused the library's keywords and the asset panel | Runs. A working path keeps its numbers. |
ExpWeightedExpectedReturns, ExpWeightedVariance, ExpWeightedCovariance or one of the two regime-adjusted forms on a transposed sample with an asset panel, dims = 2 | DimensionMismatch | The same answer as dims = 1 |
An upper bound over several assets on an EVaR or RLVaR view, with alg = nothing | ArgumentError | The sequential formulation meets the view. |
| An upper-bound grid EVaR view at half the prior value | On a 100-row example, a DomainError on the posterior weights | The posterior meets the bound to 1e-10. |
optimise(opt, rd; dims = 2) on EqualWeighted, RandomWeighted or a hierarchical optimiser, and plot_dendrogram or plot_clusters on a prior result with dims = 2 | ConflictingArgumentError, DimensionMismatch or BoundsError | The call ignores dims, and it gives the answer of dims = 1. |
Integer returns in HierarchicalRiskParity, HierarchicalEqualRiskContribution, SchurComplementHierarchicalRiskParity, InverseVolatility, EqualWeighted, RandomWeighted, PreviousWeights, the three exponentially weighted moment estimators, RegimeAdjustedExpWeightedVariance, RegimeAdjustedExpWeightedCovariance, phylogeny_features, factor_model_summary, the exposure, regression and idiosyncratic diagnostics, CrossSectionalFactorPrior, factor_family_basis and OrthogonalUncertaintySet. In descriptor: the rolling Descriptors, such as RollingLogReturn and RollingMax, EWMean and the named Descriptors that it builds, such as EWMomentum, EWMarketBeta with agg_obs > 1, and EWMacroSensitivity, also with an integer ref | InexactError, or MethodError for eps(::Type{Int64}) | The answer of the Float64 copy of the data. Float32 data stays Float32. |
An optimiser whose fallback fb is a precomputed result, such as fb = optimise(EqualWeighted(), rd), when the first solve fails | MethodError | The fallback returns that result. A failed precomputed result ends the chain. |
MonotonicSchurComplement on a bracket narrower than about 0.18 * tol | The search did not iterate. It warned that it did not converge, or it raised under strict = true. | The search stops when the bracket is at most tol wide. |
feature_matrix(…, rows) with a Bool mask | DimensionMismatch | The stack holds the rows where the mask is true. |
| The compact covariance uncertainty set on a singular covariance | PosDefException | Runs, as Variance does |
mean(StandardDeviationExpectedReturns(SimpleCovariance()), X), the same for VarianceExpectedReturns, and either one inside EmpiricalPrior(; me = …) | MethodError | Runs |
covariance_forecast_evaluation of a PortfolioOptimisersCovariance or CorrelationCovariance that holds a StatsBase estimator | MethodError | Runs |
covariance_forecast_summary on a one-step evaluation, or on a step with a NaN standardised return | ArgumentError about quantiles in the presence of NaN | The bias columns are NaN. |
FactorRiskContribution with an estimator in frc_ple, when optimise receives a keyword that the optimiser does not read | MethodError | Runs |
FactorRiskContribution with a vector frc_ple | The model solved, then a TypeError stopped the result | Runs, and frc_plr holds the vector |
An sgcarde whose column count equals the row count of sgmtx when the row count does not, or on an optimiser where an asset is not investable | DimensionMismatch | Runs. An asset that departed removes a column of sgmtx, not a sub-group. |
A vector sglt or sgst with no card or gcard | MethodError | Runs |
NearestQuantilePrediction, sort_by_measure, quantile_by_measure, expected_risk(r, ppred) or rolling_window_measure(r, ppred, window) on a PopulationPredictionResult of single-fold PredictionResults | FieldError or MethodError | Runs. Each member takes its own method. |
train_test_split or TrainTestSplit with a Rational fraction, such as train_size = 1 // 5 | MethodError | Runs |
MissingDataFilter with a vector ivpa and no iv, when the filter drops a column | DimensionMismatch | Runs |
merge_states of the empty sample buffer that an Online wrapper seeds with a folded buffer, and port_opt_view of an empty buffer | DimensionMismatch or BoundsError | A copy of the folded buffer, and a view |
price_ingestion on a table of Union{Missing, Rational{Int}} that holds no missing | DomainError | Runs |
A price_ingestion collapse whose timestamp function makes new timestamps, on a time-varying panel | ArgumentError | Runs |
linear_constraints with a group that sheds every member while the other side is not empty | BoundsError | Runs |
predict of a Frontier optimisation on a ReturnsResult with iv and no ivpa, and PredictionReturnsResult with one iv vector for each member and no ivpa | MethodError | Runs. The iv of each member is iv * (abs.(w) / sum(abs, w)). |
CrossSectionalFactorPrior(; neutralise) with a Symbol target, such as "size" => :value | The constructor accepted it, and the fit raised a MethodError | The answer of the String target |
plot_factor_mu, plot_factor_sigma, plot_factor_forecast_correlation and plot_factor_forecast_volatilities on a HighOrderPrior over a FactorPrior | FieldError | Runs |
plot_composition of a prediction with a masked fold, plot_dendrogram and plot_clusters on a prior with gaps, plot_measures on a PredictionResult, and plot_asset_cumulative_returns(…; N = 0.5) | An error. A masked fold gave a BoundsError, a prior with gaps an IsNonFiniteError, and a fractional N a TypeError. | Runs |
Results that move
These results were wrong in v0.31:
- An
LInfNormtracking error divided the largest difference byT - ddof. With 252 rows,err = 2e-2let one day differ by5.04, so the bound did not bind. The error is now the largest difference, anderris the bound on one period. MonotonicSchurComplementreturned the weights of agammaother than the one it reported. The difference reached8e-6in a weight. The bisection also returned the weights of a midpoint that it rejected.SchurComplementHierarchicalRiskParitydropped its fee. The result had nofeesfield, socalc_net_returnsgave the gross return, and a fold charged no forced exit. The result now carries the fee.- After
factory, the skewness term of aVarianceSkewKurtosishad scale1and no floor, soexpected_riskof the stored measure did not match the model. The weights did not move. IntegerConditionalValueatRiskViewdid not reach the posterior of least divergence. On a 60-row example, the divergence falls from0.0189to0.0175for an upper bound, and from0.0858to0.0415for an equality. The view now warns when its window ofsbarlosses binds.- An
IterativeWeightFinaliserthat stalled or diverged reported success with weights that broke the bounds. It now returns the Euclidean projection of its input. A bound set that cannot hold the budget now fails, so the fallback chain runs. - A walk-forward that charged a turnover fee on a naive optimiser priced the fee against the reference weights
wof itsTurnoveron every fold, never against the weights that the fold held. Buy-and-hold paid the most, and a constant rebalanced portfolio paid nothing. The fee is now charged against the previous weights that the fold loop passes on. The first fold's fee is the trade from those reference weights. optimise(opt, rd; dims = 2)onMeanRisk,InverseVolatilityor another optimiser that fits a prior fitted the prior on the transpose, and gave one weight per observation.prior(pe, rd; dims = 2)and the clustering calls on a prior result also read the transpose. Nowdimshas no effect.- Under
MaximumRatio, the squared L2 penalty ofRSOCRiskExpr,SquaredSOCRiskExprandQuadRiskExprscaled ask^2 ‖w‖^2, so its strength moved withohf. The weights moved by0.25betweenohfand10 ohf. The penalty is nowk ‖w‖^2, of degree one, as every other penalty is. - With a fee, a moment risk measure whose target is per asset centred the net returns on the gross mean, so each deviation carried the mean fee. A target is per asset when you state a
muvector, or whenfactoryfills the prior mean. The target now subtracts the mean fee of each period, in the model and in the functor. This covers the low- and high-order moments,Kurtosis,MedianAbsoluteDeviation, the third central moment and the skewness. LowOrderMoment(; w, alg = SecondMoment()),HighOrderMomentwith a standardised algorithm andSkewness(; w)did not passwto their variance estimator. So the functor ignored the weights in the variance. On one example it gave2.7574, and the optimiser gave2.9726.expected_riskof aRiskTrackingRiskMeasurewithIndependentVariableTrackingand a fee charged the fee ofw - wb, which is zero atwb, while the model charged the fee ofw. WithFees(; l = 0.002)and a CVaR atw = wb, the functor gave about0and the model0.002. The functor now reads the series of the model. The weights do not move.- A
SemiDefinitePhylogenydropped its penaltyp tr(W)when any variance was in the model. It now drops the penalty only when the objective minimises that variance:MinimumRisk,MaximumUtilitywithl > 0, and the return form ofMaximumRatio. A variance ceiling,MaximumReturn,MaximumUtilitywithl = 0and the risk form ofMaximumRatiokeep the penalty, so their weights move. The same rule now holds for aSemiDefinitePhylogenyin thefrc_pleofFactorRiskContribution, which v0.31 always penalised. - A
RiskTrackingRiskMeasurewithDependentVariableTrackingof a semidefiniteVariance, and a dependentRiskTrackingError, built the tracking variance on a second lifted matrix, which the rows of aSemiDefinitePhylogenydid not bind. The tracking variance now reads the lifted matrix of the optimiser. - An
IntegerPhylogenyin thefrc_pleofFactorRiskContributionhad no effect. It now binds the factor weights. - Under
FactorRiskContribution(; flag = true), the variance read the factor partb1 * w1alone and omitted the off-factor weights. On one example the model value was 43 % below the variance of the returned weights. The variance now covers the whole decision vector. - Under
RelaxedRiskBudgetingwithFactorRiskBudgeting(; flag = true), the relaxed risk pricedb1 * w1alone. On one examplepsiwas0.219, and the standard deviation of the weights was1.88. The marginal risks now read the asset weights. RelaxedRiskBudgetingwith aRiskBudgetwhose values do not sum to one did not meet the budget.RiskBudget(; val = 20:-1:1)gave contribution ratios from0.19to1.64against a target of20. The cones now readval / sum(val).- Under
MaximumRatio, an upper bound on the compact covariance uncertainty set bounded the worst-case variance byub / k, so a bound thatMaximumReturnmeets made the model infeasible. The set now bounds the square root bysqrt(ub). - When
smtxandsgmtxwere the same matrix, the model ignoredsgltandsgst. It now keeps them unless they are the same objects assltandsst. risk_contributionof a vector of risk measures underMaxScalariserorMinScalarisertook the wrong measure when the measures had different degrees. The chain-rule weights now come from the scaled risks, and the log-sum-exp contributions move too.SumScalariserdoes not move.- The Laplace z-score of a parametric
ValueatRiskRangewas wrong. Atbeta = 0.05it was-0.454where the quantile of the unit-variance Laplace is-1.628, so the range was about2.08standard deviations in place of3.26. The lower tail atalpha > 1/2was also wrong. - The empirical
ValueatRisk,ValueatRiskRange,DrawdownatRiskandRelativeDrawdownatRisktook the order statisticceil(alpha T). Whenalpha Trounds above an integer, as0.07 × 100does, the functor returned the 8th smallest return and the MIP model the 7th. The functor now takes the order statistic of the model. HierarchicalEqualRiskContributionchose the nodes above the cut by their height. When two heights tied at the cut, every weight wasNaN, and the result was a failure. It now takes the nodes thatcutreeleaves. UnderLogSumExpScalariserthe shares inside a cluster did not sum to one, and atgamma = 1e-3the weights moved by up to5.6e-3.- DBHT clustering turned
Inf * 0intoNaNwhere two vertices have no path, and then chose theNaN. The bubble assignment and the tree move on such a network. ExpWeightedCovariance, andRegimeAdjustedExpWeightedCovariancewith one decay, let the variance of an asset decay on a holiday of another asset while their covariance stayed. So the estimate was not positive semidefinite. Two equal series, one of them with five holidays, gave an implied correlation of2.37underExpWeightedCovarianceand2.44under the regime-adjusted form. Each asset now ages its observations on its own clock, and a holiday holds the correlation of each pair that contains its asset. A sample with no holiday keeps its numbers.RegimeAdjustedExpWeightedCovariancewith a separatecor_decaydivided each pair by its own count of common observations. With holidays, the smallest eigenvalue reached-0.1075times the largest entry. A holiday now holds the correlation of each pair that contains its asset. A sample with no holiday keeps its numbers.IdiosyncraticVarianceScalingread only the diagonal of a full idiosyncratic covariance, which aCrossSectionalFactorPriorwithth != 0writes. On a six-asset example with a correlatedesigma, the scaling missed the full covariance by0.0032. It now reads the whole matrix.- A
PreviousWeightsfallback kept its wholewunder an asset subset. So a cluster ofNestedClustered, or the asset subset ofMultipleRandomisedorSubsetResampling, whose solve failed gave weights of the wrong length. A view now slicesw,feesandfb, and it does not rescale the slice. DiscreteAllocationhad three defects. It multiplied the weights of a side by the cash of the side, which already held the budget of the side. So when a side budgetbis not1, the targets summed tob^2times the cash. The two relative formulations boundedx C / (w p) - 1, wherexis the count of shares,pthe price,wthe weight andCthe cash. The correct relative error isx p / (w C) - 1. The relative objective added a unitless error to the cash. Onw = [0.4, 0.4],p = [10, 100]andcash = 1250, it bought[40, 4]where the exact book is[50, 5].- Below a unit budget, the long side of a finite allocation took the cash that the short side did not use. So a book could spend more than its cash. On
[1.2, -0.5]a book spent170of a cash of100, and a market-neutral book became all long. When the short side paid a fee, the long side also received an excess of twice that fee. The defaultProceedsCollateralnow bounds the net money, andCashCollateralbounds the gross money. GreedyAllocationbought an asset with a zero target weight when its first pass bought nothing, and a side whose targets are all zero gaveNaNshares and cash.- A fixed fee on a MIP optimiser charged the binary variable, which does not scale with
k, so underMaximumRatiothe weights depended onohf. The fee now charges the binary timesk. A fee with fixed terms alone did not reach the net returns, so a risk measure on the net returns did not see it. prices_to_returnslet the gap-return algorithm of the caller overwrite the-1,-InfandInfreturns next to an observed zero price. Those cells read two observed prices, and the algorithm no longer writes them.CatchUpGapReturnwrites the same values as before.prices_to_returns(…; padding = true)on a view of aListingSpanmade the first return row active for an asset listed before the window, with aNaNreturn. The row is now inactive.PriceGapFillwithCarriedPricecarried a price across an absence in the span of the caller, and across an absence at the end of the training window. So the return after the gap was an active move across the absence. An absence now clears the carry.- A
price_ingestioncollapse such as(Dates.week, first, last)took the prices of each period from its last row, but the values of the panel fields from its first row. Each period now takes the values of its last row. MissingDataFilterdropped a row whose share of missing assets equalsrow_thr, and aFloat32col_thrdropped a column at its threshold. The apply step kept the column order of the window, not the fitted order.train_test_splitandTrainTestSplitwith a fraction lost a row to round-off. For example,train_size = 0.29on 100 rows gave 28 rows. The count is now the largestnwithn / N <= s.merge_statesof two capped returns buffers trimmedXtomax_history, but nottsorB.panel_dataframeshared memory with the panel in the static long layout, so a write to the table changed the panel. It now copies.- Under
ResetCoverage, the semi-covariance, the coskewness and the cokurtosis gave the answer ofDecayCoverage. They now drop the history before the last delisting. - The online answer of a
HighOrderPriorEstimatorrefitted a co-moment that does not fold over the capped or zero-filledpr.X. Under a cap of 25 scenarios on 80 rows, the coskewness missed the batch fit by 24 %. It now refits over the rows that the embedded prior folded. linear_constraintsread only the first two factors of a product:"2*3*x <= 1"lostx, and"2*x*3 <= 1"gave2x.UniformValuesunderdatatype = Rational{Int}gave6004799503160661//18014398509481984for1//3.covariance_forecast_evaluationof a prior centred the test rows on themuthat the prior publishes. For anEmpiricalPriorwhosemeshrinks the mean, this read a bias that the forecast did not have. The centre is now the centre of thesigmaof the prior. The default pair does not move.covariance_forecast_evaluationof aPortfolioOptimisersCovariancethat holds a mask-aware estimator dropped an asset that listed after the start of the sample. Under an online cross-validation scheme withstore_forecasts = true, every stored location was the vector of the last fold, socovariance_forecast_portfolioof such a run was off by up to0.76.performance_summaryof a constant return series gave asharpeof about2e16, and a constant excess series gave aninformation_ratioof2e16. Each is nowNaN, as the docstring states.forecast_portfoliounder:zscoreturned a flat cross-section into a short book of 200 % gross. The row now stays zero. The series summary gave a constant series an information ratio of about2e16, which is nowNaN.forecast_coverageand its summary counted an asset with an infinite weight, which the Pearson column drops. They now admit0 < u < Inf.factor_model_summaryof a constant factor series gave a Sharpe ratio up to1.3e17and an autocorrelation of±1. The exposure diagnostics counted a zero weight toward a pair, and oneNaNweight made an observationNaN. A constant cross-section gave an exposure correlation of0.0and acs_regression_r2up to8.1e31. Each of these is nowNaN.idio_skewnessandidio_kurtosisof a constant cross-section gave a finite value up to2.45, where the docstring statesNaN.idio_tail_ratecounted an infinite entry in the numerator and not in the denominator, so[Inf 0.5 4 NaN -5]gave1.0where the rate is2/3.- A
PanelFieldRatiowhosenumordensums several panel fields took the number type of the first term. So aFloat32first term rounded aFloat64term. Withnum = ["f32" => 1, "f64" => 1], aFloat64term of1e-6became9.54e-7, and the reverse order gave1e-6. The sum now takes the type that every term promotes to.
These results were approximate in v0.31:
- A tracking error on
LpNorm(), whose defaultddofmoved from0to1. - The t-statistic of every information-coefficient summary treated the forward windows as independent rows. The windows overlap in three cases:
forecast_holding_periodfrom its second row on,forecast_evaluation_summaryat anystep < horizon, andexposure_ic_summaryon a block at anyhorizon > 1. In these cases the statistic now uses a Newey-West variance at the known overlap order, so it is smaller.ic_irdoes not move. MIPValueatRisk,DrawdownatRiskandValueatRiskRangewithb = nothingused a big-M constant of1000. A solver integrality tolerance of1e-6then loosened a row by about1e-3, so the model risk and the measure disagreed. The builder now derives the smallest exact constant from the weight bounds and the spread of the losses. It keeps1000for a free weight scale, a tracking shift, fees or aNaNinX. On one example, aNestedClusteredVaR portfolio falls from0.013824to0.013200.- The
ResidualInflationradius took one count of degrees of freedom from the type of the block, so its level fell to0.904atT = 30,K = 3and to0.769atK = 8, against0.95. The fit now records the count of each asset, and the level is0.942and0.946. - The three exponentially weighted estimators divided the cold-start correction by
max(1 - decay^n, eps). The floor is gone. It changed an answer only where1 - decay < eps. - A bin edge of
forecast_calibrationthat falls on an order statistic could land one ulp above it, and move a pair to the bin below. - Under Optim 2.3 and later, the entropy-pooling solve takes
Fminbox(; mu0 = 1e-5), as it does under Optim 2.0.1 to 2.2. v0.31 took the defaultmu0of Optim there, which can give aNaN.
This result keeps its numbers, but its meaning changed:
PopulationPredictionResultgives each member whoseidisnothingits position, so a scorer that selects a path names it.
These results keep their numbers, but their number type changed:
EqualWeightedonFloat32returns givesFloat32weights. v0.31 gaveFloat64.factor_attributionand the realised attribution family take the number type of the data. v0.31 gaveFloat64volatilities and errors forFloat32data.forecast_evaluation_summary(fe; quantiles = 0.2)storesquantilesas a vector of one. v0.31 stored a 0-dimensional array.
If you extend the library
- A risk-measure builder
set_risk_constraints!(model, i, r, opt, pr, …)receivesopt::RiskConstraintOwner. A method bound toRiskJuMPOptimisationEstimatoralone is not called for aProgrammeAllocationSet. SchurComplementHierarchicalRiskParityResulthas afeesfield afterclr, so its positional constructor takes one more argument. The keyword constructor needsfeestoo. Passfees = nothingfor a result with no fee.L1Normhas a field,ddof, andLInfNormhas none. Code that constructs either by position must follow.ForecastEvaluationResulthas atiesfield aftermin_count, so its positional constructor takes one more argument.RegressionandCrossSectionalFactorModelhave the fieldsedofandediv, so their positional constructors take two more arguments.FactorRiskBudgetinghas ahedgefield,falseby default, so its positional constructor takes one more argument.FiniteAllocationInputhas a fieldca, the collateral algorithm, so its positional constructor takes one more argument.
From v0.32 to v0.33
v0.33 removes brt. Each reader of the returns now states the returns that it fits on in its own x_src field: nothing, DataSource(), ExcessSource() or PriorSource(). ExcessSource() reads X - B, the returns in excess of the benchmark, as brt = true did. A head holds no source and passes none to its readers, so you state the source on each reader. The Symbol field x_src of JuMPOptimiser, HierarchicalOptimiser and NestedClustered is gone too, and a clustering, phylogeny or centrality estimator at the default reads the returns data, where v0.32 read the prior. A call that passes brt raises a MethodError.
v0.33 also brings the cross-sectional factor prior to parity with the oracle, and that changes its defaults: a default fit of CrossSectionalFactorPrior moves, and Renamed keywords and changed defaults gives the keywords that keep the v0.32 mu. The empirical Value at Risk, the regime-adjusted and exponentially weighted moments, the chi-squared radius of an uncertainty set and the default leaf order move too. Some calls that ran in v0.32 now raise an error, some calls that raised now answer, and the results in Results that move change.
Names that were removed
| Removed | Write instead |
|---|---|
brt of JuMPOptimiser, HierarchicalOptimiser, InverseVolatility, NestedClustered, Stacking and SubsetResampling | State x_src = ExcessSource() on each reader in the head: the prior, JuMPOptimiser(; pe = EmpiricalPrior(; x_src = ExcessSource())), and each clustering, phylogeny, centrality or regression estimator and each prior of an uncertainty set that must read X - B. A regression estimator at nothing reads the loadings of a prior that gives them, as it did under brt = true. A head that holds a reader at nothing beside a reader at ExcessSource() warns once when you build it. State DataSource() on the raw reader to silence the warning. An inner optimiser, a fallback and the outer optimiser of a meta-optimiser state their own sources, as they applied their own brt. On returns data with no benchmark, brt = true read the raw returns, and a reader at ExcessSource() raises an ArgumentError. |
returns_result_picker(rd, brt::Bool) | rd for false. For true, benchmark_relative_returns(rd, ExcessSource()) gives the matrix X - B, and ReturnsResult(; nx = rd.nx, X = benchmark_relative_returns(rd, ExcessSource()), nf = rd.nf, F = rd.F, ne = rd.ne, E = rd.E, ts = rd.ts, iv = rd.iv, ivpa = rd.ivpa, pnl = rd.pnl) gives the returns data with no benchmark that v0.32 gave. A reader at ExcessSource() reads X - B itself, so a call that passed the picked data to a reader passes rd now. On returns data with no benchmark, v0.32 returned rd, and benchmark_relative_returns(rd, ExcessSource()) raises an ArgumentError. |
The x_src field, :prior or :data, of JuMPOptimiser, HierarchicalOptimiser and NestedClustered, and the x_src keyword of clusterise and the other graph verbs | State the source on the graph reader. x_src = :prior becomes PriorSource(): HierarchicalOptimiser(; cle = ClustersEstimator(; x_src = PriorSource())) and JuMPOptimiser(; ple = SemiDefinitePhylogenyEstimator(; x_src = PriorSource())). x_src = :data becomes nothing or DataSource(). A graph verb reads the source of its estimator: clusterise(ClustersEstimator(; x_src = PriorSource()), pr; rd = rd). |
The keyword and field centred of ExpWeightedVariance, ExpWeightedCovariance, RegimeAdjustedExpWeightedVariance and RegimeAdjustedExpWeightedCovariance | centring = PreCentred() for centred = true, and centring = ZeroStartCentring() for the v0.32 numbers of centred = false. The new default EstimatedCentring() replaces that location with an unbiased one. See Results that move. Code that reads ce.centred reads ce.centring isa PreCentred. A call that passes centred raises a MethodError. |
Renamed keywords and changed defaults
One annualisation keyword,
ppy, with the default1.performance_summaryandplot_performance_summarytakeppy, where v0.32 tookperiods_per_year = 252, and the field ofPerformanceSummaryResultisppy. The default1states each figure per period, which is right at any data frequency, asfactor_model_summary,factor_attributionandforecast_evaluationalready did. Writeppy = 252to keep the v0.32 numbers on daily returns. A call that passesperiods_per_yearraises aMethodError.ImpliedVolatilitytakesppy, with no default, where v0.32 tookaf = 252. The implied volatility is annual, andppyconverts it to the period of the returns, so the caller states it.ImpliedVolatility(; ppy = 252)gives the v0.32 default, andImpliedVolatility()raises anUndefKeywordError.RegimeAdjustedExpWeightedVarianceandRegimeAdjustedExpWeightedCovariancetakedebias = ExactDebias(). The regime statistic divides by the bias of the estimate that it reads, and it skips an estimate too young for its statistic to have a finite variance. Statedebias = RawStatistic()to keep the v0.32 statistic.LawDebias()divides by the law of the estimate alone, and takes the deviation as independent of the estimate. See Results that move.The two regime-adjusted estimators take
regime_lohi_mult = (0.7, 1.6)andmin_val = 1e-12, where v0.32 tooknothingandsqrt(eps()). The floorsqrt(eps())removed from the statistic each asset whose variance was below1.5e-8, so a change of units moved the multiplier: on returns one thousand times smaller each variance moved by up to 32 %. Stateregime_lohi_mult = nothing, min_val = sqrt(eps())to keep the v0.32 numbers.hac_floor = NoHacFloor().RegimeAdjustedExpWeightedVariance, and the variance of the separate correlation path ofRegimeAdjustedExpWeightedCovariance, floored each HAC square at zero. On returns with no autocorrelation, that made the variance 6.7 %, 16 % and 41 % too large at one, two and five lags. Each square now keeps its sign, and the scalar estimator floors the variance that it returns at zero. Statehac_floor = PerTermHacFloor()to keep the v0.32 numbers.hac_vol_before = VolatilityBeforeUpdate()onRegimeAdjustedExpWeightedCovariance. On the separate correlation path under HAC, each row of the correlation now divides by the volatility before its update. The rule after the update amplified a negative HAC diagonal, so it had 9 % to 19 % more mean squared error at two lags. Statehac_vol_before = VolatilityAfterUpdate()to keep the v0.32 numbers. Without HAC, or with one decay, the keyword changes nothing.cor_vol = BiasCorrectedVolatility()onRegimeAdjustedExpWeightedCovariance. On the separate correlation path each product now divides by the variance state over its weight1 - λ^K. The raw state, seeded at zero, gave the first products of the warm-up more weight than the bias tables of the regime statistic assume, so the factor ofPortfolioTargetread up to 8 % high at 20 observations. The steady state does not move. Statecor_vol = RawVolatility()to keep the v0.32 numbers. With one decay, the keyword changes nothing. Under HAC on the separate path, the regime statistic also skips a row whose covariance block is not yet built, and on either pathPortfolioTargetskips a row whose direction has a variance at or belowmin_val, where v0.32 scored such a row at about1e12.PortfolioTarget(; indefinite = RefuseIndefiniteWarmUp()). A HAC block in the warm-up, and a block of assets with different histories, need not be positive definite, and a direction with a small positive variance on it scored a large statistic: on 8 assets, half-lives of 10 and 20 and two lags, one seed of 30 set the regime state to 51 after 8 rows. The default rule refuses a block with a negative eigenvalue while the gate ofMahalanobisTargetfor the same assets is closed, so the first scored row can come later, and it scores every block once the gate opens, so the steady state does not move. Stateindefinite = ScoreIndefiniteBlock()to keep the v0.32 numbers, orClipIndefiniteBlock()to clip the eigenvalues of the correlation of the block at zero.The square root of a covariance is a field,
mtx_sqrt = EigenFallbackSquareRoot().FactorPrior,CrossSectionalFactorPrior,FactorBlackLittermanPrior,Variance,StandardDeviation,DistributionValueatRisk,UncertaintySetVariance,ArithmeticReturn,RelaxedRiskBudgeting,Kurtosis,NegativeSkewness,NormBallUncertaintySetAlgorithmandOrthogonalUncertaintySettake it. On a positive definite matrix the default gives the Cholesky factor, so no risk and no weight moves. One stored value moves: underIdiosyncraticVarianceScaling()the mapLof the mean set ofOrthogonalUncertaintySetwasG * sqrt(Λ), withGthe orthonormal basis of the set andΛits scaling, and it is nowGtimes the Cholesky factor ofΛ. The two maps give the sameL L', so the set does not move. On a singular positive semidefinite matrix the default gives the eigen square root, where the three factor priors,Kurtosisand the norm ball raised aPosDefExceptionin v0.32. Statemtx_sqrt = nothingto keep the plain Cholesky factor, orRidgeCholeskySquareRoot()for the Cholesky factor of the matrix with a small ridge.ChiSqKUncertaintyAlgorithmtakesambient = false. The radius of a full covariance set reads the free entries of a symmetric matrix. See Results that move. Stateambient = trueto keep the v0.32 numbers.NormalUncertaintySettakesdc = DiagonalOfShape(), which takes the diagonal of the full shape, as v0.32 did.dc = ShapeOfDiagonal()sets each covariance to zero before it builds the shape, so each entry of the diagonal set is(1 + δ_ij) Σ_ii Σ_jj / Tin place of(Σ_ii Σ_jj + Σ_ij²) / T.branchorder = :optimal, the default, is the exact optimal leaf order. v0.32 passed:optimaltoClustering.hclust, which runs the heuristic of:barjosephunder that name. The tree and every cut do not change, but the order of the leaves can. See Results that move. Statebranchorder = :barjosephto keep the v0.32 order.CrossSectionalFactorPriorhas new defaults. Each one moves a default fit. See Results that move for the size.pe = EmpiricalPrior(; me = ExpWeightedExpectedReturns(), ce = RegimeAdjustedExpWeightedCovariance(; centring = PreCentred())), where v0.32 tookEmpiricalPrior(). The factor prior decays with the half-life ofve, so the systematic part and the specific part ofsigmaread one horizon.ve = RegimeAdjustedExpWeightedVariance(; centring = PreCentred()), where v0.32 tookRegimeAdjustedExpWeightedVariance(). The model sets the mean of the idiosyncratic return to zero, so the variance is a second moment about zero. The v0.32 default measured it about a mean that it updated at each observation.lambda = PrecisionBlend(), where v0.32 tooklambda = 1.0. The rule gives the factor mean the weightmax(0, 1 - K / (T_e B)), withBthe squared distance of the spanned part of the return forecast from the factor mean in the metric of the factor covariance,Kthe rank of that covariance andT_ethe effective sample size. With norfethe spanned part is zero, so the rule shrinks the factor mean towards zero.ofit = ScoreNeutralisation(). A fitted return forecast,ExpWeightedReturnForecastorTargetReturnForecast, neutralises its scores against every estimated factor, so its orthogonal part keeps the scale of its fit. v0.32 used the forecast as the member stated it.pdm = Posdef(; alg = ClippedNearestCorrelation())repairs the idiosyncratic block under a thresholdthabove zero. v0.32 repaired the block withmp.pdm, the nearest correlation matrix at the defaultmp.mp.pdmnow repairs the asset covariance alone.srep = NoSystematicRepair(). v0.32 repaired the systematic block withmp.pdmbefore the lift. Under the defaultsrep, a matrix processing estimator of your own inmpraises anArgumentErrorwhen you build the prior.unseen = ZeroUnseenMember(). See Results that move.
To keep the v0.32
mu, statelambda = 1.0, pe = EmpiricalPrior(), ve = RegimeAdjustedExpWeightedVariance(; centring = ZeroStartCentring(), debias = RawStatistic(), regime_lohi_mult = nothing, min_val = sqrt(eps()), hac_floor = PerTermHacFloor()), ofit = UnadjustedForecast(), unseen = SolvedUnseenMember(), srep = SystematicRepair(), pdm = Posdef(), l1mask = UnmaskedLeverageOne(). On one panel of 60 assets and 300 observations, these keywords gave the v0.32muexactly, and asigmawithin 0.3 % of its largest entry. The rest of the difference comes from the corrections that the next section lists, which no keyword undoes.ExpWeightedReturnForecastandTargetReturnForecasttakemin_obs = 1, where v0.32 tookceil(Int, half_life), which is20at the defaulthalf_life = 20. The weight1 - λ^nmultiplies both accumulators and the ridge, so the coefficients afternobservations are the weighted least squares fit of those observations, and the fit needs no warm-up. v0.32 wroteNaNin the forecast history, and in the calibration slope ofTargetReturnForecast, until 20 observations advanced the recursion: on one panel of 300 observations, 59 rows of the history wereNaN, and now 40 are. Statemin_obs = 20, orceil(Int, half_life)for your ownhalf_life, to keep the v0.32 numbers.TargetReturnForecasttakescv = PrequentialCalibration(), where v0.32 tookcv = nothing. v0.32 calibrated on the in-sample predictions, and the fit made each of them from the same forward return that the calibration regresses on it, so the slope was too large. At each matured observation the calibration now reads the prediction of the model fitted on the samples whose target had matured there, which is the forecast that the member published. On one panel the slope at the defaults moved from32.8to-1.9. Statecv = nothingto calibrate in sample again, orcv = KFold()for an out-of-fold calibration. Other corrections of the member also move the slope, socv = nothingwithmin_obs = 20gave32.6on that panel, not the v0.3232.8.The Neutralisation of
DescriptorScoresfits an intercept. The default iscre = CrossSectionalLinearRegression(; intercept = true), where v0.32 tookCrossSectionalLinearRegression(), whoseinterceptisfalse. The residual is now orthogonal to the constant and to each target. Where the targets span the constant, as a market factor does, the two rules give the same residual. A recipe with noneutralisedoes not move. Statecre = CrossSectionalLinearRegression(; intercept = false)to keep the v0.32 rule.exposure_coverageof aCrossSectionalFactorModeltakesweighting = RegressionWeightMetric(), where v0.32 tookBenchmarkWeightMetric(). The universe of an observation is now the assets of positive regression weight, which is the estimation universe of the fit, so the answer is the coverage column offactor_model_summary. Stateweighting = BenchmarkWeightMetric()to keep the v0.32 numbers.CrossSectionalTargetRegressiontakesalg = PseudoInverseFallback(). v0.32 gave the full design to the target, so a factor set that is dependent to round-off raised aPosDefExceptionfrom GLM, and a set that was nearly dependent lost a column from a condition number of about1e8. The target now fits the columns that the rank test keeps. Statealg = UncheckedSolve()to keep the v0.32 fit.cs_regression_aic,cs_regression_bicandcs_regression_adjusted_r2takek = nothing, the rank of the design of each observation, where v0.32 read the number of factors,size(B, 3). On a singular design, a coefficient that the data do not identify has aNaNt-statistic and an infinite variance inflation factor, where v0.32 reported numbers from round-off, and the residual variance divides byn - rank. Statek = size(B, 3)to keep the v0.32 scores.The idiosyncratic diagnostics take
ahead = true.idio_calibration,idio_tail_rate,idio_kurtosis,idio_skewness, their summary and their plots divide each residual by the volatility of the observation before it. v0.32 divided by the volatility of its own observation, which bounded the scaled residual and read the tails too thin. Stateahead = falseto keep the v0.32 numbers.The information-coefficient summaries take a mean test,
mt = WildBootstrapMeanTest().forecast_ic_summary,exposure_ic_summary,exposure_ic_factor_summary,forecast_holding_period,forecast_decayandforecast_evaluation_summaryread theirt_statfrom it. The test reads a fixed-bandwidth Bartlett variance and a wild bootstrap, sot_statmoves, and each summary also givesp_value,mean_ci_lowerandmean_ci_upper. On one series of 80 coefficientst_statmoved from3.0to4.0. Atlags = 0,mt = OverlapMeanTest()gives the v0.32t_stat. Atlagsabove zero no keyword gives it, because v0.32 read a long-run variance that the mean test does not use.performance_summaryandplot_performance_summaryof a prediction read the benchmark of its rows. When the returns data holdsB,excess_ret,tracking_errorandinformation_ratioare numbers, where v0.32 gaveNaN. Statebenchmark = nothingto keep the v0.32 values.factor_attributiontakesunknown = EntrywiseUnknown(). v0.32 set to zero the whole row of a held asset in the warm-up of its variance. Now its exposures and its systematic numbers stay, and each number that reads the unknown variance isNaN. See Results that move.feature_matrixtakesplaceholder = NaN, so a cell that holds a placeholder readsNaN, where v0.32 read the value that the panel stored in the cell. Stateplaceholder = nothingto keep the v0.32 value. An integer panel that holds a placeholder now stacks in a floating-point type.NestedClusteredandStackingtakepcol = RenormaliseActive(). The panel collapse weighs only the members that are active at each observation. See Results that move.An unset
pwsfollowswd. A walk-forward orMultipleRandomisedscheme that states a weight driftwdand nopwsnow takes the drifted weights,DriftedWeights(wd), as the previous weights of each fold. v0.32 took the target weights. Statepws = TargetWeights()to keep the v0.32 numbers.
Calls that now raise
| Call | v0.32 | v0.33 |
|---|---|---|
A keyword other than strict, dims and cache_reg on prior over a ReturnsResult, for example prior(pe, rd; brt = true) | Ran, and ignored the keyword. | Raises a MethodError. |
A keyword other than dims on ucs, mu_ucs or sigma_ucs over a ReturnsResult | Ran, and ignored the keyword. | Raises a MethodError. |
An optimiser with strict = true whose graph reader at the default meets an asset that has a gap in its rows and that a prior with a CoveragePolicy keeps | Ran, and the graph reader read the X of the prior, which fills the gap. | Raises an IsNonFiniteError that names the asset and the two remedies: the same CoveragePolicy on the ce of the graph reader, or x_src = PriorSource(). |
A repair of Posdef whose last result is not positive semidefinite | Warned that the matrix could not be made positive definite, and returned it. | Raises a PosdefRepairError that names the algorithm, the smallest eigenvalue and the tolerance. A result that is positive semidefinite to round-off returns with no warning. |
A Bool radius, such as kappa = true on OrthogonalUncertaintySet, CompactCovarianceUncertaintySet or NormBallUncertaintySet, or k = true on EllipsoidalUncertaintySet | Accepted, as the radius 1. | Raises an ArgumentError. |
ARCHUncertaintySet(; n_sim = 1) with an ellipsoid or a norm ball | Accepted. The fit raised an error that named neither the cause nor the remedy. | Raises a DomainError when you build the estimator. A box set still accepts one resample. |
The mean set of OrthogonalUncertaintySet under IdiosyncraticVarianceScaling(), when the idiosyncratic covariance makes the scaling indefinite | Returned a set with a complex map L. | Raises a LinearAlgebra.PosDefException. Only a loadings block that you build by hand can give such a scaling. |
A risk measure whose observation weights w, its own or those of the prior, have a length other than the number of observations | Ran. The weighted quantile kernels read the weights through the sort permutation of the returns, so a long vector passed in silence. | Raises a DimensionMismatch that names the weights, at the first evaluation or model build that reads them. |
A risk measure with observation weights that sum to zero, or LowOrderMoment with a negative weight | Accepted. | Raises a DomainError when you build the measure. A dynamic weight raises when it resolves. |
LowOrderPrior whose sigma holds a value that is not finite between two investable assets | Accepted. | Raises an IsNonFiniteError. An asset whose mu or variance is not finite is not investable, and its row and column are not checked. |
CombinatorialCrossValidation with n_test_folds == n_folds, or a negative purged_size or embargo_size on it or on KFold | Accepted. n_test_folds == n_folds gave one split with an empty training set. | Raises a DomainError. |
DateWalkForward with an integer train_size = 0 | Accepted. Every fold trained on no row. | Raises a DomainError when you build the scheme. |
split or n_splits of a DateWalkForward with a fold whose training window holds no row after expand_train and purged_size, for example DateWalkForward(2, 1; period = Day(1)) over business days, where the two dates before a Monday are a weekend | Returned the fold with an empty training range: 12 of the 86 folds over the weekdays of 2024 Q1. | Raises an IsEmptyError that names the date where the test of the fold starts. Increase train_size, or reduce purged_size. |
A CrossSectionalFactorPrior that holds a CompositeExposure or DerivedExposure whose bw is not the bw of the prior | Accepted. The member read whatever field of the panel had the name of its own bw, or failed on a missing field. | Raises an ArgumentError when you build the prior. A fit on a panel that already holds a field of the name bw of the prior also raises, where v0.32 replaced the field. |
A CompositeExposure or DerivedExposure that reads a blank benchmark weight on an active cell, under strict = true | Read the blank as zero, with no message. | Raises an ArgumentError. Under strict = false it reads the blank as zero and warns once with the count, the first observation and the assets. A blank on an inactive cell stays a silent zero. |
EntropyPoolingPrior or MeucciEntropyPoolingPrior over a LowDimensionEnsemblePrior, or over a FactorPrior whose factor prior is one | Ran. The posterior weights met the views, but mu and sigma were those of the ensemble with no view, because the ensemble reads no weights. | Raises an ArgumentError when you build the estimator. |
EntropyPoolingPrior or MeucciEntropyPoolingPrior over a factor prior or a Black-Litterman prior that holds an OpinionPoolingPrior with pe1 | Ran, and the views of the entropy pooling prior missed mu. | Raises an ArgumentError when you build the estimator. Give the pool to the entropy pooling prior directly as its pe. |
The first partial_fit! of an EmpiricalPrior or a HighOrderPriorEstimator whose member already holds a state, for example EmpiricalPrior(; me = partial_fit!(SimpleExpectedReturns(), X1)) | Ran with no message. The warm member read its earlier rows as well as the new rows, and every other part of the prior read the new rows alone. | Raises an ArgumentError that names the path of the state, such as me.cache. Pass the member with its cache at nothing. |
cov or cor of ImpliedVolatility with no iv, or a prior that holds one over a ReturnsResult with no iv | Raised an UndefKeywordError, or a TypeError on the keyword iv. | Raises an IsNothingError that names iv and the two remedies: pass iv to cov or cor, or fit the prior on a ReturnsResult that carries iv. |
cov or cor of ImpliedVolatility with a gap in iv | Read past the gap and priced the asset. | Raises an IsNonFiniteError. |
A named Descriptor on an asset panel whose price, market capitalisation, share count or total assets is at or below zero at an active, observed cell: BookToPrice, CashFlowToPrice, SalesToPrice, EarningsToPrice, ForwardEarningsToPrice, DividendToPrice, ForwardDividendToPrice, ShareholderYield, MarketLeverage, DebtToAssets, GrossProfitability, ReturnOnAssets, AssetTurnover, CashFlowToAssets, AccrualsCashFlow, AnalystDispersionToPrice, ShortInterest, LogMarketCap, EarningsChangeToPrice, CapexToAssetsChangeInIntensity, EWShareTurnover or EWAmihudIlliquidity | Wrote NaN in the cell, and the asset left the cross-section of that observation with no message. | Raises a DomainError that names the panel field, the observation and the asset. PanelFieldRatio, PanelFieldLog, ChangeToScale and ChangeInIntensity with no guard keep the NaN. The two EW presets take gt0 = nothing to keep it. |
BookLeverage or MarketLeverage with a negative debt, GrossMargin with negative sales, or EWShareTurnover, EWAmihudIlliquidity or DaysToCover with a negative volume, share count, price or short interest | Gave a number or NaN with no message. EWShareTurnover read a negative volume into its state, and DaysToCover gave a negative value. | Raises a DomainError. Zero sales still give NaN under GrossMargin. nonneg = nothing on the EW presets and on DaysToCover keeps the v0.32 numbers. |
EWMacroSensitivity whose reference return holds an infinite value | Ran. | Raises an IsNonFiniteError that names the observation. A NaN is still a gap that the recursion skips. |
A batch cross-validation of more than one fold over an estimator that holds a ReturnsTracking | Ran. A fold whose training rows had the length of the series solved against other rows with no message. | Raises an ArgumentError that names the field. Use DataBenchmarkTracking, WeightsTracking or a TimeDependent schedule of one series per fold. |
partial_fit! of an optimiser that holds a ReturnsTracking, or a ReturnsTracking whose length is not the number of rows | Raised a DimensionMismatch from the solver on an expanding window. Under max_history it ran against rows that did not align. | Raises an ArgumentError. An OnlinePortfolioSelection with a series in a risk ceiling or in a RiskLoss raises when you build it, where v0.32 raised at the first row. |
A graph verb, such as clusterise, phylogeny_matrix or centrality_vector, over a prior result with a keyword other than ivpa, branchorder, strict and dims, for example brt = true | Ran, and ignored the keyword. | Raises a MethodError. |
A graph verb over a prior result whose returns data rd has a gap in X | Read the X of the prior, which fills the gap. | Raises an IsNonFiniteError that names the asset. State x_src = PriorSource() on the estimator to read the prior. |
A Pipeline with an uncertainty-set step whose target is not :mu, :sigma or :both, a bare uncertainty-set step, a writes that is not the slot of its estimator, or a nested Pipeline that writes a data slot again | Built, and gave the wrong slots or failed later. | Raises an ArgumentError when you build the pipeline. |
NestedClustered whose inner optimiser holds a TimeDependent schedule of precomputed results, such as LinearConstraint values | Built. The fit raised a DimensionMismatch when a constraint of the whole universe reached a cluster. | Raises an ArgumentError when you build the estimator, as a precomputed result outside a schedule did in v0.32. |
fit_preprocessing of a MissingDataFilter whose row filter keeps no observation of the training window | The fit ran, and apply_preprocessing raised the IsEmptyError. | The fit raises the IsEmptyError. Under alg = SinglePassFilter() the fit runs, as in v0.32. |
Calls that now answer
| Call | v0.32 | v0.33 |
|---|---|---|
partial_fit! of a prior or of an optimiser, and optimise or partial_fit! of an OnlinePortfolioSelection head, on a ReturnsResult that carries iv | ArgumentError: the online step takes no implied-volatility surface. | The step carries iv and ivpa with the returns, and optimise or prior with no data equals the batch fit over the folded rows. |
Posdef, Denoise or Detone on a covariance with a constant asset, a zero variance | ArgumentError: matrix contains Infs or NaNs | The zero row and column stay, and the step runs on the block of the positive variances. Denoise reads the ratio of observations to assets of the block. |
A factor prior, Kurtosis or a norm-ball set on a singular positive semidefinite covariance | PosDefException | The eigen square root, under the default mtx_sqrt |
A prior whose covariance has a CoveragePolicy, on two assets that each have a variance and share too few observations for a covariance | Raised an IsNonFiniteError from the matrix repair, because the pair is NaN inside the finite block. | Warns, and answers on the other assets. The default peel = MinimalPeel() removes the fewest assets that leave no such pair, and each removed asset is no longer investable. strict = true refuses with an ArgumentError that names the assets. State peel = NoPeel() to keep the v0.32 refusal. |
ConditionalValueatRisk, EntropicValueatRisk, ConditionalDrawdownatRisk, EntropicDrawdownatRisk, RelativeConditionalDrawdownatRisk or RelativeEntropicDrawdownatRisk with alpha = 0 | DomainError | The largest loss among the observations of positive weight. Unweighted, it is the value of WorstRealisation or MaximumDrawdown. Every other tail measure still takes 0 < alpha < 1. |
Fees with a short fee s between -l and zero | DomainError | The short side earns the credit -s. s = -l is the linear fee l w. A value below -l is not convex, so it still raises a DomainError. |
MaximumRatio with an ℓ1 constraint set or a fee, on a problem where the return form was infeasible | The solve failed as infeasible. | The ratio takes the risk form, so the problem solves. |
MaximumRatio with BudgetCosts or BudgetMarketImpact at ohf = 1e-2 or above | The solve failed. | The cost rows scale with the ratio variable, so every ohf solves to one ratio. |
NestedClustered, Stacking or SubsetResampling on integer returns | InexactError | The weights of the returns as floating point numbers. A Rational return keeps its type. |
MultipleRandomised with a window of all the observations, window_size == T | ArgumentError: range must be non-empty | One window of every row. |
EntropyPoolingPrior or MeucciEntropyPoolingPrior with a view over a prior with max_scenarios, such as EmpiricalPrior(; max_scenarios = 40) or a factor prior over one | DimensionMismatch | The moments of the scenarios under the posterior weights. The posterior gives no weight to an observation that the cap removed. |
partial_fit! of a CrossSectionalFactorPrior, or of an optimiser that holds one, on returns data whose asset panel holds panel fields | ArgumentError: the online step carries a time-varying asset panel through its masks alone. | The prior folds the rows. Under the default carry = FoldOrRefit(), a part that does not fold is fitted again over its rows, and prior or optimise with no data equals the batch fit over the folded rows. |
CrossSectionalFactorPrior with c above one, for example c = 2.0 | DomainError | The prior scales the orthogonal part of the return forecast by c. A stated c is finite and at least zero. |
exposure_coverage or factor_model_summary on a CrossSectionalFactorModel with no regression weights rw | IsNothingError that names rw | The coverage over every asset. |
TargetReturnForecast with a cross-validation in cv, on fewer than two valid samples per fold | ArgumentError: an out of fold calibration needs at least two samples per fold. | Under the default warmup = NaNWarmup() the calibration coefficient is NaN. warmup = InSampleWarmup() calibrates on the in-sample predictions. |
A CrossSectionalFactorPrior on a sub-universe in which one level of a factor has no member, for example inside NestedClustered or SubsetResampling | ArgumentError: matrix contains Infs or NaNs | The empty factor has a zero return and no variance. |
A FactorPrior whose pe has a scenario cap | Raised an error at the fit. | Fits on the rows that the cap keeps. |
factor_attribution(pred, pr) of a MultiPeriodPredictionResult with a prior fitted over the whole sample | Refused. | Matches each fold to its block by a row key. The realised attribution of a block under a scenario cap answers too, where v0.32 raised a BoundsError. |
SubsetResampling or MultipleRandomised on about 70 assets or more at their defaults | OverflowError, for example from binomial(100, 80) | The weights of the resampled subsets. A Rational subset_size or window_size answers too, where v0.32 raised a MethodError. |
An OnlinePortfolioSelection whose fallback needs rows, such as EqualWeighted, InverseVolatility, an optimiser with an estimator prior, or PreviousWeights(; fb = ...), when the fallback answers | ArgumentError or IsNothingError: the fallback got no rows, and a walk-forward stopped. | The head steps its fallback on its rows, so the fallback answers as it does in a batch fit. |
cross_val_predict(pipe, data, split(cv, data)) of a Pipeline with a combinatorial or a randomised split | A combinatorial split raised a MethodError. A randomised split gave one series over every asset. | The same answer as the scheme passed directly. Resume(res) over MultipleRandomised raises an ArgumentError that names the cause, where v0.32 raised a MethodError. |
fit_and_predict(res, prices) of a PipelineResult on price data | MethodError | Takes the price data, as predict(res, prices) does. |
A search over a field of FactorPrior, a Black-Litterman prior, an entropy pooling prior or a high order prior | Raised an error from setproperties. | Searches the field. |
A covariance_forecast_evaluation step with no active asset | Refused the whole evaluation. | Keeps the step, with no score. |
investable_risk_gradient on a panel that does not cover an asset | DimensionMismatch | The gradient over the investable assets. |
A histogram of returns with a zero interquartile range under FreedmanDiaconis(), or under Knuth() | FreedmanDiaconis() raised InexactError: Int64(Inf). Knuth() searched with no upper bound, and on such data could exhaust the memory. | FreedmanDiaconis() takes the range over five as the width, and Knuth() searches from one bin to T bins. A constant column has one bin. |
AdaptiveSubgradient at delta = 0 when an asset has no gradient mass yet, because each of its price relatives so far is zero or because a RiskLoss reads a window that does not price it | DomainError | Steps. The raw step leaves the weight of that asset as it is, and the projection takes the limit of a positive diagonal: the assets with mass keep their projected weights, and the others take the rest of the budget nearest the raw step. |
AdaptiveSubgradient, or a GramProjection, on a ProgrammeAllocationSet when the set of investable assets changes between steps | DimensionMismatch | Solves over the investable assets. |
std(ve::SimpleVariance, state) of a folded SimpleVariance | MethodError | The square root of var(ve, state). |
risk_contribution or the finite-difference risk_gradient with integer weights, and risk_gradient of a vector of measures with integer weights | InexactError | The contributions or the gradient, in the type of the step delta. |
Results that move
- A clustering, phylogeny or centrality estimator at the default reads the returns data
rd.X. v0.32 read theXof the prior,x_src = :prior. The two differ when the prior changes its returns: a factor prior gives a reconstruction of rank equal to the number of factors, a prior with a scenario cap keeps fewer rows, and a prior that fills a gap writes a value where the returns data holds none. Statex_src = PriorSource()on the graph reader to keep the v0.32 numbers. Under a prior whose moment estimators carry aCoveragePolicy, an asset that has a gap in the rows that the graph reader reads now gets a zero weight, and the optimiser warns once and names the asset, because the defaultceof a graph reader has noCoveragePolicy. State the sameCoveragePolicyon theceof the graph reader, orx_src = PriorSource(), to keep the asset. - Every regime statistic of
RegimeAdjustedExpWeightedVarianceandRegimeAdjustedExpWeightedCovariancedivided a realised square by an estimated variance, and the inverse of an estimate is too large on average. So under a correctly calibrated model the regime multiplier read the risk too large. Under the default method the variance was 1.3 % too large at the default half-life of 40, and 5 % too large at a half-life of 10. AMahalanobisTargetblock with fewer observations than assets gave a statistic of about1e12. The statistic now divides by the exact bias that its method reads. Every default fit of aCrossSectionalFactorPriormoves, because itsveis a regime-adjusted variance and itspeholds a regime-adjusted covariance. - The default location of
ExpWeightedVariance,ExpWeightedCovarianceand the two regime-adjusted estimators started at zero and was not divided by the sum of its weights, so it estimated(1 - λ^k)times the mean, and its deviations kept part of the mean. The variance was 2.4 % to 36 % too large in the warm-up, and 3.5 % too large at a half-life of 10 after it. The defaultEstimatedCentring()takes the normalised exponentially weighted mean, and divides each squared deviation, or product of a pair, by its exact factor1 + 1 / n_eff, or1 + c_ij. The estimate is unbiased from the second valid return, and the first return of an asset gives no term, so an asset needs two valid returns. Under HAC the factor also reads the mean of each lagged product.ZeroStartCentring()gives the v0.32 location and its numbers.PreCentred()does not move. The defaults ofce,veandpeofCrossSectionalFactorPrioruse it now, but in v0.32 onlycedid. The bullet onCrossSectionalFactorPriorbelow gives the v0.32 defaults. ExpWeightedCovarianceandRegimeAdjustedExpWeightedCovariancedivide each pair by its own weight. On a holiday, v0.32 shrank each correlation that met the holiday towards zero, and on the separate correlation path a late listing shrank each correlation of the late asset towards zero. A sample with no holiday and no late listing keeps its numbers.- The two regime-adjusted estimators clamp the multiplier of an estimate only. v0.32 also clamped the multiplier of one before
regime_min_obs, and the multiplier ofregime_method = nothing, so a clamp with a lower bound above one inflated a variance that had no regime estimate. RegimeAdjustedExpWeightedCovariancewith a separatecor_decayreports the variance0for a constant asset, where v0.32 reportedmin_val.- Every default fit of a
CrossSectionalFactorPriormoves. On one panel of 60 assets and 300 observations,mumoved by 82 % of its largest entry andsigmaby 16 %. The new defaults that Renamed keywords and changed defaults lists cause most of it. These corrections also move a fit, and no keyword undoes them:- The idiosyncratic variance and the regime statistic read the active mask and the estimation mask. An asset that delisted and listed again kept its variance over the inactive stretch in v0.32, and the regime statistic read active assets outside the estimation universe.
- The prior divides the weights of the scenarios of its factor prior by their sum.
- Each asset reads the factor moments only on the support of its loadings, so a factor with no moment changes no asset with a zero loading on it, and the investable set holds each asset whose loadings read only factors with moments. The fit refuses only when no asset has such loadings.
- An asset in the warm-up of its variance has a finite mean and finite systematic covariances. v0.32 wrote
NaNover its whole mean, row and column. The asset is still not investable, because its variance is not finite. - The idiosyncratic correlation under a threshold
thabove zero reads the residuals with no fill. v0.32 read the residuals that the scenarios read, which fill a holiday or a late listing with the mean of the other assets, and so correlated the asset with each of them. - A return forecast with
min_obs = 1gives a forecast earlier in the history, andTargetReturnForecastcalibrates prequentially. See the two bullets on them above.
- An unseen member of a constrained factor family has a return of zero. The exposures lag the returns, so the zero-sum condition of an observation reads the benchmark weights of the observation before it. When the last asset of a member leaves the sample, the condition still weights the member, and the design is rank deficient. In v0.32 the solve algorithm of
crethen gave the member a return that depended on the dropped member of the family. Underunseen = ZeroUnseenMember()the member has a return of zero at that observation, and the condition holds over the other members. The factor returns,muandsigmamove only on a panel with such an observation. Stateunseen = SolvedUnseenMember()to keep the v0.32 numbers. - A
CrossSectionalFactorPriorreads the residual of an asset that is alone in its level as a gap. When an asset is the only member of its level of a one-hot factor at an observation, the regression fits its return exactly, so its residual is zero whatever the return. v0.32 divided that zero by the variance of the asset, so an asset with a positive variance got a scaled residual of zero, and an asset with a zero variance got the mean scaled residual of its observation. v0.33 gives every such asset that mean in the scenariosX, and the idiosyncratic correlation leaves it out, sosigmamoves under a thresholdthabove zero. A design in which every such asset has a zero variance keeps its numbers, and so does a design with no such asset. Statel1mask = UnmaskedLeverageOne()to keep the v0.32 numbers. - The chi-squared radius of a full covariance set reads
N(N + 1) / 2degrees of freedom, the free entries of a symmetric matrix. This moves the Normal ellipsoid, the Normal norm ball and the bootstrap ellipsoid underdiagonal = false. v0.32 readN², so the set was too large for its level: atN = 5andq = 0.05the radius was6.136and now is5.000, and the old set covered 0.999 of the errors at a stated 0.95. A bootstrap ellipsoid withMresamples reads at mostM - 1degrees of freedom, on both axes. StateChiSqKUncertaintyAlgorithm(; ambient = true)to keep the v0.32 numbers. The defaultdiagonal = trueand the bootstrap norm ball do not move. - The view of a
CompactCovarianceUncertaintySetis the projection of the set. A hierarchical or clustered optimiser takes this view of a set that you fit before. v0.32 fitted the basis again on the view, so a cluster portfolio paid less than the full set charges it, by 6.9 % and 14.9 % of the penalty on two examples. Now it pays what the full set charges it. AnOrthogonalUncertaintySetestimator inside the optimiser still fits on the data of the cluster. - A covariance or a correlation with a
CoveragePolicypeels the assets of an undetermined pair. v0.32 wroteNaNat the cell of a pair whose assets share too few observations, and kept both assets. v0.33 removes the assets that thepeelrule chooses, writesNaNacross the row and the column of each, and warns with their indices. The mean and the variance do not move. A call with no such pair keeps its numbers. On a fold, the peel runs each time the folded estimator answers, on the counts folded so far, so a walk-forward warns at each step that has such a pair, and the removed set can change from one step to the next. Statepeel = NoPeel()to keep the v0.32 numbers. - The default leaf order is the exact optimal order.
clusterise, the phylogeny estimators, DBHT and every hierarchical and meta-optimiser at the defaultbranchorder = :optimalcan give another order of the leaves. The order is the input of the recursive bisection, so the weights ofHierarchicalRiskParityand of the Schur complement optimiser can move. The clusters and every cut do not move. Statebranchorder = :barjosephto keep the v0.32 numbers. - An empirical Value at Risk reads the upper
alpha-quantile of the returns.ValueatRiskandValueatRiskRangeunder the defaultMIPValueatRisk(),DrawdownatRiskandRelativeDrawdownatRisktake the order statistic at positionfloor(alpha T) + 1, the definition of Equation 7.50 of [12]. v0.32 took the positionfloor((alpha - s) T) + 1with the slacks = 1e-5. The two positions differ whenalpha Tis an integer, for example at the defaultalpha = 0.05on 100, 200 or 1000 observations, where the value moves by one order statistic: on 100 normal returns from1.727to1.596. They also differ when the fractional part ofalpha Tis below1e-5 T, so on 100 000 observations or more the value moves at everyalpha. The risk of the MIP model moves in the same way, so the weights of an optimiser that reads one of these measures can move. With observation weights, the position is the first one whose cumulative weight exceedsalphatimes the total weight, where v0.32 took the first one that reached it. The defaultsis now1e-9, and the cardinality row of the MIP adds it toalpha, where v0.32 subtracted it. The conditional measures do not move. No keyword gives the v0.32 position. MaximumRatiowith a variance on the lifted weight matrix maximises the Sharpe ratio. This is aVariancethat the model states on the lifted matrixW, or a box, ellipsoid or norm-ballUncertaintySetVariance. v0.32 divided the excess return by the variance, not by its square root, so the weights moved. Risk contribution rowsrcunderMaximumRationow relax as they do underMinimumRisk. Stateratio_alg = LinearRatio()to keep the v0.32 ratio. It gives the v0.32 weights to about2e-4.- A weighted
LinearModelorGeneralisedLinearModelscales its weights to their Kish count. GLM reads weights as frequencies, so v0.32 read probability weights that sum to one as one observation: every p-value was 1, and the AIC and the BIC readn = 1. AStepwiseRegressioninside an entropy pooling or opinion pooling prior then kept one factor for each asset. The coefficients do not move, but the selected factor sets, the p-values, the AIC and the BIC do.FrequencyWeightskeep the v0.32 numbers. CombinatorialCrossValidationputs every trailing row in the last fold. Whenmod(T, n_folds) >= div(T, n_folds), v0.32 put a trailing row in no fold, so the row was in every training set and in no test set: row 13 of 13 atn_folds = 5. The splits move in that case only.- The factor attribution of a held asset in the warm-up of its variance. Under the default
unknown = EntrywiseUnknown()its exposures and its systematic numbers stay, and each number that reads the unknown variance isNaN, where v0.32 set the whole row to zero. The split and the standard error of a pair of leverage one areNaN, and a pair with no idiosyncratic return adds nothing to any component. A static loadings matrix reads every observation at any lag, andtrim = truecuts it. A held asset with no return on an active cell is a holiday. A held asset that is not active warns, or raises understrict = true. The predicted totals set to zero the row of an asset that is not investable. No keyword gives the v0.32 numbers. - The readers of an asset panel read only the active, observed cells.
FeatureDistancereads each asset and each pair at its own active rows, and an asset that it cannot read leaves the investable set at a fit. The panel collapse ofNestedClusteredandStackingweighs only the members that are active at each observation, underpcol = RenormaliseActive(). A panel with no inactive and no unobserved cell keeps its numbers. - A
RiskLossreads the lastwindowrows when its head holds more rows. A tracking or turnover ceiling in aProgrammeAllocationSetwithfixed = falsefollows the allocation of each step, where v0.32 held the weights that you passed. - A forecast evaluation keeps the weights of its book after a date with no asset that it can score, so the turnover of the book moves.
ForwardPanelFillandBackwardPanelFillstop at the edge of a stretch in which the asset is not active. v0.32 walked each column over the whole axis, so an asset that delisted and listed again took, at a blank first cell of its second listing, the last value of its first listing, andlimcounted the inactive cells as part of the run. A column with one stretch of activity keeps its numbers.opt_weight_boundswith aJuMPWeightFinaliserleaves your weight vector unchanged. Under the two relative formulations v0.32 wroteepsinto each zero entry of the vector that you passed:[0.7, 0.3, 0.0]became[0.7, 0.3, 2.2e-16].- The cross-sectional diagnostics return a
FactorDiagnosticResult.exposure_coverageand the other diagnostic verbs over aCrossSectionalFactorModelreturned aVectorin v0.32. The vector is now the fieldXof the result, which also holds the names and the families of the factors. prices_to_returnscomputes each return from the change in price,(p_t - p_{t-1}) / p_{t-1}, and the log return aslog1pof it. v0.32 took the simple return through a logarithm and lost about three bits, and its log return cancelled. Each return can move in its last bits, and so can each value computed from it.MaximumRatiowith an ℓ1 constraint set or a fee takes the risk form. Both forms state one optimum, so a problem that solved in v0.32 keeps its ratio, and its weights can move within the tolerance of the solver.MaximumRatiowithBudgetCostsorBudgetMarketImpactsolves for weights that no longer move withohf. v0.32 gavesum(w) + costof 0.877 atohf = 2.5e-4and 0.970 atohf = 1e-3, where the budget states 1.BudgetMarketImpactunder a constraint scalescother than one. The power cone of the charge did not scale its middle entry, so the charge grew bysc^((1 - beta) / beta), and the weights stayed near the start portfoliow. At the defaultscnothing moves.- The mean of
BodnarOkhrinParolyadivides itsbetaby the quadratic form of the target, as equation 7 of [58] states, where v0.32 divided by that of the sample mean. Every target of the library is a multiple of the vector of ones, so the three targets now give the same estimate. - The monotonic search of the Schur complement optimiser refines below
toland reaches the boundary where the augmented block stops being positive definite, so itsgammacan move to a value of lower variance. A repaired block is written back after the repair, so a later split augments the repaired block. UlcerIndexandRelativeUlcerIndexread the weights of the prior, as every other drawdown measure does. Under a weighted prior the index moves. Under no weights it does not.- The blended inverse-variance weights of a
CrossSectionalFactorPriorwith zero variances take the limit as those variances go to zero. With half or more of the variances of an observation zero, v0.32 dropped the inverse-variance part of the row, so the row summed to1 - lambda, and with every variance zero it took the cap weights alone. A quantile level of the clamp that lands on an order statistic beside a zero variance gave no bound, and now gives that order statistic. MultipleRandomiseddraws each start of a window, the last one included. A seeded draw can move.- An entropy pooling prior over a factor prior keeps the model of the fit that its views read.
EntropyPoolingPriorandMeucciEntropyPoolingPriorover aFactorPrioror aFactorBlackLittermanPriorfitted the regression again under the posterior weights, so the scenarios moved, and a mean view missedmu: a view of0.004read0.0040224on one example. The posterior now weighs the same scenarios and keeps the loadings, the intercepts and the residual variances, so each mean view holds onmu. A nested entropy pooling prior or opinion pool keeps its model and does not solve its views again. - A high order prior fits its coskewness and cokurtosis under the weights of the prior that it wraps. Over an entropy pooling prior or an opinion pool,
HighOrderPriorEstimatorandHighOrderFactorPriorEstimatorfitted them with no weights, so a skewness or kurtosis view reached no co-moment.HighOrderFactorPriorEstimatoralso takes off the residual variances that the prior added, where it measured them again. Under equal weights nothing moves. - A
prior(...)reference in a skewness or kurtosis view reads the weights of the prior. InEntropyPoolingPriorandMeucciEntropyPoolingPrior, v0.32 read the skewness or the kurtosis of the reference from the scenarios with no weights. It now reads them under the prior probabilitieswwithH0_EntropyPooling, and under the weights of the prior of the stage withH1_EntropyPoolingandH2_EntropyPooling, as a value at risk reference does. A view such assk_views = LinearConstraintEstimator(; val = "A1 == prior(A1) * 1.2")then states a different target, so the posterior moves. - The covariance of an entropy pooling or opinion pooling posterior takes the correction of reliability weights,
1 / (1 - sum(p .^ 2)), where v0.32 tookT / (T - 1). Under a view,sigmagrows by the factor(n_eff / (n_eff - 1)) / (T / (T - 1)), withn_eff = 1 / sum(p .^ 2): by2.2e-3with one mean view on 60 observations. The posterior weights areAnalyticWeights. Give the priorw = pweights(...)to keep the v0.32 correction. With no view nothing moves. MissingDataFilterreads the column shares again over the observations that its row filter keeps, until no asset drops. v0.32 read them one time, over the whole training window. So whenrow_thrdropped an observation, a kept asset could miss more thancol_throf the observations that stayed. The universe moves only when both thresholds are below one and the row filter drops an observation.alg = SinglePassFilter()gives the v0.32 universe.- A
DateWalkForwarddrops a fold whose test window holds no row. Two dates of the range map to one row when the data has no row between them, for example the two days of a weekend underperiod = Day(1)over business days. v0.32 returned and counted such a fold:DateWalkForward(5, 1; period = Day(1))over the weekdays of 2024 Q1 gave 83 folds, and 24 of them tested no row. v0.33 gives the 59 folds that test a row, andn_splitscounts them. - A date of a
DateWalkForwardrange after the last timestamp ends the range underprevious = truetoo. A positiveperiod_offset, or anadjuster, can make such a date. v0.32 mapped it to the last row, so the last fold counted as full and its test window left out the last row:DateWalkForward(2, 1; period = Day(3), period_offset = Day(2), previous = true)over 20 daily rows tested[7:9, 10:12, 13:15, 16:18, 19:19]. v0.33 tests[7:9, 10:12, 13:15, 16:18], as v0.32 did underprevious = false. Statereduce_test = trueto test the last rows,19:20. DimensionReductionRegressionfixes the sign of each component. Each column of the loadingsLwhose sum is negative changes sign, so the fit no longer depends on the sign that the projection returns. v0.32 kept that sign. The factor risk contributions and the span of the loadings do not move. The"loadings"field of aRegressionPanel, and the factor weights thatFactorRiskBudgetingandFactorRiskContributionread under this regression, can move.AdaptiveSubgradienttakes the step of a zero gradient in its own norm. ARiskLossgives a zero gradient while the head holds fewer than two rows. v0.32 took the Euclidean projection of the weights at such a step. v0.33 projects indiag(delta + s). While no asset has mass that norm is a multiple of the identity matrix, so the step is the Euclidean projection, except on aProgrammeAllocationSetwith a penalty in its objective: there the weight of the penalty against the distance changes, and atdelta = 0the step minimises the penalty and takes the weights nearest the raw step among its minimisers.- A projection in the entropic, Tsallis or log-barrier geometry on a
ProgrammeAllocationSetsets each weight at or belowsqrt(eps)to its floor, zero unless the set states a positive floor. v0.32 raised only a negative weight to zero, so the sign of the rounding of the solver decided whether a weight that the set forces to zero could recover. Such a weight is now zero whatever the sign of the rounding, and it stays at zero. risk_contributionand the finite-differencerisk_gradientkeep their step under a narrow weight type. v0.32 rounded the step to the type of the weights: withFloat32weights each contribution was about 1.3 % off, and withFloat16weights each contribution was zero. v0.33 returns the vector in the type of the weights promoted with the stepdelta, aFloat64by default.EntropyPoolingPriorandMeucciEntropyPoolingPriorleave the weightswthat you pass as they are. v0.32 normalised a mutablewin place when you built the prior, sov = [1.0, 3.0]; EntropyPoolingPrior(; w = pweights(v))changedvto[0.25, 0.75]. v0.33 builds new weights of the same kind. The prior does not move.- A
wthat you pass to an entropy pooling prior over a nested pooling prior is the prior of the innermost scenarios. InEntropyPoolingPriorandMeucciEntropyPoolingPriorthe nested prior solves its views from yourw, and the outer prior solves its own views from the nested posterior, as it does when you pass now. v0.32 solved the outer views from yourw, so the views of the nested prior did not reach the posterior. A nested prior that does not reweight its scenarios, such asEmpiricalPrior, keeps yourw, and its result does not move.
If you extend the library
A centring, a debias rule, a HAC floor, a rule for the timing of the volatility, a rule for the volatility of the separate correlation path, a rule for an indefinite block or a rule of the level recursion of the Mahalanobis target of your own subtypes
AbstractCentring,AbstractRegimeDebias,AbstractHacFloor,AbstractHacVolatilityTiming,AbstractCorrelationVolatility,AbstractIndefiniteBlockRuleorAbstractLevelRecursion, which are public. A centring implements the verbs that the# Interfacessection ofAbstractCentringnames. One of them,centring_law, names the law of the deviations that the bias tables of a regime-adjusted estimator read:PreCentred()orEstimatedCentring(). A centring with a law of its own returns itself, and adds a method ofregime_bias_tableand ofmahalanobis_level_bias, which are public, for that law. A debias rule implementsdebiasesandreads_dependence, a HAC floor implementshac_floor!, a timing rule implementsvolatility_before_update, a rule for the volatility of the separate path implementscorrelation_variance, a rule for an indefinite block implementsindefinite_block, and a rule of the level recursion implementsmahalanobis_recursion_ratio.A prior of your own states its source with a method of
returns_source, which is now public. A prior with no method reads the raw returns.LowOrderPriorhas the fieldsx_src,ss_gapsandpcafterfpr, so its positional constructor takes three more arguments.priorover aReturnsResult, and the result that an online fold gives, record inx_srcthe source of the prior. A returns-matrix method recordsnothing. A Prior Result of your own records no source, and an optimiser reads its returns as raw.CoveragePolicyhas a fieldpeelafteralg, so its positional constructor takes three arguments. The keyword constructor does not change. A peel rule of your own subtypesAbstractPeel, which is public, and implementspeel_assets.CrossSectionalFactorPriorhas twelve more fields, so its positional constructor takes 31 arguments, where v0.32 took 19. The new fields areunseenafterfamilies,pdmafterce,srepaftermp, andofit,l1mask,lx,mtx_sqrt,ex,choice,carry,cacheandx_srcafterc. A method that dispatches on the position of a type parameter afterfamiliesmoves. The keyword constructor keeps every v0.32 keyword.The thirteen estimators that take
mtx_sqrt,NormalUncertaintySet, which takesdc, andChiSqKUncertaintyAlgorithm, which takesambient, each have one more field, so their positional constructors take one more argument.VarianceandUncertaintySetVariancealso haveratio_algandcorneraftermtx_sqrt, so they take three more. The keyword constructors do not change.CompactCovarianceUncertaintySethas a fieldRafterQ, the factor of the rows that a view drops. A fitted set has no row in it, and the four-argument call(kappa, C, Q, val)keeps its meaning. A consumer of your own reads the penaltymin_z ‖C w − Q z‖² + ‖R z‖².A radius algorithm of your own subtypes
AbstractUncertaintyKAlgorithmand receives the dimension of the set as a fifth argumentdf. An ellipsoid callsk_ucsand a norm ball callsk_norm_ball, which is now public, so an algorithm that a norm ball reads implements both.UlcerIndexandRelativeUlcerIndexhave a fieldwaftersettings, so their positional constructors take two arguments. The keyword constructors do not change.A rule for the diagonal of the Normal covariance set subtypes
AbstractDiagonalConstructionand implementsdiagonal_sigma_shape, which are public. A square-root algorithm subtypesAbstractMatrixSquareRootAlgorithm, which is public, and implementsmatrix_square_root.A regression target of your own subtypes
AbstractRegressionTarget, which is now public, and implements the verbs that its# Interfacessection names.CrossSectionalTargetRegressioncallsfactory(tgt, w)at each observation, and a target with no such method raises anArgumentErrorthat names the method. v0.32 called the genericfactory, which returned the target unchanged, so the fit ignored the cross-sectional weights with no message.StepwiseRegressionandDimensionReductionRegressiontake a target of your own, where v0.32 readtgt.kwargsand raised aFieldErrorwhen you built the estimator.DimensionReductionRegressionreads the weights of the target withregression_target_weights, which is public.A matrix processing estimator of your own that a factor prior repairs under implements
matrix_processing_posdef, which is public. It gives the positive definite matrix estimator of the repair, ornothingto skip it. v0.32 read the fieldpdmof the estimator by name.CrossSectionalFactorPrior, andFactorPriorandFactorBlackLittermanPriorwithrsd = true, now raise anArgumentErrorwhen you build them over a type with no method.A cokurtosis estimator of your own in
HighOrderFactorPriorEstimatorimplementscokurtosis_processor, which is public, to give its matrix processing estimator, andcokurtosis_expected_returnsforrsd = true. v0.32 read the fieldmpof the estimator by name, so a type with anmpfield was processed, and a type with nompfield raised aFieldErrorwhen it was fitted.HighOrderFactorPriorEstimatornow raises anArgumentErrorwhen you build it over a type with nocokurtosis_processormethod, under everyrsd. A method that returnsnothingskips the processing and, underrsd = true, the repair.ReturnsResulthas the fieldsneandE, the exogenous series, afterB, so its positional constructor takes 12 arguments, where v0.32 took 10.PredictionReturnsResulthasneandEtoo, andPricesResulthasE. The keyword constructors do not change.More fields, so more positional arguments. These types of v0.32 have new fields, and their keyword constructors keep every v0.32 keyword:
- The fourteen covariance estimators
CorrelationCovariance,DistanceCovariance,GeodesicShrinkageCovariance,ImpliedVolatility,LowerTailDependenceCovariance,MutualInfoCovariance,RankOneCovariance,GerberCovariance,GerberIQCovariance,SmythBrobyCovariance,KendallCovariance,SpearmanCovariance,WindowedCovarianceandWindowedVariance, and the windowed expected returns, coskewness and cokurtosis, havecache. RegimeAdjustedExpWeightedVariancehashac_flooranddebias.RegimeAdjustedExpWeightedCovariancehashac_floor,hac_vol_before,cor_volanddebias. In both, and inExpWeightedVarianceandExpWeightedCovariance,centringreplacescentred.PortfolioTargethasindefinite.CrossSectionalLinearRegressionhasex, andCrossSectionalTargetRegressionhasalgandex.StepwiseRegressionhaschoice,includedandx_src, andDimensionReductionRegressionhaschoice,projandx_src.DescriptorScoreshasnwafterneutralise, andex.TargetReturnForecasthaswarmupaftercv, andintercept.- The Descriptors that fold have
cache.PanelFieldRatio,PanelFieldLog,ChangeToScaleandChangeInIntensityhavegt0.EWVolumeRatiohasnonnegandgt0, andDaysToCoverhasnonneg. Each new guard defaults to no guard.EWMacroSensitivityhasseriesaftermcap. - The results
CrossSectionalFactorModel(unseen,fx,fr,lambda,c,idx,ts,amrandhist),CrossSectionalRegression(h1,dcandlv),Regression(idxandts),PredictionResult(idx),TargetReturnForecastResult(ocalib),FactorSummaryResult(nfandfam) andCovarianceForecastSummaryResult(step_weighting). MissingDataFilterhasalgafterrow_thr, so its positional constructor takes four arguments.
- The fourteen covariance estimators
A new order of the fields, so a new order of the positional arguments. Four types of v0.32 list their fields in a new order that wastes no padding, and their keyword constructors do not change.
HindsightSplittakesstartbeforeprefix. It has seven fields, as in v0.32, so a v0.32 positional call such asHindsightSplit(true, 21, nothing, nothing, nothing, false, false)still builds a split, withstart = trueandprefix = 21, and raises aTypeErroronly when the split runs. Write the call with keywords.JuMPOptimiserhasxbgtafterlinf,FactorBlackLittermanPriorhasrsdafterve, andTargetReturnForecasthaswhole_historyandcalibrateafterunit.
From v0.33 to v0.34
Names that were removed
AllocationSetConstraint. The re-solve of aFollowTheLeaderrule with a JuMP leader passes the allocation set of the head, the set in which every allocation of the head lies, as a second block of the entry of the leader, and the type is gone. A custom constraint of yours that wrapped a set for a JuMP head of your own passes the set to the entry instead:optimise(opt, rd; blocks = ((factory(set, w), X),)), with the rowsXthat the set reads.append_custom_constraint, the prefix:aset_and the rule "state a kind on the set or on the held optimiser, not on both" go with it. A kind on both now gives two constraints.reduce_loadingsof a stack. Writereduce_exposures(fcb, Ms)for a stack of loading matrices,assets × factors × observations.reduce_loadings(fcb, M, t)takes one loading matrix alone, and a stack raises aMethodError. The numbers do not move.expand_factor_mu. Writeexpand_factor_returns(fcb, mu, t)for a factor mean vectormuat observationt. Withoutt, the vector takes the ratios of the last observation, as before. Writeexpand_factor_returns(fcb, M)for a matrixMthat holds one mean per observation, one per row.expand_factor_returnstakes both forms, and the numbers do not move. A call ofexpand_factor_muraises anUndefVarError.factory_child. Writefactory(x, args...; kwargs...).factoryis a traversal, so it returns every value that has no method of its own with no change, asfactory_childdid: a data field, a number,nothing, a set of observation weights and a covariance estimator ofStatsBase. It rebuilds an array of estimators, algorithms, results or covariance estimators element by element, in an array of the same shape, and it returns an array of data with no change. A call offactory_childraises anUndefVarError.orthogonal_forecast_resultandorthogonal_forecast_step. An orthogonal forecast fit of your own states the regression that the member reads, withorthogonal_forecast_regression(ofit::MyRule, cre), which returnscreornothing. The prior callsreturn_forecast(rfe, rd, csfm, orthogonal_forecast_regression(ofit, cre))in the batch fit, andreturn_forecast_stepwith the same last argument in the carry fold. A rule that changes the fit of the member in another way returns its own return forecast estimator fromorthogonal_forecast_member. Writereturn_forecast(rfe, rd, csfm, cre)where v0.33 wroteorthogonal_forecast_result(OrthogonalPartCalibration(), rfe, rd, csfm, cre). The numbers do not move. A call of either removed name raises anUndefVarError.- The internal steps of the exponentially weighted beta Descriptors.
EWBlockState,ew_beta_series,ew_beta_series!,ew_beta_reset!,ew_beta_output,ew_agg_series,ew_agg_vector,ew_beta_expand,ew_block_rows,ew_block_state,ew_block_copy,ew_beta_residual_variance,ew_active_returns,ew_macro_sensitivity_state,ew_macro_sensitivity_series!andew_macro_carriedare gone. Writeew_beta_stateandew_regression_series!for the regression of the returns on the market, writePortfolioOptimisers.CarriedReference(st)for the counts that anEWMacroSensitivityStatecarries, and readEWBetaState,EWMacroSensitivityStateandEWDownsideBetaStatefor the carried states. See If you extend the library. OrderedWeightsArrayConditionalValueatRiskRangeandOrderedWeightsArrayTailGiniRange. WriteOWA_CVaR_RG(; alpha, beta)where v0.33 wroteOrderedWeightsArray(; w = OrderedWeightsArrayConditionalValueatRiskRange(; alpha, beta)), andOWA_TG_RG(; alpha_i, alpha, a_sim, beta_i, beta, b_sim)for the tail Gini range. The two functions take the keywords and the defaults of v0.33, and they return anOrderedWeightsArrayRange, where v0.33 returned anOrderedWeightsArray. To build the range yourself, give the gain tail reversed:OrderedWeightsArrayRange(; w1 = OrderedWeightsArrayConditionalValueatRisk(; alpha), w2 = reverse ∘ OrderedWeightsArrayConditionalValueatRisk(; alpha = beta)), and the same with twoOrderedWeightsArrayTailGinitails.owa_cvarrgandowa_tgrgstill give the weights of each range. A call of either removed name raises anUndefVarError.StandardisedHighOrderMoment. WriteHighOrderMoment(; alg, ve)where v0.33 wroteHighOrderMoment(; alg = StandardisedHighOrderMoment(; ve, alg)). The defaultveof the wrapper wasSimpleVariance(; me = nothing), soHighOrderMoment(; alg = FourthMoment(), ve = SimpleVariance(; me = nothing))gives the v0.33 value ofHighOrderMoment(; alg = StandardisedHighOrderMoment(; alg = FourthMoment())). The defaultve = nothingofHighOrderMomentgives the raw moment, as v0.33 did with no wrapper. The numbers do not move. A call of the removed name raises anUndefVarError.- Eleven singletons that stated a skipped step. Write
nothingwhere v0.33 wrote the singleton:NoHacFloor()inhac_floor,RawStatistic()indebiasandRawVolatility()incor_volof the regime-adjusted moments,NoPeel()inpeelofCoveragePolicy,NoSlack()inslackofPassiveAggressiveMeanReversion,PlainGradient()ingradofMirrorDescent,ExponentiatedGradientandGradientProjection,NoPanelFill()inalgof a panel input,IdentityScaling()inscalingandIdentityMetric()inmetricofOrthogonalUncertaintySet,IdentityMetric()inweightingof the forecast evaluation,NoSystematicRepair()insrepofCrossSectionalFactorPrior, andNoDecay()indecayofProximity. Where the singleton was the default, the default is nownothing. The numbers do not move. A call of a removed name raises anUndefVarError. AbstractLastObservationAlgorithm, andLastObservationas a holder.LastObservationis an abstract type with the two membersLastRowandLastActiveRow. It ispublic, and it is not exported. WriteLastRow()where v0.33 wroteLastObservation(), andLastActiveRow()where v0.33 wroteLastObservation(; alg = LastActiveRow()).AbstractLastObservationAlgorithm, the bound of the old fieldalg, is gone. A call ofPortfolioOptimisers.LastObservation()raises aMethodError, and the bare nameLastObservationraises anUndefVarError.- The sequential and the grid tail views of entropy pooling. Write
SequentialTailView(; iters, tol)where v0.33 wroteSequentialConditionalValueatRiskView,SequentialEntropicValueatRiskVieworSequentialRelativisticValueatRiskViewwith the same keywords. WriteGridTailView(; pct, K, M, iters, tol, tilt_iters)where v0.33 wroteGridEntropicValueatRiskVieworGridRelativisticValueatRiskViewwith the same keywords. The tail measure of the view selects the formulation, so one type serves each measure. The numbers do not move. A call of a removed name raises anUndefVarError. - The four error weight finalisers. Write
ErrorWeightFinaliser()where v0.33 wroteRelativeErrorWeightFinaliser(),ErrorWeightFinaliser(; alg = L2Norm())forSquaredRelativeErrorWeightFinaliser(),ErrorWeightFinaliser(; dev = AbsoluteWeightDeviation())forAbsoluteErrorWeightFinaliser(), andErrorWeightFinaliser(; alg = L2Norm(), dev = AbsoluteWeightDeviation())forSquaredAbsoluteErrorWeightFinaliser(). The model of aDiscreteAllocationregisters the error row ascerr, where v0.33 registeredcabs_err,csqabs_err,crel_errorcsqrel_err. The weights and the shares do not move.algalso takesLInfNorm()andLpNorm(; p)withp > 1, andLpNorm(; p = 1)raises aDomainError. A call of a removed name raises anUndefVarError. OptimisticStep. WriteMirrorDescent(; predictor = LastGradient())where v0.33 wroteOptimisticStep(), andGradientProjection(; eta, predictor)where v0.33 wroteOptimisticStep(; alg = GradientProjection(; eta), predictor). The predictor is a field of the rule, and its defaultnothinggives no optimistic step. A transform of the gradient, such asGradientMomentum(), beside a predictor raises anArgumentError, as the wrapper refused it. The paths do not move. A call of the removed name raises anUndefVarError.OptimisationCrossValidation.NestedClusteredandStackingholdcvandscoreras two fields. WriteNestedClustered(; cv, scorer, …)where v0.33 wroteNestedClustered(; cv = OptimisationCrossValidation(; cv, scorer), …), and the same forStacking. The default of the wrapper wascv = KFold(), so writecv = KFold()where v0.33 wrotecv = OptimisationCrossValidation(). The weights do not move. Calls that now raise lists the pairs that the constructors refuse. A call of the removed name raises anUndefVarError.ElasticNetPath. The elastic net is a regression target. WriteElasticNet(; theta, strength = MiddleOfPath(; ratio), iters, tol)where v0.33 wroteElasticNetPath(; theta, ratio, iters, tol), andKernelTrendPattern(; tgt)where v0.33 wroteKernelTrendPattern(; path). The defaults are those of v0.33, soElasticNet()fits asElasticNetPath()did.KernelTrendPatternTrackingalso takesratio. On 200 problems the coefficients do not move.KernelTrendPattern()does not move attheta < 1on the cases measured, and attheta = 1it moves by1e-14relative at most. As a target,ElasticNetalso entersStepwiseRegressionundercrit = :aic,:aiccor:bic, andDimensionReductionRegression. A call of the removed name raises anUndefVarError, and the keywordpathraises aMethodError.- The keyword and field
ucs_flagofNearOptimalCentering, and theflagslot ofno_bounds_risk_measureandno_bounds_no_risk_expr_risk_measure. The copies without bounds that the anchors and the unconstrained centring model read keep the uncertainty sets of the risk measures and of the return terms.expected_riskof anUncertaintySetVarianceandexpected_returnof anArithmeticReturnwith a fitted set give the worst case over the set, so each anchor is a value of the expression that the model bounds. Withucs_flag = false, v0.33 solved the anchors of minimum risk and of maximum return on the nominal moments. It computed the bounds of the region with the sets, and the centring model ofUnconstrainedNearOptimalCenteringread the nominal moments. So the bounds of the region did not match the expressions of its model. The removal does not move the numbers of the defaultucs_flag = true. A return term with a fitted set moves the anchors, as Results that move states forexpected_return. To centre on the nominal moments, writeVariance()in place of theUncertaintySetVariance, and give theArithmeticReturnnoucs. The keyworducs_flagraises aMethodError, and so does a second argument tono_bounds_risk_measureorno_bounds_no_risk_expr_risk_measure.
Renamed keywords and changed defaults
PanelFieldTargettakesfields, where v0.33 tookname. The field takes one field of the asset panel, a sum or a product of fields, or a descriptor estimator such asEWVolumeRatio(), as thefieldsofPanelFieldScorerdoes, and a sum, a product or an estimator is not a name. WritePanelFieldTarget(; fields = "market_cap")where v0.33 wrotePanelFieldTarget(; name = "market_cap"), and readtarget.fieldswhere v0.33 readtarget.name. The v0.33 keyword raises anUndefKeywordError. The positional formPanelFieldTarget("market_cap")does not change.ProcessedJuMPOptimiserAttributesisResolvedJuMPOptimiser, and it holds its constraints in aResolvedConstraintBlock. The bundle holdspr,fees,ret,sca,imskandcbr, the resolved constraint block of the fit. v0.33 held one field for each resolved constraint. The readsjor.wb,jor.lt,jor.st,jor.lcsr,jor.ctr,jor.gcardr,jor.sgcardr,jor.smtx,jor.sgmtx,jor.slt,jor.sst,jor.sglt,jor.sgst,jor.tnandjor.plrforward to the block, sores.wbof a JuMP Result does not change. The keyword constructor takespr,fees,ret,sca,imskandcbr. The verbprocessed_jump_optimiser_attributesisresolve_jump_optimiser,ProcessedAttributesisAbstractResolved,ProcessedRiskBudgetingAttributesisAbstractResolvedRiskBudgeting,ProcessedAssetRiskBudgetingAttributesisResolvedAssetRiskBudgeting, andProcessedFactorRiskBudgetingAttributesisResolvedFactorRiskBudgeting. The v0.33 names raise anUndefVarError.fit_and_predictover one split takestrain_idx,test_idxandcolsby position. Writefit_and_predict(opt, rd, train_idx, test_idx, cols)where v0.33 wrotefit_and_predict(opt, rd; train_idx, test_idx, cols).colsdefaults to:. To read a stepped estimator or pipeline out, passnothingastrain_idx:fit_and_predict(opt, rd, nothing, test_idx). The form on a result ignorestrain_idx. Each form passes its keywords topredict, so a keyword thatpredictdoes not take raises aMethodError. On a result, v0.33 dropped such a keyword with no error. The forms over a scheme,fit_and_predict(opt, rd, cv; cols, ex, id), do not change.Every scalariser field and keyword defaults to
nothing, where v0.33 defaulted toSumScalariser(). This holds for thescaofJuMPOptimiser,HierarchicalRiskParity,RiskLoss,MeanReturnRiskRatio,ExpectedReturnRiskRatioand the Results that copy it, forscaiandscaoofHierarchicalEqualRiskContribution, forsca1andsca2ofNonOptimisationRiskRatio, and for thescakeyword ofexpected_risk,expected_ratio,risk_contributionand their siblings. With a vector of risk measures,nothinggives the sum, so no number moves. A read of the field, such asopt.sca isa SumScalariser, now readsnothing. Every slot still takesSumScalariser().The field
paof a JuMP Result isjor, and the fieldprbof a risk budgeting Result isrbr. Readres.jor.prwhere v0.33 readres.pa.pr,res.jr.jorwhere v0.33 readres.jr.pa, andres.rbr.rrwhere v0.33 readres.prb.rr. The keyword ofJuMPOptimisationResultisjor, and the keyword ofRiskBudgetingResultandRelaxedRiskBudgetingResultisrbr. A read through the forward rule, such asres.pr,res.wborres.rkb, does not change.res.paandres.prbraise aFieldError.Three range keys of the JuMP model follow
<base>_range_risk_. Readmodel[:drcvar_range_risk_1]where v0.33 readmodel[:drcvar_risk_range_1],model[:evar_range_risk_1]where v0.33 readmodel[:evar_risk_range_1], andmodel[:genvar_range_risk_1]where v0.33 readmodel[:genvar_range_1]. The keys of the upper bound of each of the three ranges change with them.range_risk_key(r)gives the key of every range that decomposes. The numbers do not move.The four fee rows of the model of a
DiscreteAllocationare vector rows. Inres.l_modelandres.s_model,model[:cftn_ub],model[:cftn_lb],model[:cb_ub]andmodel[:cb_lb]are each oneConstraintRefof a vector-valued row, where v0.33 held a vector with one row for each asset.JuMP.valueandJuMP.dualof the entry give the vector of v0.33 values, andmodel[:cftn_ub][i]raises aMethodError. The shares do not move.supports_precomputed_returnstakes the kind of the measure last. Writesupports_precomputed_returns(r, rk)where v0.33 wrotesupports_precomputed_returns(rk, r), withrkaNetReturnsInput, aWeightsInputor aWeightsReturnsFeesInput.rkdefaults torisk_input_kind(r), sosupports_precomputed_returns(r)does not change, and a measure of yours still declares its own one-argument method. The v0.33 order raises aMethodError. The answers do not change.cross_sectional_warmuptakes the name of each factor. Writecross_sectional_warmup(X, Ms, emsk, nf)where v0.33 wrotecross_sectional_warmup(X, Ms, emsk), withnfthe name of each column ofMs, asax.nfofcross_sectional_factor_axisgives it. The exposure history of the observed factors,Zo, is a fifth argument, andnfthen names the columns ofZoafter those ofMs. The v0.33 call raises aMethodError, and annfof another length raises aDimensionMismatch. The count of cold observations does not change. When every observation is cold, the refusal names each factor whose exposure history holds no finite value, such as"momentum"or"industry=Energy".EWBeta,EWMarketBeta,EWMacroSensitivity,EWDownsideBeta,EWResidualVolatilityandEWResidualDownsideVolatilitytake nomin_val. The floor that v0.33 added to each denominator is gone, because a beta is nowNaNwhere its denominator does not vary, as Results that move states. Delete the keyword.EWResidualVolatilityandEWResidualDownsideVolatilitytakebeta_min_obs = 10in its place, the number of valid observations that the beta of an asset needs before a residual is formed from it. The positional constructor ofEWResidualVolatilitytakesbeta_min_obsafterbeta_decay.JamesSteinandBayesSteinclamp their shrinkage intensity by the new fieldintensity, whose defaultUnitIntervalIntensity()clamps it into $[0, 1]$. v0.33 used the raw intensity of the formula. On a sample whose raw intensity is outside $[0, 1]$, the default moves the expected returns. One strong common factor gaveJamesSteina raw intensity of-25865, and means close to the grand mean gave26.6. The intensity ofBayesSteinis in $(0, 1]$ under a positive semidefinite covariance, so its default moves only under an indefinite covariance. Writeintensity = nothingto keep the raw intensity of v0.33.NonNegativeIntensity()clamps at zero alone.SteinShrinkagedoes not read the field.The default
subset_sizeofSubsetResamplingisPowerSubsetSize(), which keepsround(N^0.8)assets in each subset. v0.33 kept the fraction0.8 N. On 100 assets a subset now holds 40 assets, where v0.33 held 80, so the weights move. Writesubset_size = 0.8to keep the subsets of v0.33.PowerSubsetSize(; p)takes another power in $(0, 1]$.covariance_forecast_compareandlog_wealth_regrettest the mean of the loss difference with the test estimator in the keywordmt, where v0.33 tooklags. v0.33 divided the mean difference by a Newey-West variance at a fixed number of lags, and read a normal law. That test rejects too often. On a null MA(1) difference with a break in the volatility, at a nominal 5 %, the test at one lag rejected 9.4 % of the draws at 60 steps and 9.6 % at 240 steps. The defaultmt = WildBootstrapMeanTest()rejects 5.2 % and 4.9 %, andOverlapMeanTest()is the rule of zero lags.CovarianceForecastComparisonResultandLogWealthRegretResultholdt_stat,p_value,mean_ci_lowerandmean_ci_upper, where v0.33 heldvariance,z,pandlags. The keywordlagsraises aMethodError, andres.zraises aFieldError. A step that one side did not score is missing at its position, and two evaluations that share no scored step raise anIsEmptyError.SkewnessandKurtosisread their comoment matrix, and lose the fields that only their functors read.Skewnesskeepssettingsandsk, and losesw,mu,veandpe.Kurtosiskeepssettings,kt,N,algandmtx_sqrt, and losesw,mu,alg1andpe.alg2ofKurtosisisalg, so writeKurtosis(; alg = QuadRiskExpr())where v0.33 wroteKurtosis(; alg2 = QuadRiskExpr()). Give a prior estimator to the slot, as inKurtosis(; kt = HighOrderPriorEstimator()), where v0.33 wrotepe. The centre, the observation weights and the semi moment belong to the estimator of the matrix, such asCokurtosis(; w, alg = SemiMoment()). A removed keyword raises aMethodError. Each value that the v0.33 functor read from the returns has a measure of its own:Skewness(; w, mu)isThirdCentralMoment(; w, mu, ve = SimpleVariance()).Kurtosis(; w, mu, alg2 = QuadRiskExpr())isHighOrderMoment(; w, mu, alg = FourthMoment()).Kurtosis(; w, mu)isLowOrderMoment(; w, mu, alg = EvenMoment()).alg1 = SemiMoment()isFourthMoment(; alg = SemiMoment())orEvenMoment(; alg = SemiMoment()).
On 250 observations of 5 assets, eight of the nine forms give the v0.33 value bit for bit.
Kurtosis(; w)againstLowOrderMoment(; w, alg = EvenMoment())is4.2e-16apart. Results that move states the value of the two functors.EWMean,EWMomentumandExpWeightedExpectedReturnstakedebias = ZeroStartDebias(). The default divides the state of the recursion, which starts at zero, by the sum of its weights1 - decay^n.ExpWeightedExpectedReturnsdivided in v0.33 too, so its default result does not move.EWMeanandEWMomentumdid not divide in v0.33, and Results that move states how their values move.debias = nothingkeeps the undivided state, which shrinks the mean of an asset with a short history toward zero. The new field comes beforecache, so a positional call of the inner constructor takes one more argument, and the type of each estimator takes one more parameter, before the type ofcache. A positional call of v0.33 raises aMethodError.GradientMomentum,RootMeanSquareGradientandAdaptiveMomentGradienttakedebias = nothing, andEGE,EGRandEGAtake the keyworddebias. The default reads each moving average undivided, as v0.33 did, so no default result moves bit for bit.debias = ZeroStartDebias()divides each average by1 - gamma^k, wherekcounts the steps since the seed of the averages, as Adam does.EGA(; gamma1 = 0.9, gamma2 = 0.999, debias = ZeroStartDebias())is the exponentiated gradient under Adam. The new field comes last, so a positional call of the inner constructor takes one more argument, and the type of each transform takes one more parameter, last. A transform prints one more field.DriftedWeightshas no fieldwd. WriteDriftedWeights()where v0.33 wroteDriftedWeights(; wd = SelfFinancingDrift()), the default.SelfFinancingDriftwas the one drift of the library, soDriftedWeights()gives every drift of v0.33. The keywordwdraises aMethodError. A previous-weights source of your own states its drift with a methodheld_weights_drift(::Nothing, ::MySource), which is public.ImpliedVolatilityhas no fieldmp. A covariance estimator takes no matrix processing. WritePortfolioOptimisersCovariance(; ce = ImpliedVolatility(; ppy, …), mp)where v0.33 wroteImpliedVolatility(; ppy, …, mp). The keywordmpraises aMethodError. The default no longer repairs the matrix, as Results that move states.OrderedWeightsArrayRangehas no fieldrev, and it stores a givenw2as given. v0.33 reversed a givenw2unlessrev = true, and its defaultw2wasowa_tg. Writew2 = reverse(v), orw2 = reverse ∘ ffor a builder, where v0.33 wrotew2 = vorw2 = f. Writew2 = vwhere v0.33 wrotew2 = v, rev = true. With now2, v0.34 stores the reversal ofw1, where v0.33 stored the reversal ofowa_tg. Writew2 = reverse ∘ owa_tgto keep the v0.33 range ofOrderedWeightsArrayRange(; w1). A v0.33 call with aw2and norev, or with aw1alone, builds and gives another result with no error.OrderedWeightsArrayRange()does not move, and the keywordrevraises aMethodError.OWAJuMPdefaultsscandsotonothing, where v0.33 defaulted each to1.0.nothingresolves to the scale of the objective.scresolves to1.0.soresolves to1e-3underMaximumEntropy, the defaultalg, and to1.0under the other objectives. A number that you state wins. So under another objective the resolved scales are those of v0.33. A read of the field, such asow.so == 1.0, now readsnothing. UnderMaximumEntropythe objective is new, as Results that move states. On 15 programmes, withTfrom 50 to 1000 andkfrom 4 to 6, the defaultOWAJuMP(; slv)falls back toncrra_weightson none, and a statedso = 1.0falls back on 11.
Calls that now raise
| Call | v0.33 | v0.34 |
|---|---|---|
Covariance, Coskewness, Cokurtosis, SecondMoment, EvenMoment, FourthMoment, EWVolatility or EWResidualVolatility with an alg that is a Gerber, Smyth-Broby or Gerber IQ algorithm or a shrinkage target, such as Covariance(; alg = IdentityTarget()) | Built the estimator. cov then overflowed the stack, and coskewness and cokurtosis raised a MethodError. | Raises a TypeError when you build the estimator. The alg of these types is FullMoment() or SemiMoment(). Give a Gerber algorithm to GerberCovariance, SmythBrobyCovariance or GerberIQCovariance, and a shrinkage target to GeodesicShrinkageCovariance. |
EWResidualVolatility or EWResidualDownsideVolatility with a ce whose every window holds an observation before the beta of each asset exists, such as ce = Covariance(), SimpleVariance(), PortfolioOptimisersCovariance(), WindowedVariance(), which has no window, or WindowedVariance(; window = collect(1:60)) | Built the estimator, and descriptor answered. v0.33 formed a residual from the first observation, so Covariance() and SimpleVariance() gave a finite value at 117 of the 120 cells of a panel of 40 observations of 3 assets with no gap. PortfolioOptimisersCovariance() raised ArgumentError: matrix contains Infs or NaNs. | Raises an ArgumentError when you build the estimator. The residual of an asset is NaN until its beta exists, see beta_min_obs under Renamed keywords and changed defaults. The series of a plain estimator keeps no asset with a NaN in its window, so such a ce would give NaN at every cell. Pass the default ce, an ExpWeightedVariance, an ExpWeightedCovariance, a SimpleVariance or a Covariance with cvg = CoveragePolicy(), a PortfolioOptimisersCovariance over one of them with no step in its mp, such as mp = MatrixProcessing(; pdm = nothing), or a windowed estimator with an integer window, such as WindowedVariance(; window = 60). A composite with the default mp passes the constructor, and descriptor then raises ArgumentError: matrix contains Infs or NaNs on the NaN row of the warm-up, as the docstring of PortfolioOptimisersCovariance states. An index window is admitted when its first index is at least max(beta_min_obs, 2). |
JuMPOptimiser or ProgrammeAllocationSet with an empty vector in lcse, smtx, sgmtx or ple, and FactorRiskContribution with an empty frc_ple, such as lcse = LinearConstraintEstimator[] | Built the estimator. optimise of a MeanRisk on such a JuMPOptimiser then raised a MethodError, or a TypeError for ple. | Raises an IsEmptyError that names the field when you build the estimator, as an empty tn or cte does. Pass nothing for no constraint. |
A NearestQuantilePrediction called with a sign, scorer(ppred, -1), and quantile_by_measure(...; sign = -1) | Multiplied the risk of each path by the sign. | Raises a MethodError. The orientation of each measure now comes from bigger_is_better, so remove the sign. A call with sign = -1 for a measure of which a bigger value is better selects the same path without it. |
NearestQuantilePrediction or quantile_by_measure with the reduction of a vector of measures in r_kwargs, such as r_kwargs = (sca = MaxScalariser(),); sort_by_measure(ppred, r), sort_by_measure(ppred, r; sca = …) and quantile_by_measure(ppred, r, q; …); and the positional constructor NearestQuantilePrediction(r, q, r_kwargs, q_kwargs) | Passed r_kwargs.sca and the keyword sca to expected_risk, which reduced the vector with it. A call with no sca reduced it with SumScalariser(). | r_kwargs.sca raises a ConflictingArgumentError, and the other calls raise a MethodError. The reduction is the field sca of NearestQuantilePrediction, NearestQuantilePrediction(; r, sca = MaxScalariser()), and the first argument of the two verbs, sort_by_measure(MaxScalariser(), ppred, r) and quantile_by_measure(MaxScalariser(), ppred, r, q). For one measure the reduction is inert, so pass SumScalariser() or nothing. |
GridSearchCrossValidation or RandomisedSearchCrossValidation with a reduction in kwargs, such as kwargs = (sca = MaxScalariser(),); and the positional constructors of the two searches | Passed kwargs.sca to expected_risk, where it was inert on the one measure that r took. The positional constructors took r and then scorer. | kwargs.sca raises a ConflictingArgumentError that names r_sca. The reduction of a vector of measures is the new field r_sca, GridSearchCrossValidation(p; r = [ConditionalValueatRisk(), MeanReturn()], r_sca = MaxScalariser()). The positional constructors take r_sca after r, so a positional call of v0.33 raises a MethodError. The keyword constructors keep their meaning. |
SearchCrossValidationResult(; opt, ranked, …) with an opt that is not ranked[1] | Built the Result. | Raises a DimensionMismatch. opt is the winner, ranked[1], as idx is rank_idx[1]. Pass ranked with opt first, or omit ranked, which defaults to [opt]. |
FiniteAllocationInput with an infinite price, such as prices = [10.0, Inf, 20.0] | Built the input. GreedyAllocation then gave a NaN cash with an OptimisationSuccess, and DiscreteAllocation raised an ErrorException from JuMP. | Raises a DomainError when you build the input. Write an absent price as NaN. |
EntropyPoolingPrior or MeucciEntropyPoolingPrior, and an OpinionPoolingPrior of them, with a sets whose asset list has more or fewer names than X has columns | Raised a DimensionMismatch from a matrix product, which named no field. | Raises a DimensionMismatch that names pe.sets.dict[pe.sets.xkey] and both lengths, as BlackLittermanPrior does. The names still map to the columns of X by their position in the list. |
EntropyPoolingPrior or MeucciEntropyPoolingPrior with a view row that no reweighting of the scenarios meets, such as a mean target above the largest return of its asset, or a row that only a posterior with a zero on the support meets, such as a mean target equal to that largest return | Failed in the numerics with an error that named no view, and the type of the error changed with the size of the miss. The default OptimEntropyPooling raised an ArgumentError, such as matrix contains Infs or NaNs or weights cannot contain Inf or NaN values, or a DomainError from sqrt. JuMPEntropyPooling raised Entropy pooling optimisation failed. Two such views returned a posterior with no error: a mean target on the edge of its band put all the mass on one scenario, with kld = 6.92, and a correlation view outside its band under H1_EntropyPooling gave kld = 6.22. | Raises a DomainError that names the view and the values that a reweighting of the scenarios reaches, on both routes. A row that is constant on the support passes when its target is that constant, as in v0.33. Two rows that each pass alone and that no posterior meets together raise as in v0.33, unless you give solvers to the new field diagnose: the fit then raises a DomainError that names the view fields, see If you extend the library. |
prior or optimise on a ReturnsResult with names, where a UniverseSets of the estimator lists the assets in another order than rd.nx, or lists a name that rd.nx does not have, such as sets = UniverseSets(; dict = Dict("nx" => ["A", "B", "C"])) with rd.nx == ["A", "C", "B"] | Fitted. A name resolved to its position in the list, so each view, bound and group bound the column at that position, which rd names differently. Only the sets of a JuMPOptimiser was checked. | Raises an ArgumentError that names the first position where the lists differ, or a DimensionMismatch when the lengths differ. The check reads every UniverseSets of the prior and of the optimiser, and the factor key against rd.nf. A universe in the factor prior of a FactorPrior, a FactorBlackLittermanPrior or an AugmentedBlackLittermanPrior names the factors of rd. Build the list from rd.nx, as in Dict("nx" => rd.nx). |
A moment, a regression, a Descriptor, a forecast, a distance or a diagnostic called with a bare integer matrix, such as cov(ExpWeightedCovariance(), X), mean(ExpWeightedExpectedReturns(), X) or var(RegimeAdjustedExpWeightedVariance(), X) with X::Matrix{Int} | Converted the data to Float64 and gave the fit of the float copy. | Raises, usually an InexactError or a MethodError. These kernels take the type of their data, and an integer holds no fraction and no NaN. Build a ReturnsResult or a PricesResult, which converts integer data once, or pass float.(X). Rational data are unchanged, and an integer stays where it is the natural type: a share count, a lot size, a cardinality, a count, an index, a Bool mask, the codes of a CategoricalPanelField. |
clusterise of a hierarchical or a k-means clustering, and a fit of HierarchicalRiskParity, HierarchicalEqualRiskContribution, SchurComplementHierarchicalRiskParity or NestedClustered, on a distance with a NaN between two assets, such as two assets that share too few observations under a reader with CoveragePolicy(; peel = nothing) | The hierarchical clustering raised ArgumentError: Distance matrix should be symmetric. from Clustering.hclust, and the k-means clustering raised ArgumentError: weights cannot contain Inf or NaN values from Clustering.kmeans. | Raises a DomainError that names the first NaN cell and its cause, two assets that share too few observations. |
A weight finaliser, or opt_weight_bounds, on integer weights with an absent bound, such as opt_weight_bounds(IterativeWeightFinaliser(), WeightBounds(; lb = nothing, ub = 1), [2, 1, 0]) | Read the absent bound as an infinity and gave the projection of the float copy. | Raises an ArgumentError that names the element type. An absent bound is an infinity of the element type of the weights, and an integer type has none. Pass float weights. |
FollowTheLeader whose held estimator has a fallback of another kind, such as FollowTheLeader(; opt = MeanRisk(; opt = JuMPOptimiser(; slv), fb = EqualWeighted())), or a precomputed result in its fallback chain | Built the rule. A fallback leader solved without the allocation set of the head, so a cap of 0.2 on the set gave a weight of 0.9999999937 on one asset. | Raises an ArgumentError that names the member. Each member of the chain must have the kind of the held estimator: a JuMP estimator under a JuMP estimator, and a BestConstantRebalancedPortfolio under a BestConstantRebalancedPortfolio. |
FactorRiskContribution with a SemiDefinitePhylogeny or a SemiDefinitePhylogenyEstimator in the ple of its JuMPOptimiser, alone, in a vector or in a schedule, such as FactorRiskContribution(; opt = JuMPOptimiser(; slv, ple = SemiDefinitePhylogeny(; A, p = 0.05))) | Built the estimator, and solved with no row of the phylogeny and no message. The weights were those of ple = nothing, so the linked pairs kept their weight. | Raises an ArgumentError when you build the estimator. The head solves for the factor weights and writes no lift of the asset weights, so the phylogeny could add no row. Put a phylogeny of the factors in frc_ple. An IntegerPhylogeny in opt.ple still applies. |
OnlinePortfolioSelection with a FollowTheLeader whose held estimator, or a member of its fallback chain, is a FactorRiskContribution, and a ProgrammeAllocationSet whose ple holds a SemiDefinitePhylogeny or a SemiDefinitePhylogenyEstimator | Built the head. The rows of the phylogeny sat on a lift of the asset weights that no term held down and that took no penalty, so they bound nothing. | Raises an ArgumentError when you build the head, as FactorRiskContribution refuses a semidefinite phylogeny in opt.ple. Put the phylogeny on a MeanRisk leader, or use an IntegerPhylogeny on the set. |
FollowTheLeader whose held JuMP optimiser has a net budget that excludes one, such as bgt = 0.5 or bgt = BudgetRange(; lb = 1.1, ub = 1.2), or a BudgetCosts or a BudgetMarketImpact in bgt, also as an entry or the default of a TimeDependent schedule | Built the rule. With bgt = 0.5 the leader solved at no step, and the head traded nothing, so on 40 rows of three assets it played its drifted start allocation, [0.3919, 0.3328, 0.2754]. With bgt = BudgetCosts(; bgt = 1.0, w = fill(1 / 3, 3), vp = 0.01, vn = 0.01) the leader stayed at the reference [1/3, 1/3, 1/3]. | Raises when you build the rule: a DomainError for a number or a range, and an ArgumentError for a cost estimator. The head owns the budget of one, so write bgt = nothing or bgt = 1 on the held optimiser. A function schedule raises at the first fold whose value excludes one. |
JuMPOptimiser whose gross budget gbgt has an upper end below the least magnitude of the net budget, such as JuMPOptimiser(; slv, bgt = 1.0, gbgt = 0.5, wb = WeightBounds(; lb = -1, ub = 1)), and a ProgrammeAllocationSet whose gbgt has an upper end below one | Built the optimiser, and its solve gave an OptimisationFailure, because the gross exposure is at least abs(sum(w)). | Raises an ArgumentError that names both budgets when you build it. |
OnlinePortfolioSelection with a ProgrammeAllocationSet and a FollowTheLeader whose held estimator, or a member of its fallback chain, is a NearOptimalCentering under its default alg = UnconstrainedNearOptimalCentering() | Built the head. The centring model of the leader dropped rows of the set, and the rule plays the leader with no projection at gamma = 0, so the head played an allocation outside its set. On 80 rows of eight assets and a set with the row a + b <= 0.05, the head played a + b = 0.2054. | Raises an ArgumentError when you build the head, also for an expert of an ExpertMixture and for an entry of a schedule on set. Write alg = ConstrainedNearOptimalCentering(), which keeps every row of the set, or use a BoundedAllocationSet for bounds alone. |
ConstantRebalancedPortfolio with a target w whose element type is not a number, such as w = Any[0.5, 0.5] | Built the rule when the elements were numbers. A vector of another element type raised an error from sum. | Raises a TypeError when you build the rule. The bound of w is a vector of numbers. Pass [0.5, 0.5]. |
covariance_forecast_summary or the keyword constructor of CovarianceForecastSummaryResult with a level that is not a real number, such as levels = ("a",) | covariance_forecast_summary raised a MethodError from zero. The constructor built the Result. | Raises a TypeError at the keyword levels. Pass a tuple or a vector of real numbers, such as (0.95, 0.99). |
A PerformanceSummaryResult built by hand with an alpha outside $(0, 1)$, a ppy that is not positive, an rf that is not finite, a negative count, deviation, turnover or exposure, a risk that does not have the names of measures, or a field of an entry that does not have the shape of n_periods | Built the Result. The constructor checked no value. | Raises a DomainError for a value outside its domain, an ArgumentError for the names of risk, and a DimensionMismatch for a shape. The shape of a field is one value for one entry, or one vector entry for each series. A summary that performance_summary builds does not change. |
A linear constraint row whose coefficients are all zero under strict = true, such as linear_constraints(LinearConstraintEstimator(; val = "A - A <= 0.1"), sets; strict = true), also in a Black-Litterman view, a centrality constraint and a precomputed LinearConstraint in an ExposureConstraintEstimator | Raised an ArgumentError. A precomputed LinearConstraint in an ExposureConstraintEstimator kept a row that the loadings made all zero, and strict = true did not raise. | Raises an IsZeroError, a PortfolioOptimisersError. Catch IsZeroError where you caught ArgumentError. strict = false warns and drops the row, as in v0.33, and the precomputed route drops it too. An unknown name still raises an ArgumentError. |
owa_tg, owa_tgrg, OrderedWeightsArrayTailGini, OWA_TG or OWA_TG_RG with a_sim < 2 or b_sim < 2, such as owa_tg(10; a_sim = 1) | owa_tg raised an ArgumentError from range. OrderedWeightsArrayTailGini(; a_sim = 1) built the measure, and a call of it failed. | Raises a DomainError. The grid of a tail Gini needs two points, so a_sim = 2 and b_sim = 2 are the smallest values. |
cov or cor of ImpliedVolatility with a negative entry or a gap in iv | A gap raised an IsNonFiniteError. A negative entry passed, and on the premium path a negative last entry gave a negative volatility, whose sign the conversion to a covariance hid. | Raises a DomainError for each, under both algorithms. A zero entry passes. |
ImpliedVolatilityRegression on data that give three or four windows, with a zero iv on the last row of a window, or with a window of constant returns | Three windows gave a fit with no unique coefficients, and four windows a fit with no residual. A zero iv on the last row of an earlier window, and a window of constant returns, raised ArgumentError: matrix contains Infs or NaNs from the solve. A zero iv on the last row of the sample predicted a volatility of zero. | Raises a DomainError. The fit needs more than four windows, and it takes the logarithm of each implied and realised volatility that it reads, so each must be positive. The message names the count of windows, or the value, the asset and the window. A zero iv on a row that ends no window is not read. |
RegimeAdjustedExpWeightedVariance or RegimeAdjustedExpWeightedCovariance with a regime_decay outside $(0, 1)$, LogRegimeAdjusted with an x or a y that is not positive, FirstMomentRegimeAdjusted with an x that is not positive, and a regime_method of your own under debias = ExactDebias() or debias = LawDebias() | Built the estimator. At regime_decay = 1 the regime state froze, a zero parameter gave a NaN or an infinite multiplier, and a method of your own failed in the fit. | Raises when you build the estimator: a DomainError for a value, and an ArgumentError for a method of your own. The two bias corrections read the moments of the methods of the library alone, so a method of your own takes debias = nothing, the raw statistic. |
A matrix in TurnoverEstimator.val, RiskBudgetEstimator.val, ThresholdEstimator.val, WeightBoundsEstimator.lb or ub, or FeesEstimator.l, s, fl or fs, such as WeightBoundsEstimator(; lb = [0.1 0.2; 0.3 0.4]) | Built the estimator. Its resolution then raised a TypeError, because the result holds a number or a vector. | Raises a TypeError at the keyword. Each slot takes a number, a vector of numbers, a pair, a value of many estimators, or a VectorAbstractEstimatorValueAlgorithm. |
PowerNormValueatRisk, PowerNormDrawdownatRisk or RelativePowerNormDrawdownatRisk with p = 1 | Built the measure. The power cone of order one is degenerate, so PRM returned NaN. | Raises a DomainError. At p = 1 the measure equals the conditional measure of the same series, such as ConditionalValueatRisk, so use that measure. |
The functor of GenericValueatRiskRange on a vector of returns, r(X * w), with a ValueatRisk(; alg = DistributionValueatRisk()) tail | Raised a DimensionMismatch, or returned a wrong value when X had as many observations as assets. | Raises an ArgumentError, because such a tail reads the weights. Call r(w, X, fees) or expected_risk(r, w, X), as Calls that now answer states. |
PricesResult with a repeated timestamp | Built the result. port_opt_view then found each row by its timestamp, so a view returned the wrong rows. | Raises an ArgumentError that names the count and the first repeat, as ReturnsResult does. |
L1UncertaintySet or SignedL1UncertaintySet with an infinite entry in sd | Built the set. A NaN entry raised a DomainError. | Raises an IsNonFiniteError for a NaN or an infinite entry. A zero entry builds, as Calls that now answer states. |
A FeatureDistance under StackObservations with a WeightedHamming, PeriodicEuclidean, Mahalanobis or SqMahalanobis metric, on a pair of assets that shares fewer rows than the window | Raised a DimensionMismatch from Distances.jl. | Raises an ArgumentError that names the method of stack_rescale to add for the metric, or tells you to use AggregateDistances. |
BlackLittermanViews with a repeated entry in excl, an entry outside 1:(length(Q) + length(excl)), or a vector views_conf of the length of the kept views under an excl | Built the views. A views_conf of the kept length passed, and its first entry applied to every kept view, so the other confidences were lost with no error. | Raises an ArgumentError for a repeat, a DomainError for an entry out of range, and a DimensionMismatch for views_conf. views_conf has one entry for each view that you wrote, length(Q) + length(excl). |
Kurtosis(; alg1 = SemiMoment()), and every call that passes alg1 to Kurtosis | Built the measure. alg1 set the moment of the functor alone. The JuMP model read the cokurtosis of kt or of the prior, so under alg1 = SemiMoment() the model and the functor disagreed. | Raises a MethodError. The functor and the model both read kt. Write Kurtosis(; kt = Cokurtosis(; alg = SemiMoment())) for the semi fourth moment. |
owa_l_moment(T, k) with k > T, such as owa_l_moment(5, 6) | Returned weights of NaN, because no subset of k observations exists. | Raises a DomainError. The L-moment of order k weighs k order statistics at a time, so 1 <= k <= T must hold. |
owa_gmd(T) with T < 2, and OrderedWeightsArray() on one observation | owa_gmd(1) returned the range NaN:Inf:NaN. OrderedWeightsArray()([0.01]) returned NaN, and a JuMP model on one observation stopped at a NaN coefficient. | Raises a DomainError. The Gini mean difference averages over the pairs of distinct observations, and one observation has no pair. |
OrderedWeightsArray or OrderedWeightsArrayRange with a weight vector whose length is not the count of observations, such as OrderedWeightsArray(; w = owa_cvar(100)) on 39 observations, in a JuMP model or in a call of the measure | The default ApproxOrderedWeightsArray() read only the sum, the extremes and the norms of the vector, so it solved another problem with no error. ExactOrderedWeightsArray() and SortingNetworkOrderedWeightsArray() raised a DimensionMismatch that named no field, and a call of the measure raised one from dot. | Raises a DimensionMismatch that names the field, w, w1 or w2, and the count of observations, under each formulation and in a call of the measure. A function in the field, such as the default, takes the count of observations, as in v0.33. |
TurnoverRiskMeasure with a NaN or an infinite entry in w | Built the measure. | Raises a DomainError when you build the measure. |
ThirdCentralMoment with a NaN or an infinite mu, a number or an entry of a vector | Built the measure. | Raises an IsNonFiniteError when you build the measure, as MedianAbsoluteDeviation and Kurtosis do. |
bounds_risk_measure(rs, ubs) with a vector of measures and a vector of bounds of another length, such as bounds_risk_measure([ConditionalValueatRisk()], [0.1, 0.2, 0.3]) | Broadcast the measures over the bounds. One measure and three bounds gave three copies of the measure, and other lengths raised the DimensionMismatch of the broadcast. | Raises a DimensionMismatch that names both lengths. Each measure takes one bound. |
FactorRiskContribution with a Frontier or a vector in settings.ub of a risk measure | Logged a warning that the bound "would be silently ignored", and solved one portfolio with no bound. | Raises an ArgumentError, because FactorRiskContribution solves its model once and sweeps no frontier. A number in ub still warns. Use MeanRisk or NearOptimalCentering for a sweep. |
FactorRiskContribution, RiskBudgeting or RelaxedRiskBudgeting with a Frontier or a vector return floor, such as ret = ArithmeticReturn(; settings = JuMPReturnsSettings(; lb = Frontier(; N = 3))), and RiskBudgeting with a Frontier or a vector in settings.ub of a risk measure | Solved one portfolio with no message. No solve read the bound, so the portfolio could fall below the floor. | Raises an ArgumentError that names the bounds when the model is built. Give each bound one number, or use MeanRisk or NearOptimalCentering, which sweep a frontier. |
Frontier(; N = 1) | Built the frontier. A sweep then raised an ArgumentError from range, because a range of one point cannot hold two different end points. | Raises a DomainError when you build the frontier. A sweep runs from the minimum-risk end to the maximum-return end, so it needs two points. To solve at one bound, give the bound as a number. |
Skewness or Kurtosis on a bare returns matrix, such as expected_risk(Kurtosis(), w, X), or over a LowOrderPrior, such as prior(EmpiricalPrior(), X) or the prior that a hierarchical optimiser fits with its default EmpiricalPrior | Read the returns, and gave a value. | Raises an IsNothingError, because each measure reads its comoment matrix, sk or kt. The message names prior(HighOrderPriorEstimator(), X), which fits both matrices. |
ScoreSelector(; score = Skewness(), rule) or ScoreSelector(; score = Kurtosis(), rule) | Built the selector, and scored each asset on its returns. | Raises an ArgumentError that names a measure of a return series: ThirdCentralMoment(), ThirdCentralMoment(; ve = SimpleVariance()), HighOrderMoment(; alg = FourthMoment()) or LowOrderMoment(; alg = EvenMoment()). |
asset_scores(r, X) or asset_scores(r, rd) with a risk measure that cannot score the return series of one asset, such as EqualRisk(), Variance(), StandardDeviation(), Skewness() or Kurtosis() | EqualRisk() gave 1 / T to each asset, because its functor read the column as portfolio weights. The other measures failed in their functor, for example with a MethodError. | Raises the ArgumentError that ScoreSelector raises for the same measure, which names a measure of a return series. |
AssetPanel with an empty vector in pf | Built a panel that held its masks alone. | Raises an IsEmptyError. Write pf = nothing for a panel that holds its masks alone. |
NestedClustered or Stacking with a split result in cv, such as a KFoldResult, and with a scorer beside a cv that is not a CombinatorialCrossValidation | OptimisationCrossValidation(; cv, scorer) took both. | Raises a TypeError at the keyword cv for a split result, and an ArgumentError for the scorer, which selects one path of a combinatorial scheme. Pass the scheme in cv, and scorer = nothing beside a scheme that is not combinatorial. |
RadialTailDecay on a prior whose chol is a singular square factor with no zero on its diagonal, such as [1 1 0; 1 1 0; 0 0 1] | Passed the check of the diagonal, and whitened the sample with a singular factor. | Raises a DomainError. The rule reads the diagonal of a triangular factor: chol when it is an UpperTriangular, and the R factor of its QR factorisation otherwise. |
NumericPanelInput or TensorPanelInput with a fill policy whose val is a string, such as alg = ConstantPanelFill(; val = "a") | Built the input. asset_panel then failed when the fill wrote the string, with a conversion error that named no field. | Raises an ArgumentError that names the field when you build the input. A CategoricalPanelInput still takes a string val, the level to fill with. |
A variance estimator, such as SimpleVariance(), ExpWeightedVariance(), RegimeAdjustedExpWeightedVariance() or WindowedVariance(), in a slot that calls cov or cor, such as EmpiricalPrior(; ce = SimpleVariance()), PortfolioOptimisersCovariance(; ce = SimpleVariance()), the ce of ShrunkExpectedReturns, ClustersEstimator or NetworkEstimator, or the sigma of Variance | Built the estimator. The first fit raised a MethodError, because a variance estimator has no cov. NetworkEstimator(; ce = SimpleVariance(), de = Distance(; alg = VariationInfoDistance())) with a tree type built and fitted, because that distance did not call cor. | Raises an ArgumentError in the constructor that names the slot and asks for a covariance estimator, such as Covariance(). A slot that calls only var or std keeps a variance estimator: the ce of StandardDeviationExpectedReturns and VarianceExpectedReturns, the ve of GerberCovariance and of CrossSectionalFactorPrior, and the ve of WindowedVariance. |
brinson_attribution(X, w, wb, asset_classes, col, date0, date1) with a bound whose type does not compare with the timestamps of X, such as a DateTime bound of zoned prices, or with a bound that is not a timestamp, such as the string "2020-01-02" | Converted each bound with DateTime. A zoned X then raised no promotion exists for DateTime and ZonedDateTime for every bound, zoned ones too, and a string bound was parsed. | Compares each bound in the type of the timestamps. A bound of another type raises an ArgumentError that names the bound and both types, and a string raises a MethodError. Give a zoned bound for zoned prices, and write Date("2020-01-02") for a string. A Date bound of DateTime prices still works. |
brinson_attribution with a window that holds no observation of X | Raised a MethodError from X[nothing]. | Raises an ArgumentError that names both bounds and the first and last timestamps of X. |
port_opt_view(rd, i, j) of a ReturnsResult, and port_opt_view(pr, i, j) of a PricesResult, with timestamps i whose type does not compare with the timestamps of the data, such as DateTime timestamps of zoned data, also when i is a vector of an abstract element type, such as Dates.AbstractTime[zoned_t, DateTime(2020, 3, 5)] | Raised no promotion exists for DateTime and ZonedDateTime, or a MethodError of getindex on a TimeArray. | Raises an ArgumentError that names i and both types. A vector of an abstract element type is checked entry by entry, so a vector whose entries are all zoned still selects. |
ExponentialDecay(; rate = Inf), also as the decay of a Proximity | Built the decay. separation_decay gave NaN at the separation 0, because Inf * 0 is NaN, so phylogeny_features put a NaN on the entry of each asset itself. | Raises a DomainError when you build the decay. Give a large finite rate, which scores each neighbour near 0. |
ScoreSelector or RedundancySelector with a measure of the entropic, relativistic or power-norm family that has no solver, such as score = EntropicValueatRisk(), or with a GenericValueatRiskRange or a RiskRatio that holds such a measure, and expected_risk(r, w, X), asset_scores(r, X) or the functor r(x) of such a measure | The constructor built the selector, and the fit raised a MethodError of ERM, RRM or PRM, several frames down. The evaluations raised the same MethodError. | The constructor raises an IsNothingError that names slv and shows a Solver, also when a child of the measure has no solver. The new FoldRiskScorer and ScoreWeightBounds refuse it in their constructors too. The evaluations raise an IsNothingError that names slv, also when PRM needs no model. State the solver on the measure, such as EntropicValueatRisk(; slv = Solver(; solver = Clarabel.Optimizer)). An optimiser still gives the measure its own solver. |
A lens write, such as Accessors.@set pipe.steps = (InverseVolatility(), EmpiricalPrior()), a positional call, or a candidate of a search, that gives a Pipeline steps in an order that its keyword constructor refuses. The same for a value that the keyword constructor refuses in a SampleBufferState, a ReturnsBufferState, a PipelineBufferState, a PricesToReturnsState, a PriceGapFillState, a PriceGapFillResult, a MissingDataFilterState, an OnlinePortfolioSelectionState, a StepwiseRegression or a DimensionReductionRegression, in EntropyBudget(nothing), and in the count, the mean or the shape of a CovarianceState, a SimpleVarianceState or a SimpleExpectedReturnsState | Built the value. Only the keyword constructor checked it. A search over a step of a pipeline fitted a candidate that put the optimiser before the prior. | Raises the error of the keyword constructor, because the inner constructor now holds each check. The keyword constructor of the three moment states alone checks that the values are finite, because that scan costs as much as the fold of one observation. A lens write of a symbol crit on a StepwiseRegression converts it to a Val, as the keyword constructor does. |
Calls that now answer
| Call | v0.33 | v0.34 |
|---|---|---|
A plot function other than plot_network, such as plot_composition, after using PortfolioOptimisers, StatsPlots with no using GraphRecipes | Raised a MethodError, because the plot extension loaded only with both packages. | Draws. The plot extension loads with StatsPlots alone. plot_network is in a second extension, PortfolioOptimisersGraphRecipesExt, which loads after using GraphRecipes, StatsPlots. Code that loads both packages does not change. |
CrossSectionalFactorPrior with ve = SimpleVariance(), ve = Covariance() or another estimator with no variance series of its own, with ve = ExpWeightedCovariance() or ve = WindowedCovariance(; ce = Covariance()), and the same prior inside an entropy pooling prior with w | Raised a DimensionMismatch, because the variance series did not cut the masks and the weights of the fit to the rows of each refit. ExpWeightedCovariance() and WindowedCovariance(; ce = Covariance()) raised a MethodError of the count of the variance, which they did not state. | Fits. Row t of the series reads the masks, the implied volatility and the observation weights of the rows 1 to t. A covariance estimator whose diagonal weights the squares as a variance estimator with a count does, such as Covariance(), ExpWeightedCovariance() or WindowedCovariance(; ce = Covariance()), states the count of that variance estimator, so ResidualInflation on that prior gives the radius of ve = SimpleVariance() for ve = Covariance(). A shrinkage estimator, a SemiMoment covariance and an alg step of your own in a MatrixProcessing state no count, and ResidualInflation then raises an IsNothingError that names the fix. A PortfolioOptimisersCovariance with a step in its mp, as PortfolioOptimisersCovariance() is, raises ArgumentError: matrix contains Infs or NaNs in place of the DimensionMismatch, as its docstring states. WindowedCovariance() wraps such a composite, and it raised that ArgumentError in v0.33 too. |
WindowedVariance or WindowedCovariance with no weights of its own over an inner estimator with observation weights, such as WindowedVariance(; ve = SimpleVariance(; w), window = 20) | Raised a DimensionMismatch. | Cuts the weights of the inner estimator to the window. |
variance_series over a panel of a WindowedVariance or a WindowedCovariance over a plain estimator, such as WindowedVariance(; window = 4), when a window covers no asset | Raised an IsEmptyError at the first such window, so the whole series raised. | Gives NaN in the row of such a window, as in the row of a window that keeps no observation, and fits each other row. A single call of var over a window that covers no asset still raises the IsEmptyError. So EWResidualVolatility(; ce = WindowedVariance(; window = 60)), whose first windows hold the warm-up of the residual, does not raise, and it is NaN in each row whose window holds the warm-up. It answered in v0.33 too, at 117 of the 120 cells of a panel of 40 observations of 3 assets with no gap, because v0.33 formed a residual from the first observation. |
var, std and variance_series over a panel, or with pnl = nothing, of a PortfolioOptimisersCovariance over a mask-aware estimator, such as PortfolioOptimisersCovariance(; ce = ExpWeightedCovariance(), mp = MatrixProcessing(; pdm = nothing)) | Reduced each window to the assets that are finite and active at each of its rows, whatever the inner estimator. So an asset with one NaN or one inactive row in the window was NaN, and var raised an IsEmptyError when no asset was covered. On a panel of 30 assets and 300 observations whose first 9 rows are NaN, the series of the composite had 0 finite cells. | The inner estimator reads the window, as the panel method of cov of the composite already let it do. var is the diagonal of the processed covariance over the panel, so mp runs on each fit. On that panel the series has the 8 700 finite cells of Covariance(; cvg = CoveragePolicy()), and the 7 560 of ExpWeightedCovariance(). Over a plain estimator the composite gives the v0.33 values. Over Covariance(; cvg = CoveragePolicy()) with no w, ExpWeightedCovariance() or RegimeAdjustedExpWeightedCovariance(), with no alg step in mp, the series folds each observation one time, with the matrix call and with the panel, and gives the values of a refit at each row. Over a Covariance with w, the series refits each row. |
expected_return(ArithmeticReturn(; mu = 0.01), w, pr), a number in mu, and each ratio and measure that reads the term, such as ExpectedReturn | Raised a DimensionMismatch. | Gives 0.01 * sum(w), the value of the model expression of the term. |
JuMPOptimiser, ProgrammeAllocationSet or FactorRiskContribution with a vector field that mixes the members of its element type, such as tn = [Turnover(…), TurnoverEstimator(…)]; and GridSearchCrossValidation or RandomisedSearchCrossValidation with a vector of grids whose types differ | TypeError or MethodError, unless the caller narrowed the literal with concrete_typed_array | The keyword constructor narrows the literal. A wrong element raises an ArgumentError that names the field. |
A JuMP optimiser with sca = LogSumExpScalariser() and a risk measure whose entry of the risk vector is quadratic, such as MeanRisk(; r = [Variance(), ConditionalValueatRisk()], opt = JuMPOptimiser(; sca = LogSumExpScalariser(), …)) | The solve failed, and the Result held an OptimisationFailure. | Solves. An epigraph variable takes the place of each quadratic entry in the exponential cone, so the scalarised risk does not change. |
A constraint estimator whose val maps names to fractions and whose dval is an integer, such as ThresholdEstimator(; val = "A" => 0.05, dval = 0) | Raised an InexactError when it resolved against a UniverseSets. | Resolves. An integer dval takes the type that the values of the map promote it to. Any other dval keeps its type, as in v0.33. |
sort_by_measure with a vector of risk measures that disagree on orientation, such as [MeanReturn(), MaximumDrawdown()] | Raised an ArgumentError from bigger_is_better. | Sorts. Each measure is oriented so that a higher score is better before the vector is reduced. |
NearestQuantilePrediction, sort_by_measure or quantile_by_measure with a VectorToScalarMeasure or a function as the reduction of a vector, such as sca = MedianValue() | Raised a TypeError, because expected_risk takes a Scalariser only. | Reduces the oriented scores of the measures with it. |
factor_attribution(w, pr, ret) with constant weights w and a net return series ret, and its rolling twin factor_attribution(w, pr, ret, window) | Raised a MethodError, because the method on a return series took a weight history alone. | Decomposes the series. The methods on asset returns form their net series and call this method, so factor_attribution(w, pr, X) gives what factor_attribution(w, pr, ret) gives on the series that X forms. |
GridSearchCrossValidation or RandomisedSearchCrossValidation with a vector of risk measures in r, such as r = [ConditionalValueatRisk(), MeanReturn()] | Raised a TypeError, because r took one measure. | Scores the vector. Each test score and each train score orients each measure so that a higher score is better, and the field r_sca reduces the vector in each fold or path. Its default nothing gives the sum, as SumScalariser() does. A vector whose measures disagree on orientation is admitted. A search of one measure does not change. |
expected_risk and expected_risk_from_returns with the scalariser as the first argument, such as expected_risk(MaxScalariser(), [ConditionalValueatRisk(), MaximumDrawdown()], w, X) | Raised a MethodError, because the scalariser was the keyword sca alone. | Gives what the keyword form expected_risk(r, w, X; sca = MaxScalariser()) gives, on weights, a weight path, a prior, a result and a prediction. The keyword form does not change. A single measure ignores the scalariser in both forms. |
GreedyAllocation or DiscreteAllocation on prices with a NaN, such as prices = [10.0, NaN, 20.0] for an asset with no bar on the allocation date | GreedyAllocation gave NaN shares of that asset and a NaN cash, with an OptimisationSuccess. DiscreteAllocation raised an ErrorException from JuMP. | Allocates. No allocator can buy an asset with no price, so it holds zero shares, and the new upw field of FiniteAllocationInput states what its target weight becomes. The default upw = nothing keeps the money of that weight in cash. ProportionalRedistribution(), EvenRedistribution(), AssetRedistribution(; idx) and SideRedistribution(; l, s) move it to priced assets of the same side. |
FiniteAllocationInput(; ca = f) with a plain function f | Raised a TypeError, because ca took an AbstractCollateralAlgorithm only. | Takes a function with the three methods of AbstractCollateralAlgorithm. |
SimpleExpectedReturns, SimpleVariance, Covariance, Coskewness or Cokurtosis with observation weights w and a CoveragePolicy, such as var(SimpleVariance(; w, cvg = CoveragePolicy()), X) | Raised an ArgumentError that told you to run the batch verb, which you ran. | Fits. Each asset, each pair and each cell of a co-moment reads its own valid observations with their weights, and equal weights give the fit with no weights. A pair whose shared observations have no positive weight is undetermined, so the peel removes an asset of it, or strict = true refuses it. |
CrossSectionalFactorPrior with CurrencyExposure(; base) on a universe whose every asset is in the base currency, such as "currency" => CurrencyExposure(; base = "USD") on assets that are all in "USD" | With no E, raised an IsNothingError that named an empty list of series. With an E that holds no currency of the universe, raised IsEmptyError: fx cannot be empty. | Fits. The member gives no currency factor and reads no series, so mu and sigma equal the fit without the member. |
A fit of the view of an OpinionPoolingPrior of entropy pooling opinions, such as prior(port_opt_view(op, [1, 3]), X[:, [1, 3]]) | Raised a DimensionMismatch from a matrix product, because each opinion kept its sets on every asset. | Fits. The view cuts the sets of each opinion. |
A fit of HierarchicalRiskParity, HierarchicalEqualRiskContribution, SchurComplementHierarchicalRiskParity or NestedClustered, or a JuMPOptimiser with ple or cte, whose distance reader has a CoveragePolicy that refuses an asset that the prior keeps, such as ClustersEstimator(; ce = PortfolioOptimisersCovariance(; ce = Covariance(; cvg = CoveragePolicy(; min_coverage = 0.6)))) with an asset that holds half of the observations | The hierarchical heads raised ArgumentError: Distance matrix should be symmetric. from Clustering.hclust, and the phylogeny and centrality readers raised a DomainError with NaN. | Fits. The fit drops the asset with a warning and gives it a zero weight, and the other weights equal the fit on the other assets. strict = true raises an IsNonFiniteError. A direct call of clusterise, phylogeny_matrix or centrality_vector raises a DistanceReaderRefusalError that names the columns. |
A fit of HierarchicalRiskParity, HierarchicalEqualRiskContribution, SchurComplementHierarchicalRiskParity or NestedClustered, or a JuMPOptimiser with ple or cte, on an asset with zero variance, such as cash at a constant return | Under the default reader, HierarchicalRiskParity and HierarchicalEqualRiskContribution raised ArgumentError: matrix contains Infs or NaNs. Under the reader ClustersEstimator(; ce = Covariance()), HierarchicalRiskParity raised ArgumentError: Distance matrix should be symmetric., and a k-means clustering raised ArgumentError: weights cannot contain Inf or NaN values. | Fits. The fit drops the asset from the investable mask with a warning and gives it a zero weight, and strict = true refuses it with an IsNonFiniteError. The correlation of the asset is NaN at every entry, see the entry of cor in Results that move. |
An online fit whose ProgrammeAllocationSet holds a ple or cte reader that cannot estimate the correlation of an asset that the prior of the set keeps, such as a reader whose CoveragePolicy asks for more observations than the prior | The reader raised an error from its graph, and the fit stopped. | Fits. At each such step the asset takes a zero weight with a warning, and the strict flag of the head refuses it with an IsNonFiniteError. The re-solve of a FollowTheLeader rule does the same, because the set enters the entry of the leader as a block. |
An online fit whose ProgrammeAllocationSet holds a ple or cte graph reader with a plain moment estimator, such as SemiDefinitePhylogenyEstimator(; pl = NetworkEstimator()), beside a prior of the set that fills the gap of a young asset, such as EmpiricalPrior(; fill_limit = 1) | Raised an IsNonFiniteError from the graph reader at the first step whose rows held the gap, and the fit stopped. | Fits. The projection resolves the set through the entry of a JuMP head, so the asset takes a zero weight at each such step with the warning of the graph reader, as in a batch fit. The strict flag of the head refuses it with an IsNonFiniteError. An asset that a FeatureDistance of a reader of the set cannot read drops in the same way. |
A FollowTheLeader rule whose ProgrammeAllocationSet has a prior that prices fewer assets than the prior of the leader, such as a plain pe in the set beside a mask-aware prior in the leader, at a step with a young asset | Raised an ArgumentError that named the assets that the prior of the set could not price. | Solves. The entry of the leader intersects the investable masks of its own block and of the block of the set, so each such asset takes a zero weight with a warning that names it. The strict flag of the head refuses it with an IsNonFiniteError. |
An online fit whose ProgrammeAllocationSet holds a LinearConstraintEstimator in lcse or gcarde, at a step at which the prior of the set leaves an asset out of its investable mask | The set resolved the constraint once for each fold over every asset, and the reduction of the step kept its width. The model then raised a DimensionMismatch from a matrix product. | Solves. The set resolves lcse and gcarde at each step, after the reduction, as a JuMP head does. A row that names the departed asset drops, and strict does not refuse the name. A precomputed LinearConstraint of the width of the universe raises a DimensionMismatch that names the slot, as it does in a JuMP head. |
cor(MutualInfoCovariance(), X) with the default bins = HacineGharbiRavier() on a matrix with a constant column | Raised an InexactError. | Gives the constant column NaN at every entry. |
asset_scores(r, X) of a risk measure on a matrix with a column that holds a gap, such as asset_scores(SCM(), X) with NaN in 20 rows of one column | Raised the IsNonFiniteError of the moment estimator of the measure, so one gap refused the scores of every asset. | Scores each column with no gap, and gives NaN at a column with a gap, which every selection rule drops. On returns data, a column that the data do not cover over the window scores NaN too. A column with no gap and a non-finite score still raises a DomainError. ScoreSelector dropped such a column in v0.33 too, so a selection does not change. |
A FollowTheLeader rule whose leader and whose ProgrammeAllocationSet both state l1, linf, l2c or linfc, such as JuMPOptimiser(; l1 = 0.01, …) in the leader and ProgrammeAllocationSet(; l1 = 0.01, …) | Raised an ErrorException from JuMP when the leader's model took the set: An object of name :t_l1 is already registered in this model. | Solves. The set's terms enter the leader's model under the prefix of the set, and its penalties add to the objective penalty of the leader. A cardinality, a threshold or an integer phylogeny in both now reads one binary for each asset, where v0.33 declared a second vector of binaries for the set. |
plot_histogram of a return series that holds a NaN or an infinite return, such as the series of a walk-forward path with a fold that failed to solve | Raised an ArgumentError: start and stop must be finite, got NaN and NaN. | Draws the finite returns. The bins, the moments, every vertical line and the fitted Normal law read them alone. A series with no finite return draws the axes alone, with no bin and no line. |
plot_weight_stability and plot_cv_dashboard of a walk-forward path with a fold that failed to solve, and plot_weight_stability of a population with such a path | Raised an ArgumentError: quantiles are undefined in presence of NaNs or missing values. | Draws. A failed fold holds no weight, so it is absent from every box, and a path with no fold left draws the axes alone. |
HierarchicalRiskParity and SchurComplementHierarchicalRiskParity with a WeightBoundsEstimator that resolves a side to a number or to nothing, such as WeightBoundsEstimator(; lb = 0.0, ub = 0.6) or WeightBoundsEstimator(; ub = Dict("B" => 0.2)), whose lb keeps its default | Raised a MethodError: no method matching view(::Float64, ::Vector{Int64}), or view(::Nothing, …) for lb = nothing. | Solves. Each side is expanded to one bound per asset, so the weights equal those of the same bounds stated as two vectors. |
OnlinePortfolioSelection with a FollowTheLeader whose held estimator has a RiskTrackingError of a Variance under DependentVariableTracking in tr, and a ProgrammeAllocationSet whose ple holds a semidefinite phylogeny | Every re-solve failed, because the tracking variance took the second-order cone, which that tracking mode cannot solve. Each step warned that the programme of the leader did not solve, and traded nothing, so the rule held the drift of its start. | Solves. The block of the set marks the weights before the tracking errors of the head, so the tracking variance takes the semidefinite formulation, and the leader equals the leader with the same phylogeny in the ple of the held estimator. On 6 assets and 120 rows with two linked pairs and p = 0.05, the largest w_i w_j of a linked pair is 0.028 in v0.33 and 4.7e-7 in v0.34. |
Solver(; settings) with an MOI.AbstractOptimizerAttribute key, such as settings = MOI.Silent() => true, MOI.TimeLimitSec() => 7.5 or MOI.RawOptimizerAttribute("max_iter") => 3 | Raised an ArgumentError, because a key was a string or an MOI.AbstractModelAttribute. | Sets the attribute on the model of the solve. A Symbol key, such as :verbose => false, still raises an ArgumentError. |
ImpliedVolatilityRegression(; ws = 2) | Raised a DomainError, because ws had to be greater than 2. | Builds. A window of two rows has a corrected standard deviation with one degree of freedom. ws = 1 raises a DomainError, because a window of one row has no dispersion. |
expected_risk and the call r(w, X, fees) of a GenericValueatRiskRange with a ValueatRisk(; alg = DistributionValueatRisk()) tail | expected_risk raised a DimensionMismatch, or returned a wrong value when X had as many observations as assets. | Evaluates the loss tail on w and the gain tail on -w, and a tail of returns on the net returns. Under MinimumRisk, the objective of the JuMP model equals expected_risk of its weights. |
matrix_square_root(RidgeCholeskySquareRoot(), M) on a Rational matrix | Raised a MethodError: no method matching eps(::Type{Rational{Int64}}). | Factorises. The ridge and its floor take the element type of the plain factor. |
AggregateDistances or StackObservations of a FeatureDistance on an integer window | Raised an InexactError, because a mean or a rescale went into an Int matrix. | Gives a float matrix. A Rational window stays exact, and a Float32 window with no weights stays Float32. |
L1UncertaintySet or SignedL1UncertaintySet with a zero entry in sd or a NaN entry in mu | Raised a DomainError for the zero, and an IsNonFiniteError for the NaN. | Builds. A zero scale fixes the entry at its estimate, and the worst case reads only the other assets. An infinite entry of mu still raises. |
CharacteristicUncertaintySet with an l1 algorithm on a prior fitted on a point-in-time asset panel, whose mu holds a NaN outside its investable mask | Raised DomainError with 0.2 from the tie check of the radius, because the NaN entries of pr.mu reached the ladder. | Fits on the investable mask of the prior, and expands the set to the full universe, as the other uncertainty sets do. sd is zero outside the mask, and mu is NaN there. The view of the set at the mask is the fit on the mask. |
BlackLittermanViews with an excl longer than Q, such as three views of which two resolve no name under strict = false | Raised DimensionMismatch: length(excl) = 2 must be <= length(Q) = 1. | Drops the two views with a warning for each, and keeps the third. |
A LoGo matrix processing under dims = 2 with a variation of information distance | Raised a DimensionMismatch, because the check read the observations as the assets. | Fits. The distance gives the same matrix for both orientations. |
phylogeny_matrix(::ClustersEstimator, X; dims = 2), and asset_phylogeny through it | Raised a BoundsError, because the membership matrix took the count of observations. | Gives the phylogeny matrix of the assets. |
| A network estimator on an integer distance matrix with a zero entry | Raised a MethodError: no method matching nextfloat(::Int64). | Fits. The repaired copy of the matrix takes a float element type. |
A covariance or a correlation view of entropy pooling whose pair cancels, such as cov_views = LinearConstraintEstimator(; val = "(A, B) - (A, B) == 0.1") in EntropyPoolingPrior or MeucciEntropyPoolingPrior | EntropyPoolingPrior raised Entropy pooling optimisation failed, also for == 0.0 and under rho_views. | Drops the view with a warning, as a cancelled mean view does. prior(pe, X; strict = true) raises an IsZeroError. |
A sequential CVaR view of EntropyPoolingPrior, ConditionalValueatRiskView(; alg = SequentialTailView(), views), where v0.33 wrote alg = SequentialConditionalValueatRiskView(), on a target that a posterior meets, where the worst scenario holds at least alpha of the prior, such as 10 equal weights of 0.1 at alpha = 0.05, also where the losses of the assets on the left side sum to a constant on the support | Raised Entropy pooling optimisation failed. The start of the sequential solve read the row of the prior, which no posterior meets, so the first solve was infeasible. | Solves, and the posterior CVaR meets the target. On 10 rows of the test data, a view halfway between the best and the worst loss of an asset gives a posterior CVaR within 5e-8 relative of the target. |
A CVaR view at the worst loss of its asset on the support, under >= or ==, and a CVaR, EVaR or RLVaR view whose left side is constant on the support, at that constant, in EntropyPoolingPrior | Raised a DomainError: View … is too extreme. | Solves, because a posterior that puts at least alpha on the worst scenarios meets the first view. Where the prior puts at least alpha on the worst scenarios, the posterior is the prior to the tolerance of the solver. A view with a constant left side that the prior meets drops, so the posterior is the prior. A target above the worst loss still raises the DomainError. MeucciEntropyPoolingPrior takes an == view at the worst loss too, where v0.33 raised the DomainError. It writes the view as one row, which puts at least alpha of the posterior on the worst scenarios, and it searches only the other CVaR views. With no other view, the posterior is the prior when the prior meets the row. Otherwise it is the prior scaled to alpha on the worst scenarios and to 1 - alpha on the rest. |
JuMPEntropyPooling(; alg = LogEntropyPooling()) over a prior with a zero weight in w | Raised an ErrorException from JuMP: $Affine expression contains an invalid term `Inf * x[33]`$. | Solves. A scenario of zero prior weight takes zero posterior weight, and the kld equals the kld of OptimEntropyPooling within 2e-7 relative. |
MeucciEntropyPoolingPrior with more than one view in ConditionalValueatRiskView, whose search meets a trial point at which the inner solve fails | Stopped the fit with Entropy pooling optimisation failed. | Rejects the trial point, and the search moves on. A failed inner solve at the start of the search, or at its last point, still raises. |
MeucciEntropyPoolingPrior with a CVaR view whose posterior value at risk is below zero, such as a view at half the prior CVaR at alpha = 0.5, or a view just below the worst loss of an asset with few losses above zero | One view raised CVaR entropy pooling optimisation failed. More than one view returned a posterior that missed its target with no error, by 0.55 % in one measurement. | Solves. The search of the value at risk starts at the lowest loss of the asset, not at zero. With one view, a search whose root is above zero runs as before. When every loss of the asset on the support is above zero, the search of one view starts at the lowest loss, and the start of the search of more than one view is the midpoint of the lowest loss and the target. With more than one view, the box of the search is [lo, B] in place of [0, B], where lo is the lowest loss and B the target, so every such posterior moves: by up to 4.2e-4 of the largest weight in two measured cases. The warning of MeucciEntropyPoolingPrior gives the miss under the default dm_opt and under a tighter one. |
owa_l_moment(T, k) where a binomial coefficient of T overflows an Int, such as owa_l_moment(1000, 8) | Raised OverflowError: binomial(1000, 8) overflows. | Gives the weights. The binomial coefficients take the float type of the weights. |
no_bounds_risk_measure, no_bounds_no_risk_expr_risk_measure, no_risk_expr_risk_measure, bounds_risk_measure and unit_scale_risk_measure on a measure that the JuMP model does not optimise, such as MeanReturn() or ThirdCentralMoment(), and unit_scale_risk_measure(Skewness()) | Raised a MethodError. The five functions had methods for a RiskMeasure and a HierarchicalRiskMeasure alone, and Skewness had three of the five. | Returns the measure with no change. Skewness has all five methods. |
MaximumRatio(; kmin = 0) | Raised DomainError: kmin must be > 0. | Builds, with no floor on the scale variable k. A negative kmin raises a DomainError. |
RiskBudgeting with AssetRiskBudgeting(; alg = MixedIntegerRiskBudgeting()) and a net budget below one, such as bgt = 0.5 | Did not meet the budget. The model held the row sum(w) - k >= 0, which a net budget below one meets only at k <= 0. | Solves on the budget. The row is gone. |
port_opt_view of a RiskBudgeting with MixedIntegerRiskBudgeting() or with LogRiskBudgeting() and no orthant vector | Raised TypeError: in keyword argument alg, expected RiskBudgetingFormulation, got a value of type Nothing. | Views the estimator, and keeps its formulation. |
NearOptimalCentering with an infinite weight bound, such as WeightBounds(; lb = 0.0, ub = Inf), or with a negative lower bound whose centre holds a short weight | The barrier wrote -log(w_i) and -log(ub_i - w_i) for each asset. An infinite bound put Inf in a cone row, and the solve failed. A negative lower bound added the hidden row w_i > 0, so a centre with a short weight was not feasible. | Solves. The barrier has one term for each finite bound, -log(w_i - lb_i) and -log(ub_i - w_i), and no term for an infinite bound or a fixed weight. |
VarianceSkewKurtosis with a vector bound on one term and a Frontier on another, such as a vector ub on vr and a Frontier ub on kt | Raised a FieldError, because the rebuild of the sweep read the vector as the Frontier. | Sweeps the Frontier of its term, and holds the vector bound of the other term. |
The end points of a Frontier sweep under MaximumRatio with rf > 0 | The end-point solve on the ratio model failed, and the sweep raised an ArgumentError that named the failed maximum-return solve. | Solves. The end points come from a model with k = 1, see Results that move. A sweep under MaximumRatio still needs the solver wrapped in ParametricOptInterface.Optimizer, as in v0.33. |
RegimeAdjustedExpWeightedCovariance on Float32 data with debias = ExactDebias() or debias = LawDebias(), and with regime_target = MahalanobisTarget(; recursion = GaussianLevelRecursion()) under any debias | Under DiagonalTarget with FirstMomentRegimeAdjusted or LogRegimeAdjusted, raised ArgumentError: matrix contains Infs or NaNs. Under MahalanobisTarget, gave a covariance of NaN at every entry with no error. | Fits, and keeps Float32. On twelve configurations, the largest relative gap to the Float64 fit is 1.9e-5. Each Float64 fit does not move. |
RegimeAdjustedExpWeightedCovariance with a MahalanobisTarget on BigFloat data at 256 bits, or at any precision whose eps is below exp(-61) | Raised a BoundsError from the lattice of the level bias. | Fits, within 1.1e-11 of the Float64 fit. A BigFloat fit needs GenericLinearAlgebra, which gives the eigen of a symmetric BigFloat matrix. |
cov(pc) and cor(pc) with no data on a PortfolioOptimisersCovariance that partial_fit! folded over an ExpWeightedCovariance, a RegimeAdjustedExpWeightedCovariance, a seed-windowed WindowedCovariance or a GeodesicShrinkageCovariance, and cor of a seed-windowed WindowedCovariance and std of a seed-windowed WindowedVariance with no data | Raised an error, such as a FieldError for the field n of the state. | Gives the matrix of the batch route on the folded rows. Under MatrixProcessing(; dn = Denoise()), on 150 observations of 6 assets, the largest gap to the batch route is 6.7e-14. |
ThirdCentralMoment(; ve = SimpleVariance()) | Raised a MethodError, because ve was not a keyword. | Divides the third moment by the cube of the standard deviation. This is the standardised skewness that the v0.33 functor of Skewness gave. The default ve = nothing gives the raw third moment, as in v0.33. |
NestedClustered or Stacking with an online walk-forward in cv, such as cv = OnlineIndexWalkForward(20, 10) | Raised a TypeError, because OptimisationCrossValidation took no online walk-forward. | Builds the estimator. |
RadialTailDecay on a prior whose chol is a nonsingular square factor with a zero on its diagonal, such as the Cholesky factor with its rows permuted | Raised a DomainError that said that the covariance matrix is singular. | Whitens the sample with the R factor of the QR factorisation of chol, which states the same covariance matrix. |
predict of a PipelineResult on returns data with no asset panel, where the training window had one, or the reverse | Raised an ArgumentError that said that the two windows did not come from one ingestion. | Predicts. A table with no gap and no field of the asset panel gives returns data with no panel, see Results that move, so the check reads the asset names alone. |
CrossSectionalFactorPrior whose exposures read the returns alone, on returns data with no asset panel | Raised an error that said that the step carries no panel. | Fits, in the batch fit and in the carry fold. A read of a named field of the panel on such data raises a KeyError that names both causes: the data carry no panel, or a panel of the two universe masks alone. |
CategoricalPanelInput with a fill policy of your own that has no field val | Raised a FieldError, because the check read alg.val of every policy. | Builds. The check reads val of the library policies that carry one, and of no other policy. |
A panel input on Int data with ConstantPanelFill(; val = 0.5), where the first column has no blank and a later column has one | Raised InexactError: Int64(0.5). | Fills the blank, and the field is Float64. |
panel_feature_matrix of a categorical field of the asset panel with more levels than assets | Raised a BoundsError. | Gives the feature matrix. |
A JuMP model of GenericValueatRiskRange whose two tails are ValueatRisk(; alg = DistributionValueatRisk(; dist)) over the same covariance, on a law whose mean is far from zero, such as dist = Normal(2, 1) | Was DUAL_INFEASIBLE. Each tail held its own cone, and the coefficient of the gain tail was negative, so a minimisation drove its cone to infinity. ValueatRiskRange with the same law solved. | Solves. The two tails share one cone, with the sum of their coefficients, as ValueatRiskRange does, and the ub of each tail still bounds its own value. On 300 observations of 6 assets at alpha = beta = 0.05 under MinimumRisk, the minimum is 0.0123379, the minimum of ValueatRiskRange. The tails can read different mu: a gain tail with mu = zeros(6) beside the loss tail solves to 0.0116972. A tail whose coefficient is negative beside a tail of another kind, such as GenericValueatRiskRange(; loss = ConditionalValueatRisk(), gain), is not convex, and its model is still unbounded. |
risk_contribution and risk_gradient of ExpectedReturn or ExpectedReturnRiskRatio, and every call on a measure that holds one: a vector such as [ExpectedReturn(), ConditionalValueatRisk()], a side of NonOptimisationRiskRatio, the rk of MeanReturnRiskRatio, and the r of RiskTrackingRiskMeasure | Raised the ArgumentError of risk_input_kind, because the two measures read pr.mu and the route of the prior passed pr.X to them. expected_risk of either measure alone answered. | Evaluates, without and with fees. Each contribution equals w .* g / d, with g a central difference of the value and d the degree of the measure, within 2.2e-10 relative on the cases of the review. |
RiskTrackingRiskMeasure whose tracked measure is a MeanReturnRiskRatio, a NonOptimisationRiskRatio or an ExpectedReturnRiskRatio, such as RiskTrackingRiskMeasure(; r = MeanReturnRiskRatio(; rk = ConditionalValueatRisk()), tr = WeightsTracking(; w = wb)) | The constructor raised a MethodError from no_bounds_no_risk_expr_risk_measure. | Builds. expected_risk, risk_contribution and risk_gradient evaluate it, also with fees. The value reads the series of the active weights, net of the fee of w. |
port_opt_view(rd, t, j) of a ReturnsResult with one timestamp t, such as rd.ts[2] | Raised ArgumentError: invalid index, because the view read the timestamp as a position. | Gives the one observation at t, with a matrix of one row, as port_opt_view(rd, [t], j) does. A timestamp that rd.ts does not hold raises an ArgumentError that names it. One timestamp in an asset or a factor index raises an ArgumentError, as a vector of timestamps does there. |
port_opt_view(pr, i, j) of a PricesResult with Date timestamps i of DateTime prices | Raised a MethodError of getindex on a TimeArray. | Selects the observations at midnight of each date, as the view of a ReturnsResult does. |
port_opt_view of a ReturnsResult or of a PricesResult with one integer or one name in an index, such as port_opt_view(rd, 2, :), port_opt_view(rd, :, "a"), port_opt_view(rd, 2), port_opt_view(rd, :, :, 1) or port_opt_view(pr, :, 2), and port_opt_view(pr, t) with one timestamp t | A ReturnsResult raised a TypeError that named a field, such as nx, or ArgumentError: invalid index for a name. A PricesResult raised the ArgumentError that lists its call shapes. | Gives a view of one observation, one asset or one factor, with the matrix shape of the data: one integer n selects as n:n does, and one name as [name] does. One timestamp of a PricesResult selects the one observation at it, as on a ReturnsResult, and a timestamp that the prices do not hold raises an ArgumentError that names it. A name in the observation index raises an ArgumentError, as a vector of names does there. One Bool in an index raises an ArgumentError, as Julia refuses it, and a vector of Bool is still a mask of the axis. |
Accessors.set on a MultiPeriodPredictionResult or a PipelineResult, such as Accessors.@set res.pred = res.pred[1:3] or Accessors.@set res.names = ("a", "b") | Raised a MethodError. The keyword constructor of MultiPeriodPredictionResult does not take mrd, which its inner constructor computes, and PipelineResult had no keyword constructor. | Gives the new Result. mrd is computed again from the new pred, and a patch of mrd raises an ArgumentError that names the fields to set. PipelineResult(; names, results, ctx) is the new keyword constructor. |
A Pipeline whose step is a precomputed optimisation result, such as Pipeline(; steps = (EmpiricalPrior(), res)) with res = optimise(EqualWeighted(), rd) | Raised an ArgumentError that said that the pipeline cannot infer the slot of the result. A TimeDependent schedule of such results ran, because the check did not see the result of each fold. | Builds. The result writes :opt and reads :returns, as an optimisation estimator does, and the fit predicts with its weights, as a fold of the schedule does. The inner constructor now checks the pipeline of each fold, so the result needs the slot. |
Detone on a matrix whose leading eigenvalues tie, such as an identity matrix, which Denoise makes when it finds no signal, or a MatrixProcessing with both dn = Denoise() and dt = Detone() on such a sample | ArgumentError: matrix contains Infs or NaNs, or a NaN matrix under pdm = nothing. Detone(; n = size(X, 2)) on a covariance raised a DomainError of sqrt on most samples, raised the ArgumentError on some, and gave a matrix of rounding noise on the others. | Removes the largest number of leading modes, at most n, whose smallest eigenvalue stands above the next one, and gives the matrix back when none does. An asset that the removed modes hold in full keeps a unit row, so n = size(X, 2) gives an identity matrix, and the diagonal of a covariance returns. |
Calls that return another type
Each call in this list returns a value of another type, and the values in it do not move. Each row states the reads that do not change and the reads that raise.
range_tailsreturns aRangeTails, not a named tuple. v0.33 returned(; loss, gain).tails.loss,tails.gainand(; loss, gain) = tailsread the same two measures as in v0.33. A range of your own returnsPortfolioOptimisers.RangeTails(loss, gain), a public type, from its method ofrange_tails. The constructor refuses a tail whosesettings.rkeistruewith anArgumentError, because the range registers its risk expression once.pairs(tails),keys(tails),tails[1],loss, gain = tails,merge(tails, x)andlength(tails)raise aMethodError, andtails == (; loss, gain)isfalse.panel_align_activereturns the plain tuple(pnl, n), asfindmaxdoes. v0.33 returned the named tuple(; pnl, n). Writealigned, n = panel_align_active(pnl, fields)where v0.33 readres.pnlandres.n.res.pnlandres.nraise aFieldError. The aligned panel and the count do not change.cross_sectional_factor_axisreturns aCrossSectionalFactorAxisResult. v0.33 returned the named tuple(; nf, fam).ax.nf,ax.famand(; nf, fam) = axread the same lists as in v0.33. Two Results are not==, because the type compares its vectors by identity, so compareax.nfandax.fam. A call ofkeys(ax)raises aMethodError. The constructor refuses afamwhose length is not the length ofnfwith aDimensionMismatch.Eight verbs of the forecast evaluation and the diagnostics return a type, not a named tuple.
descriptor_scoresreturns aDescriptorScoresResult,forecast_ic_summaryaForecastICSummaryResultof twoICSummaryResults,forecast_portfolioaForecastPortfolioResult,forecast_quantile_spreadaForecastQuantileSpreadResult,forecast_holding_periodandforecast_decayaForecastWindowResult,forecast_calibrationaForecastCalibrationResultwhosecurveis aForecastCalibrationCurveResult, andidio_calibration_summaryanIdioCalibrationSummaryResult. Each field keeps its name, so a read asres.ann_iror(; slope, curve) = resdoes not change.keys,pairs,mergeand a splat of a result raise aMethodError, andvalues(res)returns the result itself: readfieldnames(typeof(res))orgetfield(res, k)instead. The library defines==on no struct, so compare two answers by their fields.The results of the forecast evaluation and of the factor model diagnostics check their values.
exposure_ic_summaryover a bare matrix returns theExposureICSummaryResultof its other two methods, withnothinginnfandfam.DataFrame(res)writes aForecastWindowResultor aForecastCalibrationCurveResultas a table. Each constructor of the eight verbs above checks its values: a p-value, a hit rate or a coverage share outside[0, 1]and a deviation below zero raise aDomainError, andNaNpasses.ForecastSummaryResult,ExposureICSummaryResultandFactorSummaryResultcheck their values in the same way now, and each takes a keyword constructor.covariance_forecast_stepandcovariance_forecast_portfolioreturn a type, not a named tuple.covariance_forecast_stepreturns aCovarianceForecastStepResult, where v0.33 returned(; n_valid, mahalanobis_ratio, diagonal_ratio, qlike, frobenius, standardised_return, portfolio_qlike).covariance_forecast_portfolioreturns aCovarianceForecastPortfolioResult, where v0.33 returned(; standardised_return, portfolio_qlike). A caller that reads a field by name, asstep.qlikeor(; qlike) = step, does not change. A splat(; step...),keys,pairsandmergeraise aMethodError.==andisequalof two Results compare their arrays by identity, so compare the fields. Each constructor checks its values: a negativen_valid, ann_validabove the count of assets, and portfolio fields of two lengths or two sizes raise.CovarianceForecastSummaryResultchecks its values now too, and it takes a keyword constructor; v0.33 checked nothing.forecast_evaluation_summary(fe)andcovariance_forecast_summary(cfer)give scalar fields. v0.33 gave a vector of length one in each field of a summary of one evaluation. Readfs.spearman_mean_icwhere v0.33 readfs.spearman_mean_ic[1]. A spread of the forecast summary andexceedanceof the covariance summary become a vector over the tail fractions or the levels. Pass a vector,[fe], to keep the shape of v0.33.A
Pipelinekeeps the container form of its steps. v0.33 converted the steps ofPipeline(; steps = [EmpiricalPrior(), InverseVolatility()])to aTuple, and its names too. v0.34 keeps a vector of steps as a vector, and itsnames, and thenamesandresultsof itsPipelineResult, are vectors too. ATupleof steps gives tuples, as in v0.33. The weights and every other value do not change. A read by index, by name,length, iteration andmapdo not change. A method of your own that dispatches onpipe.steps::Tupleorres.results::Tupleraises aMethodErrorfor the vector form, so pass the steps as aTupleto keep the form of v0.33.The positional
Pipeline(names, steps, cache)takes a vector of names and a vector of steps too, where v0.33 raised aMethodError.PipelineStep(; reads = [:returns], ...)keeps the vector that you give, where v0.33 raised aTypeError. The keyword constructor ofPipelineResultis new, and it takes a vector of names and a vector of results, as the positionalPipelineResult(names, results, ctx)did in v0.33. A tuple of steps compiles the methods of a pipeline for each set of step types, and a vector compiles them once for each element type, so a vector can cost less time to the first result. An online step of a vector of two steps took 19.3 µs, against 15.0 µs for the tuple form, at 20 assets.gradient_state_seedofGradientMomentum,RootMeanSquareGradientandAdaptiveMomentGradientreturns aPortfolioOptimisers.GradientAverageState, andtransform_gradient!returns the state with the transformed gradient. v0.33 returned the zero average, the zero squared average or the pair of both fromgradient_state_seed, andĝalone fromtransform_gradient!(grad, gs, g). Writegs, ĝ = transform_gradient!(grad, gs, g)where v0.33 wroteĝ = transform_gradient!(grad, gs, g), and readgs.vandgs.mwhere v0.33 read the vector orgs[1]andgs[2]. A call with the state of v0.33, such astransform_gradient!(GradientMomentum(), zeros(N), g), raises aMethodError, and so doesgs[1]. The transformed gradient does not change.traverse_concrete_subtypesreturns aVector{Type}. v0.33 returned aVector{Any}. The entries do not change. Pass aVector{Any}asctarrto collect into a vector of your own type.Returns, prices and panel fields of integer data hold a float copy.
ReturnsResult,PricesResult,NumericPanelFieldandTensorPanelFieldconvert an integer element type once, when you build them, soeltype(rd.X)ofReturnsResult(; nx, X = [1 2; 3 4])isFloat64, where v0.33 keptInt. The values do not change, and a fit on such an input gives the fit of the float data, as in v0.33. AFloat32, aRationalor any other element type is kept, as in v0.33.describeof an asset panel with no field givesFloat64share columns. v0.33 gave the columnsmissingandactive_missing, and themissingcolumn of abyreport, the element typeAny.
Lot units of a finite allocation
Both finite allocators buy each asset in whole lots of its own lot unit, for fractional shares and for board lots. The unit field takes a LotUnit, one number for every asset or one value for each asset, or a LotUnitEstimator, which names the lot units by asset or group and resolves against the new sets field of the allocator.
| v0.33 | v0.34 |
|---|---|
GreedyAllocation(; unit = 10) | GreedyAllocation(; unit = LotUnit(10)). A bare number raises a TypeError. |
GreedyAllocation(; unit = 0.01, kwargs = (; digits = 2)) | GreedyAllocation(; unit = LotUnit(0.01)). The args and kwargs fields are gone. The first pass floors the lot count, so a fractional lot unit buys whole lots with no rounding keyword. |
PortfolioOptimisers.roundmult | Gone, with the rounding that it did. |
DiscreteAllocation(; slv), which bought whole shares only | Takes unit, sets and strict. The default LotUnit(1) buys whole shares, as in v0.33, and the default fallback reads the same unit. The model counts lots in its integer variable and holds the shares in an expression, so a side with more than one optimal book can return another of them, with the same objective. |
A count or a fraction states its reading
A field that takes the size of a part of a set holds a CountOf or a FractionOf. CountOf(n) is n members, an Integer of at least one. FractionOf(f) is a share of the set, with f in (0, 1]. v0.33 read the type of a plain number: an Integer was a count, and any other real number was a fraction. Julia promotes the elements of a vector literal, so a search grid could turn a count into a float. A plain number is still a shorthand, and the field then holds the wrapper.
| v0.33 | v0.34 |
|---|---|
x.active == 0.2, x.sbar == 25, cv.subset_size == 3, and the same read of neighbours, window_size, train_size and test_size | The field holds FractionOf(0.2), CountOf(25) or CountOf(3). Read x.active.val for the number. |
A plain 1.0 in one of these fields | Raises a DomainError, because a grid promotes the count 1 to it. Write CountOf(1) for one member, or FractionOf(1) for the whole set. |
QuantileRule(; best = 0.2) | RankRule(; best = FractionOf(0.2)), or the shorthand RankRule(; best = 0.2). QuantileRule is gone. One rule can now take a count from one end and a fraction from the other. |
RankRule(; best = 0, worst = 5) | RankRule(; worst = 5). A count is at least one, so nothing states a tail that takes no asset. |
HopCount(; n = HopCountQuantile(; q = 0.25)) and PathLength(; dmax = PathLengthQuantile(; q = 0.25)) | HopCount(; n = FractionOf(0.25)) and PathLength(; dmax = FractionOf(0.25)). The budgets do not move. HopCountQuantile and PathLengthQuantile are gone. q = 0 is refused, and CountOf(1) states that hop budget. |
HopCount(; n = 2).n == 2 | HopCount(; n = 2).n is CountOf(2). Read .n.val for the number of hops. A plain float, such as HopCount(; n = 0.25), is a fraction, where v0.33 refused it. In PathLength(; dmax = 0.25) a plain number stays a radius. |
ConditionalValueatRisk(; alpha = ScenarioCount(; n = 25)), and every other significance slot | ConditionalValueatRisk(; alpha = CountOf(25)). The level is 25 / T, as before. ScenarioCount is gone. A plain number in alpha is still the level itself. |
JuMPOptimiser(; l2c = EffectiveAssetFloor(; fraction = 0.5)), and the same in linfc, lpc and ProgrammeAllocationSet | JuMPOptimiser(; l2c = FractionOf(0.5)). The ceiling does not move. EffectiveAssetFloor is gone, and CountOf(m) states the floor as m effective assets. A plain number in l2c is still the ceiling itself. |
WildBootstrapMeanTest(; min_periods = 2.5), and the same OverlapMeanTest | Raises a TypeError. min_periods is a count of windows, so it is an Integer. |
ActiveAssetsUncertaintyAlgorithm(; active = 1 // 5) | Builds and calibrates. v0.33 raised a TypeError when you built the algorithm, because active took an Integer or an AbstractFloat only. |
Arrays of rank three hold their observations last
Every array of rank three that the library takes or gives holds its observations on its last axis, so the matrix of one observation is one contiguous block. A v0.33 array of shape T × N × K is a v0.34 array of shape N × K × T, and permutedims(A, (2, 3, 1)) converts one. A matrix over observations, such as the returns X, the weights W, a mask, the factor returns f or a one-factor exposure, does not change.
| Where | v0.33 | v0.34 |
|---|---|---|
Z of cross_sectional_regression, predict, cross_sectional_r2 and mean_cross_sectional_r2; the field Ms of CrossSectionalFactorModel; Ms of factor_family_basis and reduce_exposures, and the result of reduce_exposures; B of factor_attribution, forecast_factor_correlation, plot_forecast_factor_correlation, exposure_ic, the exposure_* diagnostics and the cs_regression_* diagnostics | observations × assets × factors | assets × factors × observations |
factor_exposure of OneHotExposure and CurrencyExposure, and B of cross_sectional_groups | observations × assets × levels | assets × levels × observations |
cs_gram, and a stack given to expand_factor_covariance or reduce_factor_covariance | observations × factors × factors | factors × factors × observations |
dropped_factor_weights(fcb) with no observation index | observations × constrained families × reduced factors | constrained families × reduced factors × observations |
descriptor_scores(...).S | observations × assets × descriptors | assets × descriptors × observations |
vals, omsk and pmsk of a time-varying TensorPanelField or TensorPanelInput, and panel_field_values of such a field | observations × assets × labels | assets × labels × observations |
feature_matrix and panel_feature_matrix of a time-varying panel, and the Z of distance(::FeatureDistance, Z) and cor_and_dist(::FeatureDistance, Z) | observations × assets × features | assets × features × observations |
A static TensorPanelField and a static feature matrix keep assets × labels and assets × features.
Results that move
The last bits of a few kernels on arrays of rank three. The matrix of one observation is now contiguous, so a product on it runs in BLAS. The stack of
expand_factor_covariance, a realisedfactor_attribution, the panel collapse of a meta-optimiser and the mean ofAggregateFeaturescan differ from v0.33 in the last bits. On a panel of 60 assets, 24 features and 300 observations, the mean ofAggregateFeaturesmoves by4e-16relative and the panel collapse by4e-16. A realisedfactor_attributionof 20 assets moves by up to4e-15, in its unattributed remainder. A distance near zero amplifies the change of the mean, so the angular distance ofFeatureDistance(; alg = AggregateFeatures())on that panel moves by1e-13relative to its largest entry.AggregateDistancesatdims = 2moves by3e-15. The new layout keeps every value of aCrossSectionalFactorPriorfit bit for bit.The default
lambda = PrecisionBlend()of aCrossSectionalFactorPriorreads the effective count of the factor moments. The rule gives the factor mean the weightmax(0, 1 - K / (T_e B)). v0.33 tookT_eas the count of observations. v0.34 takes the smaller of the effective counts that the factor prior states for its mean and its covariance, and an estimator that weights or decays its rows states fewer. So the weight falls, and it can reach0. On a panel of 60 assets, 4 industries and 300 observations, with a market, an industry and two style factors, the resolvedlambdais0.1700in v0.33 and0in v0.34. With no return forecast, every expected return of that fit is then0. To keep the v0.33mu, state thelambdaof the v0.33 fit as a number, whichres.rr.lambdaof that fit gives.NearestQuantilePrediction,sort_by_measureandquantile_by_measureorient each measure before they reduce a vector. v0.33 reduced the raw risks and then applied one sign, so a vector of measures that disagree on orientation, whichNearestQuantilePredictionadmitted, gave a number with no orientation and a wrong path. v0.34 multiplies each measure by-1when a smaller value is better, before the reduction. The result depends on the orientation of the measures:- Measures of which a smaller value is better, one or a vector. Under
SumScalariser, the three functions select and sort as in v0.33. A vector underMaxScalarisernow selects and sorts by the best measure of each path, where v0.33 used the worst risk. WriteMinScalariser()to keep the v0.33 result, andMaxScalariser()for the v0.33 result ofMinScalariser.LogSumExpScalariseralso moves. - Measures of which a bigger value is better, one or a vector.
sort_by_measuresorts as in v0.33 under every scalariser. Under the default call with no sign,NearestQuantilePredictionandquantile_by_measurenow readq = 1as the worst path. Write1 - qto keep the v0.33 path, whenq_kwargskeepsalphaequal tobeta, as the default does.
- Measures of which a smaller value is better, one or a vector. Under
GreedyAllocationwith a lot unit below one. v0.33 rounded the first pass withBase.round, which rounds to a whole share under the defaultkwargs. So a target could round above itself and stop the first pass early. v0.34 floors the lot count of each target. The shares of such an allocation differ, and they are multiples of the lot unit. A lot unit that is a whole number gives the v0.33 shares. A lot unit above one that is not a whole number gives other shares too, because v0.33 rounded the first pass to a whole share: at a lot unit of1.5, v0.33 bought218shares where v0.34 buys217.5.The
cashof a finite allocation is the cash that the account holds after the trade. v0.33 reported the cash that the long side did not spend. That number left out the cash that no side received: the cash outside a budget below one, and the cash of a book whose long cash the floor at zero ofProceedsCollateralsets. Onw = [0.3, 0.25, 0.15, 0.1],prices = [12.3, 45.6, 7.89, 101.1]andcash = 10000, the shares do not change, andcashis2038.6, where v0.33 gave38.6. UnderProceedsCollateral,sum(cost) + cash + feesis the input cash. UnderCashCollateral,sum(abs, cost) + cash + feesis. A negativecashis money that the book borrows.performance_summaryof a prediction whose optimiser gives many portfolios gives one entry for each member. v0.33 gave the scalar figures of the first member and dropped the others. Each field is now a vector with one entry for each member, and each member reads its own series, benchmark, turnover and weights. Readps.sharpe[1]to keep the v0.33 number. The same holds for weights in aVecVecNum, and for anOptimisationResultof a frontier, which v0.33 refused.log_wealth_regretof a prediction whose optimiser gives many portfolios gives one Result for each member. v0.33 gave oneLogWealthRegretResultfor the first member and dropped the others. v0.34 gives aVectorofLogWealthRegretResult, one entry for each member. Each member meets its own benchmark series, and thepath_lengthof an entry reads the targets of its own member of the comparator. Two sides with many members pair by index, and a different count of members raises aDimensionMismatch. A side with one series pairs with every member of the other side. Readregs[1]to keep the v0.33 number. A pair of single series gives one Result, as in v0.33.A selection rule and a redundancy algorithm drop a non-finite score. v0.33 compared a
NaNthroughislessand>.RankRuleandQuantileRule(nowRankRulewith aFractionOf) could then return an empty mask,action = :dropkept theNaN,QuantileRulecounted it in the size of the universe, aThresholdRulewith one bound admitted an infinite score on the open side,CorrelationComponentsandClusterGroupskept no member of a group whose first member had aNaN, andPairwiseCorrelationdropped both assets of a pair with oneNaN. In v0.34 aNaNor an infinite score is outside every tail and every band, under eachaction, and the partner of aNaNasset survives their pair. A selector with a risk measure raises aDomainErroron a non-finite score of a column with no gap, as in v0.33, so the change reaches a direct call ofrule_keeporredundancy_keep, and theNaNthatFoldRiskScorerandWeightMassScorerwrite at an asset that too few folds scored.A corrected weighted fit with no positive divisor is
NaN. A corrected fit on one observation of positive weight divides by zero, and the weighted mean of one value can differ from it by one unit in the last place. So v0.33 gaveInfwhere the fit with no weights givesNaN:var(SimpleVariance(; w = aweights([w])), x)wasInfin 493 of 2000 draws andNaNin the others. Frequency weights that sum to less than one gave a variance of zero or below, such as-0.0forfweights([0.4]). v0.34 givesNaNin each case, inSimpleVariance, in the weightedcovofGeneralCovarianceandCovariance, and inStdValueandVarValue. A fit with a positive divisor gives the v0.33 number bit for bit.var(SimpleVariance(; w, cvg = CoveragePolicy()), x)on one series readsw. v0.33 ignored the weights of the vector arm with no message, and gave the variance with no weights. On 12 observations with analytic weights, v0.33 gave0.0013162and v0.34 gives0.0011678, the weighted variance.The default drop score of
PairwiseCorrelationandCorrelationComponentsskips a correlation that is not defined. Under acewith no matrix repair, such asCovariance(), the correlation with a constant column isNaN, so in v0.33 the summary of every column wasNaN.PairwiseCorrelationthen dropped both assets of each correlated pair, andCorrelationComponentsraised anIsEmptyError. v0.34 summarises the finite entries of each column, and a weightedmeasureloses the weight of each skipped entry. On a correlated pairA,B, an unrelatedCand a constantD, both algorithms keep["B", "C", "D"], where v0.33 kept["C", "D"]and raised. The defaultce = PortfolioOptimisersCovariance()refuses theNaNin its repair, as in v0.33.The correlation of a constant column is
NaNon the diagonal too. The correlation of an asset with zero variance is0 / 0at every asset, itself included. v0.33 gave such an assetNaNoff the diagonal and one on it underCovariance,GeneralCovariance,ExpWeightedCovariance,RegimeAdjustedExpWeightedCovariance,ImpliedVolatility,SpearmanCovarianceandKendallCovariance, and aNaNdiagonal under aCoveragePolicy. Now every one of them gives theNaNdiagonal, asDistanceCovariancedid. Socor(Covariance(), X)[i, i]isNaNfor a constant columni, anddistanceof a covariance matrix with a zero variance gives aNaNrow. A weightedSimpleCovariancecorrelation with fewer than two observations of positive weight isNaNat every entry, as the unweighted fit on one observation is. An estimator that defines the dependence of a constant, such asGerberCovarianceor a shrinkage inCovariance(; ce), keeps its values.A constant other than zero gets the same
NaNrow. The mean of a constant can differ from it by one unit in the last place, so underCovariance,GeneralCovarianceand the defaultPortfolioOptimisersCovariance, cash at a constant return of0.0005has a variance of about1e-38, not zero. v0.33 gave its row a correlation of about1e-18with each asset and one on the diagonal, andHierarchicalRiskParityandHierarchicalEqualRiskContributiongave the cash the whole weight. Now the row isNaNat every entry for every constant, also under observation weights, where a column that is constant on the observations of positive weight counts. The fit drops the asset, as it drops cash at0.0. The normalised mutual information ofMutualInfoCovariancegives every constant theNaNrow too, under each bin rule.number_effective_assets, and then_effofperformance_summary, read the concentration of a book and not its leverage. The function issum(abs, w)^2 / dot(w, w), where v0.33 took1 / dot(w, w). The two forms give one value on every book whose absolute weights sum to one, such as a long-only book with a budget of one. Elsewhere the value moves:[1.0, -1.0]gives2, where v0.33 gave0.5, and a book of zeros givesNaN, where v0.33 gaveInf.performance_summaryalso giveslong_exposure,short_exposure,gross_exposureandnet_exposurefor each entry that holds weights, andDataFrame(ps)writes them aftern_eff, so a measure cannot take one of those names.currency_excess_indexholds a cash index across a gap inside its span. A deposit accrues interest on every day, so a cash total-return index has a value at every observation from its first value to its last one. v0.33 divided by the gap, so the index wasNaNon each holiday of the market of one cash index, and so was every currency factor of that observation. v0.34 holds the last value of the cash index there, so the index keeps the exchange-rate move of that day, and the observation that ends the gap carries the accrual of the whole gap. Onfx = [2.0, 2.5, 3.0], a cash index[1.0, 1.0, 1.0]and a base cash index[1.0, NaN, 1.5], v0.33 gives[2.0, NaN, 2.0]and v0.34 gives[2.0, 2.5, 2.0]. A gap offx, and a gap before the first value or after the last value of a cash index, stay gaps.A
PriceGapFillunderCarriedPricekeeps an asset with no observed training price. v0.33 gave such an asset no entry in thePriceGapFillResult. Soapply_preprocessingon a later window left every gap of the asset open, also after its first price in that window, wherepartial_fit_transformfilled the gap. v0.34 keeps the asset innxwith amissingseed, so the fill reads the prices of the later window alone, as the online step does.nxunderCarriedPricenow names every asset of the training window, andfit_preprocessingof a steppedPriceGapFillkeeps the same assets. On a training window whereBhas no price, and a later window whereBis[5.0, NaN, 6.0, 7.0], v0.33 gives[5.0, NaN, 6.0, 7.0]and v0.34 gives[5.0, 5.0, 6.0, 7.0]. A fill with a statistic, such asMedianValue(), still gives the asset no entry.A product of fields of the asset panel takes the promoted type of its fields. A side of
EWVolumeRatiothat names a vector of fields reads their product. v0.33 multiplied in the type of the first field, so aFloat32first field cut aFloat64second field toFloat32. v0.34 promotes the types, as the sum of fields does. With aFloat32field times aFloat64field near one, each entry of the product moves by up to1e-7relative, and anEWVolumeRatioover 30 observations moves by about1.3e-8relative. A product of fields of one type does not move.A walk-forward with a
BudgetCostsor aBudgetMarketImpactinbgtcharges each fold the cost of its own trade. v0.33 did not pass the previous weights tobgt, so every fold charged the cost of the move from the caller's referencew, and not from the book that the fold trades from. v0.34 replaces the reference with the previous weights, as aTurnoverdoes, and the folds run in order. On the returns0.01 .* randn(StableRNG(7), 200, 5) .+ 0.0005, withBudgetCosts(; bgt = 1.0, w = fill(0.2, 5), vp = 0.05, vn = 0.05, up = 0.5, un = 0.5)and seven folds ofIndexWalkForward(60, 20)underMaximumReturn, v0.33 ends at[0.243, 0, 0.7, 0, 0]and v0.34 ends at[0.498, 0, 0.454, 0, 0]. Writefixed = trueon the estimator to keep the v0.33 result.A
BudgetCostsor aBudgetMarketImpactbudget is a ceiling, and the floor of aBudgetRangein itsbgtbounds the invested weights alone. v0.33 wrotesum(w) + cost == bgton a split of the trade into a buy and a sale, and nothing kept one of the two at zero. So a programme that gained from cash bought and sold one asset together, and held the false charge as cash. v0.34 writessum(w) + cost <= bgt, andsum(w) >= lbfor a floor. The unused budget is cash. With every mean negative,MaximumReturngave[0.15, 0.25, 0.25, 0.197, 0.15]and givesfill(0.15, 5).MinimumRiskunderbgt = 1.0gavesum(w) = 0.9514, and it now sells to cash. Bound the cash withbgt = BudgetRange(; lb = 0.95, ub = 1.0), or pinsum(w) + costwithxbgt = trueon aBudgetCosts, under a mixed-integer solver.A
Frontiersweep ofMeanRiskwith a Custom Objective Term counts the term once. v0.33 added the term to the objective penalty each time the model got an objective, and the penalty kept every copy. A return or a risk frontier sets the objective of the minimum-risk end point, of one maximum-return end point for each swept term, and of the sweep. So the end points solved with the term counted once and twice, and each point of a one-term sweep with the term counted three times. Now each solve counts the term once, so the points and the span of the sweep move. A sweep with nocobj, and a solve with noFrontier, do not move.A fallback leader of
FollowTheLeadersolves on the allocation set of the head. The set enters the entry of each member of the fallback chain of a JuMP leader. v0.33 gave the set to the held optimiser alone, so a fallback leader solved without it. The re-solve also sets the net budget of the held optimiser, and of each fallback, to the budget of one. So a fallback withbgt = nothingholds weights that sum to one. A solver-free fallback of aBestConstantRebalancedPortfoliotakes the bounds of aBoundedAllocationSet, as the held estimator does.A semidefinite phylogeny of a
ProgrammeAllocationSetbinds in the re-solve ofFollowTheLeader. v0.33 gave aVarianceof the leader the second-order cone, because the variance read the phylogeny of the block of the leader alone. The rows of the set then sat on a lift that no term held down and that took no penalty, so the weights did not move with the set'sp. v0.34 marks the weights in phase 1 of each block that holds a semidefinite phylogeny, so everyVarianceon them takes the semidefinite formulation. A variance that the objective minimises then holds down the lift that the rows bind, as in a batchMeanRiskwith the same phylogeny in its ownple. On 6 assets and 120 rows with two linked pairs andp = 0.05, the largestw_i w_jof a linked pair is0.01997in v0.33 and1.6e-7in v0.34, where the batchMeanRiskgives1.9e-7. A leader with no variance does not move.A
Varianceceiling of aProgrammeAllocationSetin the re-solve ofFollowTheLeadertakes the semidefinite formulation when the leader holds a semidefinite phylogeny in its ownple. The mark of the previous item reaches every variance on the weights, so the ceiling bounds the lift that the rows of that phylogeny bind. v0.33 gave the ceiling the second-order cone.A
TimeDependentschedule in a field of the leader of an online rule resolves at each fold. v0.33 resolved the schedules in the fields of the head alone. Each re-solve of the leader then reset a schedule in it to its fold-less value, thedefaultor the static default of the field, so its entries never ran, and no message said so. v0.34 resolves each schedule of the rule tree at the fold, also in a leader among the experts of anExpertMixtureand under aFollowTheLeadingHistory. A schedule that readsctx.w_prev, such as aPreviousWeightsFunction, gets the weights of the previous fold, and a walk-forward then runs its folds in order. On 10 rows of three assets and five folds ofOnlineIndexWalkForward(5, 1)orIndexWalkForward(5, 1; expand_train = true), aMeanRiskleader withwb = TimeDependent(fill(WeightBounds(; lb = 0.0, ub = 0.4), 5))had a largest weight of1.0at each fold in v0.33, and has0.4in v0.34.The
cobjof aProgrammeAllocationSetenters the re-solve of aFollowTheLeaderleader. v0.33 dropped it with no message, so a custom objective term on the set had no effect on the leader. v0.34 adds it once to the objective of the leader, as the same term on the held optimiser. On 40 rows of three assets, a term that costs 10 times the weight of the first asset gave[1, 0, 0]on the set in v0.33, and gives[0, 1, 0]in v0.34, the weights of the term on the held optimiser.plot_weight_stabilityboxes the rows ofprediction_weights. v0.33 stacked the weights of each fold on the universe of the caller and labelled the boxes with the names of the first fold. A fold whose universe differs from the first fold now boxes each weight under its own name, as the composition plots do, and a failed fold is absent from every box.A search over a
MultipleRandomisedscheme with noseeddraws its folds fromrngitself. v0.33 drew one seed fromrngand split the data for each candidate with that seed. v0.34 splits the data once and passes the folds to each candidate. So at the samerng, the search scores other folds than v0.33, andrngends in another state. Every candidate still scores the same folds. A scheme with aseedgives the folds of v0.33.plot_portfolio_cumulative_returnsof a population draws one curve for each member. v0.33 drew an empty figure. Each curve takes the label of its member, the key of the path thatportfolio_reportuses, and the keywords of the call, as the curve of a path does.A
TimeDependentschedule inside anOnline(pipe)step of aPipelineresolves at each fold. v0.33 read such a step as a step with no schedule, so each fold of an online scheme ran thedefaultof the schedule, and a schedule with too few entries ran with no message. v0.34 reads the step as the pipeline that it wraps, so the step gives the answer ofOnline(pipe)run alone, and a schedule whose count of entries is not the count of folds raises aDimensionMismatch. On 150 rows of four assets withTimeDependent([EqualWeighted(), InverseVolatility(), EqualWeighted()]; default = EqualWeighted())andOnlineIndexWalkForward(60, 30), fold 2 gave the equal weights in v0.33, and gives the inverse volatility weights in v0.34.EWMean,EWVolumeRatioandDaysToCoverdivide their state by the sum of its weights. The state of the recursion starts at zero, so afternvalid observations of an asset it is1 - decay^ntimes a weighted mean. v0.33 gave that state as it is. So every value of an asset with a short history, such as an asset listed late, was shrunk toward zero, and its days to cover was too large by the inverse. v0.34 divides by1 - decay^n, asEWVolatilityalready did. This holds for the presetsEWMomentum,EWShareTurnoverandEWAmihudIlliquiditytoo. On a constant share turnover of0.01and the default half-life of21, the first value of an asset listed late was0.005in v0.33, and is0.01in v0.34. Its first days to cover halves. The values converge to the v0.33 values as the countngrows.debias = nothingonEWMeanorEWMomentumkeeps the state undivided, as v0.33 did. On a panel that the restart of the next row does not move, it gives the v0.33 values bit for bit. For a volume ratio, multiply by1 - decay^n, and divide a days to cover by it.An inactive observation restarts
EWMean,EWVolumeRatioandDaysToCover. v0.33 wroteNaNat an inactive cell and kept the state and the count of the asset. So an asset that delisted and listed again carried its history from before the delisting, and a finite value at an inactive cell advanced the state. v0.34 sets the state and the count to zero at an inactive cell, asEWVolatilityand the beta Descriptors do, so the warm-up runs again after a relisting. With askip, the recursion after the restart reads no return of an observation at or before the inactive one. This holds for the presetsEWMomentum,EWShareTurnoverandEWAmihudIlliquiditytoo. A panel whose assets stay active after their first listing, and whose inactive cells hold no finite value, keeps its numbers. No keyword gives the v0.33 values back.The degrees of freedom of an idiosyncratic variance of a
CrossSectionalFactorPriorread the active mask. The variance restarts an asset where it turns inactive, but v0.33 counted every finite residual of the asset. So an asset that listed again kept the count of its rows before the delisting, and a delisted asset, whose variance isNaN, had the full count. On a synthetic panel of 80 assets and 420 observations, with 18 to 28 delisted assets by the draw, each delisted asset had about 113 degrees of freedom under the market factor alone, and about 96 with an industry factor and a size factor too. Each one now has0. The count of an exponentially weighted variance now reads the rows after the last inactive row of each asset. A variance estimator of your own reads the mask in its own method, see If you extend the library. A bound thatResidualInflationsets moves only on a panel with a delisting or a relisting.The exponentially weighted beta Descriptors regress the observations of each asset alone. v0.33 advanced the market mean and the market variance at every observation, and the covariance of an asset only at its own valid observations, from a mean that started at zero. So an asset that is listed late, or that misses observations, divided a covariance of its own observations by a variance of all of them, and its beta was biased toward zero. v0.34 keeps one set of weighted moments per asset, of the market, of the reference series of an
EWMacroSensitivityand of the asset, over the valid observations of the asset, so the beta is the slope of a weighted regression with an intercept on those observations. On the parity panel of 80 observations and 12 assets, the asset listed at observation 21 has anEWMarketBeta(; half_life = 8)of1.24at observation 29, where v0.33 gave0.906. An asset listed on the whole panel moves too, because v0.33 started its means at zero, and that start keeps the weightdecay^nafternobservations. On the same panel, such an asset moves by up to0.29at the first value ofEWMarketBeta(; half_life = 8), at observation 8, and by up to0.0028at observation 40. With the defaultEWMarketBeta(), it moves by0.007to0.032over observations 60 to 80. The same rules give five more changes:- An inactive observation resets the asset in
EWBeta,EWMacroSensitivityandEWDownsideBeta, as it did in the residual volatility. A relisted asset starts a new history, and its beta isNaNuntil it has the observations of a new warm-up:max(2, min_obs)for a market beta,max(3, min_obs)for the partial beta of anEWMacroSensitivity, andmin_obsfor anEWDownsideBeta. v0.33 resumed the state that it left. - A window of
agg_obs > 1averages the series of an asset over the same observations, those where the asset is active and every series is finite. An inactive observation clears the open window of its asset. - A beta is
NaNwhere it has no denominator. That is where the market does not vary over the observations of the asset, where the market falls short of the target of anEWDownsideBetaon none of them (v0.33 gave0), and where the market and the reference series of anEWMacroSensitivityare almost perfectly correlated. The partial beta needs three observations, or two where the market is constant, which the intercept then absorbs. - The shrinkage of an
EWBetawith agroupweighs each beta against the sampling variance of the weighted least-squares slope, which needs three observations. v0.33 divided the residual variance by twice the half-life. A beta with no finite variance turnsNaNwhere its group shrinks it, and a group whose prior variance is zero keeps the lower bound of the weight. EWResidualVolatilityforms a residual from thebeta_min_obs-th observation of the beta, and its warm-up counts the residuals. With the defaults and no missing return, the first value is at observation69, where v0.33 gave one at observation60.
- An inactive observation resets the asset in
The JuMP model of
MeanAbsoluteDeviationis exact for every target of the deviations. v0.33 registered the one-sided rowmad_t >= tgt - x_tand reported2 mean(mad), which is the mean absolute deviation only when the target is the mean of the net series. Undermu = 0.0the v0.33 model held0.003182, where the functor gives0.003990. v0.34 addsmean(net_X) - tgt, so the model and the functor differ by2.6e-10relative at most under every target. A portfolio with MAD and a target other than the mean moves. So does a portfolio whose prior mean is not the sample mean, such as a James-Stein mean, under the default target.The entropic and the relativistic measures, the power-norm measures and the even moment model read no observation of zero weight. The programmes of
ERM,RRMandPRM, the JuMP models ofEntropicValueatRisk,RelativisticValueatRisk,PowerNormValueatRiskand their drawdown and range forms, and the JuMP model ofLowOrderMoment(; alg = EvenMoment())held one cone row for each observation, also for an observation of weight zero. Such a row holds no probability, but the row of a large loss stopped the solver far from the optimum, and the solver reported success. v0.34 builds the rows on the observations of positive weight. With a crash of-0.3on a zero-weight row of 150, the EVaR weights equal the weights without the row. Atp = 3the v0.33 even moment model held3.8389e-5, where the functor gives3.7756e-5, and its weights moved by6.5e-4. With no zero weight, each model is the programme of v0.33.PRMreturns the largest loss with no solver where $\alpha \pi^{-1/p} \le 1$. The measure is then the largest loss. v0.33 solved the programme there, at the boundary of the cone, where a solver can stall and giveNaN.A
ubon the gain tail of aGenericValueatRiskRangewith aDistributionValueatRisktail binds. The v0.33 model bounded the negated value of the tail, so the bound did not bind the portfolio. v0.34 boundsdot(mu, w) + z * g, the value that the functor gives on-w. UnderMaximumReturn, the gain tail is0.017057with no bound, and withub = 0.0085285on the gain tail it is0.0085285at the optimum. A portfolio with such a bound moves.WorstRealisationbesideRangekeeps its bound, and a second instance of a measure that reads no index warns.MaximumDrawdown,WorstRealisation,NoRisk,RangeandBrownianDistanceVarianceregister one risk expression in a model. In v0.33 a second instance of one of these types lost its bound and its scale with no message. In[Range(), WorstRealisation(; settings = RiskMeasureSettings(; ub))], theWorstRealisationadded no bound and no risk term, because both read one key. v0.34 builds the bound ofWorstRealisationthere, and its value at the optimum equalsub. A second instance of one type still has no effect, and it logs a warning that names its type and its settings.owa_rg(1)is[0.0]. v0.33 wrote-1and then1into the one entry, so it returned[1.0], and the ordered weights range of one observation was that observation.OWA_RG()of one observation now gives0.0, asRangedoes. ForT >= 2the weights do not change.Three fits of the regime-adjusted moments move.
LogRegimeAdjustedwith anxother than1/2scales the volatility byexp(s / 2), where v0.33 tookexp(x s), which is correct only atx = 1/2. The raw statistic ofDiagonalTargetfor the first moment,debias = nothing, which v0.33 spelledRawStatistic(), divides by the mean of a $\chi(n)$ law, $\sqrt{2} \Gamma((n + 1) / 2) / \Gamma(n / 2)$. v0.33 divided by $\sqrt{n}$, so atn = 6the raw statistic moves by the factor1.08655before the clip. Under the defaultExactDebias(), the same fit moves by round-off alone,7.4e-16relative at most. A row with no valid asset counts as one lag of the HAC variance, where v0.33 skipped it, so the returns on the two sides of a holiday no longer read as adjacent. Athac_lags = 2, the variance of the first moment on a panel with a holiday moves by0.14 %at the median and by0.47 %at most.AngularDist, and so the defaultFeatureDistance, keeps aFloat32or aBigFloatinput. v0.33 promoted the type withFloat64, so aFloat32feature matrix gave aFloat64distance matrix under every collapse. AnIntor aRationalinput still givesFloat64.matrix_square_root(RidgeCholeskySquareRoot(), M)keeps the type of aFloat32matrix that needs a ridge. v0.33 read the ridge as aFloat64, so such a matrix got aFloat64factor, where its plain factor isFloat32.vcatof two asset panels whose equal static fields have different element types promotes the type. v0.33 took the element type of the first part, so aFloat32field and an equalFloat64field gave aFloat32field. The field stays lazy.A
DateWalkForwardwith a negativeperiod_offsetkeeps its last anchor. v0.33 added the offset to the whole range of anchors. Under a calendar step the shifted range restarted its step from the shifted start, so it dropped an anchor in the lastabs(period_offset)of the data, and the fold of that anchor. v0.34 shifts each date. On daily data from 2021-01-01 to 2021-02-25, withperiod = Month(1)andperiod_offset = Day(-10), the anchor 2021-02-19 now opens a second test fold underreduce_test = true. The test windows are[22:49, 50:56], where v0.33 gave[22:56]. A fixed step and a fixed offset, such asDayorWeek, keep aStepRange.OptimalNumberClusters(; alg = SecondOrderDifference())selects one cluster on two assets. The ceiling of the count isfloor(Int, sqrt(2)) = 1, and v0.33 selectedk = 2on the hierarchical and on the non-hierarchical branch. v0.34 returns the ceiling, asSilhouetteScoreand a statedkdo.BayesianBlackLittermanPriorforms its posterior mean beforempprocesses the covariance. v0.33 formed the mean from the processed covariance. So a processing step that changes the covariance, such asMatrixProcessing(; dn = Denoise()), moved the mean, and the equationmu == rr.M * fpr.mu + rr.b + rfof its docstring failed by0.0060. The defaultMatrixProcessing()leaves a positive definite covariance unchanged, so a default fit does not move.OWAJuMP(; alg = MaximumEntropy())maximises the entropy of the L-moment coefficients. v0.33 maximised the entropy of an auxiliary vector that every feasible point let take the value1/T, so the objective did not depend on the weights, and the weights were where the solver stopped. So the two encodings,RelativeEntropy()andExponentialConeEntropy(), gave weights6.1 %apart. v0.34 has one maximiser, and the weights of the two encodings differ by2.7e-6at most. The OWA weights ofMaximumEntropymove. The defaultsoresolves to1e-3underMaximumEntropy. Atso = 1, Clarabel stopped short on 11 of 15 programmes of the new objective, and each of them fell back toncrra_weights.The radius of a distributionally robust measure reads the count of the rows that the measure holds. This holds for
DistributionallyRobustConditionalValueatRisk,DistributionallyRobustConditionalValueatRiskRangeandDistributionallyRobustConditionalDrawdownatRisk. v0.33 read the count of the observations behind the moments. Under a cap on the scenarios,EmpiricalPrior(; max_scenarios), the rows are fewer, so the ball was too small. Withmax_scenarios = 250over 1250 observations, the radius ofConcentrationRadiusand ofDualNormRadiusgrows bysqrt(5), and the radius ofDimensionalRateRadiusby5^(1/N)onNassets. The new fieldnofCalibrationContextcarries the count, see If you extend the library. With no cap and no observation weights, the radius does not move.RateRadiusandRateSignificanceread the count of the rows that the measure prices, and the observation weights. v0.33 read the count of the observations behind the moments, and no observation weights.RateRadiusnow reads the count of its site, as the three rules of the row above do.RateSignificancereads the count thatCountOfreads. With no cap on the scenarios and no observation weights, neither rule moves. Three cases move:- A distributionally robust measure with
RateRadiusunder a cap. Withmax_scenarios = 250over 1250 observations,RateRadius()gives the radius1 / sqrt(250) = 0.0632456, where v0.33 gave1 / sqrt(1250) = 0.0282843. So the ball grows bysqrt(5), and it equals the ball over the same 250 rows with no cap.RateRadiusin a regularisation slot,l1orlinf, under the cap does not move. - A tail measure with
RateSignificanceunder a cap. Its level grows bysqrt(5)in the same way, fromc / sqrt(1250)toc / sqrt(250). - Observation weights. A robust measure or a regularisation slot with
RateRadius, and a tail measure withRateSignificance, read the Kish count of the weights, where v0.33 read the count of the rows. On 250 rows with weights0.99 .^ (249:-1:0), whose Kish count is169.158, both rules give1 / sqrt(169.158) = 0.0768872, where v0.33 gave1 / sqrt(250).
- A distributionally robust measure with
A
MedianAbsoluteDeviationwith observation weights takes the weighted median of the absolute deviations. v0.33 gave the deviations toStatsBase.mad, which reads no weights, so the weights moved the centre alone. A measure with no weights does not move.bigger_is_betterof aNonOptimisationRiskRatiofollows its numerator, andbigger_is_better(ThirdCentralMoment())istrue. v0.33 gavefalsefor each. So a search or a selection rule that scored on a ratio with a return numerator, such asNonOptimisationRiskRatio(; r1 = MeanReturn(), r2 = ConditionalValueatRisk()), or on the third central moment, put the worst candidate first. A ratio with a risk numerator still givesfalse.risk_contributiondivides each term by its own degree of homogeneity. v0.33 read a ratio as a measure of degree one, andVarianceSkewKurtosisas one measure, so the contributions of a ratio of another degree and ofVarianceSkewKurtosisdid not sum to the risk. In v0.34 the contributions of a homogeneous measure sum to its risk.EqualRiskand a measure of degree zero give zero contributions.risk_contributiongives the plain marginal contributionsw .* gof a measure that is not homogeneous.gis the gradient of the risk. v0.33 read the degree from the type of the measure alone, and divided by it. A fixed target other than zero, or a fixed fee, makes a measure not homogeneous, so no degree applies. These cases move:- A measure of degree 2, 3 or 4 with a fixed target other than zero: a
LowOrderMoment, aHighOrderMomentor aThirdCentralMomentwith a number target or aVecScalartarget with an offset, and aTrackingRiskMeasurewithSquaredL2Normagainst a benchmark other than zero. v0.33 divided by the degree. - A measure of degree other than one that reads the net returns, under a one-off fixed fee, which is
fl,fsorflqwithoutAmortisedFees, or under a periodic fee that does not cancel from its risk: a turnover against weights other than zero,lq, or an amortised fixed fee. - A ratio whose side is one of these measures.
The contributions of these measures do not sum to the risk. A
RiskTrackingRiskMeasureagainst benchmark weights of zero is its inner measure, so it divides by the degree of that measure, where v0.33 divided by one. Its contributions then sum to its risk.- A measure of degree 2, 3 or 4 with a fixed target other than zero: a
risk_contributionandrisk_gradientof a measure whose value is a solve read its worst-case distribution. These areEntropicValueatRisk,RelativisticValueatRiskandPowerNormValueatRisk, their drawdown forms, their relative drawdown forms and their ranges, twelve measures in all, and every vector, ratio, tracking measure andGenericValueatRiskRangethat holds one. v0.33 took a finite difference of one solve for each asset, and the gap of each solve was as large as the signal. So the contributions missed the risk: on the data of the review,sum(rc) / riskwas0.999957for EVaR and1.000159for RLVaR. v0.34 solves once and differentiates the expected loss under the worst-case distribution. The contributions sum to the risk within1e-6, andrisk_gradientequals a central difference within2.4e-5.ApproxOrderedWeightsArraybuilds no p-norm cone for a weight vector with at most one entry strictly between its smallest and its largest value.owa_cvarandowa_wrare such vectors, and so are both tails ofOWA_CVaR_RG. v0.33 built the cones of every order inpfor each vector. Such an optimum sits at the apex of every cone, and the default Clarabel stopped atSLOW_PROGRESS: the minimum-risk range of two CVaR tails gave0.017781, where the exact optimum is0.017823. v0.34 solves an exact linear programme for such a vector, and its value equals the exact optimum within2.9e-8. A vector with more inner entries, such asowa_gmdorowa_tg, keeps its cones and does not move.EqualRiskkeeps the element type of the weights. v0.33 returnedinv(length(w)), aFloat64, forFloat32weights.The barrier of
NearOptimalCenteringreads both weight bounds. v0.33 wrote-log(w_i)for each asset, so a lower bound other than zero added the hidden roww_i > 0, and the centre was not the analytic centre of the bounds. v0.34 writes-log(w_i - lb_i). A portfolio with a lower bound other than zero moves. The default boundslb = 0andub = 1do not move.LogRiskBudgetingwith an orthant vectorzdrops the rowsum(z .* w) - k >= 0. No source states the row. It does not bind at the default budget of one, so only a portfolio whose gross exposure passes one moves.A sweep on two terms of
VarianceSkewKurtosisgives one portfolio for each pair of levels. v0.33 swept the firstFrontierand dropped the second with no message. AFrontier(; N = 3)onvrand onktnow gives nine portfolios, and the capmax_frontiercounts the product.Models (B) and (C) of
RelaxedRiskBudgetinghold the factornof their source, andpof Model (C) is itsλ.RegularisedRelaxedRiskBudgetingwritesρ² >= n w'Σw, where v0.33 wroteρ² >= w'Σw, andRegularisedPenalisedRelaxedRiskBudgetingwritesρ² >= n p z'Θz, where v0.33 wroteρ² >= p z'Θz.nis the count of the entries of the risk budget, andΘis the diagonal of the covariance ofz. Writep / nto keep the Model (C) of v0.33. No field keeps the Model (B) of v0.33. With a target return 1.2 and 1.5 times the return of the risk parity portfolio, Model (B) moves by0.044and0.031, and Model (C) atp = 5by0.045and0.112.BasicRelaxedRiskBudgetingdoes not move.RiskBudgetingputs a floor on its scale variablek. v0.33 leftkfree. The new fieldkmindefaults tonothing, which gives the floor1e-4 / b, withbthe absolute upper end of the net budget, and zero for a budget of zero or an infinite budget. A negativekminraises aDomainError. Where the floor does not bind, the solve moves within its precision: the pinned solves of the test suite moved by a median of5e-5to1.6e-4, and by1.8e-2at most.A
Frontiersweep underMaximumRatiosolves its two end points on a model withk = 1. v0.33 solved them on the ratio model, so atrf = 0every point of the sweep was the tangency portfolio, and atrf > 0the end-point solve failed. v0.34 builds a second model for the end points, and the sweep spans the range from the minimum-risk portfolio to the maximum-return portfolio. A level above the risk of the tangency portfolio still gives the tangency portfolio.RandomisedSearchCrossValidationdrawsn_iterjoint trials. v0.33 drewn_itervalues of each key and searched the grid of their product, so three keys gave up ton_iter^3candidates. v0.34 drawsn_iterpoints of the joint grid. Over grids of vectors, it drawsmin(n_iter, |Λ|)distinct points, so on three keys of four values,n_iterof 3, 10, 64 and 200 gives 3, 10, 64 and 64 trials. With a distribution, each trial draws one value of each key, and a multivariate distribution gives one vector for each trial. The samernggives the same trials. Ann_iterat or above the size of a grid of vectors gives the grid search.The functor of
Skewnessis the raw third moment of its coskewness matrix.expected_risk(Skewness(), w, pr)givesw' M3 (w ⊗ w)ofpr.sk, the value that a bound on the measure holds. v0.33 gave the standardised skewness of the returns of the portfolio. On 250 observations of 5 assets with a skewed asset, over a high order prior, v0.33 gave0.0227and v0.34 gives2.92e-9. Every reader of the functor moves, such as the span of a sweep on a skewness floor. WriteThirdCentralMoment(; ve = SimpleVariance())for the v0.33 value. The functor ofKurtosisreadskt, which each JuMP model of the measure read in v0.33 too, so the models do not move. Over a high order prior, its readers move by rounding alone:expected_riskby1.0e-13,HierarchicalRiskParityandHierarchicalEqualRiskContributionby3.5e-14at most, andrisk_contributionby6.4e-10.A weighted moment reads its effective count. v0.33 read the count of the rows of
Xat each site that prices the sampling error of a weighted moment. v0.34 reads the Kish count(sum(w))^2 / sum(w .^ 2)of analytic or probability weights,sum(f)of frequency weights, and the count of the rows of a window. With no weights and with unit weights, 69 of 70 values do not move. The one that moves is a rolling window under a denoiser. These results move:- A denoiser over a weighted
Covariance,GeneralCovarianceorDistanceCovariance, over either exponentially weighted covariance, over a rolling or a seedWindowedCovariance, and the denoiser of a weightedCokurtosisorCoskewness. A denoiser keeps the same factors at both counts when no eigenvalue lies between the two edges of the band of noise, so the matrix moves only when one eigenvalue does. On 90 observations,WindowedCovariance(; window = 40)under a denoiser moves by1.79relative, because the denoiser reads the 40 rows of the window. - A prior with a weighted
meorce. Its normal uncertainty sets, its calibration rules, the defaulttauof Black-Litterman and the denoisers of its assembled matrices read the Kish count. The normal sets of an entropy pooling or an opinion pooling prior read the Kish count ofwin place of its perplexity, so they are wider. - A
ShrunkExpectedReturnsover a weightedme.JamesStein,BayesSteinandBodnarOkhrinParolyaprice the error of the sample mean at the effective count ofme. On the reference data of the test suite, three shrunk means overSimpleExpectedReturnswith observation weights move by up to6.8 %,10.6 %and62 %. An unweighted mean keepsT = size(X, 1), and its result does not move. - A prior over a
StandardDeviationExpectedReturnsor aVarianceExpectedReturnswith a weightedce. The mean states the count of the covariance ofce. So its normal mean set, its Black-Littermantauand its calibration rules read a Kish count, such as95.6, where v0.33 read 200 rows. - An
EmpiricalPriorover aPriorExpectedReturnswhose inner prior weights its mean or pools. The outer mean states the count of the inner prior. So the normal uncertainty sets, the calibration rules and the default Black-Littermantauof the outer prior read that count, where v0.33 read the rows. Under an inner mean with the weights0.98 .^ (200:-1:1)on 200 rows, the count is95.58. The moments do not move.
- A denoiser over a weighted
The bare
ImpliedVolatility()does not repair a matrix that is not positive definite. The v0.33 default heldmp = MatrixProcessing(), which holds aPosdefrepair. On 30 observations of 50 assets, the smallest eigenvalue was1.7e-16in v0.33 and is-2.3e-19in v0.34, and the entries move by8.9e-17at most. On 200 observations of 10 assets the matrix does not move.PortfolioOptimisersCovariance(; ce = ImpliedVolatility(; …))gives the v0.33 matrix, also as theceof another estimator, such asClustersEstimator(; ce = PortfolioOptimisersCovariance(; ce = ImpliedVolatility(; ppy = 252))).A table of prices with no gap and no field of the asset panel gives no asset panel.
prices_to_returnsof such a table givespnl = nothing, where v0.33 gave a panel whose masks were all true. A panel that holds its masks alone holdspf = nothing, where v0.33 held an empty vector. A table with a gap keeps a panel of its masks, and a table with a field of the asset panel keeps its panel. Code that readsrd.pnlof such data now readsnothing.CountOfin a significance slot andEntropyBudgetread the rows of the measure under a cap on the scenarios. UnderEmpiricalPrior(; max_scenarios)with no observation weights, the level ofCountOf(n)isnover the count of the rows that the measure holds, andEntropyBudgetreads the same count. v0.33 read the effective sample size of the observations behind the moments. In the test of the fix, v0.33 gave the level0.02where the rows give0.1, and anEntropyBudgetpaid-2.716on a budget of-5. With no cap, the level does not move.The separate path of
RegimeAdjustedExpWeightedCovariancewith HAC lags scores an asset only on a built block. With acor_decayandhac_lags > 0, v0.33 wrote the block of the correlation only when every active asset had a diagonal. So a late listing kept the block of every other asset at the row before, and the next row scored those assets against it. v0.34 writes a zero row for an asset with no diagonal, and the other assets take their row. A covariance with one decay does not move.The feature matrix of a categorical field of the asset panel with an observed mask holds one mask column. The column is
"<name>::observed", where v0.33 gave one column for each level, such as"sector=T::observed". The mask of a tensor with one label is"<name>=<label>::observed".OWA_RG,OWA_CVaR_RGandOWA_TG_RGreturn anOrderedWeightsArrayRange, and their optimum underApproxOrderedWeightsArraymoves toward the exact optimum. v0.33 returned anOrderedWeightsArray. The value of each functor and the minimum risk underExactOrderedWeightsArraydo not move. On 100 observations of 8 assets, the exact value of each measure at the approximate optimum was above the exact optimum by0.31 %,1.03 %and0.44 %in v0.33. In v0.34 it is above it by0.00 %,0.00 %and0.06 %.The
edofof aCrossSectionalFactorPrioron a rank-deficient period counts the rank of the design. Each period spends the rank of its design, where v0.33 spent its count of columns. A market column beside a one-hot industry block is such a design. On the panel of the test suite, with five columns of rank four, theedofof most assets is96.316, where v0.33 gave93.319.A bound on
BrownianDistanceVarianceunderMaximumRatiobinds. v0.33 bounded the risk expression, which is of degree two in the weights. Under the scale variable of the ratio such a row does not hold the bound, so the tangency portfolio could break it. v0.34 bounds the square root of the expression, which is of degree one, asVariancedoes. The bound then holds underMaximumRatio, and aFrontieron the measure sweeps the square root.A JuMP solve with a risk bound or a return bound can stop at another point within the tolerance of the solver. v0.34 divides each bound row by the size of its bound, and each anchor cone of
NearOptimalCenteringby the width of its region. A positive scale does not change the feasible set, so the optimum does not move, but the solver meets the rows on another path. At the default tolerances of Clarabel, the wealth of a point of aMeanRiskfrontier at its return bound moves by1.3e-5against v0.33, and by5.8e-7at tolerances of1e-12. Its performance summary and its regret move with it. A ceiling ofNearOptimalCenteringon a measure such asKurtosisorEntropicValueatRisk, which the unscaled rows broke at the default tolerances, holds on the cases of the review. A centring model that v0.33 stopped atSLOW_PROGRESScan solve: on the last 253 rows ofSP500.csv.gz, withr = UncertaintySetVariance(; ucs)of a box set and the default Clarabel settings, v0.33 returned anOptimisationFailureand v0.34 solves.A logarithmic return on a weighted prior reads the observation weights of the prior. This holds for
expected_return(LogarithmicReturn(), w, pr), forexpected_riskof anExpectedReturnor anExpectedReturnRiskRatioover aLogarithmicReturn, and so for each ratio and summary over a log return, on a prior with weights, such as an entropy pooling prior. v0.33 took the plain mean oflog1p.(X * w), where the JuMP model read the weights. On an entropy pooling prior with one view on a mean,expected_return(LogarithmicReturn(), w, pr)moves from0.000556308to0.000982213, and at the optimum of the model it equals the model within1.9e-12relative. A prior with no weights, anArithmeticReturn, andexpected_riskof a population of weight vectors do not move.The warning of a JuMP optimiser that no solver finishes states each failed stage and its termination status. v0.33 logged
Failed to solve optimisation problem.and a pointer toresult.retcode.res. v0.34 logsModel could not be solved satisfactorily (n solver trial(s))., then one line for each failed stage of each solver, with the termination status in words, such asINFEASIBLE: no solution satisfies every constraint, and then the same pointer. Each failed trial inres.retcode.resholds:termination_status. The solve that builds aJuMPResultwarned one line for each failed stage in v0.33 too, and it adds the line of the status. Each failed trial in itstrialsholds:termination_status. A test or a log filter that matches the v0.33 text must match the new text.A
JuMPEntropyPoolingposterior puts no mass on a scenario of zero prior weight. v0.33 wrote the relative entropy cone over every scenario. A zero prior weight forces a zero posterior weight only in exact arithmetic, so the solver gave such a scenario a small positive weight, andkldwasInf. On 60 scenarios with two of zero prior weight, the two posterior weights were3.4e-10and8.3e-10under a mean view, and6.3e-10and3.4e-10under a CVaR view inside its band. v0.34 fixes these weights at zero and writes the cone over the support alone, sokldis finite and equals thekldofOptimEntropyPoolingto the tolerance of the solver. A prior that is positive on every scenario does not move.LogEntropyPoolingnow solves over such a prior, as Calls that now answer states.An
OptimEntropyPoolingfit gives the same posterior on each call. The dual solve keeps the point of its last evaluation, and skips the update of the objective and the gradient when the next point is equal. v0.33 started that store as uninitialised memory. When a freed array of an earlier fit held the start point exactly, the first evaluation read a stale objective and gradient, so two equalpriorcalls in one process could give two posteriors. On four CVaR fits ofMeucciEntropyPoolingPrior, each run 60 times after a loop that frees arrays, the v0.33 store gave 134 of 240 posteriors that differ from the fit that reads no stale store, by up to1.5e-3, and 2 of 240 fits raisedEntropy pooling optimisation failed. v0.34 fills the store at the start point, and the same loop gives no difference and no error. A fit that did not read a stale store does not move.brinson_attributionwith one bound attributes the window of that bound. v0.33 applied the window only when the call gave bothdate0anddate1, and a single bound attributed the whole ofXwith no message. v0.34 applies each bound on its own. A call withdate0alone runs fromdate0to the last observation, and a call withdate1alone runs from the first observation todate1. Writebrinson_attribution(X, w, wb, asset_classes, col)with no bound to keep the v0.33 number.expected_returnof anArithmeticReturnwith a fitted uncertainty set gives the worst-case return over the set. v0.33 gave the nominaldot(w, mu), where the model expression of the term, and each bound on it, is the worst case. So a returnFrontieron such a term took its levels from the nominal return, and its last levels were above the largest worst case: on the last 253 rows ofSP500.csv.gz, with anL1UncertaintySetofCountOf(5), v0.33 swept[0.013519, 0.030196]and its last point was infeasible. v0.34 sweeps[-0.001437, 0.022103], and every point solves. The value is the one that the functor ofUncertaintySetVariancegives for a fitted set of the covariance. It reaches each ratio and each measure that reads the term, such asexpected_ratioandExpectedReturn, and the anchors ofNearOptimalCentering. An optimiser fits an estimator inucsonce, before it builds the model, so the resolved terms inres.jor.rethold the fitted set, andexpected_return(res.jor.ret, res.w, pr)gives the worst case. An estimator inucsoutside an optimisation, and a term with no set, give the nominal return as in v0.33. To keep the v0.33 number, callexpected_returnon the same term withucs = nothing.Accessors.set, and a search, on a type whose constructor computes a field.LogRegimeAdjustedcomputeskappafromxandy,NormalEquationsFitcomputescoeffrom its sums, andCustomValueReturnForecastResultandTargetReturnForecastResultsethisttonothing. v0.33 passed every field, the computed one too, to the positional constructor that@concretewrites, and that constructor skips the inner constructor. So the computed field kept its old value, and no check ran.Accessors.@set la.x = 3.0onla = LogRegimeAdjusted()keptkappa = -1.2704, whereLogRegimeAdjusted(; x = 3.0).kappais1.6159, andx = -1.0gave no error.GridSearchCrossValidationandRandomisedSearchCrossValidationwrite each candidate throughAccessors.set, so a search overxoryfitted every candidate with thekappaof the start value. v0.34 calls the keyword constructor, which computes the field again and runs each check. A patch of the computed field raises anArgumentErrorthat names the fields to set.
If you extend the library
Seven public types now subtype a root type, where v0.33 subtyped
Any.AttributionComponent,AttributionBreakdown,AssetAttributionBreakdown,AssetFactorContributionandResumesubtypeAbstractResult.CarriedPriceandPortfolioOptimisers.SubPortfolioUniversesubtypeAbstractAlgorithm.PortfolioOptimisers.RangeTails, which v0.33 did not have, subtypesAbstractEstimator. A method of your own on a root type now reaches them, and so do the library methods on the roots: the REPL shows each one field by field, andlength,iterateandgetindextreat it as a scalar. A method of your own that takes one of the seven and a root type in two positions can now be ambiguous.A range of your own subtypes
PortfolioOptimisers.RangeRiskMeasure, and the library builds it. Every Range variant of the library subtypesRangeRiskMeasure <: RiskMeasure, a public type, where v0.33 subtypedRiskMeasure. A range of your own that decomposes into two point measures declaresPortfolioOptimisers.range_tails(r)andPortfolioOptimisers.range_risk_key(r), the key under which the model stores the expression of the sum. The method ofset_risk_constraints!for aRangeRiskMeasurethen builds both tails and registers their sum, so the range needs no builder of its own. v0.33 gave a range of your own no builder.range_tailsof a measure that is not a range raises aMethodError, where v0.33 raised anArgumentError. A range that fuses its tails still raises theArgumentError.A fill policy or a panel field input of your own takes the active mask in its own method.
asset_panelcallspanel_fill(alg, v, act, name),panel_placeholder(alg, v, act)andpanel_resolve(inp, amsk), as in v0.33. v0.33 also reached a policy that defined onlypanel_fill(alg, v, name)orpanel_placeholder(alg, v), and an input that defined onlypanel_resolve(inp), through fallbacks that dropped the mask. These fallbacks are gone. Writepanel_fill(alg::MyFill, v, ::Option{<:AbstractVector{Bool}}, name),panel_placeholder(alg::MyFill, v, ::Option{<:AbstractVector{Bool}})andpanel_resolve(inp::MyInput, ::Option{<:AbstractMatrix{Bool}} = nothing)to ignore the mask, or read it. A policy or an input with the v0.33 methods alone raises aMethodErrorinasset_panel. The library policies takeact = nothingfor a column with no mask, sopanel_fill(ForwardPanelFill(), v, nothing, name)gives whatpanel_fill(ForwardPanelFill(), v, name)gave.A method of yours that reads an array of rank three reads the observations last. A method of
cross_sectional_regressionfor an estimator of your own, ofunseen_member_designfor a rule of your own for an unseen member, offactor_exposurefor an observed exposure of several factors, or ofattribution_leverage_splitfor a rule of your own readsZ[:, :, t]where v0.33 readZ[t, :, :], and gives an array of rank three with the observations last. See Arrays of rank three hold their observations last.A rule of your own that reads the mean out of a recursion from zero subtypes
AbstractZeroStartDebias, which is public, and adds a method ofzero_start_mean(rule, s, decay, n), which is public too.ExpWeightedExpectedReturns,EWMeanandEWMomentumtake it in theirdebiasfield, and so do the three gradient transformsGradientMomentum,RootMeanSquareGradientandAdaptiveMomentGradient.A gradient transform of your own returns its state with the transformed gradient.
transform_gradient!(grad, gs, g)returns(gs, ĝ), the state of the transform after the period and the transformed gradient, where v0.33 returnedĝalone and the rule kept the state that it passed in. Return the state that you wrote in place, asreturn gs, ĝ. A transform with the v0.33 return raises aTypeErrorat its first step. A transform with no method ofgradient_state_seedkeeps the statenothing, where v0.33 raised aMethodError. The three momentum transforms of the library keep aPortfolioOptimisers.GradientAverageState, which is public, with the count of the steps since the seed, where v0.33 kept a vector or a pair of vectors. A method oflearning_ratefor a schedule of your own that readsst.gs, the state of the transform in the state of the rule, readsst.gs.vandst.gs.mnow.A variance estimator of your own as the
ceofEWResidualVolatilityorEWResidualDownsideVolatilityadds a method ofPortfolioOptimisers.reads_active_mask, which is public. The constructor refuses acethat is not mask-aware, as Calls that now raise states. It cannot see a method ofvariance_seriesover an asset panel that your type defines, so it refuses your type with anArgumentError, where v0.33 called that method. If the method reads the active mask of each asset, addPortfolioOptimisers.reads_active_mask(::MyVariance) = true. A windowed series and aPortfolioOptimisersCovarianceread the same method, and give your type the whole window.A selection rule or a redundancy algorithm of your own drops a non-finite score. A method of
rule_keepfor a subtype ofAbstractSelectionRulereturnsfalseat everyNaNand every infinite score, under every parameter of the rule. A method ofredundancy_keepfor a subtype ofAbstractRedundancyAlgorithmreturnsfalseat every asset whose given score is not finite. A subtype ofAbstractAssetScorerwritesNaNat an asset that it cannot score, and the asset must not survive a selection.The Gerber, Smyth-Broby and Gerber IQ algorithms and the shrinkage targets are not moment forms.
GerberCovarianceAlgorithm,SmythBrobyCovarianceAlgorithm,GerberIQCovarianceAlgorithmandAbstractCovarianceShrinkageTargetsubtypeAbstractAlgorithm, where v0.33 hadAbstractMomentAlgorithm. A method that you wrote onAbstractMomentAlgorithmno longer reaches their members. An algorithm of your own in one of these families keeps working with the estimator that owns the family.DiscreteAllocationandGreedyAllocationhave the fieldsunit,setsandstrictbeforefb.DiscreteAllocationtakes eight positional arguments, where v0.33 took five, andGreedyAllocationtakesunit,sets,strictandfb, where v0.33 tookunit,args,kwargsandfb. A method that names the type parameters ofDiscreteAllocationby position moves, becausefbis now the eighth. In the model ofDiscreteAllocation, the integer variable is the lot countz, andxis the expressionlu .* z.finite_sub_allocation,finite_sub_allocation!andset_allocation_fees!take the lot unit after the prices.A collateral algorithm of your own needs a third method.
ca(w, prices, cash, smoney, sfee, lmoney, lfee)returns the cash that the account holds after both sides trade, and both allocators report it ascash. A rule with only the two v0.33 methods raises aMethodErrorwhen an allocator reports its cash.ProceedsCollateralreturnscash + smoney - sfee - lmoney - lfee, andCashCollateralreturnscash - smoney - sfee - lmoney - lfee. ANaNprice inpricesmarks an asset with no price on the allocation date, and its weight inwis zero.FiniteAllocationInputhas a fieldupwafterca, so its positional constructor takes nine arguments, where v0.33 took eight. The keyword constructor keeps every v0.33 keyword.EntropyPoolingPriorandMeucciEntropyPoolingPriorhave a fielddiagnoseafteropt, so each positional constructor takes 18 arguments, where v0.33 took 17. The keyword constructors keep every v0.33 keyword. The defaultdiagnose = nothingfits as v0.33 did. A solver, or a vector of solvers, indiagnoseruns a feasibility programme over the scenarios before the entropy pooling solve, and a set of views that no posterior meets together raises aDomainErrorthat names the view fields. The programme can cost more than the fit: on 1008 scenarios, from 1.6 to 69 times the time of the fit.GridSearchCrossValidationandRandomisedSearchCrossValidationhave the fieldss_scaandn_bestafterscorer.n_bestis the count of the best candidates that the search keeps.s_scareduces the values of a vector of search scorers inscorerto one value per candidate, and the defaultnothinggives the sum. They also have the fieldrank_predictionaftertrain_score. Withrank_prediction = true, the Result keeps the prediction that the search scored for each kept candidate, and the defaultfalsekeeps none. Their positional constructors take three more arguments. The keyword constructors keep every v0.33 keyword, andn_best = 1with one scorer gives the v0.33 search.HighestMeanScorehas a fieldscale, the weight of the scorer in a vector of search scorers.HighestMeanScore()givesscale = 1.0, and the scale is inert for one scorer, so a v0.33 search does not move. A method that dispatches onHighestMeanScorekeeps working, and the type now has one type parameter. The constructor raises anIsNonFiniteErrorfor a scale that is not finite.SearchCrossValidationResulthas the fieldsranked,rank_idx,rank_scores,rank_predictionsandpath_idsafteridx, so its positional constructor takes 11 arguments, where v0.33 took 6. The keyword constructor keeps every v0.33 keyword, and the new keywords default to[opt],[idx],nothing,nothingandnothing. UnderEachValue()inr_scaors_scaof the search,opt,idx,ranked,rank_idx,rank_scoresandrank_predictionshold one entry for each value, in a vector or aK × Lmatrix, andtest_scoresandtrain_scoreshold one entry per measure underr_sca = EachValue(). So the bounds of these fields widen, and a method that dispatches on their types also meets these containers. Underr_sca = PerCandidate(sca)with a vector of measures,test_scoresandtrain_scoresalso hold one entry per measure, and the other fields keep one ranking. A search of one value keeps the v0.33 types.A search scorer of your own can define
candidate_scores, which is public, to give one value per candidate. The search then orders the candidates by it, and it can keep more than one. It refuses values of another length with aDimensionMismatch, and aNaNvalue with anIsNonFiniteError. A scorer that defines only the index form keeps working atn_best = 1, and a search atn_best > 1raises anArgumentErrorthat names the method to add.A function scorer gives what a search scorer gives. It gives a vector of one value per column of the score matrix, bigger is better, or the index of one winner, as in v0.33. The search reads the form from the return. A function that gives an index with
n_best > 1raises anArgumentErrorwhen the search runs, not when you build it. A scorer that gives an index raises anArgumentErrorin a vector of scorers under a reduction ins_sca, and underr_sca = PerCandidate(sca), because an index has no value to combine. Unders_sca = EachValue()it keeps its one winner, and its entry ofrank_scoresisnothing. A subtype with ascalefield definesPortfolioOptimisers.scorer_scale, which is public, to give its weight in a vector. The fallback gives1.Fewer type parameters on a Result. A Result does not carry the type of an estimator in a type parameter, so a verb on it compiles one time for every configuration of the estimator.
MultiPeriodPredictionResulthas no type parameter foropt.MeanRiskResult,RiskBudgetingResult,FactorRiskContributionResult,NearOptimalCenteringResult,HierarchicalRiskParityResultandSchurComplementHierarchicalRiskParityResulthave none forr. The fields keep their bounds and their values. A method that names the type parameters of these types by position moves.Resumehas a second field,opt, the estimator that its Result carries, and its second type parameter is the type of that estimator. Dispatch on it in place of the fourth parameter ofMultiPeriodPredictionResult.No type parameter for a scalariser or a returns estimator.
ResolvedJuMPOptimiser, thejorof every JuMP optimisation Result, has none forretandsca. It isProcessedJuMPOptimiserAttributes, thepaof v0.33, see Renamed keywords and changed defaults.HierarchicalRiskParityResulthas none forsca, andHierarchicalEqualRiskContributionResulthas none forri,ro,scaiandscao. The fields keep their bounds and their values. A method that names the type parameters of these types by position moves.PredictionResulthas no type parameter forres. Its three type parameters are the types ofrd,hwandidx, andreskeeps the boundNonFiniteAllocationOptimisationResulton the field. So the folds of every optimiser have one type, andMultiPeriodPredictionResultnarrows its folds to that type:eltype(p.pred)is concrete, where v0.33 gavePredictionResult. WritePredictionResult{<:Any, <:HeldWeightsResult}in place ofPredictionResult{<:Any, <:Any, <:HeldWeightsResult}, andPredictionResult{<:PredictionReturnsResult{…}}in place ofPredictionResult{<:Any, <:PredictionReturnsResult{…}}. Aconcrete_typed_array(p.pred)by hand is no longer needed.LowOrderPriorandHighOrderPriorhave the fieldeoc, the effective number of observations of each moment. It comes afterensinLowOrderPriorand afterskmpinHighOrderPrior, so the positional constructors take 15 and 10 arguments, where v0.33 took 14 and 9. The keyword constructors giveeoc = (nothing, nothing)when you omit it, and an entry ofnothingmeans the number of rows ofX. The propertypr.eocof aHighOrderPriorgives the four counts, the two of its low order prior first.eocis not a type parameter, because an entry isnothingor a count by its value. So the type parameters are the 14 ofLowOrderPriorand the 9 ofHighOrderPriorof v0.33, in the same order, and a stated and an unstated count give one prior type.Stackingstores a vectoroptias aVector{OptE_Opt_TD}. v0.33 narrowed it to the union of the types of its elements, so each combination of inner optimisers gave a new type ofStacking. A method that dispatched on the element type ofoptidispatches on each element. A mixed literal needs noconcrete_typed_array.An estimator of your own that holds a child on another axis than the assets. The check of a
UniverseSetswalks the fields of each estimator thatasset_axis_fieldsnames. For a@propagatablestruct with a@vpropfield, these are the@vpropfields. For any other struct, these are all the fields that can hold an estimator, an algorithm or a vector. A struct of the second kind that holds a child that it fits on other data, such as the factor returns, definesasset_axis_fieldsfor its type, and leaves that child out. Otherwise a correct universe in that child is refused.PerformanceSummaryResulthas the fieldsnames,paths,members,date0anddate1beforen_periods,rfaftercompound, andn_eff,long_exposure,short_exposure,gross_exposure,net_exposure,measuresandriskafterturnover. Its positional constructor takes 29 arguments, where v0.33 took 16. Build it withperformance_summary, or with the new keyword constructorPerformanceSummaryResult(; n_periods, ppy, …), which takes each field by name. The keyword constructor givesnothingto the keys and the dates, and an emptyNamedTupletomeasuresandrisk, when you omit them. In a summary of many entries, an omitted key or date isnothingat each entry. Both constructors check the values, as Calls that now raise states.ClusterNodehas two type parameters,ClusterNode{T, H}, the types ofidandheight. v0.33 had five, one for each field, so the type of a node held the shape of its subtree, and each new dendrogram compiled the methods that read it again. A method that names the type parameters ofClusterNodeby position moves.leftandrightarenothingor aClusterNode{T, H}, and the constructor raises aDomainErrorfor a child of another id type or height type, which v0.33 accepted.levelis anInt.CrossSectionalLinearRegressionandCrossSectionalTargetRegressionhave a fieldleveragebeforeex, so their positional constructors take four and five arguments, where v0.33 took three and four. The keyword constructors keep every v0.33 keyword, and the defaultleverage = trueruns the leverage check of v0.33.BudgetCostsandBudgetMarketImpacthave a fieldfixedafter their last field, andBudgetCostshas a fieldxbgtafterfixed. So both positional constructors take eight arguments, where v0.33 took six and seven. The keyword constructors keep every v0.33 keyword, andfixed = truekeeps the referencewat every fold, as in v0.33.JuMPOptimiserholds its feasible set in aConstraintBlock, in the fieldcbe. The block holds the slotswb,sbgt,gbgt,lt,st,lcse,cte,gcarde,sgcarde,smtx,sgmtx,slt,sst,sglt,sgst,tn,sets,tr,ple,ccnt,cobj,ss,card,scard,l2c,lpc,linfc,l1,l2,lp,linfandxbgt. The positional constructor takes 11 arguments,JuMPOptimiser(pe, slv, cbe, bgt, fees, ret, sca, sc, so, strict, cache), where v0.33 took 42. The keyword constructor keeps every v0.33 keyword, and it also takescbe. A read such asopt.wb, a search key such as"opt.wb",Accessors.setand a pipeline route into a slot give the values of v0.33. A method that names the type parameters ofJuMPOptimiserby position moves, and so does code that reads a slot withgetfield(opt, :wb): readopt.wboropt.cbe.wb. A path that names a slot, such as in an error message or ingroup_frames, now passes through the block, as"opt.cbe.tr.tr".ProgrammeAllocationSetholds its constraint kinds in aConstraintBlock, in the fieldcbe, asJuMPOptimiserdoes.r,ret,scandsostay fields of the set. The positional constructor takes 7 arguments,ProgrammeAllocationSet(pe, slv, cbe, r, ret, sc, so), where v0.33 took 38. The keyword constructor keeps every v0.33 keyword, and it also takescbe.set.wbandAccessors.setgive the values of v0.33. A method that names the type parameters by position moves, and so does agetfield(set, :wb)read: readset.wb. A path that names a slot passes through the block, as"set.cbe.ple". ATimeDependentin a slot raises anArgumentError, where v0.33 raised aTypeError: schedule the whole set.A Custom Constraint or a Custom Objective Term of your own receives a
ResolvedJuMPOptimiser. Writeattrs::ResolvedJuMPOptimiserwhere v0.33 wroteattrs::ProcessedJuMPOptimiserAttributes.attrs.pr,attrs.fees,attrs.ret,attrs.wband the other resolved constraints of v0.33 read as before. The norm ceilingsl2c,lpcandlinfcand the penaltiesl1,l2,lpandlinfare resolved inattrs.cbr, with each calibration rule replaced by its value, where v0.33 resolved them inassemble_jump_model!and held them on the optimiser alone. The four buildersset_weight_norm_2_constraints!,set_weight_norm_inf_constraints!,set_l1_regularisation!andset_linf_regularisation!no longer check their number, because the stage 2 of the block,resolve_constraint_block, checks it.attrs.cbrcan be a vector. When the head solves with more than one block,attrs.cbris a vector ofResolvedConstraintBlocks with the block of the head first, andattrs.wband the other forwarded reads give the block of the head.A head of your own builds its weights and stops there.
assemble_jump_model!now adds the weight bounds and the budgets, in phase 1 of the block of the head, with the net budgetopt.bgt. A head that calledset_weight_constraints!(model, attrs.wb, opt)beforeassemble_jump_model!now raises anArgumentErrorthat names the keyw_lborw_ub, because the model registers the row twice: remove the call. A long-only head checks its bounds withassert_long_only_weight_bounds(wb), where v0.33 passedlong = truetoset_weight_constraints!. That positional argument is gone.set_weight_constraints!and the budget builders takeprefix.set_weight_constraints!,set_budget_constraints!,set_long_short_budget_constraints!andset_gross_budget_constraints!register their rows under the prefix of a block, and the defaultSymbol("")gives the names of v0.33. ABudgetCostsor aBudgetMarketImpactunder a non-empty prefix raises anArgumentError, because it registers shared entries.assemble_allocation_set!is gone.set_block_constraints!andset_block_post_risk_constraints!add a block, andset_allocation_risk_return_bounds!adds the ceilings and the floor of aProgrammeAllocationSet.A Custom Objective Term of a
ProgrammeAllocationSetreceives theResolvedConstraintBlockof the set. In a projection,add_custom_objective_term!gets the block Result of the set asattrs, where v0.33 gavenothing. The set also gives itsccntand itscobjthe price-adjusted allocation of the step throughfactory, as it gives its turnover and its tracking errors.set_allocation_set_constraints!returns the bounds of the step and the block Result,(wb, cbr), where v0.33 returnednothing. On aBoundedAllocationSet,cbrisnothing.A projection gives a set the price-adjusted allocation before it views the set at the investable mask. The projection programme calls
factory(set, w)on every asset, and then views the set at the mask of the step, as a JuMP head does. v0.33 viewed the set first, and then calledfactorywithwon the mask. A Custom Constraint or a Custom Objective Term of your own that definesport_opt_viewand holdswthroughfactorynow meets the view afterfactory, so itsport_opt_viewcutswto the mask too.set_allocation_set_constraints!takes a three-argument form,(model, set, cbr), which adds a block that the entry resolved. The four-argument and the five-argument forms resolve the step themselves and refuse an asset that the prior of the set cannot price, as in v0.33.allocation_set_cobjis gone, andset_block_objective_terms!adds thecobjof a block.The rows of a set in a leader's model are registered under
blk_2_. The bounds and the short and gross budgets of aProgrammeAllocationSetor aBoundedAllocationSetwere anonymous rows in the model of aFollowTheLeaderleader. The set is now the second block of the model, so its rows areblk_2_w_lb,blk_2_w_ub,blk_2_sbgtand the others, and a reader of the model can find them. The budget of one is the rowbgtof the leader, because the re-solve sets the net budget of the leader to one. The return floor of a set clears itsrte, so the floor no longer entersret_vecof the leader. No weight moves, because the leader readret_vecbefore the set added its floor.A head of your own passes
blockstoassemble_jump_model!. A JuMP head that gets more than one block adds the rows of every block to its model, where it added the rows of its own block alone. Its_optimisetakes the keywordblocksby name, gives it toresolve_jump_optimiser, and gives the same value toassemble_jump_model!(...; blocks = blocks). Blockiafter the first registers its rows under the prefixblk_i_, so the second block givesblk_2_w_ub. A head of your own that leaves out the keyword ofassemble_jump_model!adds its own block alone, as before. The unconstrainedNearOptimalCenteringadds the bounds and the budgets of each later block, and no other row of it.A Custom Objective Term gets the objective of the model, once for each model.
assemble_jump_model!callsadd_custom_objective_term!once, with its ownobj, the declared objective of aMeanRisk. v0.33 called it inset_portfolio_objective_function!, once for each objective that the model got. So the end points of aFrontiersweep gave the termMinimumRiskandMaximumReturnasobj, and now give it the declared objective. A method that dispatches onobjto change the term at an end point no longer can.set_portfolio_objective_function!takes(model, obj), where v0.33 took(model, obj, optimiser, attrs). A head of your own that callsassemble_jump_model!gets its terms from it, and callsset_portfolio_objective_function!(model, obj).More entries of a JuMP model have a name. A
BudgetCostsregisters its rowswp_ub,wn_ubandcost_bgt_trade, and aBudgetMarketImpactalso registerswip_pconeandwin_pcone, where v0.33 left them anonymous. The gain tail of a range of returns registers the negated seriesgain_net_X, and a drawdown measure registers the negated pathneg_dd, under the prefix of the measure. A Custom Constraint of your own that registers one of these names in the same model raises anErrorExceptionof JuMP. The rows and the weights do not move.A test of the mean of your own returns a
MeanTestResult.mean_testreturns aMeanTestResult, which is public, where v0.33 returned the named tuple(; t_stat, p_value, mean_ci_lower, mean_ci_upper). A method ofmean_testfor a subtype ofAbstractMeanTestEstimatorbuilds it withMeanTestResult(t_stat, p_value, mean_ci_lower, mean_ci_upper)or with the same four keywords. The constructor raises aDomainErrorfor a p-value outside[0, 1]and for a lower bound above the upper bound, and aNaNpasses. A caller that reads the fields by name, asres.p_valueor(; t_stat, p_value) = res, does not change. A caller that callsvalues,keysormergeon the answer reads the four fields instead.factoryreturns every value that has no method of its own.factory(a, args...; kwargs...) = atakes::Any, where v0.33 took an estimator, an algorithm, a result ornothing, and raised aMethodErrorfor any other value. A struct of yours with an@fpropfield that holds data, or a covariance estimator ofStatsBase, needs no method. The methods offactorythat only returned their input onStatsBase.CovarianceEstimator,AbstractBaseRiskMeasure,MomentMeasureAlgorithm,ValueatRiskFormulation,DimensionReductionTarget, phylogeny estimators and results, a number with a weights vector, and anAbstractRegressionTargetwith anInterceptColumnare gone, and the leaf gives the same answer. The array method takes anAbstractArrayof any shape, where v0.33 took anAbstractVector.A return forecast estimator of your own takes a last regression argument. The prior calls
return_forecast(rfe, rd, csfm, cre)withcreasorthogonal_forecast_regressiongives it,nothingunder every rule butOrthogonalPartCalibration. A member that reads no regression writesreturn_forecast(rfe::MyMember, rd, csfm, ::Nothing = nothing), and a member that folds writesreturn_forecast_step(rfe::MyMember, P, csfm, fs, ::Nothing = nothing). A member with only the three-argument method of v0.33 raises aMethodErrorin the prior.A cross-sectional solve algorithm of your own takes six arguments in one method. The regression calls
cross_sectional_solve(alg, A, y, t, F, ws), with the factorisationFthat it took and the workspacewsof its task. v0.33 called a method of four arguments,cross_sectional_solve(alg, A, y, t). Writecross_sectional_solve(::MySolve, A, y, t, F = nothing, ws::NamedTuple = (;)), and ignore the two slots when the member reads neither. A member with only the four-argument method raises aMethodErrorin the regression.resolve_deferred_quantitiestakes a prior result. A call with a second argument that is not anAbstractPriorResultraises aMethodError, where v0.33 returned the first argument. No caller in the library made such a call.A cross-sectional solve algorithm of your own returns a
CrossSectionalSolveResult.cross_sectional_solveandcross_sectional_target_solvereturn aCrossSectionalSolveResult, which is public, where v0.33 returned the vector of the factor returns. The fieldfholds that vector. The fieldedofis new: the residual count of the fit, which the regression writes intoedofofCrossSectionalRegression. A method for a subtype ofAbstractCrossSectionalSolveAlgorithmbuilds it withCrossSectionalSolveResult(f, edof)or with the same two keywords. The constructor raises aDomainErrorfor a residual count that is not finite, and a count below zero passes. A method that returns a vector, as in v0.33, or a named tuple raises aMethodErrorin the regression. A caller that used the vector readsres.f. A caller that compares two answers with==compares their fields instead.A descriptor of your own that folds returns a
DescriptorStepResult.descriptor_stepreturns aDescriptorStepResult, which is public, where v0.33 returned the named tuple(; de, D). A method for a subtype ofAbstractDescriptorEstimatorbuilds it withDescriptorStepResult(de, D)or with the same two keywords, from the estimator with its new state and the matrix of the descriptor. The carry fold of the prior reads it throughdescriptor_carried, which takesnothingor aDescriptorStepResult, so a method that returns the named tuple raises aMethodErrorin the fold. A caller that reads the fields by name does not change.An unseen member rule of your own returns an
UnseenMemberDesignResult.unseen_member_designreturns anUnseenMemberDesignResult, which is public, where v0.33 returned the named tuple(; Z, P). A method for a subtype ofAbstractUnseenMemberRulebuilds it withUnseenMemberDesignResult(Z, P), or with the keywordsZandP, whose default is().Pis a vector or a tuple of the pairst => P_t. The constructor raises aDomainErrorfor a pairt => P_twhosetis not an observation ofZ, and aDimensionMismatchfor aP_tthat is not square on the factor axis ofZ. Build the type in a method of yours: the readers of the library read the two fields by name, so they do not refuse the named tuple, but they get no check of it. A caller that reads the fields by name does not change.A rule of your own for an unknown entry returns a
LeverageSplitResultand anAttributionErrorsResult.attribution_leverage_splitreturns aLeverageSplitResultornothing, andattribution_leverage_errorsreturns anAttributionErrorsResult. Both types are public. v0.33 returned the named tuples(; assets, factors)and(; sys, factor, family). A method for a subtype ofAbstractUnknownEntryRulebuilds them withLeverageSplitResult(assets, factors)andAttributionErrorsResult(sys, factor, family), or with the same keywords. The defaults ofAttributionErrorsResultarenothing, the answer of an attribution with no standard errors. The constructor ofLeverageSplitResultraises anArgumentErrorfor marks that name no asset, because a rule that marks nothing answersnothing. The constructor ofAttributionErrorsResultraises anArgumentErrorwhensysandfactorare not both stated or bothnothing, and whenfamilyis stated withoutfactor. A method that returns a named tuple raises aMethodErrorinattribution_leverage_nanor in the realised attribution. The argumentsesand the answers ofpassare anAttributionErrorsResulttoo. A caller that reads the fields by name, ass.assetsor(; sys, factor) = ses, does not change.keysof an answer raises aMethodError, and a destructure by position, asassets, factors = s, raises aBoundsError. Two answers are not==, because the types compare their vectors by identity, so compare their fields.An orthogonal forecast fit of your own returns a
ForecastSplitResult.orthogonal_forecast_rescalereturns aForecastSplitResult, which is public, where v0.33 returned the named tuple(; g, ap). A method for a subtype ofAbstractOrthogonalForecastFitbuilds it withForecastSplitResult(g, ap)or with the same two keywords. The constructor raises anArgumentErrorwhen one part isnothingand the other is not. A method that returns the named tuple raises aMethodErrorin the prior. A caller that reads the fields by name does not change.The buffer of
centring_lag_recordsholds aCentringLagRecord. Each record of the HAC term of anEstimatedCentringis aCentringLagRecord, which is private, with the fieldsobs_count,validandP. v0.33 held the named tuple(; obs_count, valid, P), with the same values. A method ofcentring_lag_factorof your own that reads a record by field name does not change. A method ofcentring_lag_recordsof your own that makes a buffer of the named tuple raises aMethodErrorwhen the fold pushes a record into it. Make the buffer with the element typetypeof(PortfolioOptimisers.CentringLagRecord(Int[], falses(0), P)). A caller that callskeysormergeon a record raises aMethodError.An online portfolio selection rule of your own takes the last slot of
online_update!and ofrule_state_seed. Writeonline_update!(alg::MyRule, st, w, x, rows, set, ::Option{<:AbstractVector} = nothing)where v0.33 wrote the six-argument form, andrule_state_seed(alg::MyRule, w, ::Option{<:AbstractAllocationSet} = nothing)where v0.33 wrote the two-argument form. The last slots are the point at which anExpertMixtureasks its experts for a gradient, and the set of allowed weights that the head gives the seed. v0.33 had a generic method of each long form that dropped the slot, and v0.34 has none. A rule with only the six-argument form raises aMethodErroras an expert of anExpertMixture. A rule with only the two-argument form gets the default statenothingfrom the head. A first-order rule that getsnothingas the point of its gradient takes its own iterate.A geometry of your own reaches the projection programme on a
ProgrammeAllocationSet.project(proj::AbstractProjectionGeometry, set::ProgrammeAllocationSet, q, w)solves the programme for every geometry, with the objective thatset_projection_objective!writes for it. v0.33 had a method for each geometry of the library alone, so a geometry of your own raised aMethodErrorinproject. It now raises theMethodErrorinset_projection_objective!, a private function, unless it has a methodproject(proj::MyGeometry, set::ProgrammeAllocationSet, q, w), which is more specific than the method of the library.A dynamic observation weight of your own returns one concrete weight type. A moment risk measure now rebuilds itself with the weights that your
get_observation_weightsmethod returns. When the method infers aUnion, aseweights(1:n, lambda)does, each call of the measure allocates 80 more bytes than before. Return one concrete type, aseweights(n, lambda)does, and the call allocates no more than before. The value does not change. The docstring ofDynamicAbstractWeightsshows the form.A JuMP optimisation Result of your own declares its own property forwarding. v0.33 defined
getpropertyandpropertynamesonRJR_NRJR, so a subtype ofRiskJuMPOptimisationResultorNonRiskJuMPOptimisationResultreadres.wand the fields ofjorthrough its fieldjrwith no declaration. These methods are gone, because they gave nosetpropertiesmethod, andAccessors.setrefused every patch of aMeanRiskResultor aNearOptimalCenteringResult. Write@forward_properties MyResult begin forward(jr) endafter the struct, as each Result of the library does. A subtype without the block raises an error at its first read ofres.w, becausewis not one of its fields. The block givesMeanRiskResultandNearOptimalCenteringResultthe names that the methods onRJR_NRJRgave, in the same order, and a patch of a field now gives a new Result. The names ofjorare those of its v0.34 type, so a name of v0.33 that leftjoris not a name of the Result either.The carried states of the exponentially weighted beta Descriptors.
EWBetaStateholds theEWMomentsof each asset, the moments of the squared weights for the shrinkage, the openEWReturnWindow, the held betas and the count of the observations, and it is the state of anEWBetatoo, where v0.33 usedEWBlockState.EWMacroSensitivityStateholds anEWBetaState, the constant-market flag of each asset and the two counts of the reference windows.EWDownsideBetaStateholds the second moment of the market shortfall per asset invd, a vector, and has no fieldt. A state of v0.33 does not fold into v0.34: fit the Descriptor again.CalibrationContexthas a fieldnaftercs, the count that the site prices, so its positional constructor takes five arguments, where v0.33 took four. The keyword constructor keeps every v0.33 keyword, and the defaultn = nothingreads the effective sample size of the prior, as v0.33 did. A radius rule of your own readsctx.nwhere it is notnothing, as the radius rules of the library do.A systematic repair of your own takes the count
T. The prior callssystematic_processing!(srep, mp, sigma, X, T; kwargs...), withTthe effective count of the observations, where v0.33 called the form of four arguments. Writesystematic_processing!(::MyRepair, mp, sigma, X, T::Real = size(X, 1); kwargs...)for a subtype ofAbstractSystematicRepair. A method with the v0.33 arguments alone raises aMethodErrorin the prior.A variance estimator of your own takes the active mask in
variance_count. ACrossSectionalFactorPriorcallsvariance_count(ve, X, amsk), a private function, with the active mask that its variance read, where v0.33 calledvariance_count(ve, X). A method of your own with the two v0.33 arguments alone is not called there. The fallback then states no count, so the block records no degrees of freedom, andResidualInflationraises anIsNothingErrorthat asks fordof. WritePortfolioOptimisers.variance_count(ve::MyVariance, X::PortfolioOptimisers.MatNum, amsk::Union{Nothing, AbstractMatrix{<:Bool}} = nothing). A looser bound onXor onamskis ambiguous with the fallback, and the call raises aMethodError. When your variance restarts an asset where the mask turnsfalse, count the rows after the last inactive row of the asset, as the exponentially weighted estimators of the library do.A regression target of your own subtypes one of two families. A target that subtypes
AbstractRegressionTargetdirectly subtypesAbstractUnpenalisedRegressionTargetorAbstractPenalisedRegressionTargetnow, both public. An unpenalised target takes every criterion ofStepwiseRegression. A penalised target takes:aic,:aiccand:bic, asElasticNetdoes. A target in neither family raises aMethodErrorinStepwiseRegressionunder the defaultPValue(),:r2and:adjr2.RiskBudgetinghas a fieldkminbeforefb, so its positional constructor takes six arguments,RiskBudgeting(opt, r, rba, wi, kmin, fb), where v0.33 took five. The keyword constructor keeps every v0.33 keyword.