Swap - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Finance

  

Swap

  

construct a swap instrument

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Swap(firstleg, secondleg)

Parameters

firstleg

-

list of cash flows; paying leg

secondleg

-

list of cash flows; receiving leg

Description

• 

The Swap command constructs an instrument that swaps one set of cash flows with another set.

Examples

withFinance:

SetEvaluationDateJanuary 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.

Schedule1ScheduleJanuary 03, 2008,January 03, 2018,Monthly

Schedule1moduleend module

(1)

Schedule2ScheduleJanuary 03, 2010,January 03, 2015,Quarterly

Schedule2moduleend module

(2)

Rate10.05

Rate10.05

(3)

Rate2BenchmarkRate0.03

Rate2moduleend module

(4)

Consider two simple swaps that exchange the first set of payments for the second set.

Swap1InterestRateSwap1000,Rate1,Schedule1,Rate2,Schedule2,0.03

Swap1moduleend module

(5)

Swap2InterestRateSwap1000,Rate2,Schedule2,Rate1,Schedule1,0.03

Swap2moduleend module

(6)

NetPresentValueSwap1,0.05

−146.0132438

(7)

NetPresentValueSwap2,0.05

146.0132438

(8)

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.

PayingLeg1CashFlowsSwap1,paying

PayingLeg14.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'

(9)

PayingLeg2CashFlowsSwap2,paying

PayingLeg214.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'

(10)

Here is the set of cash flows for the receiving leg.

ReceivingLeg1CashFlowsSwap1,receiving

ReceivingLeg114.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'

(11)

ReceivingLeg2CashFlowsSwap2,receiving

ReceivingLeg24.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'

(12)

Swap3SwapPayingLeg1,ReceivingLeg1

Swap3moduleend module

(13)

Swap4SwapPayingLeg2,ReceivingLeg2

Swap4moduleend module

(14)

NetPresentValueSwap3,0.05

−146.0132438

(15)

NetPresentValueSwap4,0.05

146.0132438

(16)

Compatibility

• 

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]