time_series
mainsequence.virtualfundbuilder.time_series
PortfolioStrategy
Bases: TimeSerie
Manages the rebalancing of asset weights within a portfolio over time, considering transaction fees and rebalancing strategies. Calculates portfolio values and returns while accounting for execution-specific fees.
human_readable
property
Generates a human-readable name for the portfolio strategy.
Returns: str: Human-readable name.
__init__(portfolio_build_configuration, *args, **kwargs)
Initializes the PortfolioStrategy class with the necessary configurations.
Args: portfolio_build_configuration (PortfolioBuildConfiguration): Configuration for building the portfolio, including assets, execution parameters, and backtesting weights. is_live (bool): Flag indicating whether the strategy is running in live mode.
get_portfolio_about_text()
Constructs the portfolio about text.
Returns: str: Portfolio description.
update(update_statistics)
Updates the portfolio weights based on the latest available data.
Args: latest_value (datetime): The timestamp of the latest available data.
Returns: pd.DataFrame: Updated portfolio values with and without fees and returns.
translate_to_pandas_freq(custom_freq)
Translate custom datetime frequency strings to Pandas frequency strings.
Args: custom_freq (str): Custom frequency string (e.g., '1d', '1m', '1mo').
Returns: str: Pandas frequency string (e.g., 'D', 'T', 'M').