edu.ucla.stat.SOCR.applications.demo
Class BinomialTradingApplication
java.lang.Object
edu.ucla.stat.SOCR.core.SOCRValueSettable
edu.ucla.stat.SOCR.core.MultiplePartsPanel
edu.ucla.stat.SOCR.applications.Application
edu.ucla.stat.SOCR.applications.demo.BinomialTradingApplication
- All Implemented Interfaces:
- IExperiment, IValueSettable, Pluginable, java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, java.util.Observer
public class BinomialTradingApplication
- extends Application
- implements java.util.Observer, IExperiment, java.awt.event.ActionListener
The Binomial Trading Application demonstrates the Price of a stock call with time:
Inputs:
S0 = Price of the stock at time zero (now).
E = Exercise price (it is exercised at the end if price of stock at the end > E).
t = Time until expiration in years, e.g. if t = 73 days, then t = 0.2.
r = Interest rate per year.
sigma = Annual volatility.
n = Number of periods that we divide the time to expiration (here n = 2).
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent evt)
|
void |
addEdge(int source,
int target)
|
void |
addNode(java.lang.String name,
int x,
int y)
|
void |
addNode(java.lang.String name,
int x,
int y,
java.awt.Color backgroundColor)
|
void |
addTabbedPane(java.lang.String name,
javax.swing.JComponent c)
|
protected JFreeChart |
createEmptyChart(PieDataset dataset)
|
DefaultGraphCell |
createVertex(java.lang.String name,
double x,
double y,
double w,
double h,
java.awt.Color bg,
boolean raised)
|
java.lang.String |
getAppletInfo()
|
java.awt.Container |
getDisplayPane()
|
java.lang.String |
getOnlineDescription()
|
void |
init()
This method initializes the application. |
void |
initialize()
|
void |
mouseClicked(java.awt.event.MouseEvent event)
|
void |
update()
This method is the default update method and defines how the display is
updated. |
void |
update(java.util.Observable o,
java.lang.Object arg)
|
void |
updateAllNodes()
|
Methods inherited from class edu.ucla.stat.SOCR.applications.Application |
addTool2, doExperiment, emptyTool, emptyTool2, getInstance, getLocalAbout, getLocalHelp, getResultTable, getStopFreq, getTime, getWikiAbout, getWikiHelp, graphUpdate, loadSlider, pasteData, reset, setApplet, setNumberStocks, setShowModelDistribution, setStopFreq, setStopNow, setTangent, step, stop, updateGraph |
Methods inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel |
addGraph, addTable, addTool, addTool2, addToolbar, format, getMainPanel, getName, getRecordTable, getTextPanel, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, play, removeToolbar, setName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.ucla.stat.SOCR.core.IExperiment |
doExperiment, getResultTable, getStopFreq, getTime, graphUpdate, pasteData, reset, setShowModelDistribution, setStopFreq, setStopNow, step, stop |
CHART_SIZE_X
protected final int CHART_SIZE_X
- See Also:
- Constant Field Values
CHART_SIZE_Y
protected final int CHART_SIZE_Y
- See Also:
- Constant Field Values
GRAPH
protected final java.lang.String GRAPH
- See Also:
- Constant Field Values
jgraphPanel
protected javax.swing.JPanel jgraphPanel
chartPanel2
protected ChartPanel chartPanel2
jgraph
protected JGraph jgraph
upContainer
protected javax.swing.JSplitPane upContainer
tabbedPaneCount
protected int tabbedPaneCount
tabbedPanelContainer
public javax.swing.JTabbedPane tabbedPanelContainer
inSo
protected javax.swing.JTextField inSo
inEP
protected javax.swing.JTextField inEP
inR
protected javax.swing.JTextField inR
inSigma
protected javax.swing.JTextField inSigma
BinomialTradingApplication
public BinomialTradingApplication()
- This is the main constructor of BinomialTradingApplication objects.
init
public void init()
- This method initializes the application.
- Overrides:
init
in class Application
addTabbedPane
public void addTabbedPane(java.lang.String name,
javax.swing.JComponent c)
createEmptyChart
protected JFreeChart createEmptyChart(PieDataset dataset)
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
- Specified by:
actionPerformed
in interface java.awt.event.ActionListener
update
public void update(java.util.Observable o,
java.lang.Object arg)
- Specified by:
update
in interface java.util.Observer
- Overrides:
update
in class MultiplePartsPanel
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent event)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
- Overrides:
mouseClicked
in class MultiplePartsPanel
getOnlineDescription
public java.lang.String getOnlineDescription()
- Specified by:
getOnlineDescription
in interface IExperiment
- Overrides:
getOnlineDescription
in class Application
getDisplayPane
public java.awt.Container getDisplayPane()
- Specified by:
getDisplayPane
in interface Pluginable
- Overrides:
getDisplayPane
in class Application
getAppletInfo
public java.lang.String getAppletInfo()
- Specified by:
getAppletInfo
in interface IExperiment
- Overrides:
getAppletInfo
in class Application
update
public void update()
- Description copied from interface:
IExperiment
- This method is the default update method and defines how the display is
updated. This method should be overridden.
- Specified by:
update
in interface IExperiment
- Overrides:
update
in class Application
initialize
public void initialize()
- Specified by:
initialize
in interface IExperiment
- Overrides:
initialize
in class Application
createVertex
public DefaultGraphCell createVertex(java.lang.String name,
double x,
double y,
double w,
double h,
java.awt.Color bg,
boolean raised)
addNode
public void addNode(java.lang.String name,
int x,
int y)
addNode
public void addNode(java.lang.String name,
int x,
int y,
java.awt.Color backgroundColor)
addEdge
public void addEdge(int source,
int target)
updateAllNodes
public void updateAllNodes()