Re: CPIbond

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: CPIbond

Mirko Raso-2
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.

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: CPIbond

Seyfullah ÇETİN
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
Reply | Threaded
Open this post in threaded view
|

Re: CPIbond

Luigi Ballabio
In reply to this post by Mirko Raso-2
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
Reply | Threaded
Open this post in threaded view
|

Re: CPIbond

Mirko Raso-2
In reply to this post by Mirko Raso-2
In the attached file,  the "patch" ... or simply the official cpibond.cpp file (QL 1.2) plus the following line in the Class constructor:

        ...
        // added to use the standard bond functions
        calculateNotionalsFromCashflows();
        ...


Hope it helps.
Cheers,

Mirko Raso

-----Messaggio originale-----
Da: Luigi Ballabio [mailto:[hidden email]]
Inviato: 13 April 2012 09:34
A: Seyfullah ÇETİN
Cc: Raso Mirko (ICCREA Holding); [hidden email]
Oggetto: Re: [Quantlib-users] CPIbond

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

cpibond.cpp (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CPIbond

Seyfullah ÇETİN
Ok, I have got one last question about CPIBond.

In the test suite, we have 2 observation lag settings. One for building the
inflation curve(observationLag) and one for building the
bond(contractobservationLag). What do these two stand for?

Thanks,

Seyfullah.

-----Original Message-----
From: Raso Mirko (ICCREA Holding) [mailto:[hidden email]]
Sent: Friday, April 13, 2012 1:59 PM
To: Luigi Ballabio; Seyfullah ÇETİN
Cc: [hidden email]
Subject: Re: [Quantlib-users] CPIbond

In the attached file,  the "patch" ... or simply the official cpibond.cpp
file (QL 1.2) plus the following line in the Class constructor:

        ...
        // added to use the standard bond functions
        calculateNotionalsFromCashflows();
        ...


Hope it helps.
Cheers,

Mirko Raso

-----Messaggio originale-----
Da: Luigi Ballabio [mailto:[hidden email]]
Inviato: 13 April 2012 09:34
A: Seyfullah ÇETİN
Cc: Raso Mirko (ICCREA Holding); [hidden email]
Oggetto: Re: [Quantlib-users] CPIbond

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

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.


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: CPIbond

Luigi Ballabio
In reply to this post by Mirko Raso-2
Ok, thanks.  I've added the fix to the svn repository.

Luigi

2012/4/13 Raso Mirko (ICCREA Holding) <[hidden email]>:

> In the attached file,  the "patch" ... or simply the official cpibond.cpp file (QL 1.2) plus the following line in the Class constructor:
>
>        ...
>        // added to use the standard bond functions
>        calculateNotionalsFromCashflows();
>        ...
>
>
> Hope it helps.
> Cheers,
>
> Mirko Raso
>
> -----Messaggio originale-----
> Da: Luigi Ballabio [mailto:[hidden email]]
> Inviato: 13 April 2012 09:34
> A: Seyfullah ÇETİN
> Cc: Raso Mirko (ICCREA Holding); [hidden email]
> Oggetto: Re: [Quantlib-users] CPIbond
>
> 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
>
> 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.

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: CPIbond

Luigi Ballabio
In reply to this post by Mirko Raso-2
The first is the lag used in the quoted inflation swaps used to build
the curve, the second is the lag used in the bond.  They're different
contract, so they might differ.

Luigi

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

> Ok, I have got one last question about CPIBond.
>
> In the test suite, we have 2 observation lag settings. One for building the
> inflation curve(observationLag) and one for building the
> bond(contractobservationLag). What do these two stand for?
>
> Thanks,
>
> Seyfullah.
>
> -----Original Message-----
> From: Raso Mirko (ICCREA Holding) [mailto:[hidden email]]
> Sent: Friday, April 13, 2012 1:59 PM
> To: Luigi Ballabio; Seyfullah ÇETİN
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] CPIbond
>
> In the attached file,  the "patch" ... or simply the official cpibond.cpp
> file (QL 1.2) plus the following line in the Class constructor:
>
>        ...
>        // added to use the standard bond functions
>        calculateNotionalsFromCashflows();
>        ...
>
>
> Hope it helps.
> Cheers,
>
> Mirko Raso
>
> -----Messaggio originale-----
> Da: Luigi Ballabio [mailto:[hidden email]]
> Inviato: 13 April 2012 09:34
> A: Seyfullah ÇETİN
> Cc: Raso Mirko (ICCREA Holding); [hidden email]
> Oggetto: Re: [Quantlib-users] CPIbond
>
> 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
>
> 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.
>
>
> ------------------------------------------------------------------------------
> Better than sec? Nothing is better than sec when it comes to
> monitoring Big Data applications. Try Boundary one-second
> resolution app monitoring today. Free.
> http://p.sf.net/sfu/Boundary-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users