www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/PriceFwdSwpExample.m
%% Price a Forward Swap % Price a forward swap using the |StartDate| input argument to define the % future starting date of the swap. % Copyright 2015 The MathWorks, Inc. %% % Create the |RateSpec|. Rates = 0.0325; ValuationDate = '1-Jan-2012'; StartDates = ValuationDate; EndDates = '1-Jan-2018'; Compounding = 1; RateSpec = intenvset('ValuationDate', ValuationDate,'StartDates', StartDates,... 'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding) %% % Compute the price of a forward swap that starts in a year (Jan 1, 2013) % and matures in three years with a forward swap rate of 4.27%. Settle ='1-Jan-2012'; StartDate = '1-Jan-2013'; Maturity = '1-Jan-2016'; LegRate = [0.0427 10]; Price = swapbyzero(RateSpec, LegRate, Settle, Maturity, 'StartDate' , StartDate) %% % Using the previous data, compute the forward swap rate, the coupon rate % for the fixed leg, such that the forward swap price at time = 0 is zero. LegRate = [NaN 10]; [Price, SwapRate] = swapbyzero(RateSpec, LegRate, Settle, Maturity,... 'StartDate' , StartDate)