Lean  $LEAN_TAG$
QuantConnect.Algorithm.Framework.Portfolio.PortfolioOptimizerPythonWrapper Class Reference

Python wrapper for custom portfolio optimizer More...

Inheritance diagram for QuantConnect.Algorithm.Framework.Portfolio.PortfolioOptimizerPythonWrapper:
[legend]

Public Member Functions

 PortfolioOptimizerPythonWrapper (PyObject portfolioOptimizer)
 Creates a new instance More...
 
double[] Optimize (double[,] historicalReturns, double[] expectedReturns=null, double[,] covariance=null)
 Perform portfolio optimization for a provided matrix of historical returns and an array of expected returns More...
 
- Public Member Functions inherited from QuantConnect.Python.BasePythonWrapper< IPortfolioOptimizer >
 BasePythonWrapper (bool validateInterface=true)
 Creates a new instance of the BasePythonWrapper<TInterface> class More...
 
 BasePythonWrapper (PyObject instance, bool validateInterface=true)
 Creates a new instance of the BasePythonWrapper<TInterface> class with the specified instance More...
 
void SetPythonInstance (PyObject instance)
 Sets the python instance More...
 
GetProperty< T > (string propertyName)
 Gets the Python instance property with the specified name More...
 
PyObject GetProperty (string propertyName)
 Gets the Python instance property with the specified name More...
 
void SetProperty (string propertyName, object value)
 Sets the Python instance property with the specified name More...
 
dynamic GetEvent (string name)
 Gets the Python instance event with the specified name More...
 
bool HasAttr (string name)
 Determines whether the Python instance has the specified attribute More...
 
PyObject GetMethod (string methodName)
 Gets the Python instances method with the specified name and caches it More...
 
InvokeMethod< T > (string methodName, params object[] args)
 Invokes the specified method with the specified arguments More...
 
PyObject InvokeMethod (string methodName, params object[] args)
 Invokes the specified method with the specified arguments More...
 

Additional Inherited Members

- Protected Attributes inherited from QuantConnect.Python.BasePythonWrapper< IPortfolioOptimizer >
PyObject Instance
 Gets the underlying python instance More...
 

Detailed Description

Python wrapper for custom portfolio optimizer

Definition at line 25 of file PortfolioOptimizerPythonWrapper.cs.

Constructor & Destructor Documentation

◆ PortfolioOptimizerPythonWrapper()

QuantConnect.Algorithm.Framework.Portfolio.PortfolioOptimizerPythonWrapper.PortfolioOptimizerPythonWrapper ( PyObject  portfolioOptimizer)

Creates a new instance

Parameters
portfolioOptimizerThe python model to wrapp

Definition at line 31 of file PortfolioOptimizerPythonWrapper.cs.

Member Function Documentation

◆ Optimize()

double [] QuantConnect.Algorithm.Framework.Portfolio.PortfolioOptimizerPythonWrapper.Optimize ( double  historicalReturns[,],
double[]  expectedReturns = null,
double  covariance[,] = null 
)

Perform portfolio optimization for a provided matrix of historical returns and an array of expected returns

Parameters
historicalReturnsMatrix of annualized historical returns where each column represents a security and each row returns for the given date/time (size: K x N).
expectedReturnsArray of double with the portfolio annualized expected returns (size: K x 1).
covarianceMulti-dimensional array of double with the portfolio covariance of annualized returns (size: K x K).
Returns
Array of double with the portfolio weights (size: K x 1)

Implements QuantConnect.Algorithm.Framework.Portfolio.IPortfolioOptimizer.

Definition at line 43 of file PortfolioOptimizerPythonWrapper.cs.


The documentation for this class was generated from the following file: