|
From: Sumit S. <su...@mo...> - 2019-12-27 15:17:12
|
hi Pedro, I found the issue. I was initialising the ZeroCurve and then , later, updating it during the curve fitting process. Hence, I had to set the enableExtrapolate() in 2 places - one during the init phase and second time whilst I update the ZeroCurve. I actually thought just initialising the ZeroCurve with the enableExtrapolate() should suffice - but clearly that wasn;t the case. Thanks a lot for your prompt help!! Regards Sumit On Fri, 27 Dec 2019 at 14:23, Pedro Coelho <coe...@gm...> wrote: > Hum... Hard to know what happened without the full code. Can you send an > example of what are you doing? > > Em sex, 27 de dez de 2019 às 11:21, Sumit Sengupta < > su...@mo...> escreveu: > >> Thanks Pedro. However, the above line gives me this error:- >> >> def __init__(self, *args): >> > this = _QuantLib.new_YieldTermStructureHandle(*args) >> E NotImplementedError: Wrong number or type of arguments for >> overloaded function 'new_YieldTermStructureHandle'. >> E Possible C/C++ prototypes are: >> E Handle< YieldTermStructure >::Handle(boost::shared_ptr< >> YieldTermStructure > const &) >> E Handle< YieldTermStructure >::Handle() >> >> ..\..\..\Anaconda3\envs\pricer-end\lib\site-packages\QuantLib\QuantLib.py:5719: >> NotImplementedError >> >> On Fri, 27 Dec 2019 at 14:13, Pedro Coelho <coe...@gm...> wrote: >> >>> Just a typo, I forgot the QLZeroCurve in the statement below: >>> >>> zc_extrapolated = YieldTermStructureHandle(self.z_discurve_1.QLZeroCurve) >>> >>> >>> Em sex., 27 de dez. de 2019 às 11:11, Pedro Coelho < >>> coe...@gm...> escreveu: >>> >>>> Hi Sumit, >>>> >>>> Just write as the below: >>>> >>>> # enableExtrapolation returns nothing, so you just have to call it alone >>>> >>>> self.z_discurve_1.QLZeroCurve.enableExtrapolation() >>>> >>>> # Than pass the curve to a Handle, in this case the YieldTermStructureHandle >>>> >>>> zc_extrapolated = YieldTermStructureHandle(self.z_discurve_1) >>>> >>>> engine = ql.DiscountingSwapEngine(zc_extrapolated) >>>> >>>> >>>> Regards, >>>> >>>> Pedro Coelho >>>> >>>> >>>> >>>> Em sex., 27 de dez. de 2019 às 10:54, Sumit Sengupta < >>>> su...@mo...> escreveu: >>>> >>>>> Hi, >>>>> >>>>> I have a 50y swap which I am trying to price using a ZeroCurve that I've fitted. However, the maturity of my zero curve is for *30Y.* >>>>> >>>>> Hence I modify the below statement.... >>>>> >>>>> engine = ql.DiscountingSwapEngine(self.z_discurve_1.QLZeroCurve) >>>>> self.QL_Swap1.setPricingEngine(engine) >>>>> >>>>> to >>>>> >>>>> zc_extrapolated = self.z_discurve_1.QLZeroCurve.enableExtrapolation() >>>>> >>>>> engine = ql.DiscountingSwapEngine(*zc_extrapolated*) >>>>> self.QL_Swap1.setPricingEngine(engine) >>>>> >>>>> However, the ql.DiscountingSwapEngine(...) line gives me an error:- >>>>> >>>>> def __init__(self, *args): >>>>> > this = _QuantLib.new_DiscountingSwapEngine(*args) >>>>> E ValueError: invalid null reference in method 'new_DiscountingSwapEngine', argument 1 of type 'Handle< YieldTermStructure > const &' >>>>> >>>>> Any help on how to correctly extrapolate my ZeroCurve would be >>>>> appreciated. >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> Sumit >>>>> >>>>> _______________________________________________ >>>>> QuantLib-users mailing list >>>>> Qua...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>>>> >>>> >> >> -- >> Mosaic Smart Data >> >> mobile +44 (0)7961839363 >> su...@mo... >> 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom >> <https://www.google.com/maps/search/25+Finsbury+Circus+%E2%96%AB+EC2M+7EE+%E2%96%AB+London+%E2%96%AB%C2%A0United%C2%A0Kingdom?entry=gmail&source=g> >> www.mosaicsmartdata.com >> > -- Mosaic Smart Data mobile +44 (0)7961839363 su...@mo... 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom www.mosaicsmartdata.com |