maturity of instrument in curve

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

maturity of instrument in curve

Xavier.Abulker
Hello Quantlib
could you please help me to retreive the maturity of instruments in a yield
curve?

1) I define the following yield curve

// deposits segment
        double d2dQuote=0.036;
        double d1mQuote=0.037;
        double d3mQuote=0.038;
        double d6mQuote=0.039;
//********************************************
Handle<MarketElement> d2dRate(new SimpleMarketElement(d2dQuote));
        Handle<MarketElement> d1mRate(new SimpleMarketElement(d1mQuote));
        Handle<MarketElement> d3mRate(new SimpleMarketElement(d3mQuote));
        Handle<MarketElement> d6mRate(new SimpleMarketElement(d6mQuote));
Handle<RateHelper> d2d(new DepositRateHelper(
            RelinkableHandle<MarketElement>(d2dRate), settlementDays,
            2, Days, calendar, nonBdConv, dayCountConvention));
//************************************************
        Handle<RateHelper> d1m(new DepositRateHelper(
            RelinkableHandle<MarketElement>(d1mRate), settlementDays,
            1, Months, calendar, nonBdConv, dayCountConvention));

        Handle<RateHelper> d3m(new DepositRateHelper(
            RelinkableHandle<MarketElement>(d3mRate), settlementDays,
            3, Months, calendar, nonBdConv, dayCountConvention));

        Handle<RateHelper> d6m(new DepositRateHelper(
            RelinkableHandle<MarketElement>(d6mRate), settlementDays,
            6, Months, calendar, nonBdConv, dayCountConvention));
//*****************************************************

2) push back the instruments in the curve

std::vector<Handle<RateHelper> > depoSwapInstruments;
        depoSwapInstruments.push_back(d2d);
        depoSwapInstruments.push_back(d1m);
        depoSwapInstruments.push_back(d3m);
        depoSwapInstruments.push_back(d6m);

3) I'd like to retreive the maturity of the second instrument

I tried  std::cout<<DateFormatter::toString(depoSwapInstruments[1]
->maturity())<<std::endl;
without success

Thanks for your help

Xavier


*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration.
La Fimat et ses filiales declinent toute responsabilite au
titre de ce message s'il a ete altere, deforme ou falsifie.
                    ********
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
E-mails are susceptible to alteration.
Neither Fimat nor any of its subsidiaries or affiliates shall
be liable for the message if altered, changed or falsified.
*************************************************************************