MaxDiversificationPortfolio

class qf_lib.portfolio_construction.portfolio_models.max_diversification_portfolio.MaxDiversificationPortfolio(cov_matrix: qf_lib.containers.dataframe.qf_dataframe.QFDataFrame, std_of_assets: qf_lib.containers.series.qf_series.QFSeries, upper_constraint: Union[float, Sequence[float]] = None)[source]

Bases: qf_lib.portfolio_construction.portfolio_models.portfolio.Portfolio

Class used for constructing a Max Diversification portfolio. See: http://allaboutalpha.com/blog/2011/03/27/the-most-diversified-portfolio/

Methods

calculate_diversification_ratio(weights)

Calculates a Diversification Ratio for the portfolio taking the returns of assets (set for the portfolio) and the weights provided in the parameter.

get_weights()

returns

calculate_diversification_ratio(weights: qf_lib.containers.series.qf_series.QFSeries) → float[source]

Calculates a Diversification Ratio for the portfolio taking the returns of assets (set for the portfolio) and the weights provided in the parameter. For two or more assets diversification ratio will be greater or equal to one. The higher it is, the better.

Parameters

weights (pandas.Series) – series of weights indexed with names of assets

Returns

Diversification Ratio

Return type

float

get_weights()qf_lib.containers.series.qf_series.QFSeries[source]
Returns

Return type

a series indexed with names of assets containing weights (one for each asset)