[ojAlgo-user] SimplePortfolio.getVariances() returns zero results
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Yang H. <yan...@gm...> - 2013-06-25 12:42:02
|
Hi everyone, I am new to ojAlgo and I am trying to create a simple portfolio optimization analyzing tool using ojAlgo library in Java. First of all, I created a simple portfolio with 5 instruments with corresponding expected returns, volatilities, and weights. I have created individual instruments using SimpleAsset class: *SimpleAsset<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimpleAsset.html#SimpleAsset(java.lang.Number, java.lang.Number, java.lang.Number)>*(Number<http://download.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true> aMeanReturn, Number<http://download.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true> aVolatility, Number<http://download.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true> aWeight) Then I have created an instance of SimplePortfolio class to contain all these instruments as a list: *SimplePortfolio<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#SimplePortfolio(java.util.List)> *(List<http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true> <SimpleAsset<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimpleAsset.html> > someAssets) It turns out that *getMeanReturn<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#getMeanReturn()> *() method of SimplePortfolio gives me an expected answer but * getReturnVariance<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#getReturnVariance()> *() method doesn't provides an expected result. When I check the correlation matrix from *getCorrelations<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#getCorrelations()> *(), I got the following BasicMatrix instance: class org.ojalgo.matrix.PrimitiveMatrix {{1.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 1.0}} Could anyone please let me know how I should fix this? Thanks a lot! |