Re: CPIbond

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Re-CPIbond-tp5825p5830.html

I think that's correct.  Do you have a patch you can send?

Thanks,
    Luigi

2012/4/13 Seyfullah ÇETİN <[hidden email]>:

> Hi Mirko,
>
> Investigating the code I found the same, too. I added
> calculateNotionalsFromCashflows() to the CPIBond constructor. But I was just
> not so sure if it was the right solution. But the clean price seems to be
> generated correctly.
>
> -----Original Message-----
> From: Raso Mirko (ICCREA Holding) [mailto:[hidden email]]
> Sent: Thursday, April 05, 2012 12:39 PM
> To: Seyfullah ÇETİN
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] CPIbond
>
> Hi all,
>  I've got the same problem on using cleanprice() method for the cpibond,
> while it disappers when the NPV() method is invoked, as done in the test
> suite.
>  Problems arise even calling other methods such as, for example,
> accruedamount(...), dirtyprice() or yield(...).
>
>  Investigating the code the problem seems to be connected to the missing
> generation of the notional schedule of the bond
> (notionalSchedule_ and notionals_  property).
>  In fact, due to the its "inflation nature", the cpibond doesn't call the
> addRedemptionsToCashflows(...) method because redemption is managed
>  directly by the inflationCashFlow class and, consequently,  no notional
> schedule is build.
>
>  An easy  workaround (I tested and works fine) is adding a call to
> calculateNotionalsFromCashflows() method in the class definition
>  which generates the required schedule  but doesn't alter the bond cashflows
> and, more important, the final price.
>
>
> Let me know if I missed some other aspects in the global cpibond management
> or if there's another more appropriate solution.
>
> Ciao,
> Mirko
>
> -----Messaggio originale-----
> Da: Seyfullah ÇETİN [mailto:[hidden email]]
> Inviato: 22 March 2012 09:15
> A: [hidden email]
> Cc: 'Luigi Ballabio'
> Oggetto: Re: [Quantlib-users] CPIbond
>
> Hi again,
>
> Here is the code. It is pretty much same as the the one in test suite.
>
> In the line when I try to get the cleanprice() (cpiB.cleanPrice();), I get a
> "Vector iterator offset out of range" exception.
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Tuesday, March 20, 2012 3:40 PM
> To: Seyfullah ÇETİN
> Subject: Re: [Quantlib-users] CPIbond
>
> May you send to the mailing list some code that reproduces the problem?
>
>
> 2012/3/20 Seyfullah ÇETİN <[hidden email]>:
>> We get a C++ vector exception.  It is thrown when Bond::notional(Date
>> d)
> is
>> called. It is because notionalSchedule_ is empty I guess.
>>
>>
>>
>> From: Luigi Ballabio [mailto:[hidden email]]
>> Sent: Tuesday, March 20, 2012 1:47 PM
>> To: Seyfullah ÇETİN
>> Cc: [hidden email]
>> Subject: Re: [Quantlib-users] CPIbond
>>
>>
>>
>> 2012/3/16 Seyfullah ÇETİN <[hidden email]>
>>
>> I haven't seen many examples of CPIBond usage. There is only one in
>> test suite which is used for CPI Swap constintency. I tried to use
>> some parts
> of
>> that code chunk to create a CPIbond and access its methods. I can get
>> some of them but for example, I can not access cleanprice(), it throws
>> an exception. Is CPIbond a useable class or just still under construction?
>>
>>
>> It should be usable.  What is the message of the exception? Setting up
>> the inflation curves might be tricky.
>>
>> Luigi
>>
>>
>>
>>
>> --
>> This message has been scanned for viruses and dangerous content by
>> MailScanner, and is believed to be clean.
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
> AVVISO DI RISERVATEZZA
>
> Il testo e gli eventuali documenti trasmessi contengono informazioni
> riservate al destinatario indicato.
> La seguente e-mail è confidenziale e la sua riservatezza è tutelata
> legalmente dalle normative vigenti.
> La lettura, copia od altro uso non autorizzato o qualsiasi altra azione
> derivante dalla conoscenza di queste informazioni sono rigorosamente
> vietate. Se si ritiene di non essere il destinatario di questa mail, o se si
> è ricevuto questa mail per errore, si prega di darne immediata comunicazione
> al mittente e di provvedere immediatamente alla sua distruzione.
>
>
> PRIVACY NOTICE
>
> The information contained in this transmittal, including any attachments
> hereto, are confidential and
> privileged, and intended solely for the specified addressee(s). This e-mail
> has a confidential nature which is protected by the Italian law. Moreover,
> the recipient(s) may not disclose, forward, or copy this e-mail or
> attachments, or any portion thereof, or permit the use of this information,
> by anyone not entitled to it, or in a way that may be damaging to the
> sender. If you are not the intended addressee, or if you receive
> this message by error, please notify the sender and delete this information
> from your computer.
>
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users