CFL EXAMPLES
Functions
Standard and barrier options on a single stock.

Functions

cfl::MultiFunction prb::put (double dStrike, double dMaturity, cfl::AssetModel &rModel)
 
cfl::MultiFunction prb::americanPut (double dStrike, const std::vector< double > &rExerciseTimes, cfl::AssetModel &rModel)
 
cfl::MultiFunction prb::barrierUpOrDownAndOut (double dNotional, double dLowerBarrier, double dUpperBarrier, const std::vector< double > &rBarrierTimes, cfl::AssetModel &rModel)
 
cfl::MultiFunction prb::downAndOutAmericanCall (double dBarrier, const std::vector< double > &rBarrierTimes, double dStrike, const std::vector< double > &rExerciseTimes, cfl::AssetModel &rModel)
 
cfl::MultiFunction prb::swing (double dStrike, const std::vector< double > &rExerciseTimes, unsigned iNumberOfExercises, cfl::AssetModel &rModel)
 

Detailed Description

This module contains functions that compute prices of standard and barrier options in cfl::AssetModel.

Function Documentation

cfl::MultiFunction prb::americanPut ( double  dStrike,
const std::vector< double > &  rExerciseTimes,
cfl::AssetModel rModel 
)

Computes the value of the American put option. In this contract, at any exercise time (from rExerciseTimes) a holder of the option can sell the stock at the strike dStrike.

Parameters
dStrikeThe strike of the option.
rExerciseTimesThe vector of exercise times. The first exercise time is strictly greater than the initial time.
rModelReference to implementation of AssetModel.
Returns
The price of the option as the function of the initial values of the state processes in the model.
cfl::MultiFunction prb::barrierUpOrDownAndOut ( double  dNotional,
double  dLowerBarrier,
double  dUpperBarrier,
const std::vector< double > &  rBarrierTimes,
cfl::AssetModel rModel 
)

Computes the value of the up-or-down-and-out barrier option. The payoff of the option at maturity (last barrier time) is given by the notional amount dNotional if the stock price has not crossed the lower and upper barriers for all barrier times. Otherwise, the option expires worthless.

Parameters
dLowerBarrierThe lower barrier.
dUpperBarrierThe upper barrier.
dNotionalThe notional amount.
rBarrierTimesThe vector of barrier times. The first time is greater than the initial time. The last barrier time is the maturity of the option.
rModelReference to implementation of AssetModel.
Returns
The price of the option as the function of the initial values of the state processes in the model.
cfl::MultiFunction prb::downAndOutAmericanCall ( double  dBarrier,
const std::vector< double > &  rBarrierTimes,
double  dStrike,
const std::vector< double > &  rExerciseTimes,
cfl::AssetModel rModel 
)

Computes the value of the down-and-out American call. The option behaves as the American call option with the strike dStrike and the exercise times rExerciseTimes until the first barrier time when the stock price hits the lower barrier dBarrier. At this exit time the option is canceled.

Parameters
dBarrierThe lower barrier (dBarrier < dStrike).
rBarrierTimesThe vector of barrier times. The first time is greater than the initial time.
dStrikeThe strike of the option.
rExerciseTimesThe vector of exercise times. The first exercise time is strictly greater than the initial time.
rModelReference to implementation of AssetModel.
Returns
The price of the option as the function of the initial values of the state processes in the model.
cfl::MultiFunction prb::put ( double  dStrike,
double  dMaturity,
cfl::AssetModel rModel 
)

Computes the value of the European put option. In this contract, at maturity dMaturity a holder of the option can sell the stock at the strike dStrike.

Parameters
dStrikeThe strike of the option.
dMaturityThe maturity of the option.
rModelReference to implementation of AssetModel.
Returns
The price of the option as the function of the initial values of the state processes in the model.
cfl::MultiFunction prb::swing ( double  dStrike,
const std::vector< double > &  rExerciseTimes,
unsigned  iNumberOfExercises,
cfl::AssetModel rModel 
)

Computes the value of the swing option. The holder can exercise the option iNumberOfExercises times. At each exercise time he can buy only one stock for strike dStrike.

Parameters
dStrikeThe strike of the option.
rExerciseTimesThe vector of exercise times.
iNumberOfExercisesThe maximal number of exercises.
rModelReference to implementation of AssetModel.
Returns
The price of the option as the function of the initial values of the state processes in the model.