quantlab.portfolio.predefined.expected_return.RawExpectedReturn#

class quantlab.portfolio.predefined.expected_return.RawExpectedReturn(config)[source]#

Bases: PredictionExpectedReturn

mu is the prediction, which must be a return in the label’s own units.

Bound to a label whose spec reports a scale other than "raw" (a model fitted on a transformed target, or a label an ensemble averages), it refuses; PredictionExpectedReturn takes such a prediction as it is.

Examples

>>> RawExpectedReturn(RawExpectedReturnConfig()).bind(
...     LabelSpec(name="ret_5", scale="standardized", delay=1, span=5)
... )
Traceback (most recent call last):
ValueError: RawExpectedReturn reads the prediction of 'ret_5' as a return, but its label spec reports its scale as 'standardized', not 'raw' (a model fitted on a transformed target, or a label an ensemble averages); use PredictionExpectedReturn to take it as it is, or GrinoldExpectedReturn
bind(spec)[source]#

Refuse a label whose spec’s scale is not "raw"; see the class docstring.

config_cls#

alias of RawExpectedReturnConfig