Finance
Swap
construct a swap instrument
Calling Sequence
Parameters
Description
Examples
Compatibility
Swap(firstleg, secondleg)
firstleg
-
list of cash flows; paying leg
secondleg
list of cash flows; receiving leg
The Swap command constructs an instrument that swaps one set of cash flows with another set.
with⁡Finance:
SetEvaluationDate⁡January 02, 2007:
Consider two payment schedules. The first one consists of payments of 5% of the nominal every month between January 3, 2008 and January 3, 2018. The second one consists of payments of 3% of the nominal every quarter between January 3, 2010 and January 3, 2015.
Schedule1≔Schedule⁡January 03, 2008,January 03, 2018,Monthly
Schedule1 ≔ moduleend module
Schedule2≔Schedule⁡January 03, 2010,January 03, 2015,Quarterly
Schedule2 ≔ moduleend module
Rate1≔0.05
Rate2≔BenchmarkRate⁡0.03
Rate2 ≔ moduleend module
Consider two simple swaps that exchange the first set of payments for the second set.
Swap1≔InterestRateSwap⁡1000,Rate1,Schedule1,Rate2,Schedule2,0.03
Swap1 ≔ moduleend module
Swap2≔InterestRateSwap⁡1000,Rate2,Schedule2,Rate1,Schedule1,0.03
Swap2 ≔ moduleend module
NetPresentValue⁡Swap1,0.05
−146.0132438
NetPresentValue⁡Swap2,0.05
146.0132438
You can implement the above instrument as an ordinary swap using explicit cash flows. Here is the set of cash flows for the paying leg of each swap.
PayingLeg1≔CashFlows⁡Swap1,paying
PayingLeg1≔4.234972678 on 'February 3, 2008',3.961748634 on 'March 3, 2008',4.234972678 on 'April 3, 2008',4.098360656 on 'May 3, 2008',4.234972678 on 'June 3, 2008',4.098360656 on 'July 3, 2008',4.234972678 on 'August 3, 2008',4.234972678 on 'September 3, 2008',4.098360656 on 'October 3, 2008',4.234972678 on 'November 3, 2008',4.098360656 on 'December 3, 2008',4.235721237 on 'January 3, 2009',4.246575342 on 'February 3, 2009',3.835616438 on 'March 3, 2009',4.246575342 on 'April 3, 2009',4.109589041 on 'May 3, 2009',4.246575342 on 'June 3, 2009',4.109589041 on 'July 3, 2009',4.246575342 on 'August 3, 2009',4.246575342 on 'September 3, 2009',4.109589041 on 'October 3, 2009',4.246575342 on 'November 3, 2009',4.109589041 on 'December 3, 2009',4.246575342 on 'January 3, 2010',4.246575342 on 'February 3, 2010',3.835616438 on 'March 3, 2010',4.246575342 on 'April 3, 2010',4.109589041 on 'May 3, 2010',4.246575342 on 'June 3, 2010',4.109589041 on 'July 3, 2010',4.246575342 on 'August 3, 2010',4.246575342 on 'September 3, 2010',4.109589041 on 'October 3, 2010',4.246575342 on 'November 3, 2010',4.109589041 on 'December 3, 2010',4.246575342 on 'January 3, 2011',4.246575342 on 'February 3, 2011',3.835616438 on 'March 3, 2011',4.246575342 on 'April 3, 2011',4.109589041 on 'May 3, 2011',4.246575342 on 'June 3, 2011',4.109589041 on 'July 3, 2011',4.246575342 on 'August 3, 2011',4.246575342 on 'September 3, 2011',4.109589041 on 'October 3, 2011',4.246575342 on 'November 3, 2011',4.109589041 on 'December 3, 2011',4.245826783 on 'January 3, 2012',4.234972678 on 'February 3, 2012',3.961748634 on 'March 3, 2012',4.234972678 on 'April 3, 2012',4.098360656 on 'May 3, 2012',4.234972678 on 'June 3, 2012',4.098360656 on 'July 3, 2012',4.234972678 on 'August 3, 2012',4.234972678 on 'September 3, 2012',4.098360656 on 'October 3, 2012',4.234972678 on 'November 3, 2012',4.098360656 on 'December 3, 2012',4.235721237 on 'January 3, 2013',4.246575342 on 'February 3, 2013',3.835616438 on 'March 3, 2013',4.246575342 on 'April 3, 2013',4.109589041 on 'May 3, 2013',4.246575342 on 'June 3, 2013',4.109589041 on 'July 3, 2013',4.246575342 on 'August 3, 2013',4.246575342 on 'September 3, 2013',4.109589041 on 'October 3, 2013',4.246575342 on 'November 3, 2013',4.109589041 on 'December 3, 2013',4.246575342 on 'January 3, 2014',4.246575342 on 'February 3, 2014',3.835616438 on 'March 3, 2014',4.246575342 on 'April 3, 2014',4.109589041 on 'May 3, 2014',4.246575342 on 'June 3, 2014',4.109589041 on 'July 3, 2014',4.246575342 on 'August 3, 2014',4.246575342 on 'September 3, 2014',4.109589041 on 'October 3, 2014',4.246575342 on 'November 3, 2014',4.109589041 on 'December 3, 2014',4.246575342 on 'January 3, 2015',4.246575342 on 'February 3, 2015',3.835616438 on 'March 3, 2015',4.246575342 on 'April 3, 2015',4.109589041 on 'May 3, 2015',4.246575342 on 'June 3, 2015',4.109589041 on 'July 3, 2015',4.246575342 on 'August 3, 2015',4.246575342 on 'September 3, 2015',4.109589041 on 'October 3, 2015',4.246575342 on 'November 3, 2015',4.109589041 on 'December 3, 2015',4.245826783 on 'January 3, 2016',4.234972678 on 'February 3, 2016',3.961748634 on 'March 3, 2016',4.234972678 on 'April 3, 2016',4.098360656 on 'May 3, 2016',4.234972678 on 'June 3, 2016',4.098360656 on 'July 3, 2016',4.234972678 on 'August 3, 2016',4.234972678 on 'September 3, 2016',4.098360656 on 'October 3, 2016',4.234972678 on 'November 3, 2016',4.098360656 on 'December 3, 2016',4.235721237 on 'January 3, 2017',4.246575342 on 'February 3, 2017',3.835616438 on 'March 3, 2017',4.246575342 on 'April 3, 2017',4.109589041 on 'May 3, 2017',4.246575342 on 'June 3, 2017',4.109589041 on 'July 3, 2017',4.246575342 on 'August 3, 2017',4.246575342 on 'September 3, 2017',4.109589041 on 'October 3, 2017',4.246575342 on 'November 3, 2017',4.109589041 on 'December 3, 2017',4.246575342 on 'January 3, 2018'
PayingLeg2≔CashFlows⁡Swap2,paying
PayingLeg2≔14.82194787 on 'April 3, 2010',14.98694508 on 'July 3, 2010',15.15194910 on 'October 3, 2010',15.15194910 on 'January 3, 2011',14.82194787 on 'April 3, 2011',14.98694508 on 'July 3, 2011',15.15194910 on 'October 3, 2011',15.15127369 on 'January 3, 2012',14.94592054 on 'April 3, 2012',14.94592054 on 'July 3, 2012',15.11047204 on 'October 3, 2012',15.11114744 on 'January 3, 2013',14.82194787 on 'April 3, 2013',14.98694508 on 'July 3, 2013',15.15194910 on 'October 3, 2013',15.15194910 on 'January 3, 2014',14.82194787 on 'April 3, 2014',14.98694508 on 'July 3, 2014',15.15194910 on 'October 3, 2014',15.15194910 on 'January 3, 2015'
Here is the set of cash flows for the receiving leg.
ReceivingLeg1≔CashFlows⁡Swap1,receiving
ReceivingLeg1≔14.82194787 on 'April 3, 2010',14.98694508 on 'July 3, 2010',15.15194910 on 'October 3, 2010',15.15194910 on 'January 3, 2011',14.82194787 on 'April 3, 2011',14.98694508 on 'July 3, 2011',15.15194910 on 'October 3, 2011',15.15127369 on 'January 3, 2012',14.94592054 on 'April 3, 2012',14.94592054 on 'July 3, 2012',15.11047204 on 'October 3, 2012',15.11114744 on 'January 3, 2013',14.82194787 on 'April 3, 2013',14.98694508 on 'July 3, 2013',15.15194910 on 'October 3, 2013',15.15194910 on 'January 3, 2014',14.82194787 on 'April 3, 2014',14.98694508 on 'July 3, 2014',15.15194910 on 'October 3, 2014',15.15194910 on 'January 3, 2015'
ReceivingLeg2≔CashFlows⁡Swap2,receiving
ReceivingLeg2≔4.234972678 on 'February 3, 2008',3.961748634 on 'March 3, 2008',4.234972678 on 'April 3, 2008',4.098360656 on 'May 3, 2008',4.234972678 on 'June 3, 2008',4.098360656 on 'July 3, 2008',4.234972678 on 'August 3, 2008',4.234972678 on 'September 3, 2008',4.098360656 on 'October 3, 2008',4.234972678 on 'November 3, 2008',4.098360656 on 'December 3, 2008',4.235721237 on 'January 3, 2009',4.246575342 on 'February 3, 2009',3.835616438 on 'March 3, 2009',4.246575342 on 'April 3, 2009',4.109589041 on 'May 3, 2009',4.246575342 on 'June 3, 2009',4.109589041 on 'July 3, 2009',4.246575342 on 'August 3, 2009',4.246575342 on 'September 3, 2009',4.109589041 on 'October 3, 2009',4.246575342 on 'November 3, 2009',4.109589041 on 'December 3, 2009',4.246575342 on 'January 3, 2010',4.246575342 on 'February 3, 2010',3.835616438 on 'March 3, 2010',4.246575342 on 'April 3, 2010',4.109589041 on 'May 3, 2010',4.246575342 on 'June 3, 2010',4.109589041 on 'July 3, 2010',4.246575342 on 'August 3, 2010',4.246575342 on 'September 3, 2010',4.109589041 on 'October 3, 2010',4.246575342 on 'November 3, 2010',4.109589041 on 'December 3, 2010',4.246575342 on 'January 3, 2011',4.246575342 on 'February 3, 2011',3.835616438 on 'March 3, 2011',4.246575342 on 'April 3, 2011',4.109589041 on 'May 3, 2011',4.246575342 on 'June 3, 2011',4.109589041 on 'July 3, 2011',4.246575342 on 'August 3, 2011',4.246575342 on 'September 3, 2011',4.109589041 on 'October 3, 2011',4.246575342 on 'November 3, 2011',4.109589041 on 'December 3, 2011',4.245826783 on 'January 3, 2012',4.234972678 on 'February 3, 2012',3.961748634 on 'March 3, 2012',4.234972678 on 'April 3, 2012',4.098360656 on 'May 3, 2012',4.234972678 on 'June 3, 2012',4.098360656 on 'July 3, 2012',4.234972678 on 'August 3, 2012',4.234972678 on 'September 3, 2012',4.098360656 on 'October 3, 2012',4.234972678 on 'November 3, 2012',4.098360656 on 'December 3, 2012',4.235721237 on 'January 3, 2013',4.246575342 on 'February 3, 2013',3.835616438 on 'March 3, 2013',4.246575342 on 'April 3, 2013',4.109589041 on 'May 3, 2013',4.246575342 on 'June 3, 2013',4.109589041 on 'July 3, 2013',4.246575342 on 'August 3, 2013',4.246575342 on 'September 3, 2013',4.109589041 on 'October 3, 2013',4.246575342 on 'November 3, 2013',4.109589041 on 'December 3, 2013',4.246575342 on 'January 3, 2014',4.246575342 on 'February 3, 2014',3.835616438 on 'March 3, 2014',4.246575342 on 'April 3, 2014',4.109589041 on 'May 3, 2014',4.246575342 on 'June 3, 2014',4.109589041 on 'July 3, 2014',4.246575342 on 'August 3, 2014',4.246575342 on 'September 3, 2014',4.109589041 on 'October 3, 2014',4.246575342 on 'November 3, 2014',4.109589041 on 'December 3, 2014',4.246575342 on 'January 3, 2015',4.246575342 on 'February 3, 2015',3.835616438 on 'March 3, 2015',4.246575342 on 'April 3, 2015',4.109589041 on 'May 3, 2015',4.246575342 on 'June 3, 2015',4.109589041 on 'July 3, 2015',4.246575342 on 'August 3, 2015',4.246575342 on 'September 3, 2015',4.109589041 on 'October 3, 2015',4.246575342 on 'November 3, 2015',4.109589041 on 'December 3, 2015',4.245826783 on 'January 3, 2016',4.234972678 on 'February 3, 2016',3.961748634 on 'March 3, 2016',4.234972678 on 'April 3, 2016',4.098360656 on 'May 3, 2016',4.234972678 on 'June 3, 2016',4.098360656 on 'July 3, 2016',4.234972678 on 'August 3, 2016',4.234972678 on 'September 3, 2016',4.098360656 on 'October 3, 2016',4.234972678 on 'November 3, 2016',4.098360656 on 'December 3, 2016',4.235721237 on 'January 3, 2017',4.246575342 on 'February 3, 2017',3.835616438 on 'March 3, 2017',4.246575342 on 'April 3, 2017',4.109589041 on 'May 3, 2017',4.246575342 on 'June 3, 2017',4.109589041 on 'July 3, 2017',4.246575342 on 'August 3, 2017',4.246575342 on 'September 3, 2017',4.109589041 on 'October 3, 2017',4.246575342 on 'November 3, 2017',4.109589041 on 'December 3, 2017',4.246575342 on 'January 3, 2018'
Swap3≔Swap⁡PayingLeg1,ReceivingLeg1
Swap3 ≔ moduleend module
Swap4≔Swap⁡PayingLeg2,ReceivingLeg2
Swap4 ≔ moduleend module
NetPresentValue⁡Swap3,0.05
NetPresentValue⁡Swap4,0.05
The Finance[Swap] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
See Also
Finance[ExplicitZeroCurve]
Finance[FlatForwardCurve]
Finance[NetPresentValue]
Download Help Document