⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 examplemontebs.m

📁 用matlab实现衍生证券定价,非常好用
💻 M
字号:
%% Pricing Derivatives Securities using Matlab
%
% This demo illustrates how to price options using Monte 
% Carlo simulation and compares the results with the Black-Scholes formula. 

%% Price options using Monte Carlo simulation
%
% Use monte carlo simulation to price an european call and put with the
% following data
%
% Option: Price = 50, Strike = 60, Maturity = 24 months 
%
% Interest rate = 4%, Volatility = 30%

%OptionPrice = optionvanilla(So, Strike, Rate, Maturity, Sigma, DivYield, NSims, NSteps, OptType)

% Compute the price of the call option and display the simulated paths
 CallPrice = optionvanilla(50,60,0.04,2,0.30,0,15000,50,'call','true')
 
% Compute the price of the put option
 PutPrice = optionvanilla(50,60,0.04,2,0.30,0,15000,50,'put')
 

%% Compute the price of the options using the Black-Scholes formula
%
% Use Black-Scholes to price the vanilla options
%
% [Call,Put] = blsprice(Price, Strike, Rate, Time, Volatility) 

[BSCall,BSPut] = blsprice(50, 60, 0.04, 24/12, 0.30)

%% Compare the two methods by increasing the number of simulations
%
% Increase the number of simulations to 500000

CallPrice50 = optionvanilla(50,60,0.04,2,0.30,0,500000,50,'call')

%%
% Increase the number of steps to 60
CallPrice60 = optionvanilla(50,60,0.04,2,0.30,0,500000,60,'call')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -