Hull White Short Rate Model

Overview

One of the primary models used to price interest rate derivatives is the Hull White Model. It is used because it is a simple model that can be easily calibrated.

Parameters

  • a - the mean reversion parameter
  • sigma - the volatility parameters
  • Time Grid or number of steps - parameters that indicate how to construct the binomial tree

Pydantic Classes

@dataclass class ShortRate(ts.TermStructureModel): pass @dataclass class TreeParameters: pass @dataclass class HullWhiteParameters(TreeParameters): pass @dataclass class HullWhiteParametersStep(HullWhiteParameters): steps:int pass @dataclass class HullWhiteParamtersTimeGrid(HullWhiteParameters): time_grid:cl.TimeGrid pass @dataclass class HullWhite(ShortRate): #mean reversion a:float sigma:float term_structure:ts.TermStructureModel parameters:HullWhiteParameters|None=None pass

Sample Code

import contracts as ct import valuation as vl import treasury as ty import qcalendar as cl #specify the bond contract schedule = ct.Schedule(start_date='2000-01-01', end_date='2030-01-01', frequency= ct.Frequency.Annual, calendar= cl.Calendar.USGovernmentBond, convention=ct.Convention.Following, dateroll=ct.DateRoll.Forward) bond = ct.FixedRateBond(settlement_days=2,face_value=10000, day_count=ct.DayCount.Actual360, coupons=0.05,schedule=schedule) #pull the treasury rates item,stack = ty.current() treasury_curve1 = cv.TreasuryCurve(data = [[x['period'], x['value']/100] for x in stack]) testvalue = vl.value(bond, treasury_curve1) d1 = testvalue.dirtyPrice() option1 = op.Option(date='2027-01-01', strike=pc.Price(value=10000,type=pc.PriceType.Clean), type=op.OptionType.Call) options = [option1] cschedule = op.CallSchedule(options) callbond = op.CallableFixedRateBond(settlement_days=2,face_value=10000, day_count=ct.DayCount.Actual360, coupons=0.05,schedule=schedule, call_schedule=cschedule) short_rate_model = sr.HullWhite(a=100,sigma=0.03,term_structure=treasury_curve1, parameters=sr.HullWhiteParametersStep(steps=40)) bondvalue = vl.value(contract=callbond, curve=short_rate_model) dirty = bondvalue.dirtyPrice()