|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Market.Asset
Interface and default methods for all assets (deterministic or stochastic volatility, deterministic or stochastic rates).
Generally works with discounted prices S^B(t)=S(t)/B(t), where S is the asset and B the riskfree bond. This eliminates interest rates from direct consideration.
PATH COMPUTATION: the basic procedure is to continue a path which has already been realized until time t from this time t to the horizon (branching at time t).
Here we are simulating future scenarios conditioned on all information available at time t (the realized path on [0,t]). This is what is needed for the computation of conditional expectations conditioning on information available at time t. The computation of entire paths is then merely a continuation from time t=0.
Path simulation is driven by an array Z[ ] of standard normal Z-increments. These increments should be stored so that they can be reused through simple random sign change (eg. antithetic paths). The integer nSignChange is the number of sign changes applied to an existing array of Z-increments before a new array is computed.
Time is measured in discrete units (the time step dt). Thus integer time t corresponds to continuous time t*dt.
Constructor Summary | |
Asset(int T,
double dt,
double S_0,
double q,
int nSignChange)
Constructor, call from concrete subclass. |
Method Summary | |
double |
dividendReductionFactor(int t)
Reduces price by future dividends. |
double |
forwardPrice(int t)
Forward price at horizon T. |
double[] |
get_B()
Reference to the array B[ ] containing the riskfree bond. |
double |
get_dt()
Size of time step. |
int |
get_nSignChange()
Number of times the Z-increments are reused through random sign changes before new increments are generated. |
double |
get_q()
Constant dividend yield. |
double |
get_S_0()
Asset price S(0) at time t=0. |
double[] |
get_S()
Reference to the array S[ ] containing the discounted asset price path. |
double |
get_sigmaSqrtdt(int t)
sigma(t)*sqrt(dt) , where sigma(t) is the volatility of
the asset. |
int |
get_T()
Number of time steps to horizon. |
boolean |
get_volatilityIsDeterministic()
True if the volatility of the asset is deterministic, false otherwise. |
double[] |
get_Z()
Reference to the array Z[ ] of standard normal increments driving the current asset price path. |
void |
newPath(int whichProbability)
New independent path of riskfree bond and discounted asset (driven by new independent Z-increments). |
void |
newPathBranch(int whichProbability,
int t)
Continues a path of the riskfree bond and discounted asset from time t to the horizon (branching at time t). |
int |
pathSegment(int whichProbability,
int t,
Trigger trg)
Continues a path of the riskfree bond and the discounted asset which exists up to time t from this time t to the next time s>t at which the Trigger trg is triggered or s=T, whichever comes first, and returns this time s. |
double |
Sigma(int t)
sqrt(\int_t^T sigma^2(u)du), where sigma(u) is the volatility of the asset. |
void |
simulationInit(int t)
Sets up a path simulation (t=0) or a simulation of branches of an existing path (t>0, conditional expectations). |
abstract void |
timeStep(int whichProbability,
int t)
Time step of riskfree bond and discounted asset price from discrete time t to time t+1. |
void |
timeStep(int whichProbability,
int t,
int s)
Single time step of riskfree bond and discounted asset price from discrete time t to time s, skipping intermediate times if possible, driven by new Brownian increments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Asset(int T, double dt, double S_0, double q, int nSignChange)
Constructor, call from concrete subclass.
T
- Number of time steps to horizon.dt
- Size of time step.S_0
- Asset price S(0).q
- Dividend yield.nSignChange
- Number of times the
Z-increments are reused through random sign
changes.Method Detail |
public int get_T()
Number of time steps to horizon.
public double get_dt()
Size of time step.
public double get_S_0()
Asset price S(0) at time t=0.
public double get_q()
Constant dividend yield.
public int get_nSignChange()
Number of times the Z-increments are reused through random sign changes before new increments are generated.
public boolean get_volatilityIsDeterministic()
True if the volatility of the asset is deterministic, false otherwise.
public double[] get_Z()
Reference to the array Z[ ] of standard normal increments driving the current asset price path.
public double[] get_B()
Reference to the array B[ ] containing the riskfree bond.
public double[] get_S()
Reference to the array S[ ] containing the discounted asset price path.
public double dividendReductionFactor(int t)
Reduces price by future dividends.
t
- Current time.public double forwardPrice(int t)
Forward price at horizon T.
t
- Current time.public double get_sigmaSqrtdt(int t)
sigma(t)*sqrt(dt)
, where sigma(t) is the volatility of
the asset.
Polymorphic link to subclasses implementing this method. Default implementation is an error message.
t
- Current time.public double Sigma(int t)
sqrt(\int_t^T sigma^2(u)du), where sigma(u) is the volatility of the asset. For a constant volatility asset this is simply sigma*sqrt(tau), where tau is time to the horizon.
Polymorphic link to subclasses implementing this method. Default implementation is an error message.
t
- Current time.public void simulationInit(int t)
Sets up a path simulation (t=0) or a simulation of branches of an existing path (t>0, conditional expectations). Default: nothing to do.
t
- Time of branching.public abstract void timeStep(int whichProbability, int t)
Time step of riskfree bond and discounted asset price from discrete time t to time t+1. In case of nonstochastic interest rates the path of the riskfree bond is handled by the constuctor.
Routine to be implemented so as not to reuse previously generated
Z-increments through sign changes.
Thus a new independent path is
generated from calls to timeStep
.
whichProbability
- Probability for simulation (market/risk neutral).t
- Current time.public void timeStep(int whichProbability, int t, int s)
Single time step of riskfree bond and discounted asset price from discrete time t to time s, skipping intermediate times if possible, driven by new Brownian increments.
In some models large time steps t->s can be simulated without loss of accuracy in others predictor corrector simulation is reasonably accurate. In each case large time steps imply significant speedup as the asset price path has to be sampled only at the needed times.
Default implementation: steps through all intermediate times by calling
timeStep(int)
. This should be overidden in concrete
subclasses by more efficient methods if possible.
whichProbability
- Probability for simulation (market/risk neutral).t
- Current time.s
- Time to be reached.public void newPathBranch(int whichProbability, int t)
Continues a path of the riskfree bond and discounted asset from time t to the horizon (branching at time t).
Default implementation: repeated calls to timeStep. Obviously that has function call overhead but it generates new independent path branches since Z-increments are not reused through sign changes. Override this with more efficient implementation if desired.
whichProbability
- Probability for simulation (market/risk neutral).t
- time of branching.public void newPath(int whichProbability)
New independent path of riskfree bond and discounted asset (driven by new independent Z-increments).
Not implemented as newPathBranch(whichProbability,0) since this method may be overridden in subclasses so as to generate groups of dependent paths.
whichProbability
- Probability for simulation (market/risk neutral).public int pathSegment(int whichProbability, int t, Trigger trg)
Continues a path of the riskfree bond and the discounted asset which exists up to time t from this time t to the next time s>t at which the Trigger trg is triggered or s=T, whichever comes first, and returns this time s.
The Trigger could be a signal triggering a hedge trade or option exercise for example.
Default implementation: repeated calls to timeStep. Obviously that has function call overhead but it generates new independent path branches since Z-increments are not reused through sign changes. Override this with more efficient implementation if desired.
whichProbability
- Probability for simulation (market/risk neutral).t
- branching time (time at which new branch starts).trg
- Stopping time >= t until which the path is computed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |