|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.akutan.drivers.DiversificationDriver
public class DiversificationDriver
This class is a driver program which reads a file of industry sector returns from the Fama/French data and generates a sequence of portfolios using 60 month rolling returns. These portfolios are then evalutated on the basis of ex post return.
| Field Summary | |
|---|---|
protected java.lang.String[] |
_assets
Array of the asset class names for use on output |
protected cern.colt.matrix.DoubleMatrix2D |
_mktCaps
Market Cap in some units for each sector for each month |
protected int[] |
_months
Index of months to match up with the data (both returns and market caps) |
protected cern.colt.matrix.DoubleMatrix2D |
_returns
Annualized returns stored as a decimal |
| Constructor Summary | |
|---|---|
DiversificationDriver()
Constructs |
|
| Method Summary | |
|---|---|
double |
computeOutOfSample(int ptr,
double[] w)
Computes the out of sample 1 month return |
double |
computeOutOfSample12(int ptr,
double[] w)
Computes the out of sample 12 month return for the next 12 month period starting with ptr. |
void |
dumpLastMktCap()
For debugging dumps out the last line read from the file |
void |
dumpLastReturns()
For debugging dumps out the last line read from the file |
protected void |
dumpPoints(java.util.List<SolvedPoint> points)
|
cern.colt.matrix.DoubleMatrix1D |
evolve(int ptr,
double[] aw)
Evolves a portfolio one step into the future and computes new weights |
int[] |
getMonths()
Getter for use in JUnit |
void |
loadData(java.lang.String fileName)
Loads return data by asset and date |
void |
loadExcessFrontData(java.lang.String fileName)
Loads return data by asset and date |
void |
loadFrontData(java.lang.String fileName)
Loads return data by asset and date |
void |
loadMktCap(java.lang.String fileName)
Loads market cap data |
static void |
main(java.lang.String[] args)
|
protected java.util.List<EfficientFrontier.SampleData> |
prepareEstimates(int start,
int length,
cern.colt.matrix.DoubleMatrix1D mu,
cern.colt.matrix.DoubleMatrix2D V)
Called to compute sample returns and variances for the period specified. |
protected void |
processResults(int start,
int length,
SolvedPoint sp)
Called to porocess a point solution and see how it will do in out of sample testing. |
protected void |
runTest1(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest10(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest11(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest12(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest13(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest14(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest15(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest16(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest2(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest3(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest4(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest5(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest6(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest7(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected void |
runTest8(int start,
int length)
A Black-Litterman based momentum strategy ala the one Fabozzi uses in his book on Robust Portfolio managerment. |
protected void |
runTest9(int start,
int length)
For a given starting month, computes the mean and covariance for the window of size length. |
protected SolvedPoint |
sortResults(java.util.List<SolvedPoint> l)
Sorts by sharpe ratio (note this didn't work so well in the past for some unknown reason. |
protected SolvedPoint |
sortResults10(java.util.List<SolvedPoint> l)
Estimates the point with risk of 10% and returns the closest pt less than 10% |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String[] _assets
protected int[] _months
protected cern.colt.matrix.DoubleMatrix2D _returns
protected cern.colt.matrix.DoubleMatrix2D _mktCaps
| Constructor Detail |
|---|
public DiversificationDriver()
| Method Detail |
|---|
public int[] getMonths()
public void loadData(java.lang.String fileName)
fileName - The name of the input file. It is expected to be a text file
contaning columnar data, with a single line header of asset
titles and the date in the first column from the left. Returns
are specified in percent.
public void loadFrontData(java.lang.String fileName)
throws java.lang.Exception
fileName - The name of the input file. It is expected to be a text file
contaning columnar data, with a single line header of asset
titles and the date in the first column from the left. Returns
are specified in percent.
java.lang.Exception
public void loadExcessFrontData(java.lang.String fileName)
throws java.lang.Exception
fileName - The name of the input file. It is expected to be a text file
contaning columnar data, with a single line header of asset
titles and the date in the first column from the left. Returns
are specified in percent.
java.lang.Exceptionpublic void loadMktCap(java.lang.String fileName)
fileName - The name of the input file. It is expected to be a text file
containing columnar data, with a single line header of asset
titles and the date in the first column from the left. Returns
are specified in percent.
protected void runTest1(int start,
int length)
start - Starting index of window in instance datalength - Length of window
public double computeOutOfSample(int ptr,
double[] w)
ptr - Points to the out of sample monthw - The asset weights to use
public double computeOutOfSample12(int ptr,
double[] w)
ptr - Index in the instance data of the out of sample start monthw - Asset weights
public cern.colt.matrix.DoubleMatrix1D evolve(int ptr,
double[] aw)
ptr - Points to the next time period returnsaw - Starting Asset weights
protected java.util.List<EfficientFrontier.SampleData> prepareEstimates(int start,
int length,
cern.colt.matrix.DoubleMatrix1D mu,
cern.colt.matrix.DoubleMatrix2D V)
start - Starting periodlength - Length in periodsmu - On return contains the arithmetic mean of the returnsV - On return contains the covariance matrix for the period
protected void runTest2(int start,
int length)
start - length -
protected void runTest3(int start,
int length)
start - length -
protected void runTest16(int start,
int length)
start - length -
protected void runTest11(int start,
int length)
start - length -
protected void runTest4(int start,
int length)
start - length -
protected void runTest5(int start,
int length)
start - length -
protected void runTest6(int start,
int length)
start - length -
protected void runTest7(int start,
int length)
start - length -
protected void runTest8(int start,
int length)
start - length - protected void dumpPoints(java.util.List<SolvedPoint> points)
protected void runTest9(int start,
int length)
start - length -
protected void runTest10(int start,
int length)
start - length -
protected void runTest13(int start,
int length)
start - length -
protected void runTest12(int start,
int length)
start - length -
protected void runTest14(int start,
int length)
start - Starting index of window in instance datalength - Length of window
protected void runTest15(int start,
int length)
start - Starting index of window in instance datalength - Length of windowprotected SolvedPoint sortResults10(java.util.List<SolvedPoint> l)
l - List of points on the efficient frontier
protected SolvedPoint sortResults(java.util.List<SolvedPoint> l)
l - List of points on the efficient frontier in order of return from
least to greatest.
protected void processResults(int start,
int length,
SolvedPoint sp)
start - Starting index of the out of sample area for evaluationlength - Length of the window for the samplesp - Starting point to evolve with the datapublic void dumpLastReturns()
public void dumpLastMktCap()
public static void main(java.lang.String[] args)
throws java.lang.Exception
args -
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||