Login  Register

Re: Curve building with depo, futures and swaps

Posted by Kim Kuen Tang on Jul 28, 2010; 6:32pm
URL: http://quantlib.414.s1.nabble.com/Curve-building-with-depo-futures-and-swaps-tp6907p6908.html


Hi P,

[hidden email] schrieb:
> 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.
>  
you seemed to have a runtime error. Can you provide a standalone example
where we can reproduce the error?
BTW did you put your code in a try/catch block to catch the runtime error?

-Kim

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


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users