www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/ComputeOptionPricesonForeignCurrenciesUsingtheGarmanKohlExample.m

    %% Compute Option Prices on Foreign Currencies Using the Garman-Kohlhagen Option Pricing Model  

%% 
% This example shows how to compute option prices on foreign currencies
% using the Garman-Kohlhagen option pricing model. Consider a European put
% option on a currency with an exercise price of $0.50 on October 1, 2015.
% The option expires on June 1, 2016. Assume that the current exchange rate
% is $0.52 and has a volatility of 12% per annum. The annualized continuously
% compounded domestic risk-free rate is 4% per annum and the foreign risk-free
% rate is 8% per annum. Using this data, compute the price of the option
% using the Garman-Kohlhagen model. 
Settle = 'October-01-2015';
Maturity = 'June-01-2016';
AssetPrice = 0.52;
Strike = 0.50;
Sigma = .12;
Rates = 0.04;
ForeignRate = 0.08;  

%% 
% Define the |RateSpec|. 
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates',...
Maturity, 'Rates', Rates, 'Compounding', -1)  

%% 
% Define the |StockSpec|. 
DividendType = 'Continuous';
DividendAmounts = ForeignRate;

StockSpec = stockspec(Sigma, AssetPrice, DividendType, DividendAmounts)  

%% 
% Price the European put option. 
OptSpec = {'put'};
Price = optstockbybls(RateSpec, StockSpec, Settle, Maturity, OptSpec, Strike)