## Hedging Class Hedge

```java.lang.Object
Hedging.Hedge
```
Direct Known Subclasses:
DeltaHedge, OptionHedge

public class Hedge
extends java.lang.Object

Hedge Profit And Loss: this class provides methods to compute the profit/loss from hedging an option using various deltas:

• analytic deltas (if analytic option price defined)
• minimum variance deltas
• Monte Carlo deltas

computed under the two following probabilities:

• market probability
• risk neutral probability

The hedge is rebalanced whenever the Trigger rebalance triggers a hedge trade. The hedge is checked against price paths of the underlying simulated under the market probability.

At each trade nonanalytic hedge weights are derived from conditional expectations which can be computed under the market or the risk neutral probability.

It turns out that Monte Carlo deltas should be computed under the risk neutral probability while minimum variance deltas should be computed under the market proability.

The flags `whichDelta, whichProbability` indicate which type of deltas are used in the hedge and under which probability they are computed.

Transaction costs have a fixed and a proportional component. The fixed component also has to be normalized to cost per share. If you transact in lots of 1000 shares and such a trade costs 10 dollars, fixed transaction costs are 10/1000=0.01. The proportional transaction costs come from bid-ask spread etc., 0.1 is a conservative number. Transaction costs are assumed to remain constant in today's dollars.

 Constructor Summary ```Hedge(Asset underlying, Option option)```            Constructor which does not initialize the trading strategy. ```Hedge(Asset underlying, Option option, TradingStrategy hedgeStrategy)```

 Method Summary ` RandomVariable` `discountedHedgeGain()`           The discounted hedge gain as a random variable. ` RandomVector` `discountedHedgeGainAndNumberOfTrades()`           The discounted hedge gain (return_value[0]) and number of trades (return_value[1]) as a random vector. ` TradingStrategy` `get_hedgeStrategy()`           The trading strategy in the asset used to hedge the option payoff (delta hedging with our various deltas). ` Option` `get_option()`           The option to be hedged. ` Asset` `get_underlying()`           The asset underlying the option to be hedged. ` double[]` `hedgeMeanAndStandardDeviation(int nPaths)`           Computes mean (return_value[0]) and standard deviation (return_value[1]) of the profit and loss from hedging a short position in the option (on one share of the underlying). ` double[]` ```hedgeMeanAndStandardDeviation(int nPaths, int m, javax.swing.JProgressBar jPrgBar)```           Same as `hedgeMeanAndStandardDeviation(int)` with progress reported to progress bar. ` RandomVector` `hedgeStatistics()`           The `newHedgeStatistics()` as a random vector. ` double` `newDiscountedHedgeGain()`           Computes the discounted profit and loss of hedging a short position in one option on one share of the underlying along one path of the underlying. ` double[]` `newDiscountedHedgeGainAndNumberOfTrades()`           Computes the discounted profit and loss (return_value[0]) and the number of trades (return_value[1]) when hedging a short position in one option on one share of the underlying along one path of the underlying. ` double[]` `newHedgeStatistics()`           Computes the following vector x of statistics associated with hedging a short position in one option on one share of the underlying from a new independent path of the underlying:

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

 Constructor Detail

### Hedge

```public Hedge(Asset underlying,
Option option,
Parameters:
`underlying` - asset underlying the option.
`option` - option to be hedged.
`hedgeStrategy` - trading strategy hedging the option payoff..

### Hedge

```public Hedge(Asset underlying,
Option option)```

Constructor which does not initialize the trading strategy. For use in subclass constructors where the subclass must initialize the trading strategy.

Parameters:
`underlying` - asset underlying the option.
`option` - option to be hedged.
 Method Detail

### get_underlying

`public Asset get_underlying()`
The asset underlying the option to be hedged.

### get_option

`public Option get_option()`
The option to be hedged.

### get_hedgeStrategy

`public TradingStrategy get_hedgeStrategy()`
The trading strategy in the asset used to hedge the option payoff (delta hedging with our various deltas). Initialized by constructor.

### newDiscountedHedgeGain

`public double newDiscountedHedgeGain()`

Computes the discounted profit and loss of hedging a short position in one option on one share of the underlying along one path of the underlying.

Price paths of the underlying asset are simulated in the market probability and the hedge is rebalance whenever the Trigger rebalance triggers a hedge trade.

Assume that nonanalytic hedge deltas are used. Each time a hedge trade occurs the computation of the new hedge weights involves conditional expectations which are computed via branching price paths of the underlying asset, a very time consuming activity.

Each branch simulation destroys an existing price path of the underlying asset from the time of branching forward. Consequently we cannot simply compute a full path of the underlying and then move the hedge along this path. Instead we evolve the path simultaneous with the hedge in single time steps.

The option price path C[0] must be initialized with the option price at time zero before this routine is called. Note that this price is the martingale price of the option based on frictionless trading and perfect theoretical duplication of the option payoff. Sell at this price at your own risk.

### discountedHedgeGain

`public RandomVariable discountedHedgeGain()`

The discounted hedge gain as a random variable.

The parameter t will be disregarded, ie. no conditional expectations. We don't need them and they are hard to implement.

### hedgeMeanAndStandardDeviation

`public double[] hedgeMeanAndStandardDeviation(int nPaths)`

Computes mean (return_value[0]) and standard deviation (return_value[1]) of the profit and loss from hedging a short position in the option (on one share of the underlying). The gain is computed for the combined strategy hedgeStrategy + option short position.

Parameters:
`nPaths` - number of price paths of underlying against which hedge is checked.

### hedgeMeanAndStandardDeviation

```public double[] hedgeMeanAndStandardDeviation(int nPaths,
int m,
javax.swing.JProgressBar jPrgBar)```

Same as `hedgeMeanAndStandardDeviation(int)` with progress reported to progress bar.

Parameters:
`nPaths` - number of paths.
`m` - progress report updated every m paths.
`jPrgBar` - target of progress report.

`public double[] newDiscountedHedgeGainAndNumberOfTrades()`

Computes the discounted profit and loss (return_value[0]) and the number of trades (return_value[1]) when hedging a short position in one option on one share of the underlying along one path of the underlying.

See also `newDiscountedHedgeGain()`.

The option price path C[0] must be initialized with the option price at time zero before this routine is called.

`public RandomVector discountedHedgeGainAndNumberOfTrades()`

The discounted hedge gain (return_value[0]) and number of trades (return_value[1]) as a random vector.

The parameter t will be disregarded, ie. no conditional expectations. We don't need them and they are hard to implement.

### newHedgeStatistics

`public double[] newHedgeStatistics()`

Computes the following vector x of statistics associated with hedging a short position in one option on one share of the underlying from a new independent path of the underlying:

• x[0]= discounted hedge gains.
• x[1]= maximum borrowing.
• x[2]= maximum drawdown.
• x[3]= amount invested at time T disregarding the option position.
• x[4]= return on investment from trading disregarding the option position.
See also `newDiscountedHedgeGain()`. The strategy is assumed to be financed completely by borrowing at the risk free rate without using the premium.
`public RandomVector hedgeStatistics()`
The `newHedgeStatistics()` as a random vector.