backtest_lib.target_holdings#
- backtest_lib.target_holdings(holdings: Mapping[str, int], fill_cash: bool = False) TargetHoldingsDecision#
Create a decision targeting discrete holdings.
This is part of the strategy output language. Use it when your strategy expresses desired positions as share counts. The holdings keys must be a subset of the strategy universe; missing securities are treated as zero.
- Parameters:
holdings – Desired integer holdings per security.
fill_cash – Whether to allocate remaining cash automatically.
- Returns:
TargetHoldingsDecision for the target holdings.