|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
javax.swing.JApplet
org.akutan.blacklitterman.gui.BLApplet
public class BLApplet
Applet/Main class for Application that displays the results from a Black-Litterman model. Given some weights and a covariance matrix which the user can edit, the applet displays the weights in a pie chart, then shows the distributions for the various asset returns, and also can display an efficient frontier given the posterior returns and variances.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JApplet |
|---|
javax.swing.JApplet.AccessibleJApplet |
| Nested classes/interfaces inherited from class java.applet.Applet |
|---|
java.applet.Applet.AccessibleApplet |
| Nested classes/interfaces inherited from class java.awt.Panel |
|---|
java.awt.Panel.AccessibleAWTPanel |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.lang.Integer> |
_assetMap
Map of asset names for easy access |
protected org.jfree.chart.plot.CategoryPlot |
_histPlot
Displays the computed returns |
protected org.jfree.chart.plot.CategoryPlot |
_histPlot2
Displays the computed weights |
protected org.jfree.chart.plot.PiePlot |
_piePlot
Displays the equilibrium weights |
| Fields inherited from class javax.swing.JApplet |
|---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
BLApplet()
Constructs |
|
| Method Summary | |
|---|---|
void |
action(java.awt.event.ActionEvent event,
java.lang.Object arg)
Action handler for the buttons on the main control panel, these are Go and Clear. |
void |
chartMouseClicked(org.jfree.chart.ChartMouseEvent event)
We want to handle these events by opening a BayesianDialog object for the right asset. |
void |
chartMouseMoved(org.jfree.chart.ChartMouseEvent event)
We can ignore these messages |
void |
constrain(java.awt.Container container,
java.awt.Component component,
int grid_x,
int grid_y,
int grid_width,
int grid_height)
helper method to set layout constraints when adding a component to a container. |
void |
constrain(java.awt.Container container,
java.awt.Component component,
int grid_x,
int grid_y,
int grid_width,
int grid_height,
int fill,
int anchor,
double weight_x,
double weight_y,
int top,
int left,
int bottom,
int right)
Helper method to apply layout constraint to a component as it's added to a container. |
void |
constrain(java.awt.Container container,
java.awt.Component component,
int grid_x,
int grid_y,
int grid_width,
int grid_height,
int top,
int left,
int bottom,
int right)
Helper method to set layout constraints when adding a component to a container. |
protected org.jfree.chart.plot.CategoryPlot |
createBarChart()
|
protected org.jfree.chart.plot.CategoryPlot |
createBarChart2()
Called to create the pie chart frame and chart objects so they can be filled in when an optimization is run. |
protected void |
createGui()
Called to create the various charts and associated bits during initialization of the application. |
protected org.jfree.chart.plot.PiePlot |
createPieChart()
Called to create the pie chart frame and chart objects so they can be filled in when an optimization is run. |
protected void |
dumpPoints(java.util.List<SolvedPoint> points)
Debug method to dump all the points on an efficient frontier to System.out. |
java.lang.String |
getParameter(java.lang.String name)
Wraps the logic for retrieving parameters so we can use the same code as an applet and as an application. |
void |
init()
To start with we will use the He-Litterman data and allow the user to modify the sampling distribution returns (not the covariances) and also to specify views. |
static void |
main(java.lang.String[] args)
Allows us to run as an application or an applet |
void |
paint(java.awt.Graphics g)
New paint method for graphics panel using jfreechart |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat f,
int page)
|
void |
run()
Used with SwingUtilities to cause a paint when a calculation has completed |
void |
setDefaults()
Called to reset the assets, weights and covariances to the He-Litterman 1992 data which is the default for this app. |
void |
setParameter(java.lang.String key,
java.lang.String value)
Sets a parameter for later access by getParameter method. |
protected void |
updateBarChart(java.lang.String[] assets,
cern.colt.matrix.DoubleMatrix1D returns)
|
protected void |
updateBarChart(java.lang.String[] assets,
cern.colt.matrix.DoubleMatrix1D returns,
cern.colt.matrix.DoubleMatrix1D viewReturns)
|
protected void |
updateBarChart2(java.lang.String[] assets,
cern.colt.matrix.DoubleMatrix1D weights)
|
protected void |
updateGui()
|
| Methods inherited from class javax.swing.JApplet |
|---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
| Methods inherited from class java.applet.Applet |
|---|
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop |
| Methods inherited from class java.awt.Panel |
|---|
addNotify |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected org.jfree.chart.plot.PiePlot _piePlot
protected org.jfree.chart.plot.CategoryPlot _histPlot2
protected org.jfree.chart.plot.CategoryPlot _histPlot
protected java.util.Map<java.lang.String,java.lang.Integer> _assetMap
| Constructor Detail |
|---|
public BLApplet()
| Method Detail |
|---|
public void setParameter(java.lang.String key,
java.lang.String value)
key - Name of the parameter to be setvalue - Value for the parameterpublic java.lang.String getParameter(java.lang.String name)
getParameter in class java.applet.Appletname - Name of the parameter for which the value is to be returned
public void setDefaults()
public void chartMouseClicked(org.jfree.chart.ChartMouseEvent event)
chartMouseClicked in interface org.jfree.chart.ChartMouseListenerpublic void chartMouseMoved(org.jfree.chart.ChartMouseEvent event)
chartMouseMoved in interface org.jfree.chart.ChartMouseListener
public int print(java.awt.Graphics g,
java.awt.print.PageFormat f,
int page)
print in interface java.awt.print.Printablepublic void init()
init in class java.applet.Applet
public void constrain(java.awt.Container container,
java.awt.Component component,
int grid_x,
int grid_y,
int grid_width,
int grid_height,
int fill,
int anchor,
double weight_x,
double weight_y,
int top,
int left,
int bottom,
int right)
container - component - grid_x - grid_y - grid_width - grid_height - fill - anchor - weight_x - weight_y - top - left - bottom - right -
public void constrain(java.awt.Container container,
java.awt.Component component,
int grid_x,
int grid_y,
int grid_width,
int grid_height)
container - component - grid_x - grid_y - grid_width - grid_height -
public void constrain(java.awt.Container container,
java.awt.Component component,
int grid_x,
int grid_y,
int grid_width,
int grid_height,
int top,
int left,
int bottom,
int right)
container - component - grid_x - grid_y - grid_width - grid_height - top - left - bottom - right - protected void dumpPoints(java.util.List<SolvedPoint> points)
points -
public void action(java.awt.event.ActionEvent event,
java.lang.Object arg)
event - arg - public void run()
run in interface java.lang.Runnablepublic void paint(java.awt.Graphics g)
paint in class java.awt.Containerg - protected void createGui()
protected void updateGui()
protected org.jfree.chart.plot.CategoryPlot createBarChart()
protected org.jfree.chart.plot.PiePlot createPieChart()
protected org.jfree.chart.plot.CategoryPlot createBarChart2()
protected void updateBarChart2(java.lang.String[] assets,
cern.colt.matrix.DoubleMatrix1D weights)
protected void updateBarChart(java.lang.String[] assets,
cern.colt.matrix.DoubleMatrix1D returns)
protected void updateBarChart(java.lang.String[] assets,
cern.colt.matrix.DoubleMatrix1D returns,
cern.colt.matrix.DoubleMatrix1D viewReturns)
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 | ||||||||