code: def factor_cumulative_returns(
      factor_data,
      period,
      long_short=True,
      group_neutral=False,
      equal_weight=False,
      quantiles=None,
      groups=None,
  ):
      """
      Simulate a portfolio using the factor in input and returns the cumulative
      returns of the simulated portfolio
  
      Parameters
      ----------
      factor_data : pd.DataFrame - MultiIndex
          A MultiIndex DataFrame indexed by date (level 0) and asset (level 1),
          containing the values for a single alpha factor, forward returns for
          each period, the factor quantile/bin that factor value belongs to,
          and (optionally) the group the asset belongs to.
          - See full explanation in utils.get_clean_factor_and_forward_returns
      period : string
          'factor_data' column name corresponding to the 'period' returns to be
          used in the computation of porfolio returns
      long_short : bool, optional
          if True then simulates a dollar neutral long-short portfolio
          - see performance.create_pyfolio_input for more details
      group_neutral : bool, optional
          If True then simulates a group neutral portfolio
          - see performance.create_pyfolio_input for more details
      equal_weight : bool, optional
          Control the assets weights:
          - see performance.create_pyfolio_input for more details
      quantiles: sequence[int], optional
          Use only specific quantiles in the computation. By default all
          quantiles are used
      groups: sequence[string], optional
          Use only specific groups in the computation. By default all groups
          are used
  
      Returns
      -------
      Cumulative returns series : pd.Series
          Example:
              2015-07-16 09:30:00  -0.012143
              2015-07-16 12:30:00   0.012546
              2015-07-17 09:30:00   0.045350
              2015-07-17 12:30:00   0.065897
              2015-07-20 09:30:00   0.030957
      """
      fwd_ret_cols = utils.get_forward_returns_columns(
          factor_data.columns
      )
  
      if period not in fwd_ret_cols:
          raise ValueError("Period '%s' not found" % period)
  
      todrop = list(fwd_ret_cols)
      todrop.remove(period)
      portfolio_data = factor_data.drop(todrop, axis=1)
  
      if quantiles is not None:
          portfolio_data = portfolio_data[
              portfolio_data["factor_quantile"].isin(quantiles)
          ]
  
      if groups is not None:
          portfolio_data = portfolio_data[
              portfolio_data["group"].isin(groups)
          ]
  
      returns = factor_returns(
          portfolio_data, long_short, group_neutral, equal_weight
      )
  
      return cumulative_returns(returns[period], period)
  
imports: import pandas
  import numpy
  import warnings
  import empyrical
  from pandas.tseries.offsets import BDay
  from scipy import stats
  from statsmodels.regression.linear_model import OLS
  from statsmodels.tools.tools import add_constant
  from .None import utils
label_desc: Use image node_id 14 for calling a global function with example usage: factor_cumulative_returns(factor_data, period, long_short, group_neutral, equal_weight, quantiles, groups) and returns: cumulative_returns