backtest_lib.combine#

backtest_lib.combine(*decisions: HoldDecision | MakeTradeDecision | TargetWeightsDecision | TargetHoldingsDecision | ReallocateDecision | CompositeDecision) HoldDecision | MakeTradeDecision | TargetWeightsDecision | TargetHoldingsDecision | ReallocateDecision | CompositeDecision#

Combine multiple decisions into a single composite decision.

This is the composition operator for the decision language. It mirrors the + operator implemented by the decision base class.

Example

>>> from backtest_lib.engine.decision import combine, hold, target_weights
>>> d1 = hold()
>>> d2 = target_weights({"AAPL": 1.0})
>>> d1 + d2 == combine(d1, d2)
True