the mailing list. It's for your own good. I don't have much time these
days.
> Dear Luigi,
> Thank you very much for your email. I have tried to follow the steps you
> gave (please correct me when necessary).
> I am not sure the way I have used datas such as: OND, TND, SND, Tod3M,
> Tom3M, Tod6M, Tom6M, IMM1x7,
IMM2x8, IMM3x9, IMM4x10 (I have considered
> IMMaxb like futures).
> I did not use the Convexity adjustment data given in the paper (I do not
> know how).
> In the example, when you mix, depo-FRA-swap or depo-Futures-swap should it
> be the same tenor ? (like FRA on Euribor3M and Eur swaps on Euribor3M )
>
> Here is the code (I have also attached it).
>
>
> //Datas in this program are from the paper: Bootstrapping the illiquidity,
> Multiple Yield cures construction for market coherent forward rates
> estimation by Ferdinando and Bianchetti.
>
>
> #include <ql/quantlib.hpp>
>
> #ifdef BOOST_MSVC
>
> #endif
>
> #include <boost/timer.hpp>
> #include <iostream>
> #include <iomanip>
>
> using namespace QuantLib;
>
> #if defined(QL_ENABLE_SESSIONS)
> namespace QuantLib
{
>
> Integer sessionId() { return 0; }
>
> }
> #endif
>
>
> int main(int, char* []) {
>
> try {
>
> boost::timer timer;
> std::cout << std::endl;
>
> /*********************
> *** MARKET DATA ***
> *********************/
>
> Calendar calendar = TARGET();
> Date settlementDate(22, September, 2004);
> // must be a business day
> settlementDate = calendar.adjust(settlementDate);
>
> Integer fixingDays = 2;
> Date todaysDate =
calendar.advance(settlementDate, -fixingDays,
> Days);
> // nothing to do with Date::todaysDate
> Settings::instance().evaluationDate() = todaysDate;
>
>
> todaysDate = Settings::instance().evaluationDate();
> std::cout << "Today: " << todaysDate.weekday()
> << ", " << todaysDate << std::endl;
>
> std::cout << "Settlement date: " << settlementDate.weekday()
> << ", " << settlementDate << std::endl;
>
>
> // deposits
> Rate dONDQuote=0.0120; //OND
>
Rate dTNDQuote=0.0120; //TND
> Rate dSNDQuote=0.0120; //SND
> Rate d1wQuote=0.0145;
> Rate d2wQuote=0.0155;
> Rate d3wQuote=0.0160;
> Rate d1mQuote=0.0166;
> Rate d2mQuote=0.0185;
> Rate d3mQuote=0.0198;
> Rate d4mQuote=0.0200;
> Rate d5mQuote=0.0202;
> Rate d6mQuote=0.0205;
> Rate d7mQuote=0.0208;
> Rate d8mQuote=0.0209;
> Rate d9mQuote=0.0211;
> Rate d10mQuote=0.0213;
> Rate d11mQuote=0.0214;
>
Rate d12mQuote=0.0216;
>
>
>
>
> // FRAs Underlying Euribor3M
> Rate Tod3MQuote=0.01927;
> Rate Tom3MQuote=0.01925;
> Rate fra1x4Quote=0.01696;
> Rate fra2x5Quote=0.01651;
> Rate fra3x6Quote=0.01612;
> Rate fra4x7Quote=0.01580;
> Rate fra5x8Quote=0.01589;
> Rate fra6x9Quote=0.01598;
>
> // FRAs Underlying Euribor6M
>
> Rate Tod6MQuote=0.02013;
> Rate Tom6MQuote=0.02000;
> Rate fra1x7Quote=0.01831;
> Rate fra2x8Quote=0.01792;
> Rate fra3x9Quote=0.01765;
> Rate fra4x10Quote=0.01742;
> Rate fra5x11Quote=0.01783;
> Rate
fra6x12Quote=0.01788;
> Rate fra12x18Quote=0.01959;
> Rate fra18x24Quote=0.02352;
>
> // FRAs Underlying Euribor12M
>
> Rate fra12x24Quote=0.02256;
>
> // FRAs Underlying Euribor6M(IMM)
>
> Real IMMfra1x7Quote=98.169;
> Real IMMfra2x8Quote=98.204;
> Real IMMfra3x9Quote=98.236;
> Real IMMfra4x10Quote=98.257;
>
>
> // futures Underlying Euribor3M
>
> Real fut1Quote=98.0675;
> Real fut2Quote=98.3075;
> Real fut3Quote=98.4200;
> Real fut4Quote=98.3950;
> Real fut5Quote=98.2550;
>
Real fut6Quote=98.1625;
> Real fut7Quote=97.9725;
> Real fut8Quote=97.7675;
> Real fut9Quote=97.5300;
> Real fut10Quote=97.3475;
> Real fut11Quote=97.1350;
> Real fut12Quote=96.9550;
> Real fut13Quote=96.7650;
>
>
> // swaps on Euribor6M
>
> Rate s1yQuote=0.01933;
> Rate s15MQuote=0.01858;
> Rate s18MQuote=0.01947;
> Rate s21MQuote=0.01954;
> Rate s2yQuote=0.02059;
> Rate s3yQuote=0.02350;
> Rate s4yQuote=0.02604;
>
Rate s5yQuote=0.02808;
> Rate s6yQuote=0.02983;
> Rate s7yQuote=0.03136;
> Rate s8yQuote=0.03268;
> Rate s9yQuote=0.03383;
> Rate s10yQuote=0.03488;
> Rate s11yQuote=0.03583;
> Rate s12yQuote=0.03668;
> Rate s13yQuote=0.03738;
> Rate s14yQuote=0.03793;
> Rate s15yQuote=0.03833;
> Rate s16yQuote=0.03861;
> Rate s17yQuote=0.03877;
> Rate s18yQuote=0.03880;
> Rate s19yQuote=0.03872;
> Rate s20yQuote=0.03854;
>
Rate s21yQuote=0.03827;
> Rate s22yQuote=0.03792;
> Rate s23yQuote=0.03753;
> Rate s24yQuote=0.03713;
> Rate s25yQuote=0.03672;
> Rate s26yQuote=0.03635;
> Rate s27yQuote=0.03601;
> Rate s28yQuote=0.03569;
> Rate s29yQuote=0.03539;
> Rate s30yQuote=0.03510;
> Rate s35yQuote=0.03377;
> Rate s40yQuote=0.03266;
> Rate s50yQuote=0.03145;
> Rate s60yQuote=0.03076;
>
>
>
> // // IMM swaps on Euribor3M
> //
> Rate
s1s1yQuote=0.01668;
> Rate s2s1yQuote=0.01704;
> Rate s3s1yQuote=0.01817;
> Rate s4s1yQuote=0.01975;
> Rate s1s2yQuote=0.01910;
> Rate s2s2yQuote=0.02029;
> Rate s1s3yQuote=0.02256;
>
>
> // swaps on Euribor1M
>
> Rate s2x1sQuote=0.01456;
> Rate s3x1sQuote=0.01406;
> Rate s4x1sQuote=0.01365;
> Rate s5x1sQuote=0.01337;
> Rate s6x1sQuote=0.01322;
> Rate s7x1sQuote=0.01316;
> Rate s8x1sQuote=0.01315;
> Rate
s9x1sQuote=0.01321;
> Rate s10x1sQuote=0.01330;
> Rate s11x1sQuote=0.01347;
> Rate s12x1sQuote=0.01355;
>
>
>
> /********************
> *** QUOTES ***
> ********************/
>
> // SimpleQuote stores a value which can be manually changed;
> // other Quote subclasses could read the value from a database
> // or some kind of data feed.
>
> // deposits
>
> boost::shared_ptr<Quote> dONDRate(new SimpleQuote(dONDQuote));
> boost::shared_ptr<Quote> dTNDRate(new
SimpleQuote(dTNDQuote));
> boost::shared_ptr<Quote> dSNDRate(new SimpleQuote(dSNDQuote));
> boost::shared_ptr<Quote> d1wRate(new SimpleQuote(d1wQuote));
> boost::shared_ptr<Quote> d2wRate(new SimpleQuote(d2wQuote));
> boost::shared_ptr<Quote> d3wRate(new SimpleQuote(d3wQuote));
> boost::shared_ptr<Quote> d1mRate(new SimpleQuote(d1mQuote));
> boost::shared_ptr<Quote> d2mRate(new SimpleQuote(d2mQuote));
> boost::shared_ptr<Quote> d3mRate(new SimpleQuote(d3mQuote));
> boost::shared_ptr<Quote> d4mRate(new SimpleQuote(d4mQuote));
> boost::shared_ptr<Quote> d5mRate(new SimpleQuote(d5mQuote));
>
boost::shared_ptr<Quote> d6mRate(new SimpleQuote(d6mQuote));
> boost::shared_ptr<Quote> d7mRate(new SimpleQuote(d7mQuote));
> boost::shared_ptr<Quote> d8mRate(new SimpleQuote(d8mQuote));
> boost::shared_ptr<Quote> d9mRate(new SimpleQuote(d9mQuote));
> boost::shared_ptr<Quote> d10mRate(new SimpleQuote(d10mQuote));
> boost::shared_ptr<Quote> d11mRate(new SimpleQuote(d11mQuote));
> boost::shared_ptr<Quote> d12mRate(new SimpleQuote(d12mQuote));
>
>
>
>
> // FRAs Underlying Euribor3M
>
> boost::shared_ptr<Quote> Tod3MRate(new SimpleQuote(Tod3MQuote));
>
boost::shared_ptr<Quote> Tom3MRate(new SimpleQuote(Tom3MQuote));
> boost::shared_ptr<Quote> fra1x4Rate(new SimpleQuote(fra1x4Quote));
> boost::shared_ptr<Quote> fra2x5Rate(new SimpleQuote(fra2x5Quote));
> boost::shared_ptr<Quote> fra3x6Rate(new SimpleQuote(fra3x6Quote));
> boost::shared_ptr<Quote> fra4x7Rate(new SimpleQuote(fra4x7Quote));
> boost::shared_ptr<Quote> fra5x8Rate(new SimpleQuote(fra5x8Quote));
> boost::shared_ptr<Quote> fra6x9Rate(new SimpleQuote(fra6x9Quote));
>
>
> // FRAs Underlying Euribor6M
>
> boost::shared_ptr<Quote> Tod6MRate(new SimpleQuote(Tod6MQuote));
>
boost::shared_ptr<Quote> Tom6MRate(new SimpleQuote(Tom6MQuote));
> boost::shared_ptr<Quote> fra1x7Rate(new SimpleQuote(fra1x7Quote));
> boost::shared_ptr<Quote> fra2x8Rate(new SimpleQuote(fra2x8Quote));
> boost::shared_ptr<Quote> fra3x9Rate(new SimpleQuote(fra3x9Quote));
> boost::shared_ptr<Quote> fra4x10Rate(new SimpleQuote(fra4x10Quote));
> boost::shared_ptr<Quote> fra5x11Rate(new SimpleQuote(fra5x11Quote));
> boost::shared_ptr<Quote> fra6x12Rate(new SimpleQuote(fra6x12Quote));
> boost::shared_ptr<Quote> fra12x18Rate(new
> SimpleQuote(fra12x18Quote));
> boost::shared_ptr<Quote> fra18x24Rate(new
>
SimpleQuote(fra18x24Quote));
>
> // FRAs Underlying Euribor12M
>
> boost::shared_ptr<Quote> fra12x24Rate(new SimpleQuote(fra12x24Quote));
>
>
> // FRAs Underlying Euribor6M(IMM)
>
> boost::shared_ptr<Quote> IMMfra1x7Price(new
> SimpleQuote(IMMfra1x7Quote));
> boost::shared_ptr<Quote> IMMfra2x8Price(new
> SimpleQuote(IMMfra2x8Quote));
> boost::shared_ptr<Quote> IMMfra3x9Price(new
> SimpleQuote(IMMfra3x9Quote));
> boost::shared_ptr<Quote> IMMfra4x10Price(new
> SimpleQuote(IMMfra4x10Quote));
>
>
> // futures
> boost::shared_ptr<Quote> fut1Price(new
SimpleQuote(fut1Quote));
> boost::shared_ptr<Quote> fut2Price(new SimpleQuote(fut2Quote));
> boost::shared_ptr<Quote> fut3Price(new SimpleQuote(fut3Quote));
> boost::shared_ptr<Quote> fut4Price(new SimpleQuote(fut4Quote));
> boost::shared_ptr<Quote> fut5Price(new SimpleQuote(fut5Quote));
> boost::shared_ptr<Quote> fut6Price(new SimpleQuote(fut6Quote));
> boost::shared_ptr<Quote> fut7Price(new SimpleQuote(fut7Quote));
> boost::shared_ptr<Quote> fut8Price(new SimpleQuote(fut8Quote));
> boost::shared_ptr<Quote> fut9Price(new SimpleQuote(fut9Quote));
> boost::shared_ptr<Quote> fut10Price(new
SimpleQuote(fut10Quote));
> boost::shared_ptr<Quote> fut11Price(new SimpleQuote(fut11Quote));
> boost::shared_ptr<Quote> fut12Price(new SimpleQuote(fut12Quote));
> boost::shared_ptr<Quote> fut13Price(new SimpleQuote(fut13Quote));
>
>
> // swaps on Euribor6M
>
> boost::shared_ptr<Quote> s1yRate(new SimpleQuote(s1yQuote));
> boost::shared_ptr<Quote> s15MRate(new SimpleQuote(s15MQuote));
> boost::shared_ptr<Quote> s18MRate(new SimpleQuote(s18MQuote));
> boost::shared_ptr<Quote> s21MRate(new SimpleQuote(s21MQuote));
> boost::shared_ptr<Quote> s2yRate(new
SimpleQuote(s2yQuote));
> boost::shared_ptr<Quote> s3yRate(new SimpleQuote(s3yQuote));
> boost::shared_ptr<Quote> s4yRate(new SimpleQuote(s4yQuote));
> boost::shared_ptr<Quote> s5yRate(new SimpleQuote(s5yQuote));
> boost::shared_ptr<Quote> s6yRate(new SimpleQuote(s6yQuote));
> boost::shared_ptr<Quote> s7yRate(new SimpleQuote(s7yQuote));
> boost::shared_ptr<Quote> s8yRate(new SimpleQuote(s8yQuote));
> boost::shared_ptr<Quote> s9yRate(new SimpleQuote(s9yQuote));
> boost::shared_ptr<Quote> s10yRate(new SimpleQuote(s10yQuote));
> boost::shared_ptr<Quote> s11yRate(new
SimpleQuote(s11yQuote));
> boost::shared_ptr<Quote> s12yRate(new SimpleQuote(s12yQuote));
> boost::shared_ptr<Quote> s13yRate(new SimpleQuote(s13yQuote));
> boost::shared_ptr<Quote> s14yRate(new SimpleQuote(s14yQuote));
> boost::shared_ptr<Quote> s15yRate(new SimpleQuote(s15yQuote));
> boost::shared_ptr<Quote> s16yRate(new SimpleQuote(s16yQuote));
> boost::shared_ptr<Quote> s17yRate(new SimpleQuote(s17yQuote));
> boost::shared_ptr<Quote> s18yRate(new SimpleQuote(s18yQuote));
> boost::shared_ptr<Quote> s19yRate(new SimpleQuote(s19yQuote));
> boost::shared_ptr<Quote> s20yRate(new
SimpleQuote(s20yQuote));
> boost::shared_ptr<Quote> s21yRate(new SimpleQuote(s21yQuote));
> boost::shared_ptr<Quote> s22yRate(new SimpleQuote(s22yQuote));
> boost::shared_ptr<Quote> s23yRate(new SimpleQuote(s23yQuote));
> boost::shared_ptr<Quote> s24yRate(new SimpleQuote(s24yQuote));
> boost::shared_ptr<Quote> s25yRate(new SimpleQuote(s25yQuote));
> boost::shared_ptr<Quote> s26yRate(new SimpleQuote(s26yQuote));
> boost::shared_ptr<Quote> s27yRate(new SimpleQuote(s27yQuote));
> boost::shared_ptr<Quote> s28yRate(new SimpleQuote(s28yQuote));
> boost::shared_ptr<Quote> s29yRate(new
SimpleQuote(s29yQuote));
> boost::shared_ptr<Quote> s30yRate(new SimpleQuote(s30yQuote));
> boost::shared_ptr<Quote> s35yRate(new SimpleQuote(s35yQuote));
> boost::shared_ptr<Quote> s40yRate(new SimpleQuote(s40yQuote));
> boost::shared_ptr<Quote> s50yRate(new SimpleQuote(s50yQuote));
> boost::shared_ptr<Quote> s60yRate(new SimpleQuote(s60yQuote));
>
>
> // IMM swaps on Euribor3M
>
> boost::shared_ptr<Quote> s1s1yRate(new SimpleQuote(s1s1yQuote));
> boost::shared_ptr<Quote> s2s1yRate(new SimpleQuote(s2s1yQuote));
> boost::shared_ptr<Quote> s3s1yRate(new
SimpleQuote(s3s1yQuote));
> boost::shared_ptr<Quote> s4s1yRate(new SimpleQuote(s4s1yQuote));
> boost::shared_ptr<Quote> s1s2yRate(new SimpleQuote(s1s2yQuote));
> boost::shared_ptr<Quote> s2s2yRate(new SimpleQuote(s2s2yQuote));
> boost::shared_ptr<Quote> s1s3yRate(new SimpleQuote(s1s3yQuote));
>
>
> // swaps on Euribor1M
>
> boost::shared_ptr<Quote> s2x1sRate(new SimpleQuote(s2x1sQuote));
> boost::shared_ptr<Quote> s3x1sRate(new SimpleQuote(s3x1sQuote));
> boost::shared_ptr<Quote> s4x1sRate(new SimpleQuote(s4x1sQuote));
> boost::shared_ptr<Quote> s5x1sRate(new
SimpleQuote(s5x1sQuote));
> boost::shared_ptr<Quote> s6x1sRate(new SimpleQuote(s6x1sQuote));
> boost::shared_ptr<Quote> s7x1sRate(new SimpleQuote(s7x1sQuote));
> boost::shared_ptr<Quote> s8x1sRate(new SimpleQuote(s8x1sQuote));
> boost::shared_ptr<Quote> s9x1sRate(new SimpleQuote(s9x1sQuote));
> boost::shared_ptr<Quote> s10x1sRate(new SimpleQuote(s10x1sQuote));
> boost::shared_ptr<Quote> s11x1sRate(new SimpleQuote(s11x1sQuote));
> boost::shared_ptr<Quote> s12x1sRate(new SimpleQuote(s12x1sQuote));
>
>
>
> /*********************
> *** RATE HELPERS ***
>
*********************/
>
>
> // RateHelpers are built from the above quotes together with
> // other instrument dependant infos. Quotes are passed in
> // relinkable handles which could be relinked to some other
> // data source later.
>
> // deposits
> DayCounter depositDayCounter = Actual360();
>
> boost::shared_ptr<RateHelper> dOND(new DepositRateHelper(
> Handle<Quote>(dONDRate),
> 1*Days, fixingDays,
> calendar, Following,
> false, depositDayCounter));
>
boost::shared_ptr<RateHelper> dTND(new DepositRateHelper(
> Handle<Quote>(dTNDRate),
> 1*Days, fixingDays,
> calendar, Following,
> false, depositDayCounter));
> boost::shared_ptr<RateHelper> dSND(new DepositRateHelper(
> Handle<Quote>(dSNDRate),
> 1*Days, fixingDays,
> calendar, Following,
> false, depositDayCounter));
> boost::shared_ptr<RateHelper> d1w(new DepositRateHelper(
>
Handle<Quote>(d1wRate),
> 1*Weeks, fixingDays,
> calendar, Following,
> false, depositDayCounter));
> boost::shared_ptr<RateHelper> d2w(new DepositRateHelper(
> Handle<Quote>(d2wRate),
> 2*Weeks, fixingDays,
> calendar, Following,
> false, depositDayCounter));
> boost::shared_ptr<RateHelper> d3w(new DepositRateHelper(
> Handle<Quote>(d3wRate),
> 3*Weeks, fixingDays,
> calendar,
Following,
> false, depositDayCounter));
> boost::shared_ptr<RateHelper> d1m(new DepositRateHelper(
> Handle<Quote>(d1mRate),
> 1*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d2m(new DepositRateHelper(
> Handle<Quote>(d2mRate),
> 2*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
>
boost::shared_ptr<RateHelper> d3m(new DepositRateHelper(
> Handle<Quote>(d3mRate),
> 3*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d4m(new DepositRateHelper(
> Handle<Quote>(d4mRate),
> 4*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d5m(new DepositRateHelper(
>
Handle<Quote>(d5mRate),
> 5*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d6m(new DepositRateHelper(
> Handle<Quote>(d6mRate),
> 6*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d7m(new DepositRateHelper(
> Handle<Quote>(d7mRate),
> 7*Months, fixingDays,
>
calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d8m(new DepositRateHelper(
> Handle<Quote>(d8mRate),
> 8*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d9m(new DepositRateHelper(
> Handle<Quote>(d9mRate),
> 9*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
>
boost::shared_ptr<RateHelper> d10m(new DepositRateHelper(
> Handle<Quote>(d10mRate),
> 10*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d11m(new DepositRateHelper(
> Handle<Quote>(d11mRate),
> 11*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> d12m(new DepositRateHelper(
>
Handle<Quote>(d12mRate),
> 12*Months, fixingDays,
> calendar, ModifiedFollowing,
> true, depositDayCounter));
>
>
>
>
> // FRAs Underlying Euribor3M
>
> boost::shared_ptr<RateHelper> Tod3M(new FraRateHelper(
> Handle<Quote>(Tod3MRate),
> 0, 3, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> Tom3M(new FraRateHelper(
> Handle<Quote>(Tom3MRate),
> 0, 3, fixingDays,
calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra1x4(new FraRateHelper(
> Handle<Quote>(fra1x4Rate),
> 1, 4, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra2x5(new FraRateHelper(
> Handle<Quote>(fra2x5Rate),
> 2, 5, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra3x6(new FraRateHelper(
>
Handle<Quote>(fra3x6Rate),
> 3, 6, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra4x7(new FraRateHelper(
> Handle<Quote>(fra4x7Rate),
> 4, 7, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra5x8(new FraRateHelper(
> Handle<Quote>(fra5x8Rate),
> 5, 8, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
boost::shared_ptr<RateHelper> fra6x9(new FraRateHelper(
> Handle<Quote>(fra6x9Rate),
> 6, 9, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
>
> // FRAs Underlying Euribor6M
>
> boost::shared_ptr<RateHelper> Tod6M(new FraRateHelper(
> Handle<Quote>(Tod6MRate),
> 0, 6, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> Tom6M(new FraRateHelper(
> Handle<Quote>(Tom6MRate),
>
0, 6, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra1x7(new FraRateHelper(
> Handle<Quote>(fra1x7Rate),
> 1, 7, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra2x8(new FraRateHelper(
> Handle<Quote>(fra2x8Rate),
> 2, 8, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra3x9(new FraRateHelper(
>
Handle<Quote>(fra3x9Rate),
> 3, 9, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra4x10(new FraRateHelper(
> Handle<Quote>(fra4x10Rate),
> 4, 10, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra5x11(new FraRateHelper(
> Handle<Quote>(fra5x11Rate),
> 5, 11, fixingDays, calendar, ModifiedFollowing,
> true,
depositDayCounter));
> boost::shared_ptr<RateHelper> fra6x12(new FraRateHelper(
> Handle<Quote>(fra6x12Rate),
> 6, 12, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra12x18(new FraRateHelper(
> Handle<Quote>(fra12x18Rate),
> 12, 18, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
> boost::shared_ptr<RateHelper> fra18x24(new FraRateHelper(
> Handle<Quote>(fra18x24Rate),
>
18, 24, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
> // FRAs Underlying Euribor12M
>
> boost::shared_ptr<RateHelper> fra12x24(new FraRateHelper(
> Handle<Quote>(fra12x24Rate),
> 12, 24, fixingDays, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
>
>
> // FRAs Underlying Euribor6M(IMM)
>
>
> // setup FRAs
> // Rate convexityAdjustment = 0.0; ????
> Integer FRAMonths = 6;
> Date imm1 =
IMM::nextDate(settlementDate);
> boost::shared_ptr<RateHelper> IMMfra1x7(new FuturesRateHelper(
> Handle<Quote>(IMMfra1x7Price),
> imm1,
> FRAMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm1 = IMM::nextDate(imm1+1);
> boost::shared_ptr<RateHelper> IMMfra2x8(new FuturesRateHelper(
> Handle<Quote>(IMMfra2x8Price),
> imm1,
> FRAMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm1
= IMM::nextDate(imm1+1);
> boost::shared_ptr<RateHelper> IMMfra3x9(new FuturesRateHelper(
> Handle<Quote>(IMMfra3x9Price),
> imm1,
> FRAMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm1 = IMM::nextDate(imm1+1);
> boost::shared_ptr<RateHelper> IMMfra4x10(new FuturesRateHelper(
> Handle<Quote>(IMMfra4x10Price),
> imm1,
> FRAMonths, calendar, ModifiedFollowing,
> true,
depositDayCounter));
>
>
>
>
> // setup futures
> // Rate convexityAdjustment = 0.0; ????
> Integer futMonths = 3;
> Date imm = IMM::nextDate(settlementDate);
> boost::shared_ptr<RateHelper> fut1(new FuturesRateHelper(
> Handle<Quote>(fut1Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut2(new FuturesRateHelper(
>
Handle<Quote>(fut2Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut3(new FuturesRateHelper(
> Handle<Quote>(fut3Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut4(new FuturesRateHelper(
>
Handle<Quote>(fut4Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut5(new FuturesRateHelper(
> Handle<Quote>(fut5Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut6(new FuturesRateHelper(
>
Handle<Quote>(fut6Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut7(new FuturesRateHelper(
> Handle<Quote>(fut7Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut8(new FuturesRateHelper(
>
Handle<Quote>(fut8Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut9(new FuturesRateHelper(
> Handle<Quote>(fut9Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut10(new FuturesRateHelper(
>
Handle<Quote>(fut10Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut11(new FuturesRateHelper(
> Handle<Quote>(fut11Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut12(new FuturesRateHelper(
>
Handle<Quote>(fut12Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
> imm = IMM::nextDate(imm+1);
> boost::shared_ptr<RateHelper> fut13(new FuturesRateHelper(
> Handle<Quote>(fut13Price),
> imm,
> futMonths, calendar, ModifiedFollowing,
> true, depositDayCounter));
>
>
> // setup swaps Euribor6M
> Frequency swFixedLegFrequency6 = Annual;
> BusinessDayConvention swFixedLegConvention6
= Unadjusted;
> DayCounter swFixedLegDayCounter6 = Thirty360(Thirty360::European);
> boost::shared_ptr<IborIndex> swFloatingLegIndex6(new Euribor6M);
>
> boost::shared_ptr<RateHelper> s1y(new SwapRateHelper(
> Handle<Quote>(s1yRate), 1*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s15M(new SwapRateHelper(
> Handle<Quote>(s15MRate), 15*Months,
> calendar, swFixedLegFrequency6,
>
swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
> boost::shared_ptr<RateHelper> s18M(new SwapRateHelper(
> Handle<Quote>(s18MRate), 18*Months,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
> boost::shared_ptr<RateHelper> s21M(new SwapRateHelper(
> Handle<Quote>(s21MRate), 21*Months,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6,
swFixedLegDayCounter6,
> swFloatingLegIndex6));
> boost::shared_ptr<RateHelper> s2y(new SwapRateHelper(
> Handle<Quote>(s2yRate), 2*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s3y(new SwapRateHelper(
> Handle<Quote>(s3yRate), 3*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
>
swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s4y(new SwapRateHelper(
> Handle<Quote>(s4yRate), 4*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s5y(new SwapRateHelper(
> Handle<Quote>(s5yRate), 5*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
>
boost::shared_ptr<RateHelper> s6y(new SwapRateHelper(
> Handle<Quote>(s6yRate), 6*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s7y(new SwapRateHelper(
> Handle<Quote>(s7yRate), 7*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s8y(new
SwapRateHelper(
> Handle<Quote>(s8yRate), 8*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s9y(new SwapRateHelper(
> Handle<Quote>(s9yRate), 9*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s10y(new SwapRateHelper(
>
Handle<Quote>(s10yRate), 10*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s11y(new SwapRateHelper(
> Handle<Quote>(s11yRate), 11*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s12y(new SwapRateHelper(
> Handle<Quote>(s12yRate), 12*Years,
>
calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s13y(new SwapRateHelper(
> Handle<Quote>(s13yRate), 13*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s14y(new SwapRateHelper(
> Handle<Quote>(s14yRate), 14*Years,
> calendar, swFixedLegFrequency6,
>
swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s15y(new SwapRateHelper(
> Handle<Quote>(s15yRate), 15*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s16y(new SwapRateHelper(
> Handle<Quote>(s16yRate), 16*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6,
swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s17y(new SwapRateHelper(
> Handle<Quote>(s17yRate), 17*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s18y(new SwapRateHelper(
> Handle<Quote>(s18yRate), 18*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
>
swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s19y(new SwapRateHelper(
> Handle<Quote>(s19yRate), 19*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s20y(new SwapRateHelper(
> Handle<Quote>(s20yRate), 20*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
>
boost::shared_ptr<RateHelper> s21y(new SwapRateHelper(
> Handle<Quote>(s21yRate), 21*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s22y(new SwapRateHelper(
> Handle<Quote>(s22yRate), 22*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s23y(new
SwapRateHelper(
> Handle<Quote>(s23yRate), 23*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s24y(new SwapRateHelper(
> Handle<Quote>(s24yRate), 24*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s25y(new SwapRateHelper(
>
Handle<Quote>(s25yRate), 25*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s26y(new SwapRateHelper(
> Handle<Quote>(s26yRate), 26*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s27y(new SwapRateHelper(
> Handle<Quote>(s27yRate), 27*Years,
>
calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s28y(new SwapRateHelper(
> Handle<Quote>(s28yRate), 28*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s29y(new SwapRateHelper(
> Handle<Quote>(s29yRate), 29*Years,
> calendar, swFixedLegFrequency6,
>
swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s30y(new SwapRateHelper(
> Handle<Quote>(s30yRate), 30*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s35y(new SwapRateHelper(
> Handle<Quote>(s35yRate), 35*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6,
swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s40y(new SwapRateHelper(
> Handle<Quote>(s40yRate), 40*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s50y(new SwapRateHelper(
> Handle<Quote>(s50yRate), 50*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
>
swFloatingLegIndex6));
>
> boost::shared_ptr<RateHelper> s60y(new SwapRateHelper(
> Handle<Quote>(s60yRate), 60*Years,
> calendar, swFixedLegFrequency6,
> swFixedLegConvention6, swFixedLegDayCounter6,
> swFloatingLegIndex6));
>
> // setup swaps Euribor3M
> Frequency swFixedLegFrequency3 = Annual;
> BusinessDayConvention swFixedLegConvention3 = Unadjusted;
> DayCounter swFixedLegDayCounter3 = Thirty360(Thirty360::European);
> boost::shared_ptr<IborIndex> swFloatingLegIndex3(new Euribor3M);
>
>
boost::shared_ptr<RateHelper> s1s1y(new SwapRateHelper(
> Handle<Quote>(s1s1yRate), 1*Years,
> calendar, swFixedLegFrequency3,
> swFixedLegConvention3, swFixedLegDayCounter3,
> swFloatingLegIndex3));
>
> boost::shared_ptr<RateHelper> s2s1y(new SwapRateHelper(
> Handle<Quote>(s2s1yRate), 1*Years,
> calendar, swFixedLegFrequency3,
> swFixedLegConvention3, swFixedLegDayCounter3,
> swFloatingLegIndex3));
>
> boost::shared_ptr<RateHelper> s3s1y(new
SwapRateHelper(
> Handle<Quote>(s3s1yRate), 1*Years,
> calendar, swFixedLegFrequency3,
> swFixedLegConvention3, swFixedLegDayCounter3,
> swFloatingLegIndex3));
>
> boost::shared_ptr<RateHelper> s4s1y(new SwapRateHelper(
> Handle<Quote>(s4s1yRate), 1*Years,
> calendar, swFixedLegFrequency3,
> swFixedLegConvention3, swFixedLegDayCounter3,
> swFloatingLegIndex3));
>
> boost::shared_ptr<RateHelper> s1s2y(new SwapRateHelper(
>
Handle<Quote>(s1s2yRate), 2*Years,
> calendar, swFixedLegFrequency3,
> swFixedLegConvention3, swFixedLegDayCounter3,
> swFloatingLegIndex3));
>
> boost::shared_ptr<RateHelper> s2s2y(new SwapRateHelper(
> Handle<Quote>(s2s2yRate), 2*Years,
> calendar, swFixedLegFrequency3,
> swFixedLegConvention3, swFixedLegDayCounter3,
> swFloatingLegIndex3));
>
> boost::shared_ptr<RateHelper> s1s3y(new SwapRateHelper(
> Handle<Quote>(s1s3yRate), 3*Years,
>
calendar, swFixedLegFrequency3,
> swFixedLegConvention3, swFixedLegDayCounter3,
> swFloatingLegIndex3));
>
>
> // setup swaps Euribor1M
> Frequency swFixedLegFrequency1 = Annual;
> BusinessDayConvention swFixedLegConvention1 = Unadjusted;
> DayCounter swFixedLegDayCounter1 = Thirty360(Thirty360::European);
> boost::shared_ptr<IborIndex> swFloatingLegIndex1(new Euribor1M);
>
> boost::shared_ptr<RateHelper> s2x1s(new SwapRateHelper(
> Handle<Quote>(s2x1sRate), 1*Months,
> calendar,
swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s3x1s(new SwapRateHelper(
> Handle<Quote>(s3x1sRate), 3*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s4x1s(new SwapRateHelper(
> Handle<Quote>(s4x1sRate), 4*Months,
> calendar, swFixedLegFrequency1,
>
swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s5x1s(new SwapRateHelper(
> Handle<Quote>(s5x1sRate), 5*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s6x1s(new SwapRateHelper(
> Handle<Quote>(s6x1sRate), 6*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
>
swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s7x1s(new SwapRateHelper(
> Handle<Quote>(s7x1sRate), 7*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s8x1s(new SwapRateHelper(
> Handle<Quote>(s8x1sRate), 8*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
>
swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s9x1s(new SwapRateHelper(
> Handle<Quote>(s9x1sRate), 9*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s10x1s(new SwapRateHelper(
> Handle<Quote>(s10x1sRate), 10*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
>
boost::shared_ptr<RateHelper> s11x1s(new SwapRateHelper(
> Handle<Quote>(s11x1sRate), 11*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> boost::shared_ptr<RateHelper> s12x1s(new SwapRateHelper(
> Handle<Quote>(s2x1sRate), 12*Months,
> calendar, swFixedLegFrequency1,
> swFixedLegConvention1, swFixedLegDayCounter1,
> swFloatingLegIndex1));
>
> /*********************
>
** CURVE BUILDING **
> *********************/
>
> // Any DayCounter would be fine.
> // ActualActual::ISDA ensures that 30 years is 30.0
> DayCounter termStructureDayCounter =
> ActualActual(ActualActual::ISDA);
>
>
> double tolerance = 1.0e-15;
>
> // A depo-swap (on Euribor6M) curve
> /* std::vector<boost::shared_ptr<RateHelper> > depoSwapInstruments;
> depoSwapInstruments.push_back(dOND);
> depoSwapInstruments.push_back(dTND);
> depoSwapInstruments.push_back(dSND);
>
depoSwapInstruments.push_back(d1w);
> depoSwapInstruments.push_back(d2w);
> depoSwapInstruments.push_back(d3w);
> depoSwapInstruments.push_back(d1m);
> depoSwapInstruments.push_back(d2m);
> depoSwapInstruments.push_back(d3m);
> depoSwapInstruments.push_back(d4m);
> depoSwapInstruments.push_back(d5m);
> depoSwapInstruments.push_back(d6m);
> depoSwapInstruments.push_back(d7m);
> depoSwapInstruments.push_back(d8m);
> depoSwapInstruments.push_back(d9m);
> depoSwapInstruments.push_back(d10m);
>
depoSwapInstruments.push_back(d11m);
> depoSwapInstruments.push_back(d12m);
> depoSwapInstruments.push_back(s1y);
> depoSwapInstruments.push_back(s15M);
> depoSwapInstruments.push_back(s18M);
> depoSwapInstruments.push_back(s21M);
> depoSwapInstruments.push_back(s2y);
> depoSwapInstruments.push_back(s3y);
> depoSwapInstruments.push_back(s4y);
> depoSwapInstruments.push_back(s5y);
> depoSwapInstruments.push_back(s6y);
> depoSwapInstruments.push_back(s7y);
> depoSwapInstruments.push_back(s8y);
>
depoSwapInstruments.push_back(s9y);
> depoSwapInstruments.push_back(s10y);
> depoSwapInstruments.push_back(s11y);
> depoSwapInstruments.push_back(s12y);
> depoSwapInstruments.push_back(s13y);
> depoSwapInstruments.push_back(s14y);
> depoSwapInstruments.push_back(s15y);
> depoSwapInstruments.push_back(s16y);
> depoSwapInstruments.push_back(s17y);
> depoSwapInstruments.push_back(s18y);
> depoSwapInstruments.push_back(s19y);
> depoSwapInstruments.push_back(s20y);
> depoSwapInstruments.push_back(s21y);
>
depoSwapInstruments.push_back(s22y);
> depoSwapInstruments.push_back(s23y);
> depoSwapInstruments.push_back(s24y);
> depoSwapInstruments.push_back(s25y);
> depoSwapInstruments.push_back(s26y);
> depoSwapInstruments.push_back(s27y);
> depoSwapInstruments.push_back(s28y);
> depoSwapInstruments.push_back(s29y);
> depoSwapInstruments.push_back(s30y);
> depoSwapInstruments.push_back(s35y);
> depoSwapInstruments.push_back(s40y);
> depoSwapInstruments.push_back(s50y);
> depoSwapInstruments.push_back(s60y);
>
boost::shared_ptr<YieldTermStructure> depoSwapTermStructure(
> new PiecewiseYieldCurve<Discount,LogLinear>(
> settlementDate,
> depoSwapInstruments,
> termStructureDayCounter,
> tolerance));*/
>
>
> // A depo-swap (on Euribor3M) curve
> std::vector<boost::shared_ptr<RateHelper> > depoSwapInstruments;
>
depoSwapInstruments.push_back(dOND);
> depoSwapInstruments.push_back(dTND);
> depoSwapInstruments.push_back(dSND);
> depoSwapInstruments.push_back(d1w);
> depoSwapInstruments.push_back(d2w);
> depoSwapInstruments.push_back(d3w);
> depoSwapInstruments.push_back(d1m);
> depoSwapInstruments.push_back(d2m);
> depoSwapInstruments.push_back(d3m);
> depoSwapInstruments.push_back(d4m);
> depoSwapInstruments.push_back(d5m);
> depoSwapInstruments.push_back(d6m);
> depoSwapInstruments.push_back(d7m);
>
depoSwapInstruments.push_back(d8m);
> depoSwapInstruments.push_back(d9m);
> depoSwapInstruments.push_back(d10m);
> depoSwapInstruments.push_back(d11m);
> depoSwapInstruments.push_back(d12m);
> depoSwapInstruments.push_back(s1s1y);
> depoSwapInstruments.push_back(s2s1y);
> depoSwapInstruments.push_back(s3s1y);
> depoSwapInstruments.push_back(s4s1y);
> depoSwapInstruments.push_back(s1s2y);
> depoSwapInstruments.push_back(s2s2y);
> depoSwapInstruments.push_back(s1s3y);
> boost::shared_ptr<YieldTermStructure> depoSwapTermStructure(
>
new PiecewiseYieldCurve<Discount,LogLinear>(
> settlementDate,
> depoSwapInstruments,
> termStructureDayCounter,
> tolerance));
>
>
> // A depo-swap (on Euribor1M) curve
> /* std::vector<boost::shared_ptr<RateHelper> > depoSwapInstruments;
> depoSwapInstruments.push_back(dOND);
>
depoSwapInstruments.push_back(dTND);
> depoSwapInstruments.push_back(dSND);
> depoSwapInstruments.push_back(d1w);
> depoSwapInstruments.push_back(d2w);
> depoSwapInstruments.push_back(d3w);
> depoSwapInstruments.push_back(d1m);
> depoSwapInstruments.push_back(d2m);
> depoSwapInstruments.push_back(d3m);
> depoSwapInstruments.push_back(d4m);
> depoSwapInstruments.push_back(d5m);
> depoSwapInstruments.push_back(d6m);
> depoSwapInstruments.push_back(d7m);
> depoSwapInstruments.push_back(d8m);
>
depoSwapInstruments.push_back(d9m);
> depoSwapInstruments.push_back(d10m);
> depoSwapInstruments.push_back(d11m);
> depoSwapInstruments.push_back(d12m);
> depoSwapInstruments.push_back(s2x1s);
> depoSwapInstruments.push_back(s3x1s);
> depoSwapInstruments.push_back(s4x1s);
> depoSwapInstruments.push_back(s5x1s);
> depoSwapInstruments.push_back(s6x1s);
> depoSwapInstruments.push_back(s7x1s);
> depoSwapInstruments.push_back(s8x1s);
> depoSwapInstruments.push_back(s9x1s);
> depoSwapInstruments.push_back(s10x1s);
>
depoSwapInstruments.push_back(s11x1s);
> depoSwapInstruments.push_back(s12x1s);
> boost::shared_ptr<YieldTermStructure> depoSwapTermStructure(
> new PiecewiseYieldCurve<Discount,LogLinear>(
> settlementDate,
> depoSwapInstruments,
> termStructureDayCounter,
> tolerance));*/
>
>
> // A depo-futures-swap (on Euribor6M)
curve
> /* std::vector<boost::shared_ptr<RateHelper> > depoFutSwapInstruments;
> depoFutSwapInstruments.push_back(dOND);
> depoFutSwapInstruments.push_back(dTND);
> depoFutSwapInstruments.push_back(dSND);
> depoFutSwapInstruments.push_back(d1w);
> depoFutSwapInstruments.push_back(d2w);
> depoFutSwapInstruments.push_back(d3w);
> depoFutSwapInstruments.push_back(d1m);
> depoFutSwapInstruments.push_back(d2m);
> depoFutSwapInstruments.push_back(d3m);
> depoFutSwapInstruments.push_back(d4m);
> depoFutSwapInstruments.push_back(d5m);
>
depoFutSwapInstruments.push_back(d6m);
> depoFutSwapInstruments.push_back(d7m);
> depoFutSwapInstruments.push_back(d8m);
> depoFutSwapInstruments.push_back(d9m);
> depoFutSwapInstruments.push_back(d10m);
> depoFutSwapInstruments.push_back(d11m);
> depoFutSwapInstruments.push_back(d12m);
> depoFutSwapInstruments.push_back(fut1);
> depoFutSwapInstruments.push_back(fut2);
> depoFutSwapInstruments.push_back(fut3);
> depoFutSwapInstruments.push_back(fut4);
> depoFutSwapInstruments.push_back(fut5);
>
depoFutSwapInstruments.push_back(fut6);
> depoFutSwapInstruments.push_back(fut7);
> depoFutSwapInstruments.push_back(fut8);
> depoFutSwapInstruments.push_back(fut9);
> depoFutSwapInstruments.push_back(fut10);
> depoFutSwapInstruments.push_back(fut11);
> depoFutSwapInstruments.push_back(fut12);
> depoFutSwapInstruments.push_back(fut13);
> depoFutSwapInstruments.push_back(s1y);
> depoFutSwapInstruments.push_back(s15M);
> depoFutSwapInstruments.push_back(s18M);
> depoFutSwapInstruments.push_back(s21M);
> depoFutSwapInstruments.push_back(s2y);
>
depoFutSwapInstruments.push_back(s3y);
> depoFutSwapInstruments.push_back(s4y);
> depoFutSwapInstruments.push_back(s5y);
> depoFutSwapInstruments.push_back(s6y);
> depoFutSwapInstruments.push_back(s7y);
> depoFutSwapInstruments.push_back(s8y);
> depoFutSwapInstruments.push_back(s9y);
> depoFutSwapInstruments.push_back(s10y);
> depoFutSwapInstruments.push_back(s11y);
> depoFutSwapInstruments.push_back(s12y);
> depoFutSwapInstruments.push_back(s13y);
> depoFutSwapInstruments.push_back(s14y);
>
depoFutSwapInstruments.push_back(s15y);
> depoFutSwapInstruments.push_back(s16y);
> depoFutSwapInstruments.push_back(s17y);
> depoFutSwapInstruments.push_back(s18y);
> depoFutSwapInstruments.push_back(s19y);
> depoFutSwapInstruments.push_back(s20y);
> depoFutSwapInstruments.push_back(s21y);
> depoFutSwapInstruments.push_back(s22y);
> depoFutSwapInstruments.push_back(s23y);
> depoFutSwapInstruments.push_back(s24y);
> depoFutSwapInstruments.push_back(s25y);
> depoFutSwapInstruments.push_back(s26y);
> depoFutSwapInstruments.push_back(s27y);
>
depoFutSwapInstruments.push_back(s28y);
> depoFutSwapInstruments.push_back(s29y);
> depoFutSwapInstruments.push_back(s30y);
> depoFutSwapInstruments.push_back(s35y);
> depoFutSwapInstruments.push_back(s40y);
> depoFutSwapInstruments.push_back(s50y);
> depoFutSwapInstruments.push_back(s60y);
> boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
> new PiecewiseYieldCurve<Discount,LogLinear>(
> settlementDate,
> depoFutSwapInstruments,
>
termStructureDayCounter,
> tolerance));*/
>
>
> // A depo-futures-swap (on Euribor3M) curve
> /* std::vector<boost::shared_ptr<RateHelper> >
> depoFutSwapInstruments;
> depoFutSwapInstruments.push_back(dOND);
> depoFutSwapInstruments.push_back(dTND);
> depoFutSwapInstruments.push_back(dSND);
> depoFutSwapInstruments.push_back(d1w);
> depoFutSwapInstruments.push_back(d2w);
>
depoFutSwapInstruments.push_back(d3w);
> depoFutSwapInstruments.push_back(d1m);
> depoFutSwapInstruments.push_back(d2m);
> depoFutSwapInstruments.push_back(d3m);
> depoFutSwapInstruments.push_back(d4m);
> depoFutSwapInstruments.push_back(d5m);
> depoFutSwapInstruments.push_back(d6m);
> depoFutSwapInstruments.push_back(d7m);
> depoFutSwapInstruments.push_back(d8m);
> depoFutSwapInstruments.push_back(d9m);
> depoFutSwapInstruments.push_back(d10m);
> depoFutSwapInstruments.push_back(d11m);
> depoFutSwapInstruments.push_back(d12m);
>
depoFutSwapInstruments.push_back(fut1);
> depoFutSwapInstruments.push_back(fut2);
> depoFutSwapInstruments.push_back(fut3);
> depoFutSwapInstruments.push_back(fut4);
> depoFutSwapInstruments.push_back(fut5);
> depoFutSwapInstruments.push_back(fut6);
> depoFutSwapInstruments.push_back(fut7);
> depoFutSwapInstruments.push_back(fut8);
> depoFutSwapInstruments.push_back(fut9);
> depoFutSwapInstruments.push_back(fut10);
> depoFutSwapInstruments.push_back(fut11);
> depoFutSwapInstruments.push_back(fut12);
>
depoFutSwapInstruments.push_back(fut13);
> depoFutSwapInstruments.push_back(s1s1y);
> depoFutSwapInstruments.push_back(s2s1y);
> depoFutSwapInstruments.push_back(s3s1y);
> depoFutSwapInstruments.push_back(s4s1y);
> depoFutSwapInstruments.push_back(s1s2y);
> depoFutSwapInstruments.push_back(s2s2y);
> depoFutSwapInstruments.push_back(s1s3y);
> boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
> new PiecewiseYieldCurve<Discount,LogLinear>(
> settlementDate,
>
depoFutSwapInstruments,
> termStructureDayCounter,
> tolerance));*/
>
>
> // A depo-futures-swap (on Euribor1M) curve
> std::vector<boost::shared_ptr<RateHelper> > depoFutSwapInstruments;
> depoFutSwapInstruments.push_back(dOND);
> depoFutSwapInstruments.push_back(dTND);
> depoFutSwapInstruments.push_back(dSND);
> depoFutSwapInstruments.push_back(d1w);
>
depoFutSwapInstruments.push_back(d2w);
> depoFutSwapInstruments.push_back(d3w);
> depoFutSwapInstruments.push_back(d1m);
> depoFutSwapInstruments.push_back(d2m);
> depoFutSwapInstruments.push_back(d3m);
> depoFutSwapInstruments.push_back(d4m);
> depoFutSwapInstruments.push_back(d5m);
> depoFutSwapInstruments.push_back(d6m);
> depoFutSwapInstruments.push_back(d7m);
> depoFutSwapInstruments.push_back(d8m);
> depoFutSwapInstruments.push_back(d9m);
> depoFutSwapInstruments.push_back(d10m);
> depoFutSwapInstruments.push_back(d11m);
>
depoFutSwapInstruments.push_back(d12m);
> depoFutSwapInstruments.push_back(fut1);
> depoFutSwapInstruments.push_back(fut2);
> depoFutSwapInstruments.push_back(fut3);
> depoFutSwapInstruments.push_back(fut4);
> depoFutSwapInstruments.push_back(fut5);
> depoFutSwapInstruments.push_back(fut6);
> depoFutSwapInstruments.push_back(fut7);
> depoFutSwapInstruments.push_back(fut8);
> depoFutSwapInstruments.push_back(fut9);
> depoFutSwapInstruments.push_back(fut10);
> depoFutSwapInstruments.push_back(fut11);
>
depoFutSwapInstruments.push_back(fut12);
> depoFutSwapInstruments.push_back(fut13);
> depoFutSwapInstruments.push_back(s2x1s);
> depoFutSwapInstruments.push_back(s3x1s);
> depoFutSwapInstruments.push_back(s4x1s);
> depoFutSwapInstruments.push_back(s5x1s);
> depoFutSwapInstruments.push_back(s6x1s);
> depoFutSwapInstruments.push_back(s7x1s);
> depoFutSwapInstruments.push_back(s8x1s);
> depoFutSwapInstruments.push_back(s9x1s);
> depoFutSwapInstruments.push_back(s10x1s);
> depoFutSwapInstruments.push_back(s11x1s);
>
depoFutSwapInstruments.push_back(s12x1s);
> boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
> new PiecewiseYieldCurve<Discount,LogLinear>(
> settlementDate,
> depoFutSwapInstruments,
> termStructureDayCounter,
> tolerance));
>
>
> // A depo-FRA-swap (on Euribor6M) curve
>
std::vector<boost::shared_ptr<RateHelper> > depoFRASwapInstruments;
> depoFRASwapInstruments.push_back(dOND);
> depoFRASwapInstruments.push_back(dTND);
> depoFRASwapInstruments.push_back(dSND);
> depoFRASwapInstruments.push_back(d1w);
> depoFRASwapInstruments.push_back(d2w);
> depoFRASwapInstruments.push_back(d3w);
> depoFRASwapInstruments.push_back(d1m);
> depoFRASwapInstruments.push_back(d2m);
> depoFRASwapInstruments.push_back(d3m);
> depoFRASwapInstruments.push_back(d4m);
> depoFRASwapInstruments.push_back(d5m);
>
depoFRASwapInstruments.push_back(d6m);
> depoFRASwapInstruments.push_back(d7m);
> depoFRASwapInstruments.push_back(d8m);
> depoFRASwapInstruments.push_back(d9m);
> depoFRASwapInstruments.push_back(d10m);
> depoFRASwapInstruments.push_back(d11m);
> depoFRASwapInstruments.push_back(d12m);
>
> depoFRASwapInstruments.push_back(Tod6M);
> depoFRASwapInstruments.push_back(Tom6M);
> depoFRASwapInstruments.push_back(Tod3M);
> depoFRASwapInstruments.push_back(Tom3M);
> depoFRASwapInstruments.push_back(fra1x7);
>
depoFRASwapInstruments.push_back(fra2x8);
> depoFRASwapInstruments.push_back(fra3x9);
> depoFRASwapInstruments.push_back(fra4x10);
> depoFRASwapInstruments.push_back(fra5x11);
> depoFRASwapInstruments.push_back(fra3x6);
> depoFRASwapInstruments.push_back(fra6x9);
> depoFRASwapInstruments.push_back(fra6x12);
> depoFRASwapInstruments.push_back(fra12x18);
> depoFRASwapInstruments.push_back(fra18x24);
>
> depoFRASwapInstruments.push_back(IMMfra1x7);
> depoFRASwapInstruments.push_back(IMMfra2x8);
> depoFRASwapInstruments.push_back(IMMfra3x9);
>
depoFRASwapInstruments.push_back(IMMfra4x10);
>
> depoFRASwapInstruments.push_back(s1y);
> depoFRASwapInstruments.push_back(s15M);
> depoFRASwapInstruments.push_back(s18M);
> depoFRASwapInstruments.push_back(s21M);
> depoFRASwapInstruments.push_back(s2y);
> depoFRASwapInstruments.push_back(s3y);
> depoFRASwapInstruments.push_back(s4y);
> depoFRASwapInstruments.push_back(s5y);
> depoFRASwapInstruments.push_back(s6y);
> depoFRASwapInstruments.push_back(s7y);
> depoFRASwapInstruments.push_back(s8y);
>
depoFRASwapInstruments.push_back(s9y);
> depoFRASwapInstruments.push_back(s10y);
> depoFRASwapInstruments.push_back(s11y);
> depoFRASwapInstruments.push_back(s12y);
> depoFRASwapInstruments.push_back(s13y);
> depoFRASwapInstruments.push_back(s14y);
> depoFRASwapInstruments.push_back(s15y);
> depoFRASwapInstruments.push_back(s16y);
> depoFRASwapInstruments.push_back(s17y);
> depoFRASwapInstruments.push_back(s18y);
> depoFRASwapInstruments.push_back(s19y);
> depoFRASwapInstruments.push_back(s20y);
> depoFRASwapInstruments.push_back(s21y);
>
depoFRASwapInstruments.push_back(s22y);
> depoFRASwapInstruments.push_back(s23y);
> depoFRASwapInstruments.push_back(s24y);
> depoFRASwapInstruments.push_back(s25y);
> depoFRASwapInstruments.push_back(s26y);
> depoFRASwapInstruments.push_back(s27y);
> depoFRASwapInstruments.push_back(s28y);
> depoFRASwapInstruments.push_back(s29y);
> depoFRASwapInstruments.push_back(s30y);
> depoFRASwapInstruments.push_back(s35y);
> depoFRASwapInstruments.push_back(s40y);
> depoFRASwapInstruments.push_back(s50y);
>
depoFRASwapInstruments.push_back(s60y);
> boost::shared_ptr<YieldTermStructure> depoFRASwapTermStructure(
> new PiecewiseYieldCurve<Discount,LogLinear>(
> settlementDate,
> depoFRASwapInstruments,
> termStructureDayCounter,
> tolerance));
>
>
> // A depo-FRA-swap (on Euribor3M) curve
> /*
std::vector<boost::shared_ptr<RateHelper> >
> depoFRASwapInstruments;
> depoFRASwapInstruments.push_back(dOND);
> depoFRASwapInstruments.push_back(dTND);
> depoFRASwapInstruments.push_back(dSND);
> depoFRASwapInstruments.push_back(d1w);
> depoFRASwapInstruments.push_back(d2w);
> depoFRASwapInstruments.push_back(d3w);
> depoFRASwapInstruments.push_back(d1m);
> depoFRASwapInstruments.push_back(d2m);
> depoFRASwapInstruments.push_back(d3m);
> depoFRASwapInstruments.push_back(d4m);
> depoFRASwapInstruments.push_back(d5m);
>
depoFRASwapInstruments.push_back(d6m);
> depoFRASwapInstruments.push_back(d7m);
> depoFRASwapInstruments.push_back(d8m);
> depoFRASwapInstruments.push_back(d9m);
> depoFRASwapInstruments.push_back(d10m);
> depoFRASwapInstruments.push_back(d11m);
> depoFRASwapInstruments.push_back(d12m);
> depoFRASwapInstruments.push_back(Tod3M);
> depoFRASwapInstruments.push_back(Tom3M);
> depoFRASwapInstruments.push_back(fra1x4);
> depoFRASwapInstruments.push_back(fra2x5);
> depoFRASwapInstruments.push_back(fra3x6);
>
depoFRASwapInstruments.push_back(fra4x7);
> depoFRASwapInstruments.push_back(fra5x8);
> depoFRASwapInstruments.push_back(fra6x9);
> depoFRASwapInstruments.push_back(s1s1y);
> depoFRASwapInstruments.push_back(s2s1y);
> depoFRASwapInstruments.push_back(s3s1y);
> depoFRASwapInstruments.push_back(s4s1y);
> depoFRASwapInstruments.push_back(s1s2y);
> depoFRASwapInstruments.push_back(s2s2y);
> depoFRASwapInstruments.push_back(s1s3y);
> boost::shared_ptr<YieldTermStructure> depoFRASwapTermStructure(
> new PiecewiseYieldCurve<Discount,LogLinear>(
>
settlementDate,
> depoFRASwapInstruments,
> termStructureDayCounter,
> tolerance));*/
>
>
> // Term structures that will be used for pricing:
> // the one used for discounting cash flows
> RelinkableHandle<YieldTermStructure> discountingTermStructure;
> // the one used for forward rate forecasting
>
RelinkableHandle<YieldTermStructure> forecastingTermStructure;
>
>
> /*********************
> * SWAPS TO BE PRICED *
> **********************/
>
> // constant nominal 1,000,000 Euro
> Real nominal = 1000000.0;
> // fixed leg
> Frequency fixedLegFrequency = Annual;
> BusinessDayConvention fixedLegConvention = Unadjusted;
> BusinessDayConvention floatingLegConvention = ModifiedFollowing;
> DayCounter fixedLegDayCounter = Thirty360(Thirty360::European);
> Rate fixedRate = 0.04;
> DayCounter floatingLegDayCounter =
Actual360();
>
> // floating leg
> Frequency floatingLegFrequency = Semiannual;
> boost::shared_ptr<IborIndex> euriborIndex(
> new
> Euribor6M(forecastingTermStructure));
> Spread spread = 0.0;
>
> Integer lenghtInYears = 5;
> VanillaSwap::Type swapType = VanillaSwap::Payer;
>
> Date maturity = settlementDate + lenghtInYears*Years;
> Schedule fixedSchedule(settlementDate, maturity,
>
Period(fixedLegFrequency),
> calendar, fixedLegConvention,
> fixedLegConvention,
> DateGeneration::Forward, false);
> Schedule floatSchedule(settlementDate, maturity,
> Period(floatingLegFrequency),
> calendar, floatingLegConvention,
>
floatingLegConvention,
> DateGeneration::Forward, false);
> VanillaSwap spot5YearSwap(swapType, nominal,
> fixedSchedule, fixedRate, fixedLegDayCounter,
> floatSchedule, euriborIndex, spread,
> floatingLegDayCounter);
>
> Date fwdStart = calendar.advance(settlementDate, 1, Years);
> Date fwdMaturity = fwdStart + lenghtInYears*Years;
> Schedule fwdFixedSchedule(fwdStart, fwdMaturity,
> Period(fixedLegFrequency),
>
calendar, fixedLegConvention,
> fixedLegConvention,
> DateGeneration::Forward, false);
> Schedule fwdFloatSchedule(fwdStart, fwdMaturity,
> Period(floatingLegFrequency),
> calendar, floatingLegConvention,
>
floatingLegConvention,
> DateGeneration::Forward, false);
> VanillaSwap oneYearForward5YearSwap(swapType, nominal,
> fwdFixedSchedule, fixedRate, fixedLegDayCounter,
> fwdFloatSchedule, euriborIndex, spread,
> floatingLegDayCounter);
>
>
> /***************
> * SWAP PRICING *
> ****************/
>
> // utilities for reporting
> std::vector<std::string> headers(4);
> headers[0] = "term structure";
>
headers[1] = "net present value";
> headers[2] = "fair spread";
> headers[3] = "fair fixed rate";
> std::string separator = " | ";
> Size width = headers[0].size() + separator.size()
> + headers[1].size() + separator.size()
> + headers[2].size() + separator.size()
> + headers[3].size() + separator.size() - 1;
> std::string rule(width, '-'), dblrule(width, '=');
> std::string tab(8, ' ');
>
> // calculations
> std::cout << dblrule <<
std::endl;
> std::cout << "5-year market swap-rate = "
> << std::setprecision(2) << io::rate(s5yRate->value())
> << std::endl;
> std::cout << dblrule << std::endl;
>
> std::cout << tab << "5-years swap paying "
> << io::rate(fixedRate) << std::endl;
> std::cout << headers[0] << separator
> << headers[1] << separator
> << headers[2] << separator
>
<< headers[3] << separator << std::endl;
> std::cout << rule << std::endl;
>
> Real NPV;
> Rate fairRate;
> Spread fairSpread;
>
> boost::shared_ptr<PricingEngine> swapEngine(
> new
> DiscountingSwapEngine(discountingTermStructure));
>
> spot5YearSwap.setPricingEngine(swapEngine);
> oneYearForward5YearSwap.setPricingEngine(swapEngine);
>
> // Of course, you're not forced to really use different curves
>
forecastingTermStructure.linkTo(depoSwapTermStructure);
> discountingTermStructure.linkTo(depoSwapTermStructure);
>
> NPV = spot5YearSwap.NPV();
> fairSpread = spot5YearSwap.fairSpread();
> fairRate = spot5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
>
<< io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
>
> // let's check that the 5 years swap has been correctly re-priced
> QL_REQUIRE(std::fabs(fairRate-s5yQuote)<1e-8,
> "5-years swap mispriced by "
> << io::rate(std::fabs(fairRate-s5yQuote)));
>
>
> forecastingTermStructure.linkTo(depoFutSwapTermStructure);
>
discountingTermStructure.linkTo(depoFutSwapTermStructure);
>
> NPV = spot5YearSwap.NPV();
> fairSpread = spot5YearSwap.fairSpread();
> fairRate = spot5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-fut-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
>
std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
> QL_REQUIRE(std::fabs(fairRate-s5yQuote)<1e-8,
> "5-years swap mispriced!");
>
>
> forecastingTermStructure.linkTo(depoFRASwapTermStructure);
> discountingTermStructure.linkTo(depoFRASwapTermStructure);
>
> NPV = spot5YearSwap.NPV();
> fairSpread = spot5YearSwap.fairSpread();
> fairRate = spot5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
>
<< "depo-FRA-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
> QL_REQUIRE(std::fabs(fairRate-s5yQuote)<1e-8,
>
"5-years swap mispriced!");
>
>
> std::cout << rule << std::endl;
>
> // now let's price the 1Y forward 5Y swap
>
> std::cout << tab << "5-years, 1-year forward swap paying "
> << io::rate(fixedRate) << std::endl;
> std::cout << headers[0] << separator
> << headers[1] << separator
> << headers[2] << separator
> << headers[3] << separator << std::endl;
> std::cout << rule
<< std::endl;
>
>
> forecastingTermStructure.linkTo(depoSwapTermStructure);
> discountingTermStructure.linkTo(depoSwapTermStructure);
>
> NPV = oneYearForward5YearSwap.NPV();
> fairSpread = oneYearForward5YearSwap.fairSpread();
> fairRate = oneYearForward5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout <<
std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
>
> forecastingTermStructure.linkTo(depoFutSwapTermStructure);
> discountingTermStructure.linkTo(depoFutSwapTermStructure);
>
> NPV = oneYearForward5YearSwap.NPV();
> fairSpread = oneYearForward5YearSwap.fairSpread();
> fairRate = oneYearForward5YearSwap.fairRate();
>
> std::cout <<
std::setw(headers[0].size())
> << "depo-fut-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
>
>
forecastingTermStructure.linkTo(depoFRASwapTermStructure);
> discountingTermStructure.linkTo(depoFRASwapTermStructure);
>
> NPV = oneYearForward5YearSwap.NPV();
> fairSpread = oneYearForward5YearSwap.fairSpread();
> fairRate = oneYearForward5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-FRA-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
>
<< io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
>
> // now let's say that the 5-years swap rate goes up to 4.60%.
> // A smarter market element--say, connected to a data source-- would
> // notice the change itself. Since we're using SimpleQuotes,
> // we'll have to change the value manually--which forces us to
> // downcast the handle and use the SimpleQuote
> // interface. In any case, the point here is that a change in
the
> // value contained in the Quote triggers a new bootstrapping
> // of the curve and a repricing of the swap.
>
> boost::shared_ptr<SimpleQuote> fiveYearsRate =
> boost::dynamic_pointer_cast<SimpleQuote>(s5yRate);
> fiveYearsRate->setValue(0.0460);
>
> std::cout << dblrule << std::endl;
> std::cout << "5-year market swap-rate = "
> << io::rate(s5yRate->value()) << std::endl;
> std::cout << dblrule << std::endl;
>
> std::cout << tab << "5-years swap paying "
>
<< io::rate(fixedRate) << std::endl;
> std::cout << headers[0] << separator
> << headers[1] << separator
> << headers[2] << separator
> << headers[3] << separator << std::endl;
> std::cout << rule << std::endl;
>
> // now get the updated results
> forecastingTermStructure.linkTo(depoSwapTermStructure);
> discountingTermStructure.linkTo(depoSwapTermStructure);
>
> NPV = spot5YearSwap.NPV();
>
fairSpread = spot5YearSwap.fairSpread();
> fairRate = spot5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate)
<< separator;
> std::cout << std::endl;
>
> QL_REQUIRE(std::fabs(fairRate-s5yRate->value())<1e-8,
> "5-years swap mispriced!");
>
>
> forecastingTermStructure.linkTo(depoFutSwapTermStructure);
> discountingTermStructure.linkTo(depoFutSwapTermStructure);
>
> NPV = spot5YearSwap.NPV();
> fairSpread = spot5YearSwap.fairSpread();
> fairRate = spot5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-fut-swap" << separator;
>
std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
> QL_REQUIRE(std::fabs(fairRate-s5yRate->value())<1e-8,
> "5-years swap mispriced!");
>
>
>
forecastingTermStructure.linkTo(depoFRASwapTermStructure);
> discountingTermStructure.linkTo(depoFRASwapTermStructure);
>
> NPV = spot5YearSwap.NPV();
> fairSpread = spot5YearSwap.fairSpread();
> fairRate = spot5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-FRA-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
>
<< io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
> QL_REQUIRE(std::fabs(fairRate-s5yRate->value())<1e-8,
> "5-years swap mispriced!");
>
> std::cout << rule << std::endl;
>
> // the 1Y forward 5Y swap changes as well
>
> std::cout << tab << "5-years, 1-year forward swap paying "
> << io::rate(fixedRate) << std::endl;
>
std::cout << headers[0] << separator
> << headers[1] << separator
> << headers[2] << separator
> << headers[3] << separator << std::endl;
> std::cout << rule << std::endl;
>
>
> forecastingTermStructure.linkTo(depoSwapTermStructure);
> discountingTermStructure.linkTo(depoSwapTermStructure);
>
> NPV = oneYearForward5YearSwap.NPV();
> fairSpread = oneYearForward5YearSwap.fairSpread();
> fairRate = oneYearForward5YearSwap.fairRate();
>
>
std::cout << std::setw(headers[0].size())
> << "depo-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
>
>
forecastingTermStructure.linkTo(depoFutSwapTermStructure);
> discountingTermStructure.linkTo(depoFutSwapTermStructure);
>
> NPV = oneYearForward5YearSwap.NPV();
> fairSpread = oneYearForward5YearSwap.fairSpread();
> fairRate = oneYearForward5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
> << "depo-fut-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
>
<< io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
>
> forecastingTermStructure.linkTo(depoFRASwapTermStructure);
> discountingTermStructure.linkTo(depoFRASwapTermStructure);
>
> NPV = oneYearForward5YearSwap.NPV();
> fairSpread = oneYearForward5YearSwap.fairSpread();
> fairRate = oneYearForward5YearSwap.fairRate();
>
> std::cout << std::setw(headers[0].size())
>
<< "depo-FRA-swap" << separator;
> std::cout << std::setw(headers[1].size())
> << std::fixed << std::setprecision(2) << NPV << separator;
> std::cout << std::setw(headers[2].size())
> << io::rate(fairSpread) << separator;
> std::cout << std::setw(headers[3].size())
> << io::rate(fairRate) << separator;
> std::cout << std::endl;
>
> Real seconds = timer.elapsed();
> Integer hours = int(seconds/3600);
> seconds -=
hours * 3600;
> Integer minutes = int(seconds/60);
> seconds -= minutes * 60;
> std::cout << " \nRun completed in ";
> if (hours > 0)
> std::cout << hours << " h ";
> if (hours > 0 || minutes > 0)
> std::cout << minutes << " m ";
> std::cout << std::fixed << std::setprecision(0)
> << seconds << " s\n" << std::endl;
>
> return 0;
>
> } catch (std::exception& e) {
> std::cerr << e.what() <<
std::endl;
> return 1;
> } catch (...) {
> std::cerr << "unknown error" << std::endl;
> return 1;
> }
> }
>
> Thanks, waiting for the next steps.
>
>
>
> Le Mardi 18 février 2014 0h01, Luigi Ballabio <
[hidden email]> a
> écrit :
> Hello Jeffrey,
> sorry, but I don't have the time that it would take to make a demo.
> However, I or someone else on the mailing list can help you if you do the
> coding work. Do this:
> 1) check that you can compile and run the program swapvaluation.cpp in
> Examples/Swap. If you have problems, post to the mailing list and explain
> them. Someone will help you solve
them.
> 2) when you have the program running, modify it so that it uses the data in
> the paper. You should be able to insert at least the data for deposits,
> futures, fra and swaps, because the program already contains the
> corresponding code. Again, ask on the mailing list if you have problems. I
> will read it, and others will, too.
> 3) the above still uses one curve. When it's working, you can add the second
> by using OIS quotes. I'll explain when you arrive there.
>
> In general, it's easier for me and others to help if you do most of the
> coding. Otherwise, it becomes difficult to find the time to write a whole
> program.
>
> Hope this helps,
> Luigi
>
>
>
>
> On Sun, Feb 16, 2014 at 2:47 PM, Mbongo Nkounga Jeffrey Ted Johnattan
> <
[hidden email]> wrote:
>
> Dear Luigi,
>
> I have tried to figure out your instructions, I am still confused. Could
> please send me a demo, I mean, using the data provided in the attached
> paper, could you please send me a demo that will help to understand how to
> build the curves in this paper.
>
> I am very confused and desperate.
>
> Thanks in advance.
>
>
> Le Vendredi 14 février 2014 17h33, Mbongo Nkounga Jeffrey Ted Johnattan
> <
[hidden email]> a écrit :
> Dear Luigi,
>
> I have tried to figured out your instructions, I am still not confused.
> Could please send me a demo, I mean using the data provided in the attached
> paper, could you please send me a demo that will help
to build the curves
> in this paper.
> I am very confused and desperate.
>
> Thanks in advance.
>
>
>
>
>
>
> Le Samedi 1 février 2014 17h28, Luigi Ballabio <
[hidden email]> a
> écrit :
> There are several pieces:
> a) the curve implementation is in
> <ql/termstructures/yield/piecewiseyieldcurve.hpp>.
> b) the helpers used to bootstrap it on deposit, futures and swap rates
> are in <ql/termstructures/yield/ratehelpers.hpp> and the corresponding
> cpp;
> c) the helper used to bootstrap it on OIS rates is in
> <ql/termstructures/yield/oisratehelper.hpp> and the corresponding cpp.
>
> There's a few examples of putting them together; one is the example
> program in Examples/Swap/swapvaluation.cpp
that bootstraps a curve
> over deposits, futures and swaps and uses it to price a few swaps.
> It's a bit dated, so it doesn't select the rates as explained in
> Ametrano and Bianchetti, but you can try to change it so that it uses
> the appropriate rates. Other examples of bootstrap are in the test
> suite, especially test-suite/piecewiseyieldcurve.cpp and
> test-suite/overnightindexedswap.cpp.
>
> Hope this helps getting you started.
>
> Luigi
>
>
> On Wed, Jan 29, 2014 at 10:41 PM, Mbongo Nkounga Jeffrey Ted Johnattan
> <
[hidden email]> wrote:
>> Dear Luigi,
>> Could you please give me the path to access the implementation in the
>> latest
>> release ?
>> Thanks.
>>
>>
>> Le Mercredi 29 janvier 2014 23h13,
Kirill Shemyakin <
[hidden email]>
>> a
>> écrit :
>> Hi Luigi!
>> Btw, is there any curve building algorithm for illiquid bonds?
>> Thanks!
>> Cheers,
>> Kirill
>> Am 29.01.2014 20:41 schrieb "Luigi Ballabio" <
[hidden email]>:
>>
>> Hello,
>> there's no need to get that particular revision. The
>> implementation is still available in the latest release.
>>
>> Luigi
>>
>> On Wed, Jan 29, 2014 at 5:31 PM, Mbongo Nkounga Jeffrey Ted Johnattan
>> <
[hidden email]> wrote:
>>> Dear
all,
>>>
>>> I am working on Curves, I would like to download and test the
>>> implementation
>>> done by FERDINANDO M. AMETRANO AND MARCO BIANCHETTI in their paper
>>> ''BOOTSTRAPPING THE ILLIQUIDITY MULTIPLE YIELD CURVES CONSTRUCTION FOR
>>> MARKET COHERENT FORWARD RATES ESTIMATION''
>>>
>>> The paper states that the code can be found at revision 15931 in the
>>> QuantLib SVN repository. However, at the beginning of June 2013, the
>>> QuantLib project migrated its code repository to Git and I don't know how
>>> to
>>> access it now.
>>>
>>> Please can you help me?
>>>
>>> Thanks in advance!
>>>
>>>
>>> Regards,
>>>
>>> Jeffrey
>>>
>>>
>>>
>>>
------------------------------------------------------------------------------
>>> WatchGuard Dimension instantly turns raw network data into actionable
>>> security intelligence. It gives you real-time visual feedback on key
>>> security issues and trends. Skip the complicated setup - simply import
>>> a virtual appliance and go from zero to informed in seconds.
>>>
>>>
>>>
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk>>> _______________________________________________
>>> QuantLib-users mailing list
>>>
[hidden email]>>>
https://lists.sourceforge.net/lists/listinfo/quantlib-users>>>
>>
>>
>>
>> --
>> <
https://implementingquantlib.blogspot.com>
>> <
https://twitter.com/lballabio>
>
>>
>>
>> ------------------------------------------------------------------------------
>> WatchGuard Dimension instantly turns raw network data into actionable
>> security intelligence. It gives you real-time visual feedback on key
>> security issues and trends. Skip the complicated setup - simply import
>> a virtual appliance and go from zero to informed in seconds.
>>
>>
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk>> _______________________________________________
>> QuantLib-users mailing list
>>
[hidden email]>>
https://lists.sourceforge.net/lists/listinfo/quantlib-users>>
>>
>>
>
>
>
> --
> <
https://implementingquantlib.blogspot.com>
> <
https://twitter.com/lballabio>
>
>
>
>
>
>
>
> --
> <
https://implementingquantlib.blogspot.com>
> <
https://twitter.com/lballabio>
>
>