|
From: Michael (D. portal) <mi...@da...> - 2024-05-20 17:48:43
|
Hi Luigi/Philippe: Thanks a lot for your very valuable feedback! We have implemented scenario based OAS calculations as follows: 1. A user selects a number of interest rate scenarios (e.g. base, 2 rally, 2 selloff, etc) 2. For each scenario (in step 1) we calculate a bond Future Price (using a prepayment vector that corresponds to an interest rate scenario) 3. Scenario Based OAS = (Expected Price (across Future Prices in 2) - Initial Price)/Spread01 We are not sure how to calculate probabilities for the user input scenarios (in step 1) though that would reflect implied volatilities. What would be the best way to do this in QuantLib? Thanks, Michael On Mon, May 20, 2024 at 9:33 AM Philippe Hatstadt <pha...@ma...> wrote: > A few things: > 1. For scenario based OAS, speed is really not an issue as you are un > likely to compute more than a few dozens or even hundred prices per > iteration of the OAS solver (also see my point below about massive increase > on OAS solving algo) > 2. For Monte-Carlo, speed obviously matters more. If you calibrate a > stochastic model to swaption (or treasury swaptions as I've seen it called, > deriving UST bond option volatility surface for SOFR swaption surface) then > you don't need to compute path probabilities as they are equal under the RN > measure. > 3. As far as QL utilities to build curves from a given stochastic path and > discount a given cash flow path, there are no such utilities. If you use a > log-linear discount factor curve, you can get speed by only storing the x-y > coordinates (monthly). Then use standard QL objects to discount the cash > flows once generated. > 4. One trick you can use for OAS speed is to consider that exp((-rf+ > oas)(T-t)) = exp(-rf(T-t)) * exp(oas(T-t)). In turn, for each path, you can > pre-calculate all cash flow vectors CF(T-t) on the risk-free curve, and for > each iteration of OAS, only recompute exp(oas(T-t)) vectors and apply them > to the more complex pre-computed CF(T-t) vectors. This "orthogonalization" > is legit, because your prepayment model should only depend on the risk-free > curve for a given path, and usually, the prepayment calculations are slow. > Stated differently, you only need to apply the prepayment model once for > each path and there is no need to call it again for other intermediate oas > guess values. > 5. Which brings us to the OAS discussion. If you feel comfortable (I do > not) using a one factor model, then you should be able to find both the > engine and the calibration routines in QL (HW 1F as suggested by Luigi). > However, the slope of the curve is considered important, so a two-factor > model is needed. The only one I am aware of in QL is the G2++ model, but > unfortunately, there is no time-tested calibration routine for it, as the > renowned quant who built it passed away and sadly never got to finish it. > Luigi has a Python PR outstanding to verify the input compatibility of some > calibration routines (which I do not have enough time to address - > apologies Luigi). So as long as you are comfortable with a one factor model > for the stochastic part of your endeavor, you should be ok, otherwise, not > sure there is an easy approach unless you go to C++ and dig deep into > existing calibration routines for g2++ which may or not have been tested. > > Philippe Hatstadt > > On May 20, 2024, at 4:49 AM, Luigi Ballabio <lui...@gm...> > wrote: > > > Hi Michael, > > 1. a very interesting question but I'm not sure of the answer. I'm > guessing you could use a root solver for the spread given the prices > implied by the new curves, but I'm probably missing a lot of details. > 2. I think the closest we have is the possibility to generate future > interest-rate paths via Monte Carlo given a Hull-White process (which in > turn would be calibrated from a volatility surface). > 3. At the moment, I guess the best way would be to extend the swig > wrappers and recompile the wheel to add a call taking a list of dates and > this moving the loop to C++. I don't know how feasible that is for you, > though... > > Luigi > > > On Fri, May 3, 2024 at 3:53 PM Michael (DataDriven portal) < > mi...@da...> wrote: > >> Hi Luigi: >> >> Thanks for getting back to me! >> >> To be specific, we use QuantLib for mortgage bond pricing e.g. calculate >> yields, spreads, durations given mortgage performance inputs (e.g. >> prepayments or default vectors). This works quite well for static metrics >> that rely on a single yield curve input. But we also would like to >> calculate option adjusted measures (e.g. OAS - option adjusted spread) that >> require inputs of many yield curves (e.g. with high/lower rates leves, >> flatter/steeper curve shapes). >> >> So a few specific questions I have are as follows: >> >> 1. What is the best way to generate option adjusted metrics (e.g. OAS) in >> QuantLib if user inputs yield curves with associated probabilities? >> 2. Can QuantLIb generate future yield curves with associated >> probabilities based on current structure of term structure of interest >> rates and volatility surface? >> 3. What is the best way to retrieve the yield curve details for cash >> flows calculations (e.g. monthly discount factors for 360 months which is a >> typical number of cash flows for a mortgage bond)? We tried a *discount* >> method for each month separately but it takes too long. >> >> Thanks, >> >> Michael >> >> On Fri, May 3, 2024 at 4:06 AM Luigi Ballabio <lui...@gm...> >> wrote: >> >>> Hi Michael, apologies for the delay. I'm not sure what's the most >>> effective way to do this. Well, no, scratch that—the most efficient way >>> would be to do it in C++. From Python, if you have a process available >>> (such as HullWhiteProcess, for instance) you can use the available >>> PathGenerator class. What kind of simulation do you have in mind? >>> >>> Luigi >>> >>> >>> On Sat, Apr 20, 2024 at 5:49 PM Michael (DataDriven portal) < >>> mi...@da...> wrote: >>> >>>> Hi Luigi: >>>> >>>> Thank you for getting back to me! >>>> >>>> What is the most efficient way to do Monte Carlo simulations in >>>> QuantLib when I need to obtain multiple paths of yield curves for different >>>> scenarios (they do not have to be vectors of DFs but could be FRAs or any >>>> other rate metrics)? >>>> >>>> Thanks, >>>> >>>> Michael >>>> >>>> On Sat, Apr 20, 2024 at 10:59 AM Luigi Ballabio < >>>> lui...@gm...> wrote: >>>> >>>>> Hello Michael, >>>>> no, I'm afraid vector methods are not available. >>>>> >>>>> Luigi >>>>> >>>>> >>>>> On Sun, Apr 14, 2024 at 8:30 PM Michael (DataDriven portal) < >>>>> mi...@da...> wrote: >>>>> >>>>>> Hi All, >>>>>> >>>>>> I am using a *discount* method on a curve to get a discount factor >>>>>> for a given maturity (like in shown in the Cookbook below). But I need to >>>>>> output discount factors for all monthly cash flows of a bond (in my case >>>>>> 360 cash flows) so it is time consuming to call the *discount* method >>>>>> 360 times. >>>>>> >>>>>> Is there a way to get all discount factors (for all cash flows - 360 >>>>>> in my case) in a single call to a curve by passing all maturity dates (e.g. >>>>>> in a list) to speed up the calculations? >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Michael >>>>>> >>>>>> <image.png> >>>>>> _______________________________________________ >>>>>> QuantLib-users mailing list >>>>>> Qua...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>>>>> >>>>> Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > <untitled attachment> > > > |