## Market Class ConstantVolatilityAsset

```java.lang.Object
Market.Asset
Market.ConstantVolatilityAsset
```
Direct Known Subclasses:
ConstantVolatilityAssetQMC, JumpAsset

public class ConstantVolatilityAsset
extends Asset

Implementation of `Asset`. The asset path t->S(t) follows a * geometric Brownian motion with constant drift mu and * volatility sigma. The short rate r is also constant and so * the path t->B(t)=exp(r*t) of the riskfree bond can be computed at * initialization (by the constructor).

* *

These paths are stored in the arrays B[] and S[] respectively. * Discrete time t is measured in multiples t*dt of the * time step dt and so for example B[t]=B(t*dt)=exp(r*t*dt).

* *

The array S[] contains the discounted price path t->S(t)/B(t), * that is, S[t]=S(t*dt)/B(t*dt). Remember this when computing option * payoffs.

* *

Write S^B(t)=S(t)/B(t). The dynamics of the return process * log(S(t)/B(t)) depends on the probability (market/risk neutral) and is * given by

* *
dlog(S^B(t))=(mu-r-sigma^2/2)*dt+sigma*dW(t) (market probability) *
* or *
dlog(S^B(t))=-(q+sigma^2/2)*dt+sigma*dW(t) * (risk neutral probability), *
* *

where q is the continuous dividend yield of the asset, W a Brownian motion * under the market probability respectively risk neutral probability. * Thus we introduce the constants

* *
marketDriftDelta=(mu-r-sigma^2/2)*dt
*
riskNeutraldriftDelta=-(q+sigma^2/2)*dt,
* *

where dt is the size of the time step. With this we have explicit * solutions

* *
S^B(s)=S^B(t)*exp(driftDelta*(s-t)+sigma*(W(s)-W(t)), *
* *

where the driftDelta corresponds to the probability underlying the * simulation and W is a Brownian motion with respect to this probability. * Consequently we can make large time steps t->s without loss * of precision if intermediate values of the price path are not needed. * *

Driver: The increment W(s)-W(t) is * normal with mean zero and variance (s-t)*dt, that is, *

* *
W(s)-W(t)=sqrt((s-t)*dt)*Z,
* *

where Z is standard normal. In particular for the time step s=t+1 we have *

* *
S^B(t+1)=S^B(t)*exp[driftDelta+sigma*sqrt(dt)*Z(t)],
* *

where Z(t) is the standard normal increment driving this time step. * The entire price path is driven by the sequence of independent standard * normal Z-increments. * These increments are stored in the array Z[ ] and * Z[t] is the increment driving the time step t->t+1. These increments are * stored for wo reasons: *

*
• They can be reused by simple random sign change.
• *
• Some methods make explicit use of them (Monte Carlo hedge deltas)
• *
* To keep track of where we are in the cycle through sign changes the * pathCounter respectively branchCounter variable monitor the progress * through a cycle of sign changes of a path respectively branch simulation. * The reason for this is that paths in the same cycle of sign changes are not * independent.

* *

To compute correct standard deviations of Monte Carlo estimators these * variables need to be set to zero at the beginning of each simulation * `simulationInit(int)`. * If only means but no standard deviations are required then this is not * necessary

* *

This scheme is correct for expectations and conditional * expectations but not for conditional expectations of conditional expecations * (branchBranchCounter needed). However computational cost makes iterated * conditional expectations forbidding and we will not compute them.

* * @author Michael J. Meyer *

 Constructor Summary ```ConstantVolatilityAsset(int T, double dt, int nSignChange, double S_0, double r, double q, double mu, double sigma)```           * @param T Number of time steps to horizon.

 Method Summary ` double` `get_mu()`           Constant asset price drift. ` double` `get_r()`           Constant short rate. ` double` `get_sigma()`           Constant asset price volatility. ` double` `get_sigmaSqrtdt(int t)`           sigma*sqrt(dt). ` SFSMarkovChainImpl` ```markovChain(int N, double ds, double delta)```           Approximation of the discounted asset price path as a stationary finite * state Markov chain. ` void` `newPath(int whichProbability)`           Computes a new discounted price path driven by new (as opposed to * sign changed) Z-increments. ` void` ```newPathBranch(int whichProbability, int t)```           Continues a discounted asset price path existing up to time t from this * time t to the horizon (branching at time t). ` void` `newWienerIncrements(int t)`           Computes a new sequence of standard normal increments Z[j], * j=t,t+1,...T-1, needed to compute a path forward from time t to the horizon. ` int` ```pathSegment(int whichProbability, int t, Trigger trg)```           Continues a discounted price path which exists up to time t from * 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)`           Aggregate volatility sigma*sqrt(T-t) to the horizon. ` void` `simulationInit(int t)`           Sets pathCounter (if t=0) or branchCounter (if t>0) to zero. ` void` ```timeStep(int whichProbability, int t)```           Time step t -> t+1 of discounted asset price path driven by a new * (as opposed to sign changed) Z-increment. ` void` ```timeStep(int whichProbability, int t, int s)```           Single time step t -> s of discounted price path driven by new * Z-increment.

 Methods inherited from class Market.Asset `dividendReductionFactor, forwardPrice, get_B, get_dt, get_nSignChange, get_q, get_S_0, get_S, get_T, get_volatilityIsDeterministic, get_Z`

 Methods inherited from class java.lang.Object `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

 Constructor Detail

### ConstantVolatilityAsset

```public ConstantVolatilityAsset(int T,
double dt,
int nSignChange,
double S_0,
double r,
double q,
double mu,
double sigma)```
* @param T Number of time steps to horizon. * @param dt Size of time step. * @param nSignChange Number of times the * Z-increments are reused through random sign * changes. * @param S_0 Asset price S(0). * @param r Constant short rate. * @param q Constant dividend yield. * @param mu Constant asset price drift. * @param sigma Constant asset price volatility.

 Method Detail

### get_r

`public double get_r()`
Constant short rate.

### get_mu

`public double get_mu()`
Constant asset price drift.

### get_sigma

`public double get_sigma()`
Constant asset price volatility.

### get_sigmaSqrtdt

`public double get_sigmaSqrtdt(int t)`
sigma*sqrt(dt).

Overrides:
`get_sigmaSqrtdt` in class `Asset`
Parameters:
`t` - Current time.

### simulationInit

`public void simulationInit(int t)`

Sets pathCounter (if t=0) or branchCounter (if t>0) to zero.

* *

Must be called before every new simulation run of full paths (t=0) or * branches of an existing path (t>0) which are used to compute standard * deviations to keep track of where we are cycling through the sign changes * of the Z-increments. This is necessary to correctly identify groups of * dependent paths.

* *

Not necessary if only means are computed. * For simplicity call it before every new simulation.

* * @param t Current time (time of branching).

Overrides:
`simulationInit` in class `Asset`
Parameters:
`t` - Time of branching.

### Sigma

`public double Sigma(int t)`
Aggregate volatility sigma*sqrt(T-t) to the horizon. * * @param t Current time.

Overrides:
`Sigma` in class `Asset`
Parameters:
`t` - Current time.

### newWienerIncrements

`public void newWienerIncrements(int t)`

Computes a new sequence of standard normal increments Z[j], * j=t,t+1,...T-1, needed to compute a path forward from time t to the horizon. * These sequences are produced in independent groups of size nSignChange each. * In each group only the signs are changed.

* *

If t=0 a path simulation is under way while in case t>0 a simulation of * branches of an existing path is taking place. Correspondingly the pathCounter * or branchCounter variables are incremented.

* * @param t Current time.

### newPathBranch

```public void newPathBranch(int whichProbability,
int t)```

Continues a discounted asset price path existing up to time t from this * time t to the horizon (branching at time t).

* *

The Z-increments driving the path branch are the * next set of Z-increments in a group of nSignChange dependent sets of * increments which differ only by sign. Only after nSignChange sign changes * is a new set of Z-increments computed.

* * @param whichProbability Probability for simulation (market/risk neutral). * @param t Current time (time at which the new path branch starts).

Overrides:
`newPathBranch` in class `Asset`
Parameters:
`whichProbability` - Probability for simulation (market/risk neutral).
`t` - time of branching.

### timeStep

```public void timeStep(int whichProbability,
int t)```

Time step t -> t+1 of discounted asset price path driven by a new * (as opposed to sign changed) Z-increment.

* *

Sets the value S[t+1] in the price path and registers the * standard normal increment Z[t] generated to drive the time step. * This increment is used in the computation of some hedge deltas.

* * @param whichProbability probability for simulation (market/risk neutral) * @param t branching time (time at which new branch starts)

Specified by:
`timeStep` in class `Asset`
Parameters:
`whichProbability` - Probability for simulation (market/risk neutral).
`t` - Current time.

### timeStep

```public void timeStep(int whichProbability,
int t,
int s)```

Single time step t -> s of discounted price path driven by new * Z-increment. Sets only the value S[s] in the price path S[ ].

* * @param whichProbability Probability for simulation (market/risk neutral). * @param t Current time. * @param s Future time to be reached.

Overrides:
`timeStep` in class `Asset`
Parameters:
`whichProbability` - Probability for simulation (market/risk neutral).
`t` - Current time.
`s` - Time to be reached.

### pathSegment

```public int pathSegment(int whichProbability,
int t,
Trigger trg)```

Continues a discounted price path which exists up to time t from * 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. No sign changes are applied to the Z-increments and * so a new independent path branch is computed.

* * @param whichProbability Probability for simulation (market/risk neutral). * @param t Current time (time at which new path branch starts). * @param trg triggers stopping the path.

Overrides:
`pathSegment` in class `Asset`
Parameters:
`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.

### newPath

`public void newPath(int whichProbability)`

Computes a new discounted price path driven by new (as opposed to * sign changed) Z-increments. Thus the new path is indpendent of * preceeding paths.

* * @param whichProbability Probability for simulation (market/risk neutral).

Overrides:
`newPath` in class `Asset`
Parameters:
`whichProbability` - Probability for simulation (market/risk neutral).

### markovChain

```public SFSMarkovChainImpl markovChain(int N,
double ds,
double delta)```
Approximation of the discounted asset price path as a stationary finite * state Markov chain. See book, chapter 3, section 3. * * @param N Possible states j=0,1,...,N-1. * @param ds Mesh size of range grid. * @param delta Cutoff probability for small probability residual states.