Hi, This is a continuation of the discussion at http://quantlib.10058.n7.nabble.com/Valuing-CPI-Bond-at-real-yield-curve-td15354.html .I'm now in a tricky situation where there is a bit of overlap. Suppose my settlement date is 2014-05-27 and my observation lag is 4 months. What I want to do is use actual CPI indices up to the lagged date of 2014-01-27 (calculated by linear interpolation between 2014-01-01 and 2014-02-01) and for anything after that I want to use the zero inflation curve, which implies any index that is looked up for a date after 2014-01-27 will be exactly the same (no growth). My zero inflation curve already has a base date of 2014-01-27, and my historic CPI indices go up to April 2014. So there is a bit of overlap. At the moment, the ZeroInflationIndex.fixing() method prefers to use CPI indices if they are available. I want to rather use the zero inflation curve. There is a forecastTodaysFixing parameter which is currently ignored. I propose to implement the forecastTodaysFixing so that when a 'true' is passed to it, the method will rather using the forecasting part and thus use the zero inflation curve. In CPICoupon, where this method is called, I will check whether the zero inflation curve base date is before the CPICoupon's fixing date and if so, pass 'true'. Or the alternative is to introduce a new parameter in the CPIBond constructor and pass this through to CPICoupon to determine which of the two curves get preference. I'm posting here to ask what I should look out for? I don't want to introduce a breaking change. The fixing date methods are quite tricky and it took me a while to get my head around it. Any advice will be appreciated. As a sidenote, limiting the historic CPI indices up to an earlier date doesn't solve the problem. The algorithm uses the availability and observation lags to deduce up to which date the CPI index should be used. So if I exclude indices after 2014-02-01, then a lookup error occurs. regards, Francois Botha
------------------------------------------------------------------------------ HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing & Easy Data Exploration http://www.hpccsystems.com _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Francois,
sorry it took lo long---it seems that your post slipped through a crack and I lost track of it. So, in case you haven't gone ahead or given up yet: yes, I think you should enable the forecastTodaysFixing parameter so it's used in the ZeroInflationIndex::fixing() method. As for the CPICoupon, I'm not sure. A parameter that allows both behaviors seems safer at this point. In any case, I suggest you check if there are any test cases for this, and if not (as it's likely) you might add a few of them so we're sure that you get your desired behavior and nothing else breaks. Later, Luigi On Mon, Jun 9, 2014 at 12:33 PM, Francois Botha <[hidden email]> wrote: > Hi, > > This is a continuation of the discussion at > http://quantlib.10058.n7.nabble.com/Valuing-CPI-Bond-at-real-yield-curve-td15354.html > . > > To recap: I want to value a CPI Bond by discounting at the real yield curve > and input a zero inflation curve consisting only of 0 rates. I've > successfully constructed that curve using InterpolatedZeroCurve. This curve > is used for forecasting CPI indices. I also input historic CPI indices from > far back to the most recent available. > > I'm now in a tricky situation where there is a bit of overlap. Suppose my > settlement date is 2014-05-27 and my observation lag is 4 months. What I > want to do is use actual CPI indices up to the lagged date of 2014-01-27 > (calculated by linear interpolation between 2014-01-01 and 2014-02-01) and > for anything after that I want to use the zero inflation curve, which > implies any index that is looked up for a date after 2014-01-27 will be > exactly the same (no growth). > > My zero inflation curve already has a base date of 2014-01-27, and my > historic CPI indices go up to April 2014. So there is a bit of overlap. At > the moment, the ZeroInflationIndex.fixing() method prefers to use CPI > indices if they are available. I want to rather use the zero inflation > curve. There is a forecastTodaysFixing parameter which is currently ignored. > > I propose to implement the forecastTodaysFixing so that when a 'true' is > passed to it, the method will rather using the forecasting part and thus use > the zero inflation curve. In CPICoupon, where this method is called, I will > check whether the zero inflation curve base date is before the CPICoupon's > fixing date and if so, pass 'true'. Or the alternative is to introduce a new > parameter in the CPIBond constructor and pass this through to CPICoupon to > determine which of the two curves get preference. > > I'm posting here to ask what I should look out for? I don't want to > introduce a breaking change. The fixing date methods are quite tricky and it > took me a while to get my head around it. Any advice will be appreciated. > > As a sidenote, limiting the historic CPI indices up to an earlier date > doesn't solve the problem. The algorithm uses the availability and > observation lags to deduce up to which date the CPI index should be used. So > if I exclude indices after 2014-02-01, then a lookup error occurs. > > regards, > Francois Botha > > ------------------------------------------------------------------------------ > HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions > Find What Matters Most in Your Big Data with HPCC Systems > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. > Leverages Graph Analysis for Fast Processing & Easy Data Exploration > http://www.hpccsystems.com > _______________________________________________ > QuantLib-dev mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Thanks Luigi, I'm almost done with a Pull Request for this. It solves my usecase and you'll be glad to know that it concludes all my issues with bond yield curve bootstrapping :).Francois Botha
On 18 July 2014 14:47, Luigi Ballabio <[hidden email]> wrote: Hi Francois, ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Ok, glad to hear it. So Napoleon was right---half of one's letters
actually do answer themselves if one doesn't answer... Later, Luigi On Fri, Jul 18, 2014 at 2:49 PM, Francois Botha <[hidden email]> wrote: > Thanks Luigi, > > I'm almost done with a Pull Request for this. It solves my usecase and > you'll be glad to know that it concludes all my issues with bond yield curve > bootstrapping :). > > Before I can submit this PR, I have to complete the CPI reference period fix > that Peter and I are working on. > > Francois Botha > > > On 18 July 2014 14:47, Luigi Ballabio <[hidden email]> wrote: >> >> Hi Francois, >> sorry it took lo long---it seems that your post slipped through a >> crack and I lost track of it. So, in case you haven't gone ahead or >> given up yet: yes, I think you should enable the forecastTodaysFixing >> parameter so it's used in the ZeroInflationIndex::fixing() method. As >> for the CPICoupon, I'm not sure. A parameter that allows both >> behaviors seems safer at this point. In any case, I suggest you check >> if there are any test cases for this, and if not (as it's likely) you >> might add a few of them so we're sure that you get your desired >> behavior and nothing else breaks. >> >> Later, >> Luigi >> >> >> >> On Mon, Jun 9, 2014 at 12:33 PM, Francois Botha <[hidden email]> wrote: >> > Hi, >> > >> > This is a continuation of the discussion at >> > >> > http://quantlib.10058.n7.nabble.com/Valuing-CPI-Bond-at-real-yield-curve-td15354.html >> > . >> > >> > To recap: I want to value a CPI Bond by discounting at the real yield >> > curve >> > and input a zero inflation curve consisting only of 0 rates. I've >> > successfully constructed that curve using InterpolatedZeroCurve. This >> > curve >> > is used for forecasting CPI indices. I also input historic CPI indices >> > from >> > far back to the most recent available. >> > >> > I'm now in a tricky situation where there is a bit of overlap. Suppose >> > my >> > settlement date is 2014-05-27 and my observation lag is 4 months. What I >> > want to do is use actual CPI indices up to the lagged date of 2014-01-27 >> > (calculated by linear interpolation between 2014-01-01 and 2014-02-01) >> > and >> > for anything after that I want to use the zero inflation curve, which >> > implies any index that is looked up for a date after 2014-01-27 will be >> > exactly the same (no growth). >> > >> > My zero inflation curve already has a base date of 2014-01-27, and my >> > historic CPI indices go up to April 2014. So there is a bit of overlap. >> > At >> > the moment, the ZeroInflationIndex.fixing() method prefers to use CPI >> > indices if they are available. I want to rather use the zero inflation >> > curve. There is a forecastTodaysFixing parameter which is currently >> > ignored. >> > >> > I propose to implement the forecastTodaysFixing so that when a 'true' is >> > passed to it, the method will rather using the forecasting part and thus >> > use >> > the zero inflation curve. In CPICoupon, where this method is called, I >> > will >> > check whether the zero inflation curve base date is before the >> > CPICoupon's >> > fixing date and if so, pass 'true'. Or the alternative is to introduce a >> > new >> > parameter in the CPIBond constructor and pass this through to CPICoupon >> > to >> > determine which of the two curves get preference. >> > >> > I'm posting here to ask what I should look out for? I don't want to >> > introduce a breaking change. The fixing date methods are quite tricky >> > and it >> > took me a while to get my head around it. Any advice will be >> > appreciated. >> > >> > As a sidenote, limiting the historic CPI indices up to an earlier date >> > doesn't solve the problem. The algorithm uses the availability and >> > observation lags to deduce up to which date the CPI index should be >> > used. So >> > if I exclude indices after 2014-02-01, then a lookup error occurs. >> > >> > regards, >> > Francois Botha >> > >> > >> > ------------------------------------------------------------------------------ >> > HPCC Systems Open Source Big Data Platform from LexisNexis Risk >> > Solutions >> > Find What Matters Most in Your Big Data with HPCC Systems >> > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. >> > Leverages Graph Analysis for Fast Processing & Easy Data Exploration >> > http://www.hpccsystems.com >> > _______________________________________________ >> > QuantLib-dev mailing list >> > [hidden email] >> > https://lists.sourceforge.net/lists/listinfo/quantlib-dev >> > >> >> >> >> -- >> <https://implementingquantlib.blogspot.com> >> <https://twitter.com/lballabio> > > -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |