%% Price a Compound Option Using a CRR Binomial Tree
% This example shows how to price a compound option using a CRR binomial tree by loading the file deriv.mat, which provides CRRTree. The CRRTree structure contains the stock specification and time information needed to price the option.

load deriv.mat

UOptSpec = 'Call';
UStrike = 130;
USettle = '01-Jan-2003';
UExerciseDates = '01-Jan-2006';
UAmericanOpt = 1;
COptSpec = 'Put';
CStrike = 5;
CSettle = '01-Jan-2003';
CExerciseDates = '01-Jan-2005';

Price = compoundbycrr(CRRTree, UOptSpec, UStrike, USettle, ... 
UExerciseDates, UAmericanOpt, COptSpec, CStrike, CSettle, ... 
CExerciseDates)

% Copyright 2015 The MathWorks, Inc.