Hi all,
Below
is my code.
How
can I use convexity adjustement, swap forward (DatedSwapRateHelper
did not work).
#include <ql/quantlib.hpp> #include <iostream> #ifdef BOOST_MSVC #endif #include <boost/assign/std/vector.hpp> #include <boost/make_shared.hpp> #include <iomanip> #define LENGTH(a) (sizeof(a)/sizeof(a[0])); using namespace QuantLib; using namespace boost::assign; #if defined(QL_ENABLE_SESSIONS) //using namespace std; namespace QuantLib { Integer sessionId() { return 0; } } #endif int main(int, char* []) { try { /********************* *** MARKET DATA *** *********************/ Calendar calendar = TARGET(); Date settlementDate = Date(11, December, 2012); Date settlDate = TARGET().advance(settlementDate, 2 * Days); settlementDate = calendar.adjust(settlementDate); Integer fixingDays = 2; Settings::instance().evaluationDate() = settlementDate; DayCounter dayCounterOIS = Actual360(); DayCounter termStructureDayCounter = ActualActual(ActualActual::ISDA); double tolerance = 1.0e-15; // deposits Rate dONDQuote=0.00040, dTNDQuote=0.00040, dSNDQuote=0.00040, d1wQuote=0.00070, d2wQuote=0.00080, d3wQuote=0.00110, d1mQuote=0.00110, d2mQuote=0.00140, d3mQuote=0.00180, d4mQuote=0.0020, d5mQuote=0.00270, d6mQuote=0.00320, d7mQuote=0.00350, d8mQuote=0.00390, d9mQuote=0.00420, d10mQuote=0.00460, d11mQuote=0.00500, d12mQuote=0.00540; // FRAs Underlying Euribor3M Rate Tod3MQuote=0.00181, Tom3MQuote=0.00179, fra1x4Quote=0.00165, fra2x5Quote=0.00141, fra3x6Quote=0.00129, fra4x7Quote=0.00126, fra5x8Quote=0.00124, fra6x9Quote=0.00121; // FRAs Underlying Euribor6M Rate Tod6MQuote=0.00316, Tom6MQuote=0.00312, fra1x7Quote=0.00293, fra2x8Quote=0.00272, fra3x9Quote=0.00260, fra4x10Quote=0.00256, fra5x11Quote=0.00252, fra6x12Quote=0.00248, fra7x13Quote=0.00254, fra8x14Quote=0.00261, fra9x15Quote=0.00267, fra10x16Quote=0.00279, fra11x17Quote=0.00291, fra12x18Quote=0.00303, fra13x19Quote=0.00318, fra14x20Quote=0.00335, fra15x21Quote=0.00352, fra16x22Quote=0.00371, fra17x23Quote=0.00389, fra18x24Quote=0.00409; // FRAs Underlying Euribor12M Rate fra12x24Quote=0.00507; // FRAs Underlying Euribor6M(IMM) Real IMMF3FRAQuote=99.7110, IMMG3FRAQuote=99.7310, IMMH3FRAQuote=99.7410,IMMJ3FRAQuote=99.7450; // futures Underlying Euribor3M Real FUT3MZ2Quote=99.8225, FUT3MF3Quote=99.8475, FUT3MG3Quote=99.8550, FUT3MH3Quote=99.8725, FUT3MM3Quote=99.8775, FUT3MU3Quote=99.8725, FUT3MZ3Quote=99.8425, FUT3MH4Quote=99.8025, FUT3MM4Quote=99.7425, FUT3MU4Quote=99.6875, FUT3MZ4Quote=99.6175, FUT3MH5Quote=99.5575, FUT3MM5Quote=99.4775, FUT3MU5Quote=99.3825, FUT3MZ5Quote=99.2775, FUT3MH6Quote=99.1675, FUT3MM6Quote=99.0375, FUT3MU6Quote=98.9100, FUT3MZ6Quote=98.7775, FUT3MH7Quote=98.6575, FUT3MM7Quote=98.5325, FUT3MU7Quote=98.4125; // EUR IRS on Euribor3M Rate AB3E1YQuote=0.00141, AB3E15MQuote=0.00144, AB3E18MQuote=0.00153, AB3E21MQuote=0.00168, AB3E2YQuote=0.00186, AB3E3YQuote=0.00285, AB3E4YQuote=0.00437, AB3E5YQuote=0.00623, AB3E6YQuote=0.00817, AB3E7YQuote=0.01, AB3E8YQuote=0.01171, AB3E9YQuote=0.01324, AB3E10YQuote=0.01459, AB3E11YQuote=0.01582, AB3E12YQuote=0.01692, AB3E15YQuote=0.01933, AB3E20YQuote=0.02099, AB3E25YQuote=0.02156, AB3E30YQuote=0.02186, AB3E40YQuote=0.02288, AB3E50YQuote=0.02367, AB3EZ2Quote=0.00138, AB3EH3Quote=0.00134, AB3EM3Quote=0.00151, AB3EU3Quote=0.00183, AB3EZ3Quote=0.00183, AB3EH4Quote=0.00208, AB3EZ4Quote=0.00283, AB3EBASIS35YQuote=0.02308, AB3EBASIS60YQuote=0.024126; /********************************************************************** *** OIS discount Curve to be used for bootstrapping forward curve *** ***********************************************************************/ Real eoniaquotes[] ={ 0.00040, 0.00070, 0.00069, 0.00078, 0.00074, 0.00061, 0.00047, 0.00033, 0.00024, 0.00018, 0.00013, 0.00009, 0.00005, 0.00003, 0.00001, 0.00000, 0.00002, 0.00008, 0.00021, 0.00036, 0.00127, 0.00274, 0.00456, 0.00647, 0.00827, 0.00996, 0.01147, 0.01280, 0.01404, 0.01516, 0.01764, 0.01939, 0.02003, 0.02038, 0.00046, 0.00016, -0.00007, -0.00013, -0.00014,-0.00016}; boost::shared_ptr<RateHelper> rhon = boost::make_shared<DepositRateHelper>( eoniaquotes[0], 1 * Days, 0, TARGET(), Following, false, Actual360()); boost::shared_ptr<OvernightIndex> eoniaBt = boost::make_shared<Eonia>(); boost::shared_ptr<RateHelper> rhe1w = boost::make_shared<OISRateHelper>( 2, 1 * Weeks, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[1])), eoniaBt); boost::shared_ptr<RateHelper> rhe2w = boost::make_shared<OISRateHelper>( 2, 2 * Weeks, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[2])), eoniaBt); boost::shared_ptr<RateHelper> rhe3w = boost::make_shared<OISRateHelper>( 2, 3 * Weeks, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[3])), eoniaBt); boost::shared_ptr<RateHelper> rhe1m = boost::make_shared<OISRateHelper>( 2, 1 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[4])), eoniaBt); boost::shared_ptr<RateHelper> rhe2m = boost::make_shared<OISRateHelper>( 2, 2 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[5])), eoniaBt); boost::shared_ptr<RateHelper> rhe3m = boost::make_shared<OISRateHelper>( 2, 3 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[6])), eoniaBt); boost::shared_ptr<RateHelper> rhe4m = boost::make_shared<OISRateHelper>( 2, 4 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[7])), eoniaBt); boost::shared_ptr<RateHelper> rhe5m = boost::make_shared<OISRateHelper>( 2, 5 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[8])), eoniaBt); boost::shared_ptr<RateHelper> rhe6m = boost::make_shared<OISRateHelper>( 2, 6 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[9])), eoniaBt); boost::shared_ptr<RateHelper> rhe7m = boost::make_shared<OISRateHelper>( 2, 7 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[10])), eoniaBt); boost::shared_ptr<RateHelper> rhe8m = boost::make_shared<OISRateHelper>( 2, 8 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[11])), eoniaBt); boost::shared_ptr<RateHelper> rhe9m = boost::make_shared<OISRateHelper>( 2, 9 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[12])), eoniaBt); boost::shared_ptr<RateHelper> rhe10m = boost::make_shared<OISRateHelper>( 2, 10 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[13])), eoniaBt); boost::shared_ptr<RateHelper> rhe11m = boost::make_shared<OISRateHelper>( 2, 11 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[14])), eoniaBt); boost::shared_ptr<RateHelper> rhe1y = boost::make_shared<OISRateHelper>( 2, 1 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[15])), eoniaBt); boost::shared_ptr<RateHelper> rhe15m = boost::make_shared<OISRateHelper>( 2, 15 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[16])), eoniaBt); boost::shared_ptr<RateHelper> rhe18m = boost::make_shared<OISRateHelper>( 2, 18 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[17])), eoniaBt); boost::shared_ptr<RateHelper> rhe21m = boost::make_shared<OISRateHelper>( 2, 21 * Months, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[18])), eoniaBt); boost::shared_ptr<RateHelper> rhe2y = boost::make_shared<OISRateHelper>( 2, 2 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[19])), eoniaBt); boost::shared_ptr<RateHelper> rhe3y = boost::make_shared<OISRateHelper>( 2, 3 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[20])), eoniaBt); boost::shared_ptr<RateHelper> rhe4y = boost::make_shared<OISRateHelper>( 2, 4 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[21])), eoniaBt); boost::shared_ptr<RateHelper> rhe5y = boost::make_shared<OISRateHelper>( 2, 5 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[22])), eoniaBt); boost::shared_ptr<RateHelper> rhe6y = boost::make_shared<OISRateHelper>( 2, 6 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[23])), eoniaBt); boost::shared_ptr<RateHelper> rhe7y = boost::make_shared<OISRateHelper>( 2, 7 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[24])), eoniaBt); boost::shared_ptr<RateHelper> rhe8y = boost::make_shared<OISRateHelper>( 2, 8 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[25])), eoniaBt); boost::shared_ptr<RateHelper> rhe9y = boost::make_shared<OISRateHelper>( 2, 9 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[26])), eoniaBt); boost::shared_ptr<RateHelper> rhe10y = boost::make_shared<OISRateHelper>( 2, 10 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[27])), eoniaBt); boost::shared_ptr<RateHelper> rhe11y = boost::make_shared<OISRateHelper>( 2, 11 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[28])), eoniaBt); boost::shared_ptr<RateHelper> rhe12y = boost::make_shared<OISRateHelper>( 2, 12 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[29])), eoniaBt); boost::shared_ptr<RateHelper> rhe15y = boost::make_shared<OISRateHelper>( 2, 15 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[30])), eoniaBt); boost::shared_ptr<RateHelper> rhe20y = boost::make_shared<OISRateHelper>( 2, 20 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[31])), eoniaBt); boost::shared_ptr<RateHelper> rhe25y = boost::make_shared<OISRateHelper>( 2, 25 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[32])), eoniaBt); boost::shared_ptr<RateHelper> rhe30y = boost::make_shared<OISRateHelper>( 2, 30 * Years, Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[33])),eoniaBt); boost::shared_ptr<RateHelper> rhefeb13 = boost::make_shared<DatedOISRateHelper>( Date(16, January, 2013), Date(13, February, 2013), Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[34])), eoniaBt); boost::shared_ptr<RateHelper> rhemar13 = boost::make_shared<DatedOISRateHelper>( Date(13, February, 2013), Date(13, March, 2013), Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[35])), eoniaBt); boost::shared_ptr<RateHelper> rheapr13 = boost::make_shared<DatedOISRateHelper>( Date(13, March, 2013), Date(10, April, 2013), Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[36])), eoniaBt); boost::shared_ptr<RateHelper> rhemay13 = boost::make_shared<DatedOISRateHelper>( Date(10, April, 2013), Date(8, May, 2013), Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[37])), eoniaBt); boost::shared_ptr<RateHelper> rhejun13 = boost::make_shared<DatedOISRateHelper>( Date(8, May, 2013), Date(12, June, 2013), Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[38])), eoniaBt); boost::shared_ptr<RateHelper> rhejul13 = boost::make_shared<DatedOISRateHelper>( Date(12, June, 2013), Date(10, July, 2013), Handle<Quote>(boost::make_shared<SimpleQuote>(eoniaquotes[39])), eoniaBt); std::vector<boost::shared_ptr<RateHelper> > eoniaratehelpers; eoniaratehelpers += rhon, rhe1w, rhe2w, rhe3w, rhe1m, rhefeb13, rhemar13, rheapr13, rhe4m, rhemay13, rhe5m, rhejun13, rhe6m, rhejul13, rhe7m, rhe8m, rhe9m, rhe10m, rhe11m, rhe1y, rhe15m,rhe18m, rhe21m, rhe2y, rhe3y,rhe4y, rhe5y, rhe6y, rhe7y, rhe8y, rhe9y,rhe10y, rhe11y, rhe12y, rhe15y, rhe20y, rhe30y; boost::shared_ptr<YieldTermStructure> oisDiscountCurve( new PiecewiseYieldCurve<Discount,LogLinear>( settlementDate, eoniaratehelpers, termStructureDayCounter, tolerance)); /******************** *** 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> fra7x13Rate(new SimpleQuote(fra7x13Quote)); boost::shared_ptr<Quote> fra8x14Rate(new SimpleQuote(fra8x14Quote)); boost::shared_ptr<Quote> fra9x15Rate(new SimpleQuote(fra9x15Quote)); boost::shared_ptr<Quote> fra10x16Rate(new SimpleQuote(fra10x16Quote)); boost::shared_ptr<Quote> fra11x17Rate(new SimpleQuote(fra11x17Quote)); boost::shared_ptr<Quote> fra12x18Rate(new SimpleQuote(fra12x18Quote)); boost::shared_ptr<Quote> fra13x19Rate(new SimpleQuote(fra13x19Quote)); boost::shared_ptr<Quote> fra14x20Rate(new SimpleQuote(fra14x20Quote)); boost::shared_ptr<Quote> fra15x21Rate(new SimpleQuote(fra15x21Quote)); boost::shared_ptr<Quote> fra16x22Rate(new SimpleQuote(fra16x22Quote)); boost::shared_ptr<Quote> fra17x23Rate(new SimpleQuote(fra17x23Quote)); 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> IMMF3FRAPrice(new SimpleQuote(IMMF3FRAQuote)); boost::shared_ptr<Quote> IMMG3FRAPrice(new SimpleQuote(IMMG3FRAQuote)); boost::shared_ptr<Quote> IMMH3FRAPrice(new SimpleQuote(IMMH3FRAQuote)); boost::shared_ptr<Quote> IMMJ3FRAPrice(new SimpleQuote(IMMJ3FRAQuote)); // futures boost::shared_ptr<Quote> FUT3MZ2Price(new SimpleQuote(FUT3MZ2Quote)); boost::shared_ptr<Quote> FUT3MF3Price(new SimpleQuote(FUT3MF3Quote)); boost::shared_ptr<Quote> FUT3MG3Price(new SimpleQuote(FUT3MG3Quote)); boost::shared_ptr<Quote> FUT3MH3Price(new SimpleQuote(FUT3MH3Quote)); boost::shared_ptr<Quote> FUT3MM3Price(new SimpleQuote(FUT3MM3Quote)); boost::shared_ptr<Quote> FUT3MU3Price(new SimpleQuote(FUT3MU3Quote)); boost::shared_ptr<Quote> FUT3MZ3Price(new SimpleQuote(FUT3MZ3Quote)); boost::shared_ptr<Quote> FUT3MH4Price(new SimpleQuote(FUT3MH4Quote)); boost::shared_ptr<Quote> FUT3MM4Price(new SimpleQuote(FUT3MM4Quote)); boost::shared_ptr<Quote> FUT3MU4Price(new SimpleQuote(FUT3MU4Quote)); boost::shared_ptr<Quote> FUT3MZ4Price(new SimpleQuote(FUT3MZ4Quote)); boost::shared_ptr<Quote> FUT3MH5Price(new SimpleQuote(FUT3MH5Quote)); boost::shared_ptr<Quote> FUT3MM5Price(new SimpleQuote(FUT3MM5Quote)); boost::shared_ptr<Quote> FUT3MU5Price(new SimpleQuote(FUT3MU5Quote)); boost::shared_ptr<Quote> FUT3MZ5Price(new SimpleQuote(FUT3MZ5Quote)); boost::shared_ptr<Quote> FUT3MH6Price(new SimpleQuote(FUT3MH6Quote)); boost::shared_ptr<Quote> FUT3MM6Price(new SimpleQuote(FUT3MM6Quote)); boost::shared_ptr<Quote> FUT3MU6Price(new SimpleQuote(FUT3MU6Quote)); boost::shared_ptr<Quote> FUT3MZ6Price(new SimpleQuote(FUT3MZ6Quote)); boost::shared_ptr<Quote> FUT3MH7Price(new SimpleQuote(FUT3MH7Quote)); boost::shared_ptr<Quote> FUT3MM7Price(new SimpleQuote(FUT3MM7Quote)); boost::shared_ptr<Quote> FUT3MU7Price(new SimpleQuote(FUT3MU7Quote)); // EUR IRS on Euribor3M boost::shared_ptr<Quote> AB3E1YRate(new SimpleQuote(AB3E1YQuote)); boost::shared_ptr<Quote> AB3E15MRate(new SimpleQuote(AB3E15MQuote)); boost::shared_ptr<Quote> AB3E18MRate(new SimpleQuote(AB3E18MQuote)); boost::shared_ptr<Quote> AB3E21MRate(new SimpleQuote(AB3E21MQuote)); boost::shared_ptr<Quote> AB3E2YRate(new SimpleQuote(AB3E2YQuote)); boost::shared_ptr<Quote> AB3E3YRate(new SimpleQuote(AB3E3YQuote)); boost::shared_ptr<Quote> AB3E4YRate(new SimpleQuote(AB3E4YQuote)); boost::shared_ptr<Quote> AB3E5YRate(new SimpleQuote(AB3E5YQuote)); boost::shared_ptr<Quote> AB3E6YRate(new SimpleQuote(AB3E6YQuote)); boost::shared_ptr<Quote> AB3E7YRate(new SimpleQuote(AB3E7YQuote)); boost::shared_ptr<Quote> AB3E8YRate(new SimpleQuote(AB3E8YQuote)); boost::shared_ptr<Quote> AB3E9YRate(new SimpleQuote(AB3E9YQuote)); boost::shared_ptr<Quote> AB3E10YRate(new SimpleQuote(AB3E10YQuote)); boost::shared_ptr<Quote> AB3E11YRate(new SimpleQuote(AB3E11YQuote)); boost::shared_ptr<Quote> AB3E12YRate(new SimpleQuote(AB3E12YQuote)); boost::shared_ptr<Quote> AB3E15YRate(new SimpleQuote(AB3E15YQuote)); boost::shared_ptr<Quote> AB3E20YRate(new SimpleQuote(AB3E20YQuote)); boost::shared_ptr<Quote> AB3E25YRate(new SimpleQuote(AB3E25YQuote)); boost::shared_ptr<Quote> AB3E30YRate(new SimpleQuote(AB3E30YQuote)); boost::shared_ptr<Quote> AB3E40YRate(new SimpleQuote(AB3E40YQuote)); boost::shared_ptr<Quote> AB3E50YRate(new SimpleQuote(AB3E50YQuote)); boost::shared_ptr<Quote> AB3EZ2Rate(new SimpleQuote(AB3EZ2Quote)); boost::shared_ptr<Quote> AB3EH3Rate(new SimpleQuote(AB3EH3Quote)); boost::shared_ptr<Quote> AB3EM3Rate(new SimpleQuote(AB3EM3Quote)); boost::shared_ptr<Quote> AB3EU3Rate(new SimpleQuote(AB3EU3Quote)); boost::shared_ptr<Quote> AB3EZ3Rate(new SimpleQuote(AB3EZ3Quote)); boost::shared_ptr<Quote> AB3EH4Rate(new SimpleQuote(AB3EH4Quote)); boost::shared_ptr<Quote> AB3EZ4Rate(new SimpleQuote(AB3EZ4Quote)); boost::shared_ptr<Quote> AB3EBASIS35YRate(new SimpleQuote(AB3EBASIS35YQuote)); boost::shared_ptr<Quote> AB3EBASIS60YRate(new SimpleQuote(AB3EBASIS60YQuote)); /********************* *** 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, // Is it right? 0, 3, fixingDays 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> fra7x13(new FraRateHelper( Handle<Quote>(fra7x13Rate), 7, 13, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra8x14(new FraRateHelper( Handle<Quote>(fra8x14Rate), 8, 14, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra9x15(new FraRateHelper( Handle<Quote>(fra9x15Rate), 9, 15, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra10x16(new FraRateHelper( Handle<Quote>(fra10x16Rate), 10, 16, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra11x17(new FraRateHelper( Handle<Quote>(fra11x17Rate), 11, 17, 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> fra13x19(new FraRateHelper( Handle<Quote>(fra13x19Rate), 13, 19, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra14x20(new FraRateHelper( Handle<Quote>(fra14x20Rate), 14, 20, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra15x21(new FraRateHelper( Handle<Quote>(fra15x21Rate), 15, 21, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra16x22(new FraRateHelper( Handle<Quote>(fra16x22Rate), 16, 22, fixingDays, calendar, ModifiedFollowing, true, depositDayCounter)); boost::shared_ptr<RateHelper> fra17x23(new FraRateHelper( Handle<Quote>(fra17x23Rate), 17, 23, 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)); // setup FRAs Underlying Euribor6M(IMM) Integer FRAMonths = 6; Date imm1 = IMM::nextDate(settlementDate); boost::shared_ptr<RateHelper> IMMF3(new FuturesRateHelper( Handle<Quote>(IMMF3FRAPrice), imm1, FRAMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm1 = IMM::nextDate(imm1+1); boost::shared_ptr<RateHelper> IMMG3(new FuturesRateHelper( Handle<Quote>(IMMG3FRAPrice), imm1, FRAMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm1 = IMM::nextDate(imm1+1); boost::shared_ptr<RateHelper> IMMH3(new FuturesRateHelper( Handle<Quote>(IMMH3FRAPrice), imm1, FRAMonths, calendar, ModifiedFollowing,true, depositDayCounter)); imm1 = IMM::nextDate(imm1+1); boost::shared_ptr<RateHelper> IMMJ3(new FuturesRateHelper( Handle<Quote>(IMMJ3FRAPrice), imm1, FRAMonths, calendar, ModifiedFollowing, true, depositDayCounter)); // setup futures Integer futMonths = 3; Date imm = IMM::nextDate(settlementDate); boost::shared_ptr<RateHelper> FUT3MZ2(new FuturesRateHelper( Handle<Quote>(FUT3MZ2Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MF3(new FuturesRateHelper( Handle<Quote>(FUT3MF3Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MG3(new FuturesRateHelper( Handle<Quote>(FUT3MG3Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MH3(new FuturesRateHelper( Handle<Quote>(FUT3MH3Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MM3(new FuturesRateHelper( Handle<Quote>(FUT3MM3Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MU3(new FuturesRateHelper( Handle<Quote>(FUT3MU3Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MZ3(new FuturesRateHelper( Handle<Quote>(FUT3MZ3Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MH4(new FuturesRateHelper( Handle<Quote>(FUT3MH4Price), imm,futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MM4(new FuturesRateHelper( Handle<Quote>(FUT3MM4Price), imm,futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MU4(new FuturesRateHelper( Handle<Quote>(FUT3MU4Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MZ4(new FuturesRateHelper( Handle<Quote>(FUT3MZ4Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MH5(new FuturesRateHelper( Handle<Quote>(FUT3MH5Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MM5(new FuturesRateHelper( Handle<Quote>(FUT3MM5Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MU5(new FuturesRateHelper( Handle<Quote>(FUT3MU5Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MZ5(new FuturesRateHelper( Handle<Quote>(FUT3MZ5Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MH6(new FuturesRateHelper( Handle<Quote>(FUT3MH6Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MM6(new FuturesRateHelper( Handle<Quote>(FUT3MM6Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MU6(new FuturesRateHelper( Handle<Quote>(FUT3MU6Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MZ6(new FuturesRateHelper( Handle<Quote>(FUT3MZ6Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MH7(new FuturesRateHelper( Handle<Quote>(FUT3MH7Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MM7(new FuturesRateHelper( Handle<Quote>(FUT3MM7Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); imm = IMM::nextDate(imm+1); boost::shared_ptr<RateHelper> FUT3MU7(new FuturesRateHelper( Handle<Quote>(FUT3MU7Price), imm, futMonths, calendar, ModifiedFollowing, true, depositDayCounter)); // 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> AB3E1Y(new SwapRateHelper( Handle<Quote>(AB3E1YRate), 1*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E15M(new SwapRateHelper( Handle<Quote>(AB3E15MRate), 15*Months, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E18M(new SwapRateHelper( Handle<Quote>(AB3E18MRate), 18*Months, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E21M(new SwapRateHelper( Handle<Quote>(AB3E21MRate), 21*Months, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E2Y(new SwapRateHelper( Handle<Quote>(AB3E2YRate), 2*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E3Y(new SwapRateHelper( Handle<Quote>(AB3E3YRate), 3*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E4Y(new SwapRateHelper( Handle<Quote>(AB3E4YRate), 4*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E5Y(new SwapRateHelper( Handle<Quote>(AB3E5YRate), 5*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E6Y(new SwapRateHelper( Handle<Quote>(AB3E6YRate), 6*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E7Y(new SwapRateHelper( Handle<Quote>(AB3E7YRate), 7*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E8Y(new SwapRateHelper( Handle<Quote>(AB3E8YRate), 8*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E9Y(new SwapRateHelper( Handle<Quote>(AB3E9YRate), 9*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E10Y(new SwapRateHelper( Handle<Quote>(AB3E10YRate), 10*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E11Y(new SwapRateHelper( Handle<Quote>(AB3E11YRate), 11*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E12Y(new SwapRateHelper( Handle<Quote>(AB3E12YRate), 12*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E15Y(new SwapRateHelper( Handle<Quote>(AB3E15YRate), 15*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E20Y(new SwapRateHelper( Handle<Quote>(AB3E20YRate), 20*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E25Y(new SwapRateHelper( Handle<Quote>(AB3E25YRate), 25*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E30Y(new SwapRateHelper( Handle<Quote>(AB3E30YRate), 30*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3EBASIS35Y(new SwapRateHelper( Handle<Quote>(AB3EBASIS35YRate), 35*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E40Y(new SwapRateHelper( Handle<Quote>(AB3E40YRate), 40*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3E50Y(new SwapRateHelper( Handle<Quote>(AB3E50YRate), 50*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<RateHelper> AB3EBASIS60Y(new SwapRateHelper( Handle<Quote>(AB3EBASIS60YRate), 60*Years, calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); /* boost::shared_ptr<DatedSwapRateHelper> AB3EZ2(new SwapRateHelper( Handle<Quote>(AB3EZ2Rate), Date(19, December, 2012), Date(19, December, 2013), calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3)); boost::shared_ptr<DatedSwapRateHelper> AB3EH3(new SwapRateHelper( Handle<Quote>(AB3EH3Rate), Date(20, March, 2013), Date(20, March, 2014), calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<DatedSwapRateHelper> AB3EM3(new SwapRateHelper( Handle<Quote>(AB3EM3Rate), Date(19, June, 2013), Date(19, June, 2014), calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<DatedSwapRateHelper> AB3EU3(new SwapRateHelper( Handle<Quote>(AB3EU3Rate), Date(18, September, 2013), Date(18, September, 2014), calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<DatedSwapRateHelper> AB3EZ3(new SwapRateHelper( Handle<Quote>(AB3EZ3Rate), Date(18, December, 2013), Date(19, December, 2015), calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<DatedSwapRateHelper> AB3EH4(new SwapRateHelper( Handle<Quote>(AB3EH4Rate), Date(19, March, 2014), Date(21, March, 2016), calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve))); boost::shared_ptr<DatedSwapRateHelper> AB3EZ4(new SwapRateHelper( Handle<Quote>(AB3EZ4Rate), Date(17, December, 2014), Date(18, December, 2017), calendar, swFixedLegFrequency3, swFixedLegConvention3, swFixedLegDayCounter3, swFloatingLegIndex3, Handle< Quote >(), 0 *Days, Handle<YieldTermStructure>(oisDiscountCurve)));*/ /********************* ** 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-FRA-futures-swap (on Euribor3M) curve std::vector<boost::shared_ptr<RateHelper> > depoFRAFutSwapInstruments; depoFRAFutSwapInstruments.push_back(d2w); depoFRAFutSwapInstruments.push_back(d3w); depoFRAFutSwapInstruments.push_back(d1m); depoFRAFutSwapInstruments.push_back(d2m); depoFRAFutSwapInstruments.push_back(Tom3M); depoFRAFutSwapInstruments.push_back(FUT3MZ2); depoFRAFutSwapInstruments.push_back(FUT3MH3); depoFRAFutSwapInstruments.push_back(FUT3MM3); depoFRAFutSwapInstruments.push_back(FUT3MU3); depoFRAFutSwapInstruments.push_back(FUT3MZ3); depoFRAFutSwapInstruments.push_back(FUT3MH4); depoFRAFutSwapInstruments.push_back(FUT3MM4); depoFRAFutSwapInstruments.push_back(FUT3MU4); depoFRAFutSwapInstruments.push_back(AB3E3Y); depoFRAFutSwapInstruments.push_back(AB3E4Y); depoFRAFutSwapInstruments.push_back(AB3E5Y); depoFRAFutSwapInstruments.push_back(AB3E6Y); depoFRAFutSwapInstruments.push_back(AB3E7Y); depoFRAFutSwapInstruments.push_back(AB3E8Y); depoFRAFutSwapInstruments.push_back(AB3E9Y); depoFRAFutSwapInstruments.push_back(AB3E10Y); depoFRAFutSwapInstruments.push_back(AB3E12Y); depoFRAFutSwapInstruments.push_back(AB3E15Y); depoFRAFutSwapInstruments.push_back(AB3E20Y); depoFRAFutSwapInstruments.push_back(AB3E25Y); depoFRAFutSwapInstruments.push_back(AB3E30Y); boost::shared_ptr<YieldTermStructure> depoFRAFutSwapTermStructure( new PiecewiseYieldCurve<Discount,LogLinear>( settlementDate, depoFRAFutSwapInstruments, termStructureDayCounter, tolerance)); return 0; } catch (std::exception& e) { std::cerr << e.what() << std::endl; return 1; } catch (...) { std::cerr << "unknown error" << std::endl; return 1; } } Thanks Jeffrey
------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |