## HullWhite2FactorModelParameters

A set of parameters are estimated from ATM swaption volatilities. Swaption volatilities are preferred to caplets to better estimate .Although assuming that are constant makes the calibration of this model considerably easier, in general, should be allowed a piecewise linear term structure dependent on the underlying swaptions.

For a set of ATM swaptions, we need to minimize:

Where is the price of the swaption under the model, is the market value of the swaption and is the corresponding weight. The market value is calculated using the standard pricing functions

To find a good minimum of the model value, basin hopping as implemented here as well as least squares optimization are used.

The error is algorithmically differentiated and then solved via brute-force monte carlo using tensorflow and scipy.

If the currency of the interest rate is not the same as the base currency, then a quanto correction needs to be made. Assume is the value of the interest rate/FX correlation price factor (can be estimated from historical data), then the FX rate follows:

with the short rate and the short rate in base currency. The short rate with a quanto correction is:

where and are standard Wiener processes under the rate currency's risk neutral measure and is the partial derivative of the instantaneous forward rate r(t,T) with respect to the maturity. date . Define:

Then are assigned:

This is simply assumed to work