BasketStrategy

BasketStrategy#

class sigtech.framework.strategies.basket_strategies.BasketStrategy

Baseclasses: DailyStrategy

Subclasses: CashBasketStrategy, SizeVaryingBasketStrategy, RatesBasketStrategy

Basket strategy with fixed weights, rebalanced as of rebalance frequency.

Keyword arguments:

  • constituent_names: List of constituent tickers.

  • weights: List of constituents weights expressed as floats.

  • rebalance_frequency: Rebalance frequency, e.g. '1BD', '2BD', '1W', '2W', '1M', '2M', '1W-WED', '1W-FRI', '3M_IMM', 'SOM', 'EOM', 'YEARLY', '1DOM' and variations of these.

  • rebalance_dates: (Optional) List of rebalance days to use, supersedes the rebalance_frequency parameter.

  • rebalance_bdc: Rebalance business day convention, e.g. 'PRECEDE'.

  • intersecting_business_days: Whether to use the combined (intersected) calendars of the underlyings.

  • instant_sizing: Use instantaneous sizing rather than default sizing lag.

  • convert_long_short_weight: Set if the strategy applies long-short conversion (default is True).

  • use_db_for_short_version: Set if the long-short conversion looks in the DB (default is False).

  • unit_type: Units used for weights, defaults to 'WEIGHT'. See add_position_target for more details about the unit types.

  • trade_out_end: If true, closes all positions on last trading day of strategy.

Example:

import datetime as dtm
from sigtech.framework.default_strategy_objects.rolling_futures import cl_comdty_energy, co_comdty_energy

bs = sig.BasketStrategy(
    currency='USD',
    start_date=dtm.date(2010, 1, 6),
    constituents=[
        cl_comdty_energy(),
        co_comdty_energy(),
    ],
    weights=[0.5, 0.5],
    rebalance_frequency='EOM'
)
constituent_names: list[str]
constituents: Optional[Union[list[sigtech.framework.strategies.strategy.Strategy], list[str]]]
convert_long_short_weight: Optional[bool]
currency: Optional[str]
instant_sizing: Optional[bool]
intersecting_business_days: Optional[bool]
rebalance_bdc: Optional[str]
rebalance_dates: list[datetime.date]
rebalance_frequency: Optional[str]
trade_out_end: Optional[bool]
unit_type: Optional[str]
use_db_for_short_version: Optional[bool]
weights: list[float]
AVAILABLE_REBALANCE_FREQS

Subclasses: ScheduleFrequenciesWithIntraday

alias of ScheduleFrequencies

get_rebalance_dates() list[datetime.date]

Evaluate the rebalance dates based on a periodic schedule or return the user-provided one.

schedule_information()

Schedule - if intersecting_business_days is True, the constituent calendars intersection is used.

strategy_initialization(dt)

Initial decision run on the start date of the strategy.

Parameters:

dt – Reference datetime.