RiskParityPortfolioOptimizer
QuantConnect.Algorithm.Framework.Portfolio.RiskParityPortfolioOptimizer
RiskParityPortfolioOptimizer(
lower: Optional[float] = None,
upper: Optional[float] = None,
)
Bases: Object, IPortfolioOptimizer
Provides an implementation of a risk parity portfolio optimizer that calculate the optimal weights with the weight range from 0 to 1 and equalize the risk carried by each asset
Initialize a new instance of RiskParityPortfolioOptimizer
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lower
|
Optional[float]
|
The lower bounds on portfolio weights |
None
|
upper
|
Optional[float]
|
The upper bounds on portfolio weights |
None
|
optimize
optimize(
historical_returns: List[float],
expected_returns: List[float] = None,
covariance: List[float] = None,
) -> List[float]
Perform portfolio optimization for a provided matrix of historical returns and an array of expected returns
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
historical_returns
|
List[float]
|
Matrix of annualized historical returns where each column represents a security and each row returns for the given date/time (size: K x N). |
required |
expected_returns
|
List[float]
|
Risk budget vector (size: K x 1). |
None
|
covariance
|
List[float]
|
Multi-dimensional array of double with the portfolio covariance of annualized returns (size: K x K). |
None
|
Returns:
| Type | Description |
|---|---|
List[float]
|
Array of double with the portfolio weights (size: K x 1). |
risk_parity_newton_method_optimization
risk_parity_newton_method_optimization(
number_of_variables: int,
covariance: List[float],
budget: List[float],
tolerance: float = ...,
maximum_iteration: int = 15000,
) -> List[float]
Newton method of minimization
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_of_variables
|
int
|
The number of variables (size of weight vector). |
required |
covariance
|
List[float]
|
Covariance matrix (size: K x K). |
required |
budget
|
List[float]
|
The risk budget (size: K x 1). |
required |
tolerance
|
float
|
Tolerance level of objective difference with previous steps to accept minimization result. |
...
|
maximum_iteration
|
int
|
Maximum iteration per optimization. |
15000
|
Returns:
| Type | Description |
|---|---|
List[float]
|
Array of double of argumented minimization. |