# Internal Design of HWA Engine¶

## Implementation¶

### Zero Coupon Bond Price¶

The zero coupon bond price for Hull White One Factor Model is calculated using the following:

These input parameters are:

\(a\) - the mean reversion

\(\sigma\) - the volatility

\(t\) - the current time

\(T\)- the maturity

\(r(t)\) - the short rate at time t

### Equity Option Pricing¶

The price at time t of a European Call option with strike X, maturity T on a discount bond maturing at time S is given by:

The price at time t of a European Put option with strike X, maturity T on a discount bond maturing at time S is given by:

The terms are derived from:

### Cap/Floor¶

ZBC & ZBP can be used to price caps & floors since they can be viewed as portfolios of zero-bond options:

The terms are derived from:

## Implemention¶

The framework is split into host and kernel code.

### Kernel¶

The kernel directory contains the 3 kernels based on the above formula:

- HWA_K0.cpp contains the bond pricing engine
- HWA_k1.cpp contains the option pricing engine
- HWA_k2.cpp contains the cap/floor engine

### Host¶

The host code (*main.cpp*) contains the OpenCL calls to invoke each of the kernels and test for accuracy compared to the CPU model (*cpu.cpp*).