quantlab.portfolio.predefined.mean_variance.MeanVarianceInputs#
- class quantlab.portfolio.predefined.mean_variance.MeanVarianceInputs(symbols, expected_return, estimate, current_weights, locked_symbols=<factory>, locked_weights=<factory>, risk_locked_weights=<factory>, closed_without_risk=<factory>, exposures=<factory>, locked_exposures=<factory>, exposure_bounds=<factory>, closed_without_exposure=<factory>, reference_weights=<factory>, reference_without_risk=<factory>)[source]#
Bases:
objectThe problem one bar poses: the candidate symbols, the locked ones and their inputs.
- Attributes:
- symbolsnp.ndarray
The candidates the optimiser sets: tradable, not locked, covered by the covariance estimator, and either with a finite expected-return prediction or held; with
candidate_top_k, only the pool.- expected_returnnp.ndarray
muper candidate, on the expected-return label’s span; 0.0 for a held candidate without a prediction.- estimateReturnCovariance
The covariance estimator’s estimate, on the same span, over the candidates, then the locked symbols it covers, then, with a reference book, the reference’s other symbols it covers.
- current_weightsnp.ndarray
The weights currently held on the candidates.
- locked_symbolsnp.ndarray
The locked positions: held and not tradable at the bar.
- locked_weightsnp.ndarray
Their current weights, which the solution keeps.
- risk_locked_weightsnp.ndarray
The locked weights the estimate covers, in its order after the candidates.
- closed_without_risknp.ndarray
Held, tradable symbols the covariance estimator does not cover, closed.
- exposuresnp.ndarray
[k, candidates]: each bounded exposure per candidate;[0, candidates]without bounds.- locked_exposuresnp.ndarray
[k]: each bounded exposure of the locked positions,sum w * x.- exposure_boundsnp.ndarray
[k, 2]: each bounded exposure’s(lower, upper), in the rows’ order.- closed_without_exposurenp.ndarray
Held, tradable symbols lacking a bounded exposure, closed.
- reference_weightsnp.ndarray
The reference book
bonestimate’s symbols, the risk term pricingw - b; empty without one (reference_weights).- reference_without_risknp.ndarray
Symbols of the reference book the estimate does not cover, left out of it.
Examples
>>> inputs = optimizer.problem_inputs(context) >>> inputs.symbols.tolist(), inputs.covariance.shape (['AAA', 'BBB', 'CCC', 'DDD'], (4, 4))
- property covariance#
Sigmaas a dense matrix, over the candidates then the covered locked symbols.Examples
>>> inputs.covariance.shape (4, 4)