www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/OptionPricesBlackScholesExample.m
%% Compute Option Prices Using the Black-Scholes Option Pricing Model % This example shows how to compute option prices using the Black-Scholes % option pricing model. Consider two European options, a call and a put, % with an exercise price of $29 on January 1, 2008. The options expire on % May 1, 2008. Assume that the underlying stock for the call option % provides a cash dividend of $0.50 on February 15, 2008. The underlying % stock for the put option provides a continuous dividend yield of 4.5% per % annum. The stocks are trading at $30 and have a volatility of 25% per % annum. The annualized continuously compounded risk-free rate is 5% per % annum. Using this data, compute the price of the options using the % Black-Scholes model. %% % Copyright 2015 The MathWorks, Inc. Strike = 29; AssetPrice = 30; Sigma = .25; Rates = 0.05; Settle = 'Jan-01-2008'; Maturity = 'May-01-2008'; % define the RateSpec and StockSpec RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates',... Maturity, 'Rates', Rates, 'Compounding', -1); DividendType = {'cash';'continuous'}; DividendAmounts = [0.50; 0.045]; ExDividendDates = {'Feb-15-2008';NaN}; StockSpec = stockspec(Sigma, AssetPrice, DividendType, DividendAmounts,... ExDividendDates); OptSpec = {'call'; 'put'}; Price = optstockbybls(RateSpec, StockSpec, Settle, Maturity, OptSpec, Strike)