# QuantLib: Is the StochasticProcess class adapt for a HJM type of modelling?

I would like to use the following model in QuantLib:

$\frac{dF(t,T)}{F(t,T)} = \sigma_se^{-\beta(T-t)}dW_{t}^{1} + \sigma_L\left(1-e^{-\beta(T-t)}\right)dW_{t}^{2}$

This is a reformulation of the Schwartz Smith model (Schwartz-Smith). $F(t,T)$ is the commodity future price and the model is to be calibrated to American option prices (options on futures).

I plan to proceed in the following way:

1. Derive a class from StochasticProcess for the process.
2. Implement a PricingEngine for the analytical formula of european options.
3. Implement a PricingEngine for American Options. I will use the Barone-Adesi/Whaley approximation. I have adapted the algorithm to use it with this model. I cannot use the provided implementation in the library though. My implementation will follow the lines of the one in the library I just have to plug-in 3 things: the analytical formula for the european option, the delta and the term that multiplies the second derivative wrt $F$ in the pricing PDE (the first two coming from the european pricing engine and the last one coming from the process).
4. Implement a CalibratedModel.
5. Implement a CalibrationHelper.

My problem is with point number 1. Is it OK to use the StochasticProcess class ? or should I implement a different class because in fact I'm modelling a family of processes, one for each T?

Thank you for any help and thoughts.

At first sight, I'd say it's ok. You'll have to let the constructor of your process class take the maturity time, so you can create different instances with different $T$.
• Thanks Luigi. I went on implementing a setter for $T$. I'll take care of setting $T$ according to the maturity of the option when calibrating. I think /hope troubles won't arise. Oct 21, 2015 at 13:32
• I guess it depends on how you'll use it. If you want to have processes on different $T$, and especially if you pass them around to other objects, it might be better to have different instances. By changing the time into an existing one, you run the risk that some other object is still holding on to it and will see the new maturity when recalculating. Oct 21, 2015 at 13:41