已经建好LSM算普通美式期权的模型,试算了没有问题,但修改成亚美式就始终算不出正确答案,有的时候美式的价格比欧式的还低……百思不得其解……求助大神指点!
matlab代码如下:
脚本:
clc; clear;
%% Stock price features.
%%
Spot = 4000; % Spot price.
r = 0.0488; % Risk free rate.
q = 0;
% Option features.
K =4000; % Strike price.
v = 0.3; % Volatility.
T =1/3; % Maturity in years.
% Simulation features.
NT = 20; % Number of time increments.
dt = T/NT; % Time increment.
NS = 1e4; % Number of simulated paths.
% Trinomial tree features.
%n = 250; % Time steps for trinomial tree.
EuroAmer = 'A'; % Flavor indicator for trinomial tree.
PutCall = 'P'; % Select a put in the trinomial tree.
%% Simulate the stock price process under Black Scholes
FirstCol1 = log(Spot).*ones(NS,1);
z=randn(NS,NT-1);
E1 = (r-q-0.5*v^2)*dt + sqrt(dt)*v.*z;
All1 = [FirstCol1 E1];
S1 = cumsum(All1,2);
S=exp(S1);
clear FirstCol1 E1 All1
%% Longstaff-Schwartz price
% Design matrix for the LSM algorithm
XmatrixHandle = {@(y)ones(length(y),1), @(y)(y),@(y)(y.^2)};
% Run the LSM algorithm
[EuroPriceLSM AmerPriceLSM] = BlackScholesLSM_asian_new(S,K,r,q,T,NS,NT,dt,PutCall,XmatrixHandle);
% Early exercise premium
PremiumLSM = AmerPriceLSM - EuroPriceLSM;
函数:
function [EuroPrice AmerPrice] = BlackScholesLSM_asian_new(S,K,r,q,T,NS,NT,dt,PutCall,XmatrixHandle)
% Longstaff-Schwartz method for American options
% Fabrice Douglas Rouah, FRouah.com and Volopta.com
% INPUTS
% S = Matrix of simulated stock price, size NSxNT (rows are paths)
% K = Strike
% r = Risk free rate
% q = Dividend yield
% T = Maturity
% NS = Number of stock price paths
% NT = Number of time steps per path
% dt = Time increment (T/NT)
% PutCall = 'P' or 'C'
% Number of columns in the X matrix
NX = length(XmatrixHandle);
% Initialize the Cash Flows
CF = zeros(NS,NT);
%Create average price
S_avg=zeros(NS,NT);
S_sum=zeros(NS,NT);
parfor i=1:NT
S_sum(:,i)=sym(sum(S(:,1:i),2));
S_avg(:,i)=sym(S_sum(:,i)./i);
end
% Set the last cash flows to the intrinsic value
if strcmp(PutCall,'P')


雷达卡


京公网安备 11010802022788号







