Skip to content
All library documents

Using QuantLib StochasticProcess for a Schwartz–Smith Futures Model

Article Quant Q&A · Author: Giancarlo Giuffra

Summary

The question asks how to represent a two-factor commodity futures model in QuantLib. Its instantaneous return combines two Brownian shocks: one whose loading decays exponentially with time to futures maturity, and another whose loading increases toward a long-term level. The proposed implementation would derive a process class, then build pricing engines for European and American options, a calibrated model, and a calibration helper.

The accepted response says a StochasticProcess class is suitable, with the futures maturity supplied to the constructor. In practice, this means creating a separate process instance for each contract maturity. The post does not give implementation details, derive the model, or demonstrate pricing or calibration results; its guidance is limited to the class-design question. The American-option plan mentioned in the question uses a Barone–Adesi/Whaley approximation, but that approach is not evaluated in the answer.

Key ideas

  • The model describes each commodity futures maturity with its own process instance.
  • The proposed process has two Brownian drivers with different maturity-dependent factor loadings.
  • The accepted guidance is to pass the futures maturity into the StochasticProcess constructor.
  • The post does not establish how to implement or validate the pricing and calibration components.

Tags

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


# 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:

- Derive a class from StochasticProcess for the process.

- Implement a PricingEngine for the analytical formula of european options.

- 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).

- Implement a CalibratedModel.

- 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.

## Answer by Luigi Ballabio (score 3, accepted)

https://quant.stackexchange.com/a/21343

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$.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.