Skip to main content

BaseFrontier

Base class for portfolio objects with all properties needed to calculate optimal portfolios. Risk Measures:
  • MV: Standard Deviation.
  • KT: Square Root of Kurtosis.
  • MAD: Mean Absolute Deviation.
  • GMD: Gini Mean Difference.
  • MSV: Semi Standard Deviation.
  • SKT: Square Root of Semi Kurtosis.
  • FLPM: First Lower Partial Moment (Omega Ratio).
  • SLPM: Second Lower Partial Moment (Sortino Ratio).
  • CVaR: Conditional Value at Risk.
  • TG: Tail Gini.
  • EVaR: Entropic Value at Risk.
  • RLVaR: Relativistic Value at Risk.
  • WR: Worst Realization (Minimax).
  • RG: Range of returns.
  • CVRG: CVaR range of returns.
  • TGRG: Tail Gini range of returns.
  • EVRG: EVaR range of returns.
  • RVRG: RLVaR range of returns. I recommend only use this function with MOSEK solver.
  • MDD: Maximum Drawdown of uncompounded cumulative returns (Calmar Ratio).
  • ADD: Average Drawdown of uncompounded cumulative returns.
  • CDaR: Conditional Drawdown at Risk of uncompounded cumulative returns.
  • EDaR: Entropic Drawdown at Risk of uncompounded cumulative returns.
  • RLDaR: Relativistic Drawdown at Risk of uncompounded cumulative returns.
  • UCI: Ulcer Index of uncompounded cumulative returns.
Method generated by attrs for class BaseFrontier.

Ancestors

  • abc.ABC
  • riskfolio.src.Portfolio.Portfolio

Descendants

  • systematica.portfolio.frontier.models.FrontierAssetStats
  • systematica.portfolio.frontier.models.FrontierBLFactorsStats
  • systematica.portfolio.frontier.models.FrontierBLStats
  • systematica.portfolio.frontier.models.FrontierFactorsStats
  • systematica.portfolio.frontier.models.FrontierWCStats

Class variables

  • alpha: float: Significance level of VaR, CVaR, EVaR, RLVaR, DaR, CDaR, EDaR, RLDaR and Tail Gini of losses. The default is 0.05.
  • a_sim: int: Number of CVaRs used to approximate Tail Gini of losses. The default is 100.
  • beta: float: Significance level of CVaR and Tail Gini of gains. If None it duplicates alpha value. The default is None.
  • b_sim: int: Number of CVaRs used to approximate Tail Gini of gains. If None it duplicates a_sim value. The default is None.
  • model: str: Methodology used to estimate input parameters. The default is Classic.
  • rm: str: The risk measure used to optimize the portfolio. The default is MV. Possible values are displayed above.
  • kelly: str: Method used to calculate mean return. Possible values are: None for arithmetic mean return, “approx” for approximate mean logarithmic return using first and second moment and “exact” for mean logarithmic return. The default is None.
  • rf: float: Risk free rate. The default is 0.0.
  • hist: bool: Indicate what kind of returns are used to calculate risk measures that depends on scenarios (All except MV risk measure). The default is True. If model = BL, True means historical covariance and returns and False Black Litterman covariance and historical returns. If model = FM, True means historical covariance and returns and False Risk Factor model for covariance and returns. If model = BL_FM, True means historical covariance and returns, False Black Litterman with Risk Factor model for covariance and Risk Factor model for returns, and 2 Risk Factor model for covariance and returns.
  • solver: str: Solver available for CVXPY that supports power cone programming. Used to calculate RLVaR and RLDaR. The default value is CLARABEL.
  • constraints: List[Dict[str, str]]: Risk contribution constraints. Defaults to None.
  • asset_classes: dict: Asset classes.
  • config: Dict[str, Any]: Riskfolio-lib configuration. Overwrite other required parameters if referenced.

Instance variables

  • kappa: float: Deformation parameter of RLVaR and RLDaR for losses, must be between 0 and 1. The default is 0.30.
  • freq: Infer the frequency of the returns index.
  • ann_factor: Calculate the annualization factor based on the frequency.
  • x_axis: str: Generate the label for the x-axis based on the risk measure.
  • y_axis: str: Generate the label for the y-axis based on the Kelly criterion.
  • z_axis: str: Generate the label for the z-axis.

Methods

init

Initialize the portfolio object with market returns. Parameters: Raises:

fit

Abstract method to fit the portfolio model. Parameters: Returns:

add_constraints

Add inequality constraints to the portfolio. Returns:

predict

Predict the efficient frontier. Parameters: Returns:

get_portfolio

Calculate the portfolio performance based on the given weights. Parameters: Returns:

get_efficient_frontier

Calculate the efficient frontier. Parameters: Returns:

plot_frontier

Plot the efficient frontier. Parameters: Returns: