|
From: Aleksis A. R. <ale...@go...> - 2020-06-08 15:32:08
|
Sure, essentially it’s run off this class:
class bermudanswaption():
def __init__(self, calendar,settlement, used_model, swap, ratecurves, index, swvolcube_clean, swapbase,
mean_reversion,position):
discount_curve = ratecurves.loc['discountcurve', 'ratecurves']
self.swvolcube = swvolcube_clean
self.swapbase = swapbase
self.used_model = used_model
self.discount_curve = discount_curve
self.position=position
fixed_schedule=swap.fixedSchedule()
exerciseDates = [calendar.advance(i, -ql.Period('2D')) for i in fixed_schedule][1:-1]
exercise = ql.BermudanExercise(exerciseDates)
stepDates = exerciseDates
self.exerciseDates=exerciseDates
sigmas = [ql.QuoteHandle(ql.SimpleQuote(0.01))]*(1+len(exerciseDates))
self.used_model = used_model
if settlement == 'physical':
type = 0
method = 1
else:
type = 1
method = 3
self.nsswaption = ql.NonstandardSwaption(swap, exercise, type, method)
gsr = ql.Gsr(ratecurves.loc[index, 'ratecurves'],
stepDates, sigmas, [ql.QuoteHandle(ql.SimpleQuote(mean_reversion))])
engine = ql.Gaussian1dNonstandardSwaptionEngine(gsr, 64, 7.0, True, False,
ql.QuoteHandle(ql.SimpleQuote(0)),
discount_curve, 2)
self.engine = ql.Gaussian1dSwaptionEngine(gsr, 64, 7.0, True, False, discount_curve)
self.nsswaption.setPricingEngine(engine)
self.model = gsr
> On 8 Jun 2020, at 15:50, Christofer Bogaso <bog...@gm...> wrote:
>
> Hi, could you please share your python code? Thanks,
>
> On Mon, Jun 8, 2020 at 8:00 PM Aleksis Ali Raza via QuantLib-users <qua...@li... <mailto:qua...@li...>> wrote:
> Hi. In case anyone has an explanation: I get a jagged behaviour in a my greeks when I define a (what is to my knowledge sensible) swaption smile using swaptionvolcube2.
>
> The greeks are being calculated by source bumping (using a 1bp shift for the rate delta, shown below along with the NPV). The behaviour isn’t too sensitive to the bump size.
>
> Portfolio 1 consists of a 1y4y otm payer swaption and Portfolio 2 of a same strike 5y otm bermudan swaption with annual calls (both valued using the Hull-White GSR model calibrated to the swaption vol cube with MaturityStrikeByDeltaGamma mode).
>
> The code is in Python.
>
> Thanks, Aleksis
>
>
> <optionanalysis_rate.png>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li... <mailto:Qua...@li...>
> https://lists.sourceforge.net/lists/listinfo/quantlib-users <https://lists.sourceforge.net/lists/listinfo/quantlib-users>
|