quantlab.portfolio.base.Decision#
- class quantlab.portfolio.base.Decision(weights, failure=None, events=<factory>)[source]#
Bases:
objectWhat a rule decided at one bar:
PortfolioConstructor.decide’s result.- Attributes:
- weightsxr.DataArray
The weights to hold after the bar, on
symbolin the order of the context’s symbols: finite on a traded bar, all NaN to hold the current position.- failurestr or None
The message of the
PortfolioConstructionErrorthat made the bar a hold, orNonewhen the rule decided it.- eventsdict
The events the rule’s row reported in
attrs["events"], as the rule gave them ({name: [symbol, ...]}or{name: count}); empty after a failure.
Examples
>>> decision = Decision( ... weights=xr.DataArray([0.5, 0.5, 0.0], dims="symbol", coords={"symbol": ["AAA", "BBB", "CCC"]}), ... ) >>> decision.failure is None, decision.events (True, {})