Code covered by the BSD License  

Highlights from
Desenvolvimento de Aplicacoes com MATLAB

image thumbnail

Desenvolvimento de Aplicacoes com MATLAB



Slides and demo files from the webinar "Desenvolvimento de Aplicacoes com MATLAB"

function ButterflyValue=Butterflyval(OptionProps)

%function ButterflyValue=Butterflyval(SpotPrice, StrikePrice, RiskFreeRate, TimeExpiry, Volatility, VizRange, ButterflyRange)
%Compute the value of the butterfly

% Make sure input is column vector
OptionProps = OptionProps(:);

% Check for correct input properties
[m,n] = size(OptionProps);

% Vector Check
if n > 1
   errordlg('Function Requires a Vector Input','Input Dimension Error','on')

% Check for right length of input
if m < 7
    errordlg('Function Requires 7 inputs','Input Length Error','on')

SpotPrice = OptionProps(1);
StrikePrice = OptionProps(2);
RiskFreeRate = OptionProps(3);
TimeExpiry = OptionProps(4);
Volatility = OptionProps(5);
VizRange = OptionProps(6); %#ok<NASGU>
ButterflyRange = OptionProps(7);

TimeExpiry = TimeExpiry / 12;
ButterflyValue = blsbtyval(SpotPrice, StrikePrice, RiskFreeRate, ...
    TimeExpiry, Volatility, ButterflyRange);

Contact us