To plot the forward curve for the earliest trade date and the most recent trade date in the WTI dataset
The WTI forward curve for the earliest market date:
The plots indicate that the WTI curve had dropped significantly, from above 90 to around 53, during 2013 to 2019. While there was a small rebound to 55 in 2019, it decreased quickly and tended to be relatively stable later. In addition, there is no seasonality shown in the oil curve.
There is an obvious outlier data some time in 2017. In order to eliminate its potential adverse effect on the model, remove this offending data from the dataset.
And get the amount of variance for the independent Wiener factors:
After this, define the percentage of variance explained with n factors:
Plot the three most significant volatility functions:
The plot shows a clear “shift”, “twist”, “bend” pattern. Values on “shift” curve have the same sign; The front end of the “twist” curve is of the opposite sign as those at the end; The “bend” curve makes the middle contracts move in a different direction than the front.
Same as what have been initially done to WTI dataset, replace an actual date with TRADEDATE, and compute the maturity column before plotting the gas forward curve.
The gas forward curve for the earliest trade date:
The forward curve for the last trade date:
The plot shows that the gas curve had a general increasing trend with a clear seasonal pattern in 2013. Between 2013 and 2019, the gas price dropped from the range of 4 to 7.5 to the range of 2.4 to 3.8. In 2019, the gas price still had the seasonally increasing pattern, and its variance for each period is clearly larger than 2013.
Then, compute the seasonal factors and plot the result:
The seasonal factors show that, Nov, Dec, Jan, Feb are associated with increased volatility. This is probably beacuse that people using more gas for heat and cars during cold winter times.
A snip of the reuslt table:
The result table indiactes that there are 144 maturities can be used to build the model
The result of variances shows that 5 factors are needed to explain at least 98% of the variance. Next, using the same technique in WTI dataset, plot the three most significant volatility functions when factor=5:
The “shift”, “twist”, and “bend” curve show expected patterns.
This time, only 4 factors are needed to explain at least 98% of the variance.
Plot the three most significant volatility functions when factor=4:
Comparing the plots for using 60 and 36 maturities data, there is no obvious difference on “shift” and “twist” curve. On the other hand, “bend” curve is smoother when using 36 maturities.