Hi,
I try to use the solver function like Bisection or Newton method to find the root of the curve parallel shift to make sure the valuation result is very close to the market quotation. But, when I set the minimum boundary to -0.1, QuantLib throw out the exception the discount rate can not be the negative one. I know Quantlib allow user to set the discount rate to be negative one, But, I just want the RootFunction to find the result to the lowest one, but never to be negative one.
How can I achieve it? Many thanks regards Alex ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Yuanhao, As you are actually finding a root within some interval (e.g. (0.0, inf)), you can’t expect to find a “root” for sure. What you can do is to minimize the error within this interval. In such case I suggest you to use optimizer instead of root finder. QuantLib has a built-in framework for optimizer with constraint. E.g. you can use BFGS optimizer with boundary constraint like (0.0, inf). Under such setting, when optimizer hit the boundary it will stay there or try to find a better solution instead of throwing an error. Regards, Cheng 发件人: Yuanhao Zhang [mailto:[hidden email]] Hi, I try to use the solver function like Bisection or Newton method to find the root of the curve parallel shift to make sure the valuation result is very close to the market quotation. But, when I set the minimum boundary to -0.1, QuantLib throw out the exception the discount rate can not be the negative one. I know Quantlib allow user to set the discount rate to be negative one, But, I just want the RootFunction to find the result to the lowest one, but never to be negative one. How can I achieve it? Many thanks regards Alex ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
I want to make it easy to implement. I try to make the curve shift from the point after 3 month tenor to make it hard to get the negative discount rate. Use optimization maybe too complicated, and cost too much time on the optimization, if I have thousands of bond.
regards Alex 2014-05-28 10:47 GMT+08:00 cheng.li <[hidden email]>:
------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Yuanhao Maybe it is a little bit complicated than root finding… However if you are familiar with it, it won’t be too hard to start. Anyway I can’t come up any other idea which is suitable for your requirement. Regards, Cheng 发件人: Yuanhao Zhang [mailto:[hidden email]] I want to make it easy to implement. I try to make the curve shift from the point after 3 month tenor to make it hard to get the negative discount rate. Use optimization maybe too complicated, and cost too much time on the optimization, if I have thousands of bond. regards Alex 2014-05-28 10:47 GMT+08:00 cheng.li <[hidden email]>:
------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Many thanks Cheng, I would take a look at the optimization class and try it. regards Alex 2014-05-28 11:45 GMT+08:00 cheng.li <[hidden email]>:
------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hello,
optimization is a possibility, but are you sure of what you're doing? Negative rates are one thing (and QuantLib does allow them) but negative discount factors don't make sense... Luigi On Wed, May 28, 2014 at 7:44 AM, Yuanhao Zhang <[hidden email]> wrote: > Many thanks Cheng, I would take a look at the optimization class and try it. > > regards > > Alex > > > 2014-05-28 11:45 GMT+08:00 cheng.li <[hidden email]>: > >> Hi Yuanhao >> >> >> >> Maybe it is a little bit complicated than root finding… >> >> >> >> However if you are familiar with it, it won’t be too hard to start. >> >> >> >> Anyway I can’t come up any other idea which is suitable for your >> requirement. >> >> >> >> Regards, >> >> Cheng >> >> >> >> 发件人: Yuanhao Zhang [mailto:[hidden email]] >> 发送时间: 2014年5月28日 11:14 >> 收件人: cheng.li >> 抄送: QuantLib QuantLib >> 主题: Re: 答复: [Quantlib-users] negative discount rate >> >> >> >> I want to make it easy to implement. I try to make the curve shift from >> the point after 3 month tenor to make it hard to get the negative discount >> rate. >> >> Use optimization maybe too complicated, and cost too much time on the >> optimization, if I have thousands of bond. >> >> >> >> regards >> >> >> >> Alex >> >> >> >> 2014-05-28 10:47 GMT+08:00 cheng.li <[hidden email]>: >> >> Hi Yuanhao, >> >> >> >> As you are actually finding a root within some interval (e.g. (0.0, inf)), >> you can’t expect to find a “root” for sure. What you can do is to minimize >> the error within this interval. >> >> >> >> In such case I suggest you to use optimizer instead of root finder. >> QuantLib has a built-in framework for optimizer with constraint. E.g. you >> can use BFGS optimizer with boundary constraint like (0.0, inf). >> >> >> >> Under such setting, when optimizer hit the boundary it will stay there or >> try to find a better solution instead of throwing an error. >> >> >> >> Regards, >> >> Cheng >> >> >> >> >> >> >> >> 发件人: Yuanhao Zhang [mailto:[hidden email]] >> 发送时间: 2014年5月28日 10:19 >> 收件人: QuantLib QuantLib >> 主题: [Quantlib-users] negative discount rate >> >> >> >> Hi, >> >> I try to use the solver function like Bisection or Newton method to find >> the root of the curve parallel shift to make sure the valuation result is >> very close to the market quotation. >> >> But, when I set the minimum boundary to -0.1, QuantLib throw out the >> exception the discount rate can not be the negative one. I know Quantlib >> allow user to set the discount rate to be negative one, But, I just want the >> RootFunction to find the result to the lowest one, but never to be negative >> one. >> >> >> >> How can I achieve it? >> >> >> >> Many thanks >> >> >> >> regards >> >> >> >> Alex >> >> > > > > ------------------------------------------------------------------------------ > Time is money. Stop wasting it! Get your web API in 5 minutes. > www.restlet.com/download > http://p.sf.net/sfu/restlet > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Luigi,
I think here what he refers as "negative discount rate" actually means negative zero rates. Am I right Alex? Regards, Cheng -----邮件原件----- 发件人: Luigi Ballabio [mailto:[hidden email]] 发送时间: 2014年5月28日 15:32 收件人: Yuanhao Zhang 抄送: cheng.li; QuantLib QuantLib 主题: Re: [Quantlib-users] 答复: 答复: negative discount rate Hello, optimization is a possibility, but are you sure of what you're doing? Negative rates are one thing (and QuantLib does allow them) but negative discount factors don't make sense... Luigi On Wed, May 28, 2014 at 7:44 AM, Yuanhao Zhang <[hidden email]> wrote: > Many thanks Cheng, I would take a look at the optimization class and try it. > > regards > > Alex > > > 2014-05-28 11:45 GMT+08:00 cheng.li <[hidden email]>: > >> Hi Yuanhao >> >> >> >> Maybe it is a little bit complicated than root finding… >> >> >> >> However if you are familiar with it, it won’t be too hard to start. >> >> >> >> Anyway I can’t come up any other idea which is suitable for your >> requirement. >> >> >> >> Regards, >> >> Cheng >> >> >> >> 发件人: Yuanhao Zhang [mailto:[hidden email]] >> 发送时间: 2014年5月28日 11:14 >> 收件人: cheng.li >> 抄送: QuantLib QuantLib >> 主题: Re: 答复: [Quantlib-users] negative discount rate >> >> >> >> I want to make it easy to implement. I try to make the curve shift >> from the point after 3 month tenor to make it hard to get the >> negative discount rate. >> >> Use optimization maybe too complicated, and cost too much time on the >> optimization, if I have thousands of bond. >> >> >> >> regards >> >> >> >> Alex >> >> >> >> 2014-05-28 10:47 GMT+08:00 cheng.li <[hidden email]>: >> >> Hi Yuanhao, >> >> >> >> As you are actually finding a root within some interval (e.g. (0.0, >> inf)), you can’t expect to find a “root” for sure. What you can do is >> to minimize the error within this interval. >> >> >> >> In such case I suggest you to use optimizer instead of root finder. >> QuantLib has a built-in framework for optimizer with constraint. E.g. >> you can use BFGS optimizer with boundary constraint like (0.0, inf). >> >> >> >> Under such setting, when optimizer hit the boundary it will stay >> there or try to find a better solution instead of throwing an error. >> >> >> >> Regards, >> >> Cheng >> >> >> >> >> >> >> >> 发件人: Yuanhao Zhang [mailto:[hidden email]] >> 发送时间: 2014年5月28日 10:19 >> 收件人: QuantLib QuantLib >> 主题: [Quantlib-users] negative discount rate >> >> >> >> Hi, >> >> I try to use the solver function like Bisection or Newton method to >> find the root of the curve parallel shift to make sure the valuation >> result is very close to the market quotation. >> >> But, when I set the minimum boundary to -0.1, QuantLib throw out the >> exception the discount rate can not be the negative one. I know >> Quantlib allow user to set the discount rate to be negative one, But, >> I just want the RootFunction to find the result to the lowest one, >> but never to be negative one. >> >> >> >> How can I achieve it? >> >> >> >> Many thanks >> >> >> >> regards >> >> >> >> Alex >> >> > > > > ---------------------------------------------------------------------- > -------- Time is money. Stop wasting it! Get your web API in 5 > minutes. > www.restlet.com/download > http://p.sf.net/sfu/restlet > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
maybe it could be illuminating looking at the zSpread method in ql /
cashflows / cashflows.?pp, which does something similar to what you seem to try to achieve ? Peter On 28 May 2014 09:47, cheng.li <[hidden email]> wrote: > Hi Luigi, > > I think here what he refers as "negative discount rate" actually means negative zero rates. > > Am I right Alex? > > Regards, > Cheng > > -----邮件原件----- > 发件人: Luigi Ballabio [mailto:[hidden email]] > 发送时间: 2014年5月28日 15:32 > 收件人: Yuanhao Zhang > 抄送: cheng.li; QuantLib QuantLib > 主题: Re: [Quantlib-users] 答复: 答复: negative discount rate > > Hello, > optimization is a possibility, but are you sure of what you're doing? Negative rates are one thing (and QuantLib does allow them) but negative discount factors don't make sense... > > Luigi > > > On Wed, May 28, 2014 at 7:44 AM, Yuanhao Zhang <[hidden email]> wrote: >> Many thanks Cheng, I would take a look at the optimization class and try it. >> >> regards >> >> Alex >> >> >> 2014-05-28 11:45 GMT+08:00 cheng.li <[hidden email]>: >> >>> Hi Yuanhao >>> >>> >>> >>> Maybe it is a little bit complicated than root finding… >>> >>> >>> >>> However if you are familiar with it, it won’t be too hard to start. >>> >>> >>> >>> Anyway I can’t come up any other idea which is suitable for your >>> requirement. >>> >>> >>> >>> Regards, >>> >>> Cheng >>> >>> >>> >>> 发件人: Yuanhao Zhang [mailto:[hidden email]] >>> 发送时间: 2014年5月28日 11:14 >>> 收件人: cheng.li >>> 抄送: QuantLib QuantLib >>> 主题: Re: 答复: [Quantlib-users] negative discount rate >>> >>> >>> >>> I want to make it easy to implement. I try to make the curve shift >>> from the point after 3 month tenor to make it hard to get the >>> negative discount rate. >>> >>> Use optimization maybe too complicated, and cost too much time on the >>> optimization, if I have thousands of bond. >>> >>> >>> >>> regards >>> >>> >>> >>> Alex >>> >>> >>> >>> 2014-05-28 10:47 GMT+08:00 cheng.li <[hidden email]>: >>> >>> Hi Yuanhao, >>> >>> >>> >>> As you are actually finding a root within some interval (e.g. (0.0, >>> inf)), you can’t expect to find a “root” for sure. What you can do is >>> to minimize the error within this interval. >>> >>> >>> >>> In such case I suggest you to use optimizer instead of root finder. >>> QuantLib has a built-in framework for optimizer with constraint. E.g. >>> you can use BFGS optimizer with boundary constraint like (0.0, inf). >>> >>> >>> >>> Under such setting, when optimizer hit the boundary it will stay >>> there or try to find a better solution instead of throwing an error. >>> >>> >>> >>> Regards, >>> >>> Cheng >>> >>> >>> >>> >>> >>> >>> >>> 发件人: Yuanhao Zhang [mailto:[hidden email]] >>> 发送时间: 2014年5月28日 10:19 >>> 收件人: QuantLib QuantLib >>> 主题: [Quantlib-users] negative discount rate >>> >>> >>> >>> Hi, >>> >>> I try to use the solver function like Bisection or Newton method to >>> find the root of the curve parallel shift to make sure the valuation >>> result is very close to the market quotation. >>> >>> But, when I set the minimum boundary to -0.1, QuantLib throw out the >>> exception the discount rate can not be the negative one. I know >>> Quantlib allow user to set the discount rate to be negative one, But, >>> I just want the RootFunction to find the result to the lowest one, >>> but never to be negative one. >>> >>> >>> >>> How can I achieve it? >>> >>> >>> >>> Many thanks >>> >>> >>> >>> regards >>> >>> >>> >>> Alex >>> >>> >> >> >> >> ---------------------------------------------------------------------- >> -------- Time is money. Stop wasting it! Get your web API in 5 >> minutes. >> www.restlet.com/download >> http://p.sf.net/sfu/restlet >> _______________________________________________ >> QuantLib-users mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > > > > -- > <https://implementingquantlib.blogspot.com> > <https://twitter.com/lballabio> > > > ------------------------------------------------------------------------------ > Time is money. Stop wasting it! Get your web API in 5 minutes. > www.restlet.com/download > http://p.sf.net/sfu/restlet > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
thanks Peter i will try this function of cash flow.
Regards Alex
Peter Caspers <[hidden email]>于2014年5月29日星期四写道: maybe it could be illuminating looking at the zSpread method in ql / ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
I may correct it first, it is about the negative zero rate not discount rate, mis-wrote it, sorry about that. Peter, I have read the code of zspread in ql cashflows, the implementation is very similar to my work before, in which, use the rootfind function to find the accurate one. Have you ever met the result of the zspread to make the zero rate in the earlier tenor plus zspread to be negative one?
regards Alex 2014-05-29 8:30 GMT+08:00 Yuanhao Zhang <[hidden email]>: thanks Peter i will try this function of cash flow. ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Alex,
you should describe your whole use case in more detail. As Luigi said it is still not clear what you are trying to do in the first place. best regards Peter On 29 May 2014 04:55, Yuanhao Zhang <[hidden email]> wrote: > I may correct it first, it is about the negative zero rate not discount > rate, mis-wrote it, sorry about that. > > Peter, I have read the code of zspread in ql cashflows, the implementation > is very similar to my work before, in which, use the rootfind function to > find the accurate one. Have you ever met the result of the zspread to make > the zero rate in the earlier tenor plus zspread to be negative one? > > regards > > Alex > > > 2014-05-29 8:30 GMT+08:00 Yuanhao Zhang <[hidden email]>: > >> thanks Peter i will try this function of cash flow. >> >> Regards >> >> Alex >> >> Peter Caspers <[hidden email]>于2014年5月29日星期四写道: >>> >>> maybe it could be illuminating looking at the zSpread method in ql / >>> cashflows / cashflows.?pp, which does something similar to what you >>> seem to try to achieve ? >>> Peter >>> >>> On 28 May 2014 09:47, cheng.li <[hidden email]> wrote: >>> > Hi Luigi, >>> > >>> > I think here what he refers as "negative discount rate" actually means >>> > negative zero rates. >>> > >>> > Am I right Alex? >>> > >>> > Regards, >>> > Cheng >>> > >>> > -----邮件原件----- >>> > 发件人: Luigi Ballabio [mailto:[hidden email]] >>> > 发送时间: 2014年5月28日 15:32 >>> > 收件人: Yuanhao Zhang >>> > 抄送: cheng.li; QuantLib QuantLib >>> > 主题: Re: [Quantlib-users] 答复: 答复: negative discount rate >>> > >>> > Hello, >>> > optimization is a possibility, but are you sure of what you're >>> > doing? Negative rates are one thing (and QuantLib does allow them) but >>> > negative discount factors don't make sense... >>> > >>> > Luigi >>> > >>> > >>> > On Wed, May 28, 2014 at 7:44 AM, Yuanhao Zhang >>> > <[hidden email]> wrote: >>> >> Many thanks Cheng, I would take a look at the optimization class and >>> >> try it. >>> >> >>> >> regards >>> >> >>> >> Alex >>> >> >>> >> >>> >> 2014-05-28 11:45 GMT+08:00 cheng.li <[hidden email]>: >>> >> >>> >>> Hi Yuanhao >>> >>> >>> >>> >>> >>> >>> >>> Maybe it is a little bit complicated than root finding… >>> >>> >>> >>> >>> >>> >>> >>> However if you are familiar with it, it won’t be too hard to start. >>> >>> >>> >>> >>> >>> >>> >>> Anyway I can’t come up any other idea which is suitable for your >>> >>> requirement. >>> >>> >>> >>> >>> >>> >>> >>> Regards, >>> >>> >>> >>> Cheng >>> >>> >>> >>> >>> >>> >>> >>> 发件人: Yuanhao Zhang [mailto:[hidden email]] >>> >>> 发送时间: 2014年5月28日 11:14 >>> >>> 收件人: cheng.li >>> >>> 抄送: QuantLib QuantLib >>> >>> 主题: Re: 答复: [Quantlib-users] negative discount rate >>> >>> >>> >>> >>> >>> >>> >>> I want to make it easy to implement. I try to make the curve shift >>> >>> from the point after 3 month tenor to make it hard to get the >>> >>> negative discount rate. >>> >>> >>> >>> Use optimization maybe too complicated, and cost too much time on the >>> >>> optimization, if I have thousands of bond. >>> >>> >>> >>> >>> >>> >>> >>> regards >>> >>> >>> >>> >>> >>> >>> >>> Alex >>> >>> >>> >>> >>> >>> >>> >>> 2014-05-28 10:47 GMT+08:00 cheng.li <[hidden email]>: >>> >>> >>> >>> Hi Yuanhao, >>> >>> >>> >>> >>> >>> >>> >>> As you are actually finding a root within some interval (e.g. (0.0, >>> >>> inf)), you can’t expect to find a “root” for sure. What you can do is >>> >>> to minimize the error within this interval. >>> >>> >>> >>> >>> >>> >>> >>> In such case I suggest you to use optimizer instead of root finder. >>> >>> QuantLib has a built-in framework for optimizer with constraint. E.g. >>> >>> you can use BFGS optimizer with boundary constraint like (0.0, inf). >>> >>> >>> >>> >>> >>> >>> >>> Under such setting, when optimizer hit the boundary it will stay >>> >>> there or try to find a better solution instead of throwing an error. >>> >>> >>> >>> >>> >>> >>> >>> Regards, >>> >>> >>> >>> Cheng >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> 发件人: Yuanhao Zhang [mailto:[hidden email]] >>> >>> 发送时间: 2014年5月28日 10:19 >>> >>> 收件人: QuantLib QuantLib >>> >>> 主题: [Quantlib-users] negative> >>> >>> ------------------------------------------------------------------------------ >>> >>> > Time is money. Stop wasting it! Get your web API in 5 minutes. >>> > www.restlet.com/download >>> > http://p.sf.net/sfu/restlet >>> > _______________________________________________ >>> > QuantLib-users mailing list >>> > [hidden email] >>> > https://lists.sourceforge.net/lists/listinfo/quantlib-users > > ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Sorry, I did not make it clear. The use case is like this, suppose I have a spot rate curve, and I use this curve as the input to value a bond, but the bond valuation result is different from the market quotation. So I want to find the spread from the bond quotation, that is my original idea. I will parallel shift the curve by adding the spread, to fit the market price.
But if I parallel shift the curve downside, the spot rate of the term structure in the early tenor may appear to be negative one. I just want to avoid this situation, is there any solution I can refer to? Cheng Li's idea using the optimizer may be the choose, is there another one I can just use the solver to achieve it?
many thanks Alex 2014-05-29 18:20 GMT+08:00 Peter Caspers <[hidden email]>: Hi Alex, ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
then I would say, use the zSpread method directly (which should be
possible as long as exotic features like callability are not present). This will mean that you will use zero yield + z-spread as the effective discounting spread, even if negative. I would assume though that this is consistent with what is e.g. quoted as z-spread in BBG. best Peter On 30 May 2014 03:02, Yuanhao Zhang <[hidden email]> wrote: > Sorry, I did not make it clear. The use case is like this, suppose I have a > spot rate curve, and I use this curve as the input to value a bond, but the > bond valuation result is different from the market quotation. So I want to > find the spread from the bond quotation, that is my original idea. I will > parallel shift the curve by adding the spread, to fit the market price. > But if I parallel shift the curve downside, the spot rate of the term > structure in the early tenor may appear to be negative one. I just want to > avoid this situation, is there any solution I can refer to? Cheng Li's idea > using the optimizer may be the choose, is there another one I can just use > the solver to achieve it? > > many thanks > > Alex > > > 2014-05-29 18:20 GMT+08:00 Peter Caspers <[hidden email]>: > >> Hi Alex, >> you should describe your whole use case in more detail. As Luigi >> said it is still not clear what you are trying to do in the first >> place. >> best regards >> Peter >> >> On 29 May 2014 04:55, Yuanhao Zhang <[hidden email]> wrote: >> > I may correct it first, it is about the negative zero rate not discount >> > rate, mis-wrote it, sorry about that. >> > >> > Peter, I have read the code of zspread in ql cashflows, the >> > implementation >> > is very similar to my work before, in which, use the rootfind function >> > to >> > find the accurate one. Have you ever met the result of the zspread to >> > make >> > the zero rate in the earlier tenor plus zspread to be negative one? >> > >> > regards >> > >> > Alex >> > >> > >> > 2014-05-29 8:30 GMT+08:00 Yuanhao Zhang <[hidden email]>: >> > >> >> thanks Peter i will try this function of cash flow. >> >> >> >> Regards >> >> >> >> Alex >> >> >> >> Peter Caspers <[hidden email]>于2014年5月29日星期四写道: >> >>> >> >>> maybe it could be illuminating looking at the zSpread method in ql / >> >>> cashflows / cashflows.?pp, which does something similar to what you >> >>> seem to try to achieve ? >> >>> Peter >> >>> >> >>> On 28 May 2014 09:47, cheng.li <[hidden email]> wrote: >> >>> > Hi Luigi, >> >>> > >> >>> > I think here what he refers as "negative discount rate" actually >> >>> > means >> >>> > negative zero rates. >> >>> > >> >>> > Am I right Alex? >> >>> > >> >>> > Regards, >> >>> > Cheng >> >>> > >> >>> > -----邮件原件----- >> >>> > 发件人: Luigi Ballabio [mailto:[hidden email]] >> >>> > 发送时间: 2014年5月28日 15:32 >> >>> > 收件人: Yuanhao Zhang >> >>> > 抄送: cheng.li; QuantLib QuantLib >> >>> > 主题: Re: [Quantlib-users] 答复: 答复: negative discount rate >> >>> > >> >>> > Hello, >> >>> > optimization is a possibility, but are you sure of what you're >> >>> > doing? Negative rates are one thing (and QuantLib does allow them) >> >>> > but >> >>> > negative discount factors don't make sense... >> >>> > >> >>> > Luigi >> >>> > >> >>> > >> >>> > On Wed, May 28, 2014 at 7:44 AM, Yuanhao Zhang >> >>> > <[hidden email]> wrote: >> >>> >> Many thanks Cheng, I would take a look at the optimization class >> >>> >> and >> >>> >> try it. >> >>> >> >> >>> >> regards >> >>> >> >> >>> >> Alex >> >>> >> >> >>> >> >> >>> >> 2014-05-28 11:45 GMT+08:00 cheng.li <[hidden email]>: >> >>> >> >> >>> >>> Hi Yuanhao >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> Maybe it is a little bit complicated than root finding… >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> However if you are familiar with it, it won’t be too hard to >> >>> >>> start. >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> Anyway I can’t come up any other idea which is suitable for your >> >>> >>> requirement. >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> Regards, >> >>> >>> >> >>> >>> Cheng >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> 发件人: Yuanhao Zhang [mailto:[hidden email]] >> >>> >>> 发送时间: 2014年5月28日 11:14 >> >>> >>> 收件人: cheng.li >> >>> >>> 抄送: QuantLib QuantLib >> >>> >>> 主题: Re: 答复: [Quantlib-users] negative discount rate >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> I want to make it easy to implement. I try to make the curve shift >> >>> >>> from the point after 3 month tenor to make it hard to get the >> >>> >>> negative discount rate. >> >>> >>> >> >>> >>> Use optimization maybe too complicated, and cost too much time on >> >>> >>> the >> >>> >>> optimization, if I have thousands of bond. >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> regards >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> Alex >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> 2014-05-28 10:47 GMT+08:00 cheng.li <[hidden email]>: >> >>> >>> >> >>> >>> Hi Yuanhao, >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> As you are actually finding a root within some interval (e.g. >> >>> >>> (0.0, >> >>> >>> inf)), you can’t expect to find a “root” for sure. What you can do >> >>> >>> is >> >>> >>> to minimize the error within this interval. >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> In such case I suggest you to use optimizer instead of root >> >>> >>> finder. >> >>> >>> QuantLib has a built-in framework for optimizer with constraint. >> >>> >>> E.g. >> >>> >>> you can use BFGS optimizer with boundary constraint like (0.0, >> >>> >>> inf). >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> Under such setting, when optimizer hit the boundary it will stay >> >>> >>> there or try to find a better solution instead of throwing an >> >>> >>> error. >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> Regards, >> >>> >>> >> >>> >>> Cheng >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> >> >>> >>> 发件人: Yuanhao Zhang [mailto:[hidden email]] >> >>> >>> 发送时间: 2014年5月28日 10:19 >> >>> >>> 收件人: QuantLib QuantLib >> >>> >>> 主题: [Quantlib-users] negative> >> >>> >>> >> >>> >>> ------------------------------------------------------------------------------ >> >>> >> >>> > Time is money. Stop wasting it! Get your web API in 5 minutes. >> >>> > www.restlet.com/download >> >>> > http://p.sf.net/sfu/restlet >> >>> > _______________________________________________ >> >>> > QuantLib-users mailing list >> >>> > [hidden email] >> >>> > https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > >> > > > ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Sure, thanks Peter, and all. Best regards Alex 2014-05-30 20:24 GMT+08:00 Peter Caspers <[hidden email]>: then I would say, use the zSpread method directly (which should be ------------------------------------------------------------------------------ Time is money. Stop wasting it! Get your web API in 5 minutes. www.restlet.com/download http://p.sf.net/sfu/restlet _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |