|
From: Luigi B. <lui...@gm...> - 2021-04-02 16:12:35
|
Hello,
I would have guessed that passing the forecastHandle to the index (as
you did) and relinking it would change the fixings as you expect. I
understand your code is probably proprietary, but is there any chance you
can post a simplified or abridged version we can run to reproduce the
issue? If not, try returning the index as well from the function that
builds the swaption, so after relinking the curve you can check if its
fixings change or not, or if the curve it contains is actually the one you
linked.
Hope this helps,
Luigi
On Fri, Apr 2, 2021 at 1:05 PM Philippe Hatstadt <
phi...@ex...> wrote:
> Thank you. I’m not sure about the exact steps to clone the libor index? I
> assume I would create an index inside the MC loop and link its curve to my
> stochastic curve, but how do I “assign” such index to a swap that already
> exists?
>
> Regards
>
> Philippe Hatstadt
> +1-203-252-0408
> https://www.linkedin.com/in/philippe-hatstadt
>
>
> On Apr 2, 2021, at 3:23 AM, Amine Ifri <ami...@gm...> wrote:
>
> Hi Philippe,
>
> I believe your forecastHandle variable - which is set to the MC curve
> generated for scénario i - is actually used for discounting only.
> discountingSwapEngine only affects the discounting and not the curves upon
> which the floating index is dependent.
>
> You need to “clone” the libor 3m index for your underlying swap and relink
> its curve to a MC curve as well.
>
> Amine Ifri
>
> On 2 Apr 2021, at 04:11, Philippe Hatstadt <
> phi...@ex...> wrote:
>
>
> I have built a Hull-White sequence via standard method, by following
> precisely the method in the QuantLib Cookbook, with sigma = 10% and
> mean_rev = 10%.
> My goal is to ultimately build an OAS model for some Agency CMOs, for
> which I am building a Monte-carlo engine.
> I also built a Jamshidian engine to compute a closed-form value of a
> european swaption as a test, to make sure that my MC valuation converges to
> the theoretical value.
> The convergence doesn't work, and I think it has to do with the
> floating index of the swaption, so let me explain.
>
> I first build a curve name forecastHandle of type
> ql.RelinkableYieldTermStructureHandle
> I then build a swaption object via my own build_swaption() function, along
> the lines of the swaption helpers from the Cookbook approach, which returns
> a ql.Swaption() object. The curve handle is passed to the build_swaption()
> call along with tenor, maturity and strike.
> I build the floating index as follows inside the function:
> libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle)
>
> Now switching to the MC calculation. I loop on all the sequences of
> short-term rates generated by my HW sequence. I verified that the expected
> value and the variance of the short-rate are the same as in the Cookbook.
> Lastly, in order to calculate the value of the swaption via MC
> integration, I do the following, which takes place inside a function called
> swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is
> the same handle that was used to build the swaption, including its libor_3m
> index.
>
> for i in range(num_paths):
> curve = hw_discount_curve(i)
> forecastHandle.linkTo(curve)
> engine = ql.DiscountingSwapEngine(forecastHandle)
>
> swap = my_swaption.underlyingSwap()
>
> swap.setPricingEngine(engine)
> swap_npv = swap.NPV()
> sum_pv += max(0, swap_npv)
> return sum_pv / num_paths
>
> I was therefore hoping that by linking the forecastHandle to each
> path-wise stochastic curve, the libor 3m index would also be path
> dependent. but somehow, that doesn't appear to be the case, as the floating
> rates for each reset do not change with each stochastic curve. So I am
> wondering what I am doing wrong?
>
> Help appreciated.
>
> Philippe Hatstadt
>
>
>
> Broker-Dealer services offered through Exos Securities LLC, member of SIPC
> <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck
> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important
> disclosures, click here
> <https://www.exosfinancial.com/general-disclosures>.
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
>
> Broker-Dealer services offered through Exos Securities LLC, member of SIPC
> <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck
> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important
> disclosures, click here
> <https://www.exosfinancial.com/general-disclosures>.
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|