rebalance_factory
mainsequence.virtualfundbuilder.resource_factory.rebalance_factory
RebalanceStrategyBase
Bases: BaseResource
calendar
property
Workaround due to error when pickleing the calendar
__init__(calendar='24/7', *args, **kwargs)
Args: calendar (str): Trading calendar. The string should must be valid calendar from the pandas_market_calendars (like '24/7' or 'NYSE')
calculate_rebalance_dates(start, end, calendar, rebalance_frequency_strategy)
Determines the dates on which portfolio rebalancing should be executed based on the specified rebalancing strategy. This calculation takes into account the start time of the rebalancing window and the execution frequency.
Args: start (pd.DataFrame): A datetime containing the start time
Returns: pd.DatetimeIndex: A DatetimeIndex containing all the dates when rebalancing should occur.
register_rebalance_class(name=None, register_in_agent=True)
Decorator to register a model class in the factory.
If name
is not provided, the class's name is used as the key.