Matlab → Script → Input, Output → Black-Scholes Price
Write a script file where the program ask user to insert stock price, strike, interest rate, volatility, and time. And it should display the European style call and put option values in the style,
The value of call is ___, and the value of put is ___.
%Call and put option values using BS model
s=input('Insert initial stock price: ');
k=input('Insert strike price: ');
r=input('Insert annual interest rate: ');
v=input('Insert volatility of the stck price: ');
t=input('Insert time duration of the option: ');
fprintf('The value of call is %g, and the value of put is %g.\n',c,p)
Suppose we saved the program with the name “TestProgram”.
Insert initial stock price: 50
Insert strike price: 50
Insert annual interest rate: 0.1
Insert volatility of the stck price: 0.4
Insert time duration of the option: 1
The value of call is 10.1592, and the value of put is 5.40111.