Login  Register

Curve building with depo, futures and swaps

Posted by tarpanelli@libero.it on Jul 25, 2010; 2:17pm
URL: http://quantlib.414.s1.nabble.com/Curve-building-with-depo-futures-and-swaps-tp6907.html

Hello,

I am just trying to build a curve by using the swap rates, futures and depos
but I am having a very strange error (my system crash). Before re-installing I
would like to know if someone of you see some error in my piece of code that I
used. May be there is some error that I cant see.

Legenda = instruments is just a vector containing Rates and prices for depo,
swap and futures.
Everithing looks works well till when I added the RateHelper for swap! In fact
if I delete the swaps everithing works and I can use the PieceWise Yield
curve.


Rgrds

P

-----------------------------------------------------------------------------------------------------
Code Below
----------------------------------------------------------------------------

// Deposit instruments <---
deporates = instruments[nInst+i];
boost::shared_ptr<Quote> depoquotes(new SimpleQuote(deporates));
boost::shared_ptr<RateHelper> deporatehelper(new DepositRateHelper
(Handle<Quote>(depoquotes),
                                                     numtenor * tenor,
                                                     fixingdays,
                                                                  cal,
                                                     rollconvention,
                                                     false,
                                                     daycount));
  instrumentCollection.push_back(deporatehelper);
                                                                                                               
// Future instruments <---
futprices = instruments[nInst+i];
boost::shared_ptr<Quote> futquotes(new SimpleQuote(futprices));
Date expdate((int)instruments[4*nInst+i] + 1);
Date iMMdates = IMM::nextDate(expdate);
boost::shared_ptr<RateHelper> futratehelper(new FuturesRateHelper(Handle<Quote>
(futquotes),
                    iMMdates,
                                           futmonths,
                                           cal,
                                           rollconvention,
                                           false,
                                          daycount));
instrumentCollection.push_back(futratehelper);

// Swap instruments <---
swrates = instruments[nInst+i];
boost::shared_ptr<Quote> swquotes(new SimpleQuote(swrates));
boost::shared_ptr<RateHelper> swratehelper(new SwapRateHelper(Handle<Quote>
(swquotes),
                      numtenor * Years,
                                                           cal,
                                                          swFixedLegFreq,       // Annual
                                                          rollconvention,            // Unadjusted
                                                          swFixedLegDc,          // Thirty360(thirty360::
European)
                                                          swFloatingLegIndex));   // Euribor6M
instrumentCollection.push_back(swratehelper);

// Yield curve constructor
double tolerance = 1.0e-15;
boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(new
PiecewiseYieldCurve<Discount,LogLinear>(referencedate,
                                                                                               instrumentCollection,
                                                                                   daycount,
                                                                                   tolerance));
RelinkableHandle<YieldTermStructure> discountCurve;

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users