I am doing a project for university and I'm stuck at some point. The aim is to implement the Gram-Charlier expansion into the 2-factor Hull-White model with Drift extension.

I already found out how to implement it without drift extension but I'm not quite sure how to calculate it with. Can anyone help me?

These are the formulas I already have:

- Bond price under the affine term structure model: $P(t,T)=exp \{ A(t,T) + B(t,T)^{\top}X(t) \}$
- moment generating function: $M_m(t)=E^{T_0}[SV(T_0)^m | X_t]=\sum \limits_{0\leq i_1, \cdots ,\leq i_m \leq N} a_{i_1}*\cdots * a_{i_m} \mu^{T_0}(t,T_0, \{T_{i_1},\cdots ,T_{i_m} \} )$ where $a_i$ are the Cash-flow amounts calculated from $SV(t)=-P(t,T_0)+\delta K \sum_{I=1}^N P(t,T_i)+P(t,T_N) = \sum \limits_{i=0}^Na_iP(t,T_i)$
- $\mu^T(t, T_0, \{T_1, \cdots , T_m \}) = \frac{exp \{M(t) + N(t)^{\top}X(t) \} }{P(t,T)}$
- Swaption Price of Lth-order: $ SOV(t) = C_1 \varphi(\frac{C_1}{\sqrt{C_2}})+\sqrt{C_2} \theta(\frac{C_1}{\sqrt{C_2}})+\sqrt{C_2}\theta(\frac{C_1}{\sqrt{C_2}})\sum \limits_{n=3}^L (-1)^nq_nH_{n-2}(\frac{C_1}{\sqrt{C_2}})$ where $\varphi$ is the normal density and $\theta$ is the cumulative distribution function
- $A(t,T)=-(T-t)(-\frac12 \sum \limits_{i=1}^n \sum \limits_{j=1}^n \frac{\rho_{ij} \sigma_i \sigma_j}{K_iK_j}(1-D[K_i(T-t)]-D[K_j(T-t)]+D[(K_i+K_j)(T-t)])$
- and $B(t,T)=-\tau D[K_j(T-t)]$ where $D[x]=(1-e^{-x})/x$
- M(t) and N(t) are solutions of differential equations and X(t) is a Markov-state vector with $dX_t=K(\theta-X_t)dt + \sum D(X_t)dW_t$ where $\sum$ is a Matrix such that $\sum \sum^{\top}$ is positive definite

I know that for a model with drift extension I need $P(t,T)= \exp \{ -\int \limits_{t}^T \Theta(u)du + A(t,T) +B(t,T)^{\top}X(t) \}$ where $\Theta(u)$ is the drift extension

My question now is: How do I integrate the drift extension in the Rest of the formulas respectively which formula changes at all? And how do I then calculate the Drift extension in my program?

Thank you already in advance, I'm really stuck!