R: Re: Curve building with depo, futures and swaps

Posted by tarpanelli@libero.it on
URL: http://quantlib.414.s1.nabble.com/R-Re-Curve-building-with-depo-futures-and-swaps-tp6986.html

Hi Kim,

the code is in try /catch block....
The code is into a mex file (it receives data from Matlab and returns the
results to Matlab)
The strange thing is this:
if I use just Depo and Futures I can build the yield curve and get discount
factors, rates computed correctly by quantlib into Matlab without no problem,
but when I added the swap rates, so I use the SwapRateHelper the system crashes
and returns me this exception:
 
QuantLib::Error at memory location 0x00c2d760..

And the same exception I have if I use bond instruments, when I go to
implement the Schedule.

Thanks in advance,
ciao
P

>----Messaggio originale----
>Da: [hidden email]
>Data: 28/07/2010 20.32
>A: "[hidden email]"<[hidden email]>
>Cc: <[hidden email]>
>Ogg: Re: [Quantlib-users] Curve building with depo, futures and swaps
>
>
>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