%% Price a Float-Float Currency Swap
% Price a new swap where you pay a EUR float and receive a USD float.

Settle = datenum('22-Dec-2015');
Maturity = datenum('15-Aug-2018');
LegRate = [0 -50/10000];
LegType = [0 0]; % Float Float
LegReset = [4 4];
FXRate = 1.1;
Notional = [10000000 8000000];

USD_Dates = datemnth(Settle,[1 3 6 12*[1 2 3 5 7 10 20 30]]');
USD_Zero = [0.03 0.06 0.08 0.13 0.36 0.76 1.63 2.29 2.88 3.64 3.89]'/100;
Curve_USD = intenvset('StartDate',Settle,'EndDates',USD_Dates,'Rates',USD_Zero);

EUR_Dates = datemnth(Settle,[3 6 12*[1 2 3 5 7 10 20 30]]');
EUR_Zero = [0.017 0.033 0.088 .27 .512 1.056 1.573 2.183 2.898 2.797]'/100;
Curve_EUR = intenvset('StartDate',Settle,'EndDates',EUR_Dates,'Rates',EUR_Zero);

Price = swapbyzero([Curve_USD Curve_EUR], ...
    LegRate, Settle, Maturity,'LegType',LegType,'LegReset',LegReset,'Principal',Notional,...
    'FXRate',[1 FXRate],'ExchangeInitialPrincipal',false)

% Copyright 2012 The MathWorks, Inc.